reference.qbk 3.0 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747727487274972750727517275272753727547275572756727577275872759727607276172762727637276472765727667276772768727697277072771727727277372774727757277672777727787277972780727817278272783727847278572786727877278872789727907279172792727937279472795727967279772798727997280072801728027280372804728057280672807728087280972810728117281272813728147281572816728177281872819728207282172822728237282472825728267282772828728297283072831728327283372834728357283672837728387283972840728417284272843728447284572846728477284872849728507285172852728537285472855728567285772858728597286072861728627286372864728657286672867728687286972870728717287272873728747287572876728777287872879728807288172882728837288472885728867288772888728897289072891728927289372894728957289672897728987289972900729017290272903729047290572906729077290872909729107291172912729137291472915729167291772918729197292072921729227292372924729257292672927729287292972930729317293272933729347293572936729377293872939729407294172942729437294472945729467294772948729497295072951729527295372954729557295672957729587295972960729617296272963729647296572966729677296872969729707297172972729737297472975729767297772978729797298072981729827298372984729857298672987729887298972990729917299272993729947299572996729977299872999730007300173002730037300473005730067300773008730097301073011730127301373014730157301673017730187301973020730217302273023730247302573026730277302873029730307303173032730337303473035730367303773038730397304073041730427304373044730457304673047730487304973050730517305273053730547305573056730577305873059730607306173062730637306473065730667306773068730697307073071730727307373074730757307673077730787307973080730817308273083730847308573086730877308873089730907309173092730937309473095730967309773098730997310073101731027310373104731057310673107731087310973110731117311273113731147311573116731177311873119731207312173122731237312473125731267312773128731297313073131731327313373134731357313673137731387313973140731417314273143731447314573146731477314873149731507315173152731537315473155731567315773158731597316073161731627316373164731657316673167731687316973170731717317273173731747317573176731777317873179731807318173182731837318473185731867318773188731897319073191731927319373194731957319673197731987319973200732017320273203732047320573206732077320873209732107321173212732137321473215732167321773218732197322073221732227322373224732257322673227732287322973230732317323273233732347323573236732377323873239732407324173242732437324473245732467324773248732497325073251732527325373254732557325673257732587325973260732617326273263732647326573266732677326873269732707327173272732737327473275732767327773278732797328073281732827328373284732857328673287732887328973290732917329273293732947329573296732977329873299733007330173302733037330473305733067330773308733097331073311733127331373314733157331673317733187331973320733217332273323733247332573326733277332873329733307333173332733337333473335733367333773338733397334073341733427334373344733457334673347733487334973350733517335273353733547335573356733577335873359733607336173362733637336473365733667336773368733697337073371733727337373374733757337673377733787337973380733817338273383733847338573386733877338873389733907339173392733937339473395733967339773398733997340073401734027340373404734057340673407734087340973410734117341273413734147341573416734177341873419734207342173422734237342473425734267342773428734297343073431734327343373434734357343673437734387343973440734417344273443734447344573446734477344873449734507345173452734537345473455734567345773458734597346073461734627346373464734657346673467734687346973470734717347273473734747347573476734777347873479734807348173482734837348473485734867348773488734897349073491734927349373494734957349673497734987349973500735017350273503735047350573506735077350873509735107351173512735137351473515735167351773518735197352073521735227352373524735257352673527735287352973530735317353273533735347353573536735377353873539735407354173542735437354473545735467354773548735497355073551735527355373554735557355673557735587355973560735617356273563735647356573566735677356873569735707357173572735737357473575735767357773578735797358073581735827358373584735857358673587735887358973590735917359273593735947359573596735977359873599736007360173602736037360473605736067360773608736097361073611736127361373614736157361673617736187361973620736217362273623736247362573626736277362873629736307363173632736337363473635736367363773638736397364073641736427364373644736457364673647736487364973650736517365273653736547365573656736577365873659736607366173662736637366473665736667366773668736697367073671736727367373674736757367673677736787367973680736817368273683736847368573686736877368873689736907369173692736937369473695736967369773698736997370073701737027370373704737057370673707737087370973710737117371273713737147371573716737177371873719737207372173722737237372473725737267372773728737297373073731737327373373734737357373673737737387373973740737417374273743737447374573746737477374873749737507375173752737537375473755737567375773758737597376073761737627376373764737657376673767737687376973770737717377273773737747377573776737777377873779737807378173782737837378473785737867378773788737897379073791737927379373794737957379673797737987379973800738017380273803738047380573806738077380873809738107381173812738137381473815738167381773818738197382073821738227382373824738257382673827738287382973830738317383273833738347383573836738377383873839738407384173842738437384473845738467384773848738497385073851738527385373854738557385673857738587385973860738617386273863738647386573866738677386873869738707387173872738737387473875738767387773878738797388073881738827388373884738857388673887738887388973890738917389273893738947389573896738977389873899739007390173902739037390473905739067390773908739097391073911739127391373914739157391673917739187391973920739217392273923739247392573926739277392873929739307393173932739337393473935739367393773938739397394073941739427394373944739457394673947739487394973950739517395273953739547395573956739577395873959739607396173962739637396473965739667396773968739697397073971739727397373974739757397673977739787397973980739817398273983739847398573986739877398873989739907399173992739937399473995739967399773998739997400074001740027400374004740057400674007740087400974010740117401274013740147401574016740177401874019740207402174022740237402474025740267402774028740297403074031740327403374034740357403674037740387403974040740417404274043740447404574046740477404874049740507405174052740537405474055740567405774058740597406074061740627406374064740657406674067740687406974070740717407274073740747407574076740777407874079740807408174082740837408474085740867408774088740897409074091740927409374094740957409674097740987409974100741017410274103741047410574106741077410874109741107411174112741137411474115741167411774118741197412074121741227412374124741257412674127741287412974130741317413274133741347413574136741377413874139741407414174142741437414474145741467414774148741497415074151741527415374154741557415674157741587415974160741617416274163741647416574166741677416874169741707417174172741737417474175741767417774178741797418074181741827418374184741857418674187741887418974190741917419274193741947419574196741977419874199742007420174202742037420474205742067420774208742097421074211742127421374214742157421674217742187421974220742217422274223742247422574226742277422874229742307423174232742337423474235742367423774238742397424074241742427424374244742457424674247742487424974250742517425274253742547425574256742577425874259742607426174262742637426474265742667426774268742697427074271742727427374274742757427674277742787427974280742817428274283742847428574286742877428874289742907429174292742937429474295742967429774298742997430074301743027430374304743057430674307743087430974310743117431274313743147431574316743177431874319743207432174322743237432474325743267432774328743297433074331743327433374334743357433674337743387433974340743417434274343743447434574346743477434874349743507435174352743537435474355743567435774358743597436074361743627436374364743657436674367743687436974370743717437274373743747437574376743777437874379743807438174382743837438474385743867438774388743897439074391743927439374394743957439674397743987439974400744017440274403744047440574406744077440874409744107441174412744137441474415744167441774418744197442074421744227442374424744257442674427744287442974430744317443274433744347443574436744377443874439744407444174442744437444474445744467444774448744497445074451744527445374454744557445674457744587445974460744617446274463744647446574466744677446874469744707447174472744737447474475744767447774478744797448074481744827448374484744857448674487744887448974490744917449274493744947449574496744977449874499745007450174502745037450474505745067450774508745097451074511745127451374514745157451674517745187451974520745217452274523745247452574526745277452874529745307453174532745337453474535745367453774538745397454074541745427454374544745457454674547745487454974550745517455274553745547455574556745577455874559745607456174562745637456474565745667456774568745697457074571745727457374574745757457674577745787457974580745817458274583745847458574586745877458874589745907459174592745937459474595745967459774598745997460074601746027460374604746057460674607746087460974610746117461274613746147461574616746177461874619746207462174622746237462474625746267462774628746297463074631746327463374634746357463674637746387463974640746417464274643746447464574646746477464874649746507465174652746537465474655746567465774658746597466074661746627466374664746657466674667746687466974670746717467274673746747467574676746777467874679746807468174682746837468474685746867468774688746897469074691746927469374694746957469674697746987469974700747017470274703747047470574706747077470874709747107471174712747137471474715747167471774718747197472074721747227472374724747257472674727747287472974730747317473274733747347473574736747377473874739747407474174742747437474474745747467474774748747497475074751747527475374754747557475674757747587475974760747617476274763747647476574766747677476874769747707477174772747737477474775747767477774778747797478074781747827478374784747857478674787747887478974790747917479274793747947479574796747977479874799748007480174802748037480474805748067480774808748097481074811748127481374814748157481674817748187481974820748217482274823748247482574826748277482874829748307483174832748337483474835748367483774838748397484074841748427484374844748457484674847748487484974850748517485274853748547485574856748577485874859748607486174862748637486474865748667486774868748697487074871748727487374874748757487674877748787487974880748817488274883748847488574886748877488874889748907489174892748937489474895748967489774898748997490074901749027490374904749057490674907749087490974910749117491274913749147491574916749177491874919749207492174922749237492474925749267492774928749297493074931749327493374934749357493674937749387493974940749417494274943749447494574946749477494874949749507495174952749537495474955749567495774958749597496074961749627496374964749657496674967749687496974970749717497274973749747497574976749777497874979749807498174982749837498474985749867498774988749897499074991749927499374994749957499674997749987499975000750017500275003750047500575006750077500875009750107501175012750137501475015750167501775018750197502075021750227502375024750257502675027750287502975030750317503275033750347503575036750377503875039750407504175042750437504475045750467504775048750497505075051750527505375054750557505675057750587505975060750617506275063750647506575066750677506875069750707507175072750737507475075750767507775078750797508075081750827508375084750857508675087750887508975090750917509275093750947509575096750977509875099751007510175102751037510475105751067510775108751097511075111751127511375114751157511675117751187511975120751217512275123751247512575126751277512875129751307513175132751337513475135751367513775138751397514075141751427514375144751457514675147751487514975150751517515275153751547515575156751577515875159751607516175162751637516475165751667516775168751697517075171751727517375174751757517675177751787517975180751817518275183751847518575186751877518875189751907519175192751937519475195751967519775198751997520075201752027520375204752057520675207752087520975210752117521275213752147521575216752177521875219752207522175222752237522475225752267522775228752297523075231752327523375234752357523675237752387523975240752417524275243752447524575246752477524875249752507525175252752537525475255752567525775258752597526075261752627526375264752657526675267752687526975270752717527275273752747527575276752777527875279752807528175282752837528475285752867528775288752897529075291752927529375294752957529675297752987529975300753017530275303753047530575306753077530875309753107531175312753137531475315753167531775318753197532075321753227532375324753257532675327753287532975330753317533275333753347533575336753377533875339753407534175342753437534475345753467534775348753497535075351753527535375354753557535675357753587535975360753617536275363753647536575366753677536875369753707537175372753737537475375753767537775378753797538075381753827538375384753857538675387753887538975390753917539275393753947539575396753977539875399754007540175402754037540475405754067540775408754097541075411754127541375414754157541675417754187541975420754217542275423754247542575426754277542875429754307543175432754337543475435754367543775438754397544075441754427544375444754457544675447754487544975450754517545275453754547545575456754577545875459754607546175462754637546475465754667546775468754697547075471754727547375474754757547675477754787547975480754817548275483754847548575486754877548875489754907549175492754937549475495754967549775498754997550075501755027550375504755057550675507755087550975510755117551275513755147551575516755177551875519755207552175522755237552475525755267552775528755297553075531755327553375534755357553675537755387553975540755417554275543755447554575546755477554875549755507555175552755537555475555755567555775558755597556075561755627556375564755657556675567755687556975570755717557275573755747557575576755777557875579755807558175582755837558475585755867558775588755897559075591755927559375594755957559675597755987559975600756017560275603756047560575606756077560875609756107561175612756137561475615756167561775618756197562075621756227562375624756257562675627756287562975630756317563275633756347563575636756377563875639756407564175642756437564475645756467564775648756497565075651756527565375654756557565675657756587565975660756617566275663756647566575666756677566875669756707567175672756737567475675756767567775678756797568075681756827568375684756857568675687756887568975690756917569275693756947569575696756977569875699757007570175702757037570475705757067570775708757097571075711757127571375714757157571675717757187571975720757217572275723757247572575726757277572875729757307573175732757337573475735757367573775738757397574075741757427574375744757457574675747757487574975750757517575275753757547575575756757577575875759757607576175762757637576475765757667576775768757697577075771757727577375774757757577675777757787577975780757817578275783757847578575786757877578875789757907579175792757937579475795757967579775798757997580075801758027580375804758057580675807758087580975810758117581275813758147581575816758177581875819758207582175822758237582475825758267582775828758297583075831758327583375834758357583675837758387583975840758417584275843758447584575846758477584875849758507585175852758537585475855758567585775858758597586075861758627586375864758657586675867758687586975870758717587275873758747587575876758777587875879758807588175882758837588475885758867588775888758897589075891758927589375894758957589675897758987589975900759017590275903759047590575906759077590875909759107591175912759137591475915759167591775918759197592075921759227592375924759257592675927759287592975930759317593275933759347593575936759377593875939759407594175942759437594475945759467594775948759497595075951759527595375954759557595675957759587595975960759617596275963759647596575966759677596875969759707597175972759737597475975759767597775978759797598075981759827598375984759857598675987759887598975990759917599275993759947599575996759977599875999760007600176002760037600476005760067600776008760097601076011760127601376014760157601676017760187601976020760217602276023760247602576026760277602876029760307603176032760337603476035760367603776038760397604076041760427604376044760457604676047760487604976050760517605276053760547605576056760577605876059760607606176062760637606476065760667606776068760697607076071760727607376074760757607676077760787607976080760817608276083760847608576086760877608876089760907609176092760937609476095760967609776098760997610076101761027610376104761057610676107761087610976110761117611276113761147611576116761177611876119761207612176122761237612476125761267612776128761297613076131761327613376134761357613676137761387613976140761417614276143761447614576146761477614876149761507615176152761537615476155761567615776158761597616076161761627616376164761657616676167761687616976170761717617276173761747617576176761777617876179761807618176182761837618476185761867618776188761897619076191761927619376194761957619676197761987619976200762017620276203762047620576206762077620876209762107621176212762137621476215762167621776218762197622076221762227622376224762257622676227762287622976230762317623276233762347623576236762377623876239762407624176242762437624476245762467624776248762497625076251762527625376254762557625676257762587625976260762617626276263762647626576266762677626876269762707627176272762737627476275762767627776278762797628076281762827628376284762857628676287762887628976290762917629276293762947629576296762977629876299763007630176302763037630476305763067630776308763097631076311763127631376314763157631676317763187631976320763217632276323763247632576326763277632876329763307633176332763337633476335763367633776338763397634076341763427634376344763457634676347763487634976350763517635276353763547635576356763577635876359763607636176362763637636476365763667636776368763697637076371763727637376374763757637676377763787637976380763817638276383763847638576386763877638876389763907639176392763937639476395763967639776398763997640076401764027640376404764057640676407764087640976410764117641276413764147641576416764177641876419764207642176422764237642476425764267642776428764297643076431764327643376434764357643676437764387643976440764417644276443764447644576446764477644876449764507645176452764537645476455764567645776458764597646076461764627646376464764657646676467764687646976470764717647276473764747647576476764777647876479764807648176482764837648476485764867648776488764897649076491764927649376494764957649676497764987649976500765017650276503765047650576506765077650876509765107651176512765137651476515765167651776518765197652076521765227652376524765257652676527765287652976530765317653276533765347653576536765377653876539765407654176542765437654476545765467654776548765497655076551765527655376554765557655676557765587655976560765617656276563765647656576566765677656876569765707657176572765737657476575765767657776578765797658076581765827658376584765857658676587765887658976590765917659276593765947659576596765977659876599766007660176602766037660476605766067660776608766097661076611766127661376614766157661676617766187661976620766217662276623766247662576626766277662876629766307663176632766337663476635766367663776638766397664076641766427664376644766457664676647766487664976650766517665276653766547665576656766577665876659766607666176662766637666476665766667666776668766697667076671766727667376674766757667676677766787667976680766817668276683766847668576686766877668876689766907669176692766937669476695766967669776698766997670076701767027670376704767057670676707767087670976710767117671276713767147671576716767177671876719767207672176722767237672476725767267672776728767297673076731767327673376734767357673676737767387673976740767417674276743767447674576746767477674876749767507675176752767537675476755767567675776758767597676076761767627676376764767657676676767767687676976770767717677276773767747677576776767777677876779767807678176782767837678476785767867678776788767897679076791767927679376794767957679676797767987679976800768017680276803768047680576806768077680876809768107681176812768137681476815768167681776818768197682076821768227682376824768257682676827768287682976830768317683276833768347683576836768377683876839768407684176842768437684476845768467684776848768497685076851768527685376854768557685676857768587685976860768617686276863768647686576866768677686876869768707687176872768737687476875768767687776878768797688076881768827688376884768857688676887768887688976890768917689276893768947689576896768977689876899769007690176902769037690476905769067690776908769097691076911769127691376914769157691676917769187691976920769217692276923769247692576926769277692876929769307693176932769337693476935769367693776938769397694076941769427694376944769457694676947769487694976950769517695276953769547695576956769577695876959769607696176962769637696476965769667696776968769697697076971769727697376974769757697676977769787697976980769817698276983769847698576986769877698876989769907699176992769937699476995769967699776998769997700077001770027700377004770057700677007770087700977010770117701277013770147701577016770177701877019770207702177022770237702477025770267702777028770297703077031770327703377034770357703677037770387703977040770417704277043770447704577046770477704877049770507705177052770537705477055770567705777058770597706077061770627706377064770657706677067770687706977070770717707277073770747707577076770777707877079770807708177082770837708477085770867708777088770897709077091770927709377094770957709677097770987709977100771017710277103771047710577106771077710877109771107711177112771137711477115771167711777118771197712077121771227712377124771257712677127771287712977130771317713277133771347713577136771377713877139771407714177142771437714477145771467714777148771497715077151771527715377154771557715677157771587715977160771617716277163771647716577166771677716877169771707717177172771737717477175771767717777178771797718077181771827718377184771857718677187771887718977190771917719277193771947719577196771977719877199772007720177202772037720477205772067720777208772097721077211772127721377214772157721677217772187721977220772217722277223772247722577226772277722877229772307723177232772337723477235772367723777238772397724077241772427724377244772457724677247772487724977250772517725277253772547725577256772577725877259772607726177262772637726477265772667726777268772697727077271772727727377274772757727677277772787727977280772817728277283772847728577286772877728877289772907729177292772937729477295772967729777298772997730077301773027730377304773057730677307773087730977310773117731277313773147731577316773177731877319773207732177322773237732477325773267732777328773297733077331773327733377334773357733677337773387733977340773417734277343773447734577346773477734877349773507735177352773537735477355773567735777358773597736077361773627736377364773657736677367773687736977370773717737277373773747737577376773777737877379773807738177382773837738477385773867738777388773897739077391773927739377394773957739677397773987739977400774017740277403774047740577406774077740877409774107741177412774137741477415774167741777418774197742077421774227742377424774257742677427774287742977430774317743277433774347743577436774377743877439774407744177442774437744477445774467744777448774497745077451774527745377454774557745677457774587745977460774617746277463774647746577466774677746877469774707747177472774737747477475774767747777478774797748077481774827748377484774857748677487774887748977490774917749277493774947749577496774977749877499775007750177502775037750477505775067750777508775097751077511775127751377514775157751677517775187751977520775217752277523775247752577526775277752877529775307753177532775337753477535775367753777538775397754077541775427754377544775457754677547775487754977550775517755277553775547755577556775577755877559775607756177562775637756477565775667756777568775697757077571775727757377574775757757677577775787757977580775817758277583775847758577586775877758877589775907759177592775937759477595775967759777598775997760077601776027760377604776057760677607776087760977610776117761277613776147761577616776177761877619776207762177622776237762477625776267762777628776297763077631776327763377634776357763677637776387763977640776417764277643776447764577646776477764877649776507765177652776537765477655776567765777658776597766077661776627766377664776657766677667776687766977670776717767277673776747767577676776777767877679776807768177682776837768477685776867768777688776897769077691776927769377694776957769677697776987769977700777017770277703777047770577706777077770877709777107771177712777137771477715777167771777718777197772077721777227772377724777257772677727777287772977730777317773277733777347773577736777377773877739777407774177742777437774477745777467774777748777497775077751777527775377754777557775677757777587775977760777617776277763777647776577766777677776877769777707777177772777737777477775777767777777778777797778077781777827778377784777857778677787777887778977790777917779277793777947779577796777977779877799778007780177802778037780477805778067780777808778097781077811778127781377814778157781677817778187781977820778217782277823778247782577826778277782877829778307783177832778337783477835778367783777838778397784077841778427784377844778457784677847778487784977850778517785277853778547785577856778577785877859778607786177862778637786477865778667786777868778697787077871778727787377874778757787677877778787787977880778817788277883778847788577886778877788877889778907789177892778937789477895778967789777898778997790077901779027790377904779057790677907779087790977910779117791277913779147791577916779177791877919779207792177922779237792477925779267792777928779297793077931779327793377934779357793677937779387793977940779417794277943779447794577946779477794877949779507795177952779537795477955779567795777958779597796077961779627796377964779657796677967779687796977970779717797277973779747797577976779777797877979779807798177982779837798477985779867798777988779897799077991779927799377994779957799677997779987799978000780017800278003780047800578006780077800878009780107801178012780137801478015780167801778018780197802078021780227802378024780257802678027780287802978030780317803278033780347803578036780377803878039780407804178042780437804478045780467804778048780497805078051780527805378054780557805678057780587805978060780617806278063780647806578066780677806878069780707807178072780737807478075780767807778078780797808078081780827808378084780857808678087780887808978090780917809278093780947809578096780977809878099781007810178102781037810478105781067810778108781097811078111781127811378114781157811678117781187811978120781217812278123781247812578126781277812878129781307813178132781337813478135781367813778138781397814078141781427814378144781457814678147781487814978150781517815278153781547815578156781577815878159781607816178162781637816478165781667816778168781697817078171781727817378174781757817678177781787817978180781817818278183781847818578186781877818878189781907819178192781937819478195781967819778198781997820078201782027820378204782057820678207782087820978210782117821278213782147821578216782177821878219782207822178222782237822478225782267822778228782297823078231782327823378234782357823678237782387823978240782417824278243782447824578246782477824878249782507825178252782537825478255782567825778258782597826078261782627826378264782657826678267782687826978270782717827278273782747827578276782777827878279782807828178282782837828478285782867828778288782897829078291782927829378294782957829678297782987829978300783017830278303783047830578306783077830878309783107831178312783137831478315783167831778318783197832078321783227832378324783257832678327783287832978330783317833278333783347833578336783377833878339783407834178342783437834478345783467834778348783497835078351783527835378354783557835678357783587835978360783617836278363783647836578366783677836878369783707837178372783737837478375783767837778378783797838078381783827838378384783857838678387783887838978390783917839278393783947839578396783977839878399784007840178402784037840478405784067840778408784097841078411784127841378414784157841678417784187841978420784217842278423784247842578426784277842878429784307843178432784337843478435784367843778438784397844078441784427844378444784457844678447784487844978450784517845278453784547845578456784577845878459784607846178462784637846478465784667846778468784697847078471784727847378474784757847678477784787847978480784817848278483784847848578486784877848878489784907849178492784937849478495784967849778498784997850078501785027850378504785057850678507785087850978510785117851278513785147851578516785177851878519785207852178522785237852478525785267852778528785297853078531785327853378534785357853678537785387853978540785417854278543785447854578546785477854878549785507855178552785537855478555785567855778558785597856078561785627856378564785657856678567785687856978570785717857278573785747857578576785777857878579785807858178582785837858478585785867858778588785897859078591785927859378594785957859678597785987859978600786017860278603786047860578606786077860878609786107861178612786137861478615786167861778618786197862078621786227862378624786257862678627786287862978630786317863278633786347863578636786377863878639786407864178642786437864478645786467864778648786497865078651786527865378654786557865678657786587865978660786617866278663786647866578666786677866878669786707867178672786737867478675786767867778678786797868078681786827868378684786857868678687786887868978690786917869278693786947869578696786977869878699787007870178702787037870478705787067870778708787097871078711787127871378714787157871678717787187871978720787217872278723787247872578726787277872878729787307873178732787337873478735787367873778738787397874078741787427874378744787457874678747787487874978750787517875278753787547875578756787577875878759787607876178762787637876478765787667876778768787697877078771787727877378774787757877678777787787877978780787817878278783787847878578786787877878878789787907879178792787937879478795787967879778798787997880078801788027880378804788057880678807788087880978810788117881278813788147881578816788177881878819788207882178822788237882478825788267882778828788297883078831788327883378834788357883678837788387883978840788417884278843788447884578846788477884878849788507885178852788537885478855788567885778858788597886078861788627886378864788657886678867788687886978870788717887278873788747887578876788777887878879788807888178882788837888478885788867888778888788897889078891788927889378894788957889678897788987889978900789017890278903789047890578906789077890878909789107891178912789137891478915789167891778918789197892078921789227892378924789257892678927789287892978930789317893278933789347893578936789377893878939789407894178942789437894478945789467894778948789497895078951789527895378954789557895678957789587895978960789617896278963789647896578966789677896878969789707897178972789737897478975789767897778978789797898078981789827898378984789857898678987789887898978990789917899278993789947899578996789977899878999790007900179002790037900479005790067900779008790097901079011790127901379014790157901679017790187901979020790217902279023790247902579026790277902879029790307903179032790337903479035790367903779038790397904079041790427904379044790457904679047790487904979050790517905279053790547905579056790577905879059790607906179062790637906479065790667906779068790697907079071790727907379074790757907679077790787907979080790817908279083790847908579086790877908879089790907909179092790937909479095790967909779098790997910079101791027910379104791057910679107791087910979110791117911279113791147911579116791177911879119791207912179122791237912479125791267912779128791297913079131791327913379134791357913679137791387913979140791417914279143791447914579146791477914879149791507915179152791537915479155791567915779158791597916079161791627916379164791657916679167791687916979170791717917279173791747917579176791777917879179791807918179182791837918479185791867918779188791897919079191791927919379194791957919679197791987919979200792017920279203792047920579206792077920879209792107921179212792137921479215792167921779218792197922079221792227922379224792257922679227792287922979230792317923279233792347923579236792377923879239792407924179242792437924479245792467924779248792497925079251792527925379254792557925679257792587925979260792617926279263792647926579266792677926879269792707927179272792737927479275792767927779278792797928079281792827928379284792857928679287792887928979290792917929279293792947929579296792977929879299793007930179302793037930479305793067930779308793097931079311793127931379314793157931679317793187931979320793217932279323793247932579326793277932879329793307933179332793337933479335793367933779338793397934079341793427934379344793457934679347793487934979350793517935279353793547935579356793577935879359793607936179362793637936479365793667936779368793697937079371793727937379374793757937679377793787937979380793817938279383793847938579386793877938879389793907939179392793937939479395793967939779398793997940079401794027940379404794057940679407794087940979410794117941279413794147941579416794177941879419794207942179422794237942479425794267942779428794297943079431794327943379434794357943679437794387943979440794417944279443794447944579446794477944879449794507945179452794537945479455794567945779458794597946079461794627946379464794657946679467794687946979470794717947279473794747947579476794777947879479794807948179482794837948479485794867948779488794897949079491794927949379494794957949679497794987949979500795017950279503795047950579506795077950879509795107951179512795137951479515795167951779518795197952079521795227952379524795257952679527795287952979530795317953279533795347953579536795377953879539795407954179542795437954479545795467954779548795497955079551795527955379554795557955679557795587955979560795617956279563795647956579566795677956879569795707957179572795737957479575795767957779578795797958079581795827958379584795857958679587795887958979590795917959279593795947959579596795977959879599796007960179602796037960479605796067960779608796097961079611796127961379614796157961679617796187961979620796217962279623796247962579626796277962879629796307963179632796337963479635796367963779638796397964079641796427964379644796457964679647796487964979650796517965279653796547965579656796577965879659796607966179662796637966479665796667966779668796697967079671796727967379674796757967679677796787967979680796817968279683796847968579686796877968879689796907969179692796937969479695796967969779698796997970079701797027970379704797057970679707797087970979710797117971279713797147971579716797177971879719797207972179722797237972479725797267972779728797297973079731797327973379734797357973679737797387973979740797417974279743797447974579746797477974879749797507975179752797537975479755797567975779758797597976079761797627976379764797657976679767797687976979770797717977279773797747977579776797777977879779797807978179782797837978479785797867978779788797897979079791797927979379794797957979679797797987979979800798017980279803798047980579806798077980879809798107981179812798137981479815798167981779818798197982079821798227982379824798257982679827798287982979830798317983279833798347983579836798377983879839798407984179842798437984479845798467984779848798497985079851798527985379854798557985679857798587985979860798617986279863798647986579866798677986879869798707987179872798737987479875798767987779878798797988079881798827988379884798857988679887798887988979890798917989279893798947989579896798977989879899799007990179902799037990479905799067990779908799097991079911799127991379914799157991679917799187991979920799217992279923799247992579926799277992879929799307993179932799337993479935799367993779938799397994079941799427994379944799457994679947799487994979950799517995279953799547995579956799577995879959799607996179962799637996479965799667996779968799697997079971799727997379974799757997679977799787997979980799817998279983799847998579986799877998879989799907999179992799937999479995799967999779998799998000080001800028000380004800058000680007800088000980010800118001280013800148001580016800178001880019800208002180022800238002480025800268002780028800298003080031800328003380034800358003680037800388003980040800418004280043800448004580046800478004880049800508005180052800538005480055800568005780058800598006080061800628006380064800658006680067800688006980070800718007280073800748007580076800778007880079800808008180082800838008480085800868008780088800898009080091800928009380094800958009680097800988009980100801018010280103801048010580106801078010880109801108011180112801138011480115801168011780118801198012080121801228012380124801258012680127801288012980130801318013280133801348013580136801378013880139801408014180142801438014480145801468014780148801498015080151801528015380154801558015680157801588015980160801618016280163801648016580166801678016880169801708017180172801738017480175801768017780178801798018080181801828018380184801858018680187801888018980190801918019280193801948019580196801978019880199802008020180202802038020480205802068020780208802098021080211802128021380214802158021680217802188021980220802218022280223802248022580226802278022880229802308023180232802338023480235802368023780238802398024080241802428024380244802458024680247802488024980250802518025280253802548025580256802578025880259802608026180262802638026480265802668026780268802698027080271802728027380274802758027680277802788027980280802818028280283802848028580286802878028880289802908029180292802938029480295802968029780298802998030080301803028030380304803058030680307803088030980310803118031280313803148031580316803178031880319803208032180322803238032480325803268032780328803298033080331803328033380334803358033680337803388033980340803418034280343803448034580346803478034880349803508035180352803538035480355803568035780358803598036080361803628036380364803658036680367803688036980370803718037280373803748037580376803778037880379803808038180382803838038480385803868038780388803898039080391803928039380394803958039680397803988039980400804018040280403804048040580406804078040880409804108041180412804138041480415804168041780418804198042080421804228042380424804258042680427804288042980430804318043280433804348043580436804378043880439804408044180442804438044480445804468044780448804498045080451804528045380454804558045680457804588045980460804618046280463804648046580466804678046880469804708047180472804738047480475804768047780478804798048080481804828048380484804858048680487804888048980490804918049280493804948049580496804978049880499805008050180502805038050480505805068050780508805098051080511805128051380514805158051680517805188051980520805218052280523805248052580526805278052880529805308053180532805338053480535805368053780538805398054080541805428054380544805458054680547805488054980550805518055280553805548055580556805578055880559805608056180562805638056480565805668056780568805698057080571805728057380574805758057680577805788057980580805818058280583805848058580586805878058880589805908059180592805938059480595805968059780598805998060080601806028060380604806058060680607806088060980610806118061280613806148061580616806178061880619806208062180622806238062480625806268062780628806298063080631806328063380634806358063680637806388063980640806418064280643806448064580646806478064880649806508065180652806538065480655806568065780658806598066080661806628066380664806658066680667806688066980670806718067280673806748067580676806778067880679806808068180682806838068480685806868068780688806898069080691806928069380694806958069680697806988069980700807018070280703807048070580706807078070880709807108071180712807138071480715807168071780718807198072080721807228072380724807258072680727807288072980730807318073280733807348073580736807378073880739807408074180742807438074480745807468074780748807498075080751807528075380754807558075680757807588075980760807618076280763807648076580766807678076880769807708077180772807738077480775807768077780778807798078080781807828078380784807858078680787807888078980790807918079280793807948079580796807978079880799808008080180802808038080480805808068080780808808098081080811808128081380814808158081680817808188081980820808218082280823808248082580826808278082880829808308083180832808338083480835808368083780838808398084080841808428084380844808458084680847808488084980850808518085280853808548085580856808578085880859808608086180862808638086480865808668086780868808698087080871808728087380874808758087680877808788087980880808818088280883808848088580886808878088880889808908089180892808938089480895808968089780898808998090080901809028090380904809058090680907809088090980910809118091280913809148091580916809178091880919809208092180922809238092480925809268092780928809298093080931809328093380934809358093680937809388093980940809418094280943809448094580946809478094880949809508095180952809538095480955809568095780958809598096080961809628096380964809658096680967809688096980970809718097280973809748097580976809778097880979809808098180982809838098480985809868098780988809898099080991809928099380994809958099680997809988099981000810018100281003810048100581006810078100881009810108101181012810138101481015810168101781018810198102081021810228102381024810258102681027810288102981030810318103281033810348103581036810378103881039810408104181042810438104481045810468104781048810498105081051810528105381054810558105681057810588105981060810618106281063810648106581066810678106881069810708107181072810738107481075810768107781078810798108081081810828108381084810858108681087810888108981090810918109281093810948109581096810978109881099811008110181102811038110481105811068110781108811098111081111811128111381114811158111681117811188111981120811218112281123811248112581126811278112881129811308113181132811338113481135811368113781138811398114081141811428114381144811458114681147811488114981150811518115281153811548115581156811578115881159811608116181162811638116481165811668116781168811698117081171811728117381174811758117681177811788117981180811818118281183811848118581186811878118881189811908119181192811938119481195811968119781198811998120081201812028120381204812058120681207812088120981210812118121281213812148121581216812178121881219812208122181222812238122481225812268122781228812298123081231812328123381234812358123681237812388123981240812418124281243812448124581246812478124881249812508125181252812538125481255812568125781258812598126081261812628126381264812658126681267812688126981270812718127281273812748127581276812778127881279812808128181282812838128481285812868128781288812898129081291812928129381294812958129681297812988129981300813018130281303813048130581306813078130881309813108131181312813138131481315813168131781318813198132081321813228132381324813258132681327813288132981330813318133281333813348133581336813378133881339813408134181342813438134481345813468134781348813498135081351813528135381354813558135681357813588135981360813618136281363813648136581366813678136881369813708137181372813738137481375813768137781378813798138081381813828138381384813858138681387813888138981390813918139281393813948139581396813978139881399814008140181402814038140481405814068140781408814098141081411814128141381414814158141681417814188141981420814218142281423814248142581426814278142881429814308143181432814338143481435814368143781438814398144081441814428144381444814458144681447814488144981450814518145281453814548145581456814578145881459814608146181462814638146481465814668146781468814698147081471814728147381474814758147681477814788147981480814818148281483814848148581486814878148881489814908149181492814938149481495814968149781498814998150081501815028150381504815058150681507815088150981510815118151281513815148151581516815178151881519815208152181522815238152481525815268152781528815298153081531815328153381534815358153681537815388153981540815418154281543815448154581546815478154881549815508155181552815538155481555815568155781558815598156081561815628156381564815658156681567815688156981570815718157281573815748157581576815778157881579815808158181582815838158481585815868158781588815898159081591815928159381594815958159681597815988159981600816018160281603816048160581606816078160881609816108161181612816138161481615816168161781618816198162081621816228162381624816258162681627816288162981630816318163281633816348163581636816378163881639816408164181642816438164481645816468164781648816498165081651816528165381654816558165681657816588165981660816618166281663816648166581666816678166881669816708167181672816738167481675816768167781678816798168081681816828168381684816858168681687816888168981690816918169281693816948169581696816978169881699817008170181702817038170481705817068170781708817098171081711817128171381714817158171681717817188171981720817218172281723817248172581726817278172881729817308173181732817338173481735817368173781738817398174081741817428174381744817458174681747817488174981750817518175281753817548175581756817578175881759817608176181762817638176481765817668176781768817698177081771817728177381774817758177681777817788177981780817818178281783817848178581786817878178881789817908179181792817938179481795817968179781798817998180081801818028180381804818058180681807818088180981810818118181281813818148181581816818178181881819818208182181822818238182481825818268182781828818298183081831818328183381834818358183681837818388183981840818418184281843818448184581846818478184881849818508185181852818538185481855818568185781858818598186081861818628186381864818658186681867818688186981870818718187281873818748187581876818778187881879818808188181882818838188481885818868188781888818898189081891818928189381894818958189681897818988189981900819018190281903819048190581906819078190881909819108191181912819138191481915819168191781918819198192081921819228192381924819258192681927819288192981930819318193281933819348193581936819378193881939819408194181942819438194481945819468194781948819498195081951819528195381954819558195681957819588195981960819618196281963819648196581966819678196881969819708197181972819738197481975819768197781978819798198081981819828198381984819858198681987819888198981990819918199281993819948199581996819978199881999820008200182002820038200482005820068200782008820098201082011820128201382014820158201682017820188201982020820218202282023820248202582026820278202882029820308203182032820338203482035820368203782038820398204082041820428204382044820458204682047820488204982050820518205282053820548205582056820578205882059820608206182062820638206482065820668206782068820698207082071820728207382074820758207682077820788207982080820818208282083820848208582086820878208882089820908209182092820938209482095820968209782098820998210082101821028210382104821058210682107821088210982110821118211282113821148211582116821178211882119821208212182122821238212482125821268212782128821298213082131821328213382134821358213682137821388213982140821418214282143821448214582146821478214882149821508215182152821538215482155821568215782158821598216082161821628216382164821658216682167821688216982170821718217282173821748217582176821778217882179821808218182182821838218482185821868218782188821898219082191821928219382194821958219682197821988219982200822018220282203822048220582206822078220882209822108221182212822138221482215822168221782218822198222082221822228222382224822258222682227822288222982230822318223282233822348223582236822378223882239822408224182242822438224482245822468224782248822498225082251822528225382254822558225682257822588225982260822618226282263822648226582266822678226882269822708227182272822738227482275822768227782278822798228082281822828228382284822858228682287822888228982290822918229282293822948229582296822978229882299823008230182302823038230482305823068230782308823098231082311823128231382314823158231682317823188231982320823218232282323823248232582326823278232882329823308233182332823338233482335823368233782338823398234082341823428234382344823458234682347823488234982350823518235282353823548235582356823578235882359823608236182362823638236482365823668236782368823698237082371823728237382374823758237682377823788237982380823818238282383823848238582386823878238882389823908239182392823938239482395823968239782398823998240082401824028240382404824058240682407824088240982410824118241282413824148241582416824178241882419824208242182422824238242482425824268242782428824298243082431824328243382434824358243682437824388243982440824418244282443824448244582446824478244882449824508245182452824538245482455824568245782458824598246082461824628246382464824658246682467824688246982470824718247282473824748247582476824778247882479824808248182482824838248482485824868248782488824898249082491824928249382494824958249682497824988249982500825018250282503825048250582506825078250882509825108251182512825138251482515825168251782518825198252082521825228252382524825258252682527825288252982530825318253282533825348253582536825378253882539825408254182542825438254482545825468254782548825498255082551825528255382554825558255682557825588255982560825618256282563825648256582566825678256882569825708257182572825738257482575825768257782578825798258082581825828258382584825858258682587825888258982590825918259282593825948259582596825978259882599826008260182602826038260482605826068260782608826098261082611826128261382614826158261682617826188261982620826218262282623826248262582626826278262882629826308263182632826338263482635826368263782638826398264082641826428264382644826458264682647826488264982650826518265282653826548265582656826578265882659826608266182662826638266482665826668266782668826698267082671826728267382674826758267682677826788267982680826818268282683826848268582686826878268882689826908269182692826938269482695826968269782698826998270082701827028270382704827058270682707827088270982710827118271282713827148271582716827178271882719827208272182722827238272482725827268272782728827298273082731827328273382734827358273682737827388273982740827418274282743827448274582746827478274882749827508275182752827538275482755827568275782758827598276082761827628276382764827658276682767827688276982770827718277282773827748277582776827778277882779827808278182782827838278482785827868278782788827898279082791827928279382794827958279682797827988279982800828018280282803828048280582806828078280882809828108281182812828138281482815828168281782818828198282082821828228282382824828258282682827828288282982830828318283282833828348283582836828378283882839828408284182842828438284482845828468284782848828498285082851828528285382854828558285682857828588285982860828618286282863828648286582866828678286882869828708287182872828738287482875828768287782878828798288082881828828288382884828858288682887828888288982890828918289282893828948289582896828978289882899829008290182902829038290482905829068290782908829098291082911829128291382914829158291682917829188291982920829218292282923829248292582926829278292882929829308293182932829338293482935829368293782938829398294082941829428294382944829458294682947829488294982950829518295282953829548295582956829578295882959829608296182962829638296482965829668296782968829698297082971829728297382974829758297682977829788297982980829818298282983829848298582986829878298882989829908299182992829938299482995829968299782998829998300083001830028300383004830058300683007830088300983010830118301283013830148301583016830178301883019830208302183022830238302483025830268302783028830298303083031830328303383034830358303683037830388303983040830418304283043830448304583046830478304883049830508305183052830538305483055830568305783058830598306083061830628306383064830658306683067830688306983070830718307283073830748307583076830778307883079830808308183082830838308483085830868308783088830898309083091830928309383094830958309683097830988309983100831018310283103831048310583106831078310883109831108311183112831138311483115831168311783118831198312083121831228312383124831258312683127831288312983130831318313283133831348313583136831378313883139831408314183142831438314483145831468314783148831498315083151831528315383154831558315683157831588315983160831618316283163831648316583166831678316883169831708317183172831738317483175831768317783178831798318083181831828318383184831858318683187831888318983190831918319283193831948319583196831978319883199832008320183202832038320483205832068320783208832098321083211832128321383214832158321683217832188321983220832218322283223832248322583226832278322883229832308323183232832338323483235832368323783238832398324083241832428324383244832458324683247832488324983250832518325283253832548325583256832578325883259832608326183262832638326483265832668326783268832698327083271832728327383274832758327683277832788327983280832818328283283832848328583286832878328883289832908329183292832938329483295832968329783298832998330083301833028330383304833058330683307833088330983310833118331283313833148331583316833178331883319833208332183322833238332483325833268332783328833298333083331833328333383334833358333683337833388333983340833418334283343833448334583346833478334883349833508335183352833538335483355833568335783358833598336083361833628336383364833658336683367833688336983370833718337283373833748337583376833778337883379833808338183382833838338483385833868338783388833898339083391833928339383394833958339683397833988339983400834018340283403834048340583406834078340883409834108341183412834138341483415834168341783418834198342083421834228342383424834258342683427834288342983430834318343283433834348343583436834378343883439834408344183442834438344483445834468344783448834498345083451834528345383454834558345683457834588345983460834618346283463834648346583466834678346883469834708347183472834738347483475834768347783478834798348083481834828348383484834858348683487834888348983490834918349283493834948349583496834978349883499835008350183502835038350483505835068350783508835098351083511835128351383514835158351683517835188351983520835218352283523835248352583526835278352883529835308353183532835338353483535835368353783538835398354083541835428354383544835458354683547835488354983550835518355283553835548355583556835578355883559835608356183562835638356483565835668356783568835698357083571835728357383574835758357683577835788357983580835818358283583835848358583586835878358883589835908359183592835938359483595835968359783598835998360083601836028360383604836058360683607836088360983610836118361283613836148361583616836178361883619836208362183622836238362483625836268362783628836298363083631836328363383634836358363683637836388363983640836418364283643836448364583646836478364883649836508365183652836538365483655836568365783658836598366083661836628366383664836658366683667836688366983670836718367283673836748367583676836778367883679836808368183682836838368483685836868368783688836898369083691836928369383694836958369683697836988369983700837018370283703837048370583706837078370883709837108371183712837138371483715837168371783718837198372083721837228372383724837258372683727837288372983730837318373283733837348373583736837378373883739837408374183742837438374483745837468374783748837498375083751837528375383754837558375683757837588375983760837618376283763837648376583766837678376883769837708377183772837738377483775837768377783778837798378083781837828378383784837858378683787837888378983790837918379283793837948379583796837978379883799838008380183802838038380483805838068380783808838098381083811838128381383814838158381683817838188381983820838218382283823838248382583826838278382883829838308383183832838338383483835838368383783838838398384083841838428384383844838458384683847838488384983850838518385283853838548385583856838578385883859838608386183862838638386483865838668386783868838698387083871838728387383874838758387683877838788387983880838818388283883838848388583886838878388883889838908389183892838938389483895838968389783898838998390083901839028390383904839058390683907839088390983910839118391283913839148391583916839178391883919839208392183922839238392483925839268392783928839298393083931839328393383934839358393683937839388393983940839418394283943839448394583946839478394883949839508395183952839538395483955839568395783958839598396083961839628396383964839658396683967839688396983970839718397283973839748397583976839778397883979839808398183982839838398483985839868398783988839898399083991839928399383994839958399683997839988399984000840018400284003840048400584006840078400884009840108401184012840138401484015840168401784018840198402084021840228402384024840258402684027840288402984030840318403284033840348403584036840378403884039840408404184042840438404484045840468404784048840498405084051840528405384054840558405684057840588405984060840618406284063840648406584066840678406884069840708407184072840738407484075840768407784078840798408084081840828408384084840858408684087840888408984090840918409284093840948409584096840978409884099841008410184102841038410484105841068410784108841098411084111841128411384114841158411684117841188411984120841218412284123841248412584126841278412884129841308413184132841338413484135841368413784138841398414084141841428414384144841458414684147841488414984150841518415284153841548415584156841578415884159841608416184162841638416484165841668416784168841698417084171841728417384174841758417684177841788417984180841818418284183841848418584186841878418884189841908419184192841938419484195841968419784198841998420084201842028420384204842058420684207842088420984210842118421284213842148421584216842178421884219842208422184222842238422484225842268422784228842298423084231842328423384234842358423684237842388423984240842418424284243842448424584246842478424884249842508425184252842538425484255842568425784258842598426084261842628426384264842658426684267842688426984270842718427284273842748427584276842778427884279842808428184282842838428484285842868428784288842898429084291842928429384294842958429684297842988429984300843018430284303843048430584306843078430884309843108431184312843138431484315843168431784318843198432084321843228432384324843258432684327843288432984330843318433284333843348433584336843378433884339843408434184342843438434484345843468434784348843498435084351843528435384354843558435684357843588435984360843618436284363843648436584366843678436884369843708437184372843738437484375843768437784378843798438084381843828438384384843858438684387843888438984390843918439284393843948439584396843978439884399844008440184402844038440484405844068440784408844098441084411844128441384414844158441684417844188441984420844218442284423844248442584426844278442884429844308443184432844338443484435844368443784438844398444084441844428444384444844458444684447844488444984450844518445284453844548445584456844578445884459844608446184462844638446484465844668446784468844698447084471844728447384474844758447684477844788447984480844818448284483844848448584486844878448884489844908449184492844938449484495844968449784498844998450084501845028450384504845058450684507845088450984510845118451284513845148451584516845178451884519845208452184522845238452484525845268452784528845298453084531845328453384534845358453684537845388453984540845418454284543845448454584546845478454884549845508455184552845538455484555845568455784558845598456084561845628456384564845658456684567845688456984570845718457284573845748457584576845778457884579845808458184582845838458484585845868458784588845898459084591845928459384594845958459684597845988459984600846018460284603846048460584606846078460884609846108461184612846138461484615846168461784618846198462084621846228462384624846258462684627846288462984630846318463284633846348463584636846378463884639846408464184642846438464484645846468464784648846498465084651846528465384654846558465684657846588465984660846618466284663846648466584666846678466884669846708467184672846738467484675846768467784678846798468084681846828468384684846858468684687846888468984690846918469284693846948469584696846978469884699847008470184702847038470484705847068470784708847098471084711847128471384714847158471684717847188471984720847218472284723847248472584726847278472884729847308473184732847338473484735847368473784738847398474084741847428474384744847458474684747847488474984750847518475284753847548475584756847578475884759847608476184762847638476484765847668476784768847698477084771847728477384774847758477684777847788477984780847818478284783847848478584786847878478884789847908479184792847938479484795847968479784798847998480084801848028480384804848058480684807848088480984810848118481284813848148481584816848178481884819848208482184822848238482484825848268482784828848298483084831848328483384834848358483684837848388483984840848418484284843848448484584846848478484884849848508485184852848538485484855848568485784858848598486084861848628486384864848658486684867848688486984870848718487284873848748487584876848778487884879848808488184882848838488484885848868488784888848898489084891848928489384894848958489684897848988489984900849018490284903849048490584906849078490884909849108491184912849138491484915849168491784918849198492084921849228492384924849258492684927849288492984930849318493284933849348493584936849378493884939849408494184942849438494484945849468494784948849498495084951849528495384954849558495684957849588495984960849618496284963849648496584966849678496884969849708497184972849738497484975849768497784978849798498084981849828498384984849858498684987849888498984990849918499284993849948499584996849978499884999850008500185002850038500485005850068500785008850098501085011850128501385014850158501685017850188501985020850218502285023850248502585026850278502885029850308503185032850338503485035850368503785038850398504085041850428504385044850458504685047850488504985050850518505285053850548505585056850578505885059850608506185062850638506485065850668506785068850698507085071850728507385074850758507685077850788507985080850818508285083850848508585086850878508885089850908509185092850938509485095850968509785098850998510085101851028510385104851058510685107851088510985110851118511285113851148511585116851178511885119851208512185122851238512485125851268512785128851298513085131851328513385134851358513685137851388513985140851418514285143851448514585146851478514885149851508515185152851538515485155851568515785158851598516085161851628516385164851658516685167851688516985170851718517285173851748517585176851778517885179851808518185182851838518485185851868518785188851898519085191851928519385194851958519685197851988519985200852018520285203852048520585206852078520885209852108521185212852138521485215852168521785218852198522085221852228522385224852258522685227852288522985230852318523285233852348523585236852378523885239852408524185242852438524485245852468524785248852498525085251852528525385254852558525685257852588525985260852618526285263852648526585266852678526885269852708527185272852738527485275852768527785278852798528085281852828528385284852858528685287852888528985290852918529285293852948529585296852978529885299853008530185302853038530485305853068530785308853098531085311853128531385314853158531685317853188531985320853218532285323853248532585326853278532885329853308533185332853338533485335853368533785338853398534085341853428534385344853458534685347853488534985350853518535285353853548535585356853578535885359853608536185362853638536485365853668536785368853698537085371853728537385374853758537685377853788537985380853818538285383853848538585386853878538885389853908539185392853938539485395853968539785398853998540085401854028540385404854058540685407854088540985410854118541285413854148541585416854178541885419854208542185422854238542485425854268542785428854298543085431854328543385434854358543685437854388543985440854418544285443854448544585446854478544885449854508545185452854538545485455854568545785458854598546085461854628546385464854658546685467854688546985470854718547285473854748547585476854778547885479854808548185482854838548485485854868548785488854898549085491854928549385494854958549685497854988549985500855018550285503855048550585506855078550885509855108551185512855138551485515855168551785518855198552085521855228552385524855258552685527855288552985530855318553285533855348553585536855378553885539855408554185542855438554485545855468554785548855498555085551855528555385554855558555685557855588555985560855618556285563855648556585566855678556885569855708557185572855738557485575855768557785578855798558085581855828558385584855858558685587855888558985590855918559285593855948559585596855978559885599856008560185602856038560485605856068560785608856098561085611856128561385614856158561685617856188561985620856218562285623856248562585626856278562885629856308563185632856338563485635856368563785638856398564085641856428564385644856458564685647856488564985650856518565285653856548565585656856578565885659856608566185662856638566485665856668566785668856698567085671856728567385674856758567685677856788567985680856818568285683856848568585686856878568885689856908569185692856938569485695856968569785698856998570085701857028570385704857058570685707857088570985710857118571285713857148571585716857178571885719857208572185722857238572485725857268572785728857298573085731857328573385734857358573685737857388573985740857418574285743857448574585746857478574885749857508575185752857538575485755857568575785758857598576085761857628576385764857658576685767857688576985770857718577285773857748577585776857778577885779857808578185782857838578485785857868578785788857898579085791857928579385794857958579685797857988579985800858018580285803858048580585806858078580885809858108581185812858138581485815858168581785818858198582085821858228582385824858258582685827858288582985830858318583285833858348583585836858378583885839858408584185842858438584485845858468584785848858498585085851858528585385854858558585685857858588585985860858618586285863858648586585866858678586885869858708587185872858738587485875858768587785878858798588085881858828588385884858858588685887858888588985890858918589285893858948589585896858978589885899859008590185902859038590485905859068590785908859098591085911859128591385914859158591685917859188591985920859218592285923859248592585926859278592885929859308593185932859338593485935859368593785938859398594085941859428594385944859458594685947859488594985950859518595285953859548595585956859578595885959859608596185962859638596485965859668596785968859698597085971859728597385974859758597685977859788597985980859818598285983859848598585986859878598885989859908599185992859938599485995859968599785998859998600086001860028600386004860058600686007860088600986010860118601286013860148601586016860178601886019860208602186022860238602486025860268602786028860298603086031860328603386034860358603686037860388603986040860418604286043860448604586046860478604886049860508605186052860538605486055860568605786058860598606086061860628606386064860658606686067860688606986070860718607286073860748607586076860778607886079860808608186082860838608486085860868608786088860898609086091860928609386094860958609686097860988609986100861018610286103861048610586106861078610886109861108611186112861138611486115861168611786118861198612086121861228612386124861258612686127861288612986130861318613286133861348613586136861378613886139861408614186142861438614486145861468614786148861498615086151861528615386154861558615686157861588615986160861618616286163861648616586166861678616886169861708617186172861738617486175861768617786178861798618086181861828618386184861858618686187861888618986190861918619286193861948619586196861978619886199862008620186202862038620486205862068620786208862098621086211862128621386214862158621686217862188621986220862218622286223862248622586226862278622886229862308623186232862338623486235862368623786238862398624086241862428624386244862458624686247862488624986250862518625286253862548625586256862578625886259862608626186262862638626486265862668626786268862698627086271862728627386274862758627686277862788627986280862818628286283862848628586286862878628886289862908629186292862938629486295862968629786298862998630086301863028630386304863058630686307863088630986310863118631286313863148631586316863178631886319863208632186322863238632486325863268632786328863298633086331863328633386334863358633686337863388633986340863418634286343863448634586346863478634886349863508635186352863538635486355863568635786358863598636086361863628636386364863658636686367863688636986370863718637286373863748637586376863778637886379863808638186382863838638486385863868638786388863898639086391863928639386394863958639686397863988639986400864018640286403864048640586406864078640886409864108641186412864138641486415864168641786418864198642086421864228642386424864258642686427864288642986430864318643286433864348643586436864378643886439864408644186442864438644486445864468644786448864498645086451864528645386454864558645686457864588645986460864618646286463864648646586466864678646886469864708647186472864738647486475864768647786478864798648086481864828648386484864858648686487864888648986490864918649286493864948649586496864978649886499865008650186502865038650486505865068650786508865098651086511865128651386514865158651686517865188651986520865218652286523865248652586526865278652886529865308653186532865338653486535865368653786538865398654086541865428654386544865458654686547865488654986550865518655286553865548655586556865578655886559865608656186562865638656486565865668656786568865698657086571865728657386574865758657686577865788657986580865818658286583865848658586586865878658886589865908659186592865938659486595865968659786598865998660086601866028660386604866058660686607866088660986610866118661286613866148661586616866178661886619866208662186622866238662486625866268662786628866298663086631866328663386634866358663686637866388663986640866418664286643866448664586646866478664886649866508665186652866538665486655866568665786658866598666086661866628666386664866658666686667866688666986670866718667286673866748667586676866778667886679866808668186682866838668486685866868668786688866898669086691866928669386694866958669686697866988669986700867018670286703867048670586706867078670886709867108671186712867138671486715867168671786718867198672086721867228672386724867258672686727867288672986730867318673286733867348673586736867378673886739867408674186742867438674486745867468674786748867498675086751867528675386754867558675686757867588675986760867618676286763867648676586766867678676886769867708677186772867738677486775867768677786778867798678086781867828678386784867858678686787867888678986790867918679286793867948679586796867978679886799868008680186802868038680486805868068680786808868098681086811868128681386814868158681686817868188681986820868218682286823868248682586826868278682886829868308683186832868338683486835868368683786838868398684086841868428684386844868458684686847868488684986850868518685286853868548685586856868578685886859868608686186862868638686486865868668686786868868698687086871868728687386874868758687686877868788687986880868818688286883868848688586886868878688886889868908689186892868938689486895868968689786898868998690086901869028690386904869058690686907869088690986910869118691286913869148691586916869178691886919869208692186922869238692486925869268692786928869298693086931869328693386934869358693686937869388693986940869418694286943869448694586946869478694886949869508695186952869538695486955869568695786958869598696086961869628696386964869658696686967869688696986970869718697286973869748697586976869778697886979869808698186982869838698486985869868698786988869898699086991869928699386994869958699686997869988699987000870018700287003870048700587006870078700887009870108701187012870138701487015870168701787018870198702087021870228702387024870258702687027870288702987030870318703287033870348703587036870378703887039870408704187042870438704487045870468704787048870498705087051870528705387054870558705687057870588705987060870618706287063870648706587066870678706887069870708707187072870738707487075870768707787078870798708087081870828708387084870858708687087870888708987090870918709287093870948709587096870978709887099871008710187102871038710487105871068710787108871098711087111871128711387114871158711687117871188711987120871218712287123871248712587126871278712887129871308713187132871338713487135871368713787138871398714087141871428714387144871458714687147871488714987150871518715287153871548715587156871578715887159871608716187162871638716487165871668716787168871698717087171871728717387174871758717687177871788717987180871818718287183871848718587186871878718887189871908719187192871938719487195871968719787198871998720087201872028720387204872058720687207872088720987210872118721287213872148721587216872178721887219872208722187222872238722487225872268722787228872298723087231872328723387234872358723687237872388723987240872418724287243872448724587246872478724887249872508725187252872538725487255872568725787258872598726087261872628726387264872658726687267872688726987270872718727287273872748727587276872778727887279872808728187282872838728487285872868728787288872898729087291872928729387294872958729687297872988729987300873018730287303873048730587306873078730887309873108731187312873138731487315873168731787318873198732087321873228732387324873258732687327873288732987330873318733287333873348733587336873378733887339873408734187342873438734487345873468734787348873498735087351873528735387354873558735687357873588735987360873618736287363873648736587366873678736887369873708737187372873738737487375873768737787378873798738087381873828738387384873858738687387873888738987390873918739287393873948739587396873978739887399874008740187402874038740487405874068740787408874098741087411874128741387414874158741687417874188741987420874218742287423874248742587426874278742887429874308743187432874338743487435874368743787438874398744087441874428744387444874458744687447874488744987450874518745287453874548745587456874578745887459874608746187462874638746487465874668746787468874698747087471874728747387474874758747687477874788747987480874818748287483874848748587486874878748887489874908749187492874938749487495874968749787498874998750087501875028750387504875058750687507875088750987510875118751287513875148751587516875178751887519875208752187522875238752487525875268752787528875298753087531875328753387534875358753687537875388753987540875418754287543875448754587546875478754887549875508755187552875538755487555875568755787558875598756087561875628756387564875658756687567875688756987570875718757287573875748757587576875778757887579875808758187582875838758487585875868758787588875898759087591875928759387594875958759687597875988759987600876018760287603876048760587606876078760887609876108761187612876138761487615876168761787618876198762087621876228762387624876258762687627876288762987630876318763287633876348763587636876378763887639876408764187642876438764487645876468764787648876498765087651876528765387654876558765687657876588765987660876618766287663876648766587666876678766887669876708767187672876738767487675876768767787678876798768087681876828768387684876858768687687876888768987690876918769287693876948769587696876978769887699877008770187702877038770487705877068770787708877098771087711877128771387714877158771687717877188771987720877218772287723877248772587726877278772887729877308773187732877338773487735877368773787738877398774087741877428774387744877458774687747877488774987750877518775287753877548775587756877578775887759877608776187762877638776487765877668776787768877698777087771877728777387774877758777687777877788777987780877818778287783877848778587786877878778887789877908779187792877938779487795877968779787798877998780087801878028780387804878058780687807878088780987810878118781287813878148781587816878178781887819878208782187822878238782487825878268782787828878298783087831878328783387834878358783687837878388783987840878418784287843878448784587846878478784887849878508785187852878538785487855878568785787858878598786087861878628786387864878658786687867878688786987870878718787287873878748787587876878778787887879878808788187882878838788487885878868788787888878898789087891878928789387894878958789687897878988789987900879018790287903879048790587906879078790887909879108791187912879138791487915879168791787918879198792087921879228792387924879258792687927879288792987930879318793287933879348793587936879378793887939879408794187942879438794487945879468794787948879498795087951879528795387954879558795687957879588795987960879618796287963879648796587966879678796887969879708797187972879738797487975879768797787978879798798087981879828798387984879858798687987879888798987990879918799287993879948799587996879978799887999880008800188002880038800488005880068800788008880098801088011880128801388014880158801688017880188801988020880218802288023880248802588026880278802888029880308803188032880338803488035880368803788038880398804088041880428804388044880458804688047880488804988050880518805288053880548805588056880578805888059880608806188062880638806488065880668806788068880698807088071880728807388074880758807688077880788807988080880818808288083880848808588086880878808888089880908809188092880938809488095880968809788098880998810088101881028810388104881058810688107881088810988110881118811288113881148811588116881178811888119881208812188122881238812488125881268812788128881298813088131881328813388134881358813688137881388813988140881418814288143881448814588146881478814888149881508815188152881538815488155881568815788158881598816088161881628816388164881658816688167881688816988170881718817288173881748817588176881778817888179881808818188182881838818488185881868818788188881898819088191881928819388194881958819688197881988819988200882018820288203882048820588206882078820888209882108821188212882138821488215882168821788218882198822088221882228822388224882258822688227882288822988230882318823288233882348823588236882378823888239882408824188242882438824488245882468824788248882498825088251882528825388254882558825688257882588825988260882618826288263882648826588266882678826888269882708827188272882738827488275882768827788278882798828088281882828828388284882858828688287882888828988290882918829288293882948829588296882978829888299883008830188302883038830488305883068830788308883098831088311883128831388314883158831688317883188831988320883218832288323883248832588326883278832888329883308833188332883338833488335883368833788338883398834088341883428834388344883458834688347883488834988350883518835288353883548835588356883578835888359883608836188362883638836488365883668836788368883698837088371883728837388374883758837688377883788837988380883818838288383883848838588386883878838888389883908839188392883938839488395883968839788398883998840088401884028840388404884058840688407884088840988410884118841288413884148841588416884178841888419884208842188422884238842488425884268842788428884298843088431884328843388434884358843688437884388843988440884418844288443884448844588446884478844888449884508845188452884538845488455884568845788458884598846088461884628846388464884658846688467884688846988470884718847288473884748847588476884778847888479884808848188482884838848488485884868848788488884898849088491884928849388494884958849688497884988849988500885018850288503885048850588506885078850888509885108851188512885138851488515885168851788518885198852088521885228852388524885258852688527885288852988530885318853288533885348853588536885378853888539885408854188542885438854488545885468854788548885498855088551885528855388554885558855688557885588855988560885618856288563885648856588566885678856888569885708857188572885738857488575885768857788578885798858088581885828858388584885858858688587885888858988590885918859288593885948859588596885978859888599886008860188602886038860488605886068860788608886098861088611886128861388614886158861688617886188861988620886218862288623886248862588626886278862888629886308863188632886338863488635886368863788638886398864088641886428864388644886458864688647886488864988650886518865288653886548865588656886578865888659886608866188662886638866488665886668866788668886698867088671886728867388674886758867688677886788867988680886818868288683886848868588686886878868888689886908869188692886938869488695886968869788698886998870088701887028870388704887058870688707887088870988710887118871288713887148871588716887178871888719887208872188722887238872488725887268872788728887298873088731887328873388734887358873688737887388873988740887418874288743887448874588746887478874888749887508875188752887538875488755887568875788758887598876088761887628876388764887658876688767887688876988770887718877288773887748877588776887778877888779887808878188782887838878488785887868878788788887898879088791887928879388794887958879688797887988879988800888018880288803888048880588806888078880888809888108881188812888138881488815888168881788818888198882088821888228882388824888258882688827888288882988830888318883288833888348883588836888378883888839888408884188842888438884488845888468884788848888498885088851888528885388854888558885688857888588885988860888618886288863888648886588866888678886888869888708887188872888738887488875888768887788878888798888088881888828888388884888858888688887888888888988890888918889288893888948889588896888978889888899889008890188902889038890488905889068890788908889098891088911889128891388914889158891688917889188891988920889218892288923889248892588926889278892888929889308893188932889338893488935889368893788938889398894088941889428894388944889458894688947889488894988950889518895288953889548895588956889578895888959889608896188962889638896488965889668896788968889698897088971889728897388974889758897688977889788897988980889818898288983889848898588986889878898888989889908899188992889938899488995889968899788998889998900089001890028900389004890058900689007890088900989010890118901289013890148901589016890178901889019890208902189022890238902489025890268902789028890298903089031890328903389034890358903689037890388903989040890418904289043890448904589046890478904889049890508905189052890538905489055890568905789058890598906089061890628906389064890658906689067890688906989070890718907289073890748907589076890778907889079890808908189082890838908489085890868908789088890898909089091890928909389094890958909689097890988909989100891018910289103891048910589106891078910889109891108911189112891138911489115891168911789118891198912089121891228912389124891258912689127891288912989130891318913289133891348913589136891378913889139891408914189142891438914489145891468914789148891498915089151891528915389154891558915689157891588915989160891618916289163891648916589166891678916889169891708917189172891738917489175891768917789178891798918089181891828918389184891858918689187891888918989190891918919289193891948919589196891978919889199892008920189202892038920489205892068920789208892098921089211892128921389214892158921689217892188921989220892218922289223892248922589226892278922889229892308923189232892338923489235892368923789238892398924089241892428924389244892458924689247892488924989250892518925289253892548925589256892578925889259892608926189262892638926489265892668926789268892698927089271892728927389274892758927689277892788927989280892818928289283892848928589286892878928889289892908929189292892938929489295892968929789298892998930089301893028930389304893058930689307893088930989310893118931289313893148931589316893178931889319893208932189322893238932489325893268932789328893298933089331893328933389334893358933689337893388933989340893418934289343893448934589346893478934889349893508935189352893538935489355893568935789358893598936089361893628936389364893658936689367893688936989370893718937289373893748937589376893778937889379893808938189382893838938489385893868938789388893898939089391893928939389394893958939689397893988939989400894018940289403894048940589406894078940889409894108941189412894138941489415894168941789418894198942089421894228942389424894258942689427894288942989430894318943289433894348943589436894378943889439894408944189442894438944489445894468944789448894498945089451894528945389454894558945689457894588945989460894618946289463894648946589466894678946889469894708947189472894738947489475894768947789478894798948089481894828948389484894858948689487894888948989490894918949289493894948949589496894978949889499895008950189502895038950489505895068950789508895098951089511895128951389514895158951689517895188951989520895218952289523895248952589526895278952889529895308953189532895338953489535895368953789538895398954089541895428954389544895458954689547895488954989550895518955289553895548955589556895578955889559895608956189562895638956489565895668956789568895698957089571895728957389574895758957689577895788957989580895818958289583895848958589586895878958889589895908959189592895938959489595895968959789598895998960089601896028960389604896058960689607896088960989610896118961289613896148961589616896178961889619896208962189622896238962489625896268962789628896298963089631896328963389634896358963689637896388963989640896418964289643896448964589646896478964889649896508965189652896538965489655896568965789658896598966089661896628966389664896658966689667896688966989670896718967289673896748967589676896778967889679896808968189682896838968489685896868968789688896898969089691896928969389694896958969689697896988969989700897018970289703897048970589706897078970889709897108971189712897138971489715897168971789718897198972089721897228972389724897258972689727897288972989730897318973289733897348973589736897378973889739897408974189742897438974489745897468974789748897498975089751897528975389754897558975689757897588975989760897618976289763897648976589766897678976889769897708977189772897738977489775897768977789778897798978089781897828978389784897858978689787897888978989790897918979289793897948979589796897978979889799898008980189802898038980489805898068980789808898098981089811898128981389814898158981689817898188981989820898218982289823898248982589826898278982889829898308983189832898338983489835898368983789838898398984089841898428984389844898458984689847898488984989850898518985289853898548985589856898578985889859898608986189862898638986489865898668986789868898698987089871898728987389874898758987689877898788987989880898818988289883898848988589886898878988889889898908989189892898938989489895898968989789898898998990089901899028990389904899058990689907899088990989910899118991289913899148991589916899178991889919899208992189922899238992489925899268992789928899298993089931899328993389934899358993689937899388993989940899418994289943899448994589946899478994889949899508995189952899538995489955899568995789958899598996089961899628996389964899658996689967899688996989970899718997289973899748997589976899778997889979899808998189982899838998489985899868998789988899898999089991899928999389994899958999689997899988999990000900019000290003900049000590006900079000890009900109001190012900139001490015900169001790018900199002090021900229002390024900259002690027900289002990030900319003290033900349003590036900379003890039900409004190042900439004490045900469004790048900499005090051900529005390054900559005690057900589005990060900619006290063900649006590066900679006890069900709007190072900739007490075900769007790078900799008090081900829008390084900859008690087900889008990090900919009290093900949009590096900979009890099901009010190102901039010490105901069010790108901099011090111901129011390114901159011690117901189011990120901219012290123901249012590126901279012890129901309013190132901339013490135901369013790138901399014090141901429014390144901459014690147901489014990150901519015290153901549015590156901579015890159901609016190162901639016490165901669016790168901699017090171901729017390174901759017690177901789017990180901819018290183901849018590186901879018890189901909019190192901939019490195901969019790198901999020090201902029020390204902059020690207902089020990210902119021290213902149021590216902179021890219902209022190222902239022490225902269022790228902299023090231902329023390234902359023690237902389023990240902419024290243902449024590246902479024890249902509025190252902539025490255902569025790258902599026090261902629026390264902659026690267902689026990270902719027290273902749027590276902779027890279902809028190282902839028490285902869028790288902899029090291902929029390294902959029690297902989029990300903019030290303903049030590306903079030890309903109031190312903139031490315903169031790318903199032090321903229032390324903259032690327903289032990330903319033290333903349033590336903379033890339903409034190342903439034490345903469034790348903499035090351903529035390354903559035690357903589035990360903619036290363903649036590366903679036890369903709037190372903739037490375903769037790378903799038090381903829038390384903859038690387903889038990390903919039290393903949039590396903979039890399904009040190402904039040490405904069040790408904099041090411904129041390414904159041690417904189041990420904219042290423904249042590426904279042890429904309043190432904339043490435904369043790438904399044090441904429044390444904459044690447904489044990450904519045290453904549045590456904579045890459904609046190462904639046490465904669046790468904699047090471904729047390474904759047690477904789047990480904819048290483904849048590486904879048890489904909049190492904939049490495904969049790498904999050090501905029050390504905059050690507905089050990510905119051290513905149051590516905179051890519905209052190522905239052490525905269052790528905299053090531905329053390534905359053690537905389053990540905419054290543905449054590546905479054890549905509055190552905539055490555905569055790558905599056090561905629056390564905659056690567905689056990570905719057290573905749057590576905779057890579905809058190582905839058490585905869058790588905899059090591905929059390594905959059690597905989059990600906019060290603906049060590606906079060890609906109061190612906139061490615906169061790618906199062090621906229062390624906259062690627906289062990630906319063290633906349063590636906379063890639906409064190642906439064490645906469064790648906499065090651906529065390654906559065690657906589065990660906619066290663906649066590666906679066890669906709067190672906739067490675906769067790678906799068090681906829068390684906859068690687906889068990690906919069290693906949069590696906979069890699907009070190702907039070490705907069070790708907099071090711907129071390714907159071690717907189071990720907219072290723907249072590726907279072890729907309073190732907339073490735907369073790738907399074090741907429074390744907459074690747907489074990750907519075290753907549075590756907579075890759907609076190762907639076490765907669076790768907699077090771907729077390774907759077690777907789077990780907819078290783907849078590786907879078890789907909079190792907939079490795907969079790798907999080090801908029080390804908059080690807908089080990810908119081290813908149081590816908179081890819908209082190822908239082490825908269082790828908299083090831908329083390834908359083690837908389083990840908419084290843908449084590846908479084890849908509085190852908539085490855908569085790858908599086090861908629086390864908659086690867908689086990870908719087290873908749087590876908779087890879908809088190882908839088490885908869088790888908899089090891908929089390894908959089690897908989089990900909019090290903909049090590906909079090890909909109091190912909139091490915909169091790918909199092090921909229092390924909259092690927909289092990930909319093290933909349093590936909379093890939909409094190942909439094490945909469094790948909499095090951909529095390954909559095690957909589095990960909619096290963909649096590966909679096890969909709097190972909739097490975909769097790978909799098090981909829098390984909859098690987909889098990990909919099290993909949099590996909979099890999910009100191002910039100491005910069100791008910099101091011910129101391014910159101691017910189101991020910219102291023910249102591026910279102891029910309103191032910339103491035910369103791038910399104091041910429104391044910459104691047910489104991050910519105291053910549105591056910579105891059910609106191062910639106491065910669106791068910699107091071910729107391074910759107691077910789107991080910819108291083910849108591086910879108891089910909109191092910939109491095910969109791098910999110091101911029110391104911059110691107911089110991110911119111291113911149111591116911179111891119911209112191122911239112491125911269112791128911299113091131911329113391134911359113691137911389113991140911419114291143911449114591146911479114891149911509115191152911539115491155911569115791158911599116091161911629116391164911659116691167911689116991170911719117291173911749117591176911779117891179911809118191182911839118491185911869118791188911899119091191911929119391194911959119691197911989119991200912019120291203912049120591206912079120891209912109121191212912139121491215912169121791218912199122091221912229122391224912259122691227912289122991230912319123291233912349123591236912379123891239912409124191242912439124491245912469124791248912499125091251912529125391254912559125691257912589125991260912619126291263912649126591266912679126891269912709127191272912739127491275912769127791278912799128091281912829128391284912859128691287912889128991290912919129291293912949129591296912979129891299913009130191302913039130491305913069130791308913099131091311913129131391314913159131691317913189131991320913219132291323913249132591326913279132891329913309133191332913339133491335913369133791338913399134091341913429134391344913459134691347913489134991350913519135291353913549135591356913579135891359913609136191362913639136491365913669136791368913699137091371913729137391374913759137691377913789137991380913819138291383913849138591386913879138891389913909139191392913939139491395913969139791398913999140091401914029140391404914059140691407914089140991410914119141291413914149141591416914179141891419914209142191422914239142491425914269142791428914299143091431914329143391434914359143691437914389143991440914419144291443914449144591446914479144891449914509145191452914539145491455914569145791458914599146091461914629146391464914659146691467914689146991470914719147291473914749147591476914779147891479914809148191482914839148491485914869148791488914899149091491914929149391494914959149691497914989149991500915019150291503915049150591506915079150891509915109151191512915139151491515915169151791518915199152091521915229152391524915259152691527915289152991530915319153291533915349153591536915379153891539915409154191542915439154491545915469154791548915499155091551915529155391554915559155691557915589155991560915619156291563915649156591566915679156891569915709157191572915739157491575915769157791578915799158091581915829158391584915859158691587915889158991590915919159291593915949159591596915979159891599916009160191602916039160491605916069160791608916099161091611916129161391614916159161691617916189161991620916219162291623916249162591626916279162891629916309163191632916339163491635916369163791638916399164091641916429164391644916459164691647916489164991650916519165291653916549165591656916579165891659916609166191662916639166491665916669166791668916699167091671916729167391674916759167691677916789167991680916819168291683916849168591686916879168891689916909169191692916939169491695916969169791698916999170091701917029170391704917059170691707917089170991710917119171291713917149171591716917179171891719917209172191722917239172491725917269172791728917299173091731917329173391734917359173691737917389173991740917419174291743917449174591746917479174891749917509175191752917539175491755917569175791758917599176091761917629176391764917659176691767917689176991770917719177291773917749177591776917779177891779917809178191782917839178491785917869178791788917899179091791917929179391794917959179691797917989179991800918019180291803918049180591806918079180891809918109181191812918139181491815918169181791818918199182091821918229182391824918259182691827918289182991830918319183291833918349183591836918379183891839918409184191842918439184491845918469184791848918499185091851918529185391854918559185691857918589185991860918619186291863918649186591866918679186891869918709187191872918739187491875918769187791878918799188091881918829188391884918859188691887918889188991890918919189291893918949189591896918979189891899919009190191902919039190491905919069190791908919099191091911919129191391914919159191691917919189191991920919219192291923919249192591926919279192891929919309193191932919339193491935919369193791938919399194091941919429194391944919459194691947919489194991950919519195291953919549195591956919579195891959919609196191962919639196491965919669196791968919699197091971919729197391974919759197691977919789197991980919819198291983919849198591986919879198891989919909199191992919939199491995919969199791998919999200092001920029200392004920059200692007920089200992010920119201292013920149201592016920179201892019920209202192022920239202492025920269202792028920299203092031920329203392034920359203692037920389203992040920419204292043920449204592046920479204892049920509205192052920539205492055920569205792058920599206092061920629206392064920659206692067920689206992070920719207292073920749207592076920779207892079920809208192082920839208492085920869208792088920899209092091920929209392094920959209692097920989209992100921019210292103921049210592106921079210892109921109211192112921139211492115921169211792118921199212092121921229212392124921259212692127921289212992130921319213292133921349213592136921379213892139921409214192142921439214492145921469214792148921499215092151921529215392154921559215692157921589215992160921619216292163921649216592166921679216892169921709217192172921739217492175921769217792178921799218092181921829218392184921859218692187921889218992190921919219292193921949219592196921979219892199922009220192202922039220492205922069220792208922099221092211922129221392214922159221692217922189221992220922219222292223922249222592226922279222892229922309223192232922339223492235922369223792238922399224092241922429224392244922459224692247922489224992250922519225292253922549225592256922579225892259922609226192262922639226492265922669226792268922699227092271922729227392274922759227692277922789227992280922819228292283922849228592286922879228892289922909229192292922939229492295922969229792298922999230092301923029230392304923059230692307923089230992310923119231292313923149231592316923179231892319923209232192322923239232492325923269232792328923299233092331923329233392334923359233692337923389233992340923419234292343923449234592346923479234892349923509235192352923539235492355923569235792358923599236092361923629236392364923659236692367923689236992370923719237292373923749237592376923779237892379923809238192382923839238492385923869238792388923899239092391923929239392394923959239692397923989239992400924019240292403924049240592406924079240892409924109241192412924139241492415924169241792418924199242092421924229242392424924259242692427924289242992430924319243292433924349243592436924379243892439924409244192442924439244492445924469244792448924499245092451924529245392454924559245692457924589245992460924619246292463924649246592466924679246892469924709247192472924739247492475924769247792478924799248092481924829248392484924859248692487924889248992490924919249292493924949249592496924979249892499925009250192502925039250492505925069250792508925099251092511925129251392514925159251692517925189251992520925219252292523925249252592526925279252892529925309253192532925339253492535925369253792538925399254092541925429254392544925459254692547925489254992550925519255292553925549255592556925579255892559925609256192562925639256492565925669256792568925699257092571925729257392574925759257692577925789257992580925819258292583925849258592586925879258892589925909259192592925939259492595925969259792598925999260092601926029260392604926059260692607926089260992610926119261292613926149261592616926179261892619926209262192622926239262492625926269262792628926299263092631926329263392634926359263692637926389263992640926419264292643926449264592646926479264892649926509265192652926539265492655926569265792658926599266092661926629266392664926659266692667926689266992670926719267292673926749267592676926779267892679926809268192682926839268492685926869268792688926899269092691926929269392694926959269692697926989269992700927019270292703927049270592706927079270892709927109271192712927139271492715927169271792718927199272092721927229272392724927259272692727927289272992730927319273292733927349273592736927379273892739927409274192742927439274492745927469274792748927499275092751927529275392754927559275692757927589275992760927619276292763927649276592766927679276892769927709277192772927739277492775927769277792778927799278092781927829278392784927859278692787927889278992790927919279292793927949279592796927979279892799928009280192802928039280492805928069280792808928099281092811928129281392814928159281692817928189281992820928219282292823928249282592826928279282892829928309283192832928339283492835928369283792838928399284092841928429284392844928459284692847928489284992850928519285292853928549285592856928579285892859928609286192862928639286492865928669286792868928699287092871928729287392874928759287692877928789287992880928819288292883928849288592886928879288892889928909289192892928939289492895928969289792898928999290092901929029290392904929059290692907929089290992910929119291292913929149291592916929179291892919929209292192922929239292492925929269292792928929299293092931929329293392934929359293692937929389293992940929419294292943929449294592946929479294892949929509295192952929539295492955929569295792958929599296092961929629296392964929659296692967929689296992970929719297292973929749297592976929779297892979929809298192982929839298492985929869298792988929899299092991929929299392994929959299692997929989299993000930019300293003930049300593006930079300893009930109301193012930139301493015930169301793018930199302093021930229302393024930259302693027930289302993030930319303293033930349303593036930379303893039930409304193042930439304493045930469304793048930499305093051930529305393054930559305693057930589305993060930619306293063930649306593066930679306893069930709307193072930739307493075930769307793078930799308093081930829308393084930859308693087930889308993090930919309293093930949309593096930979309893099931009310193102931039310493105931069310793108931099311093111931129311393114931159311693117931189311993120931219312293123931249312593126931279312893129931309313193132931339313493135931369313793138931399314093141931429314393144931459314693147931489314993150931519315293153931549315593156931579315893159931609316193162931639316493165931669316793168931699317093171931729317393174931759317693177931789317993180931819318293183931849318593186931879318893189931909319193192931939319493195931969319793198931999320093201932029320393204932059320693207932089320993210932119321293213932149321593216932179321893219932209322193222932239322493225932269322793228932299323093231932329323393234932359323693237932389323993240932419324293243932449324593246932479324893249932509325193252932539325493255932569325793258932599326093261932629326393264932659326693267932689326993270932719327293273932749327593276932779327893279932809328193282932839328493285932869328793288932899329093291932929329393294932959329693297932989329993300933019330293303933049330593306933079330893309933109331193312933139331493315933169331793318933199332093321933229332393324933259332693327933289332993330933319333293333933349333593336933379333893339933409334193342933439334493345933469334793348933499335093351933529335393354933559335693357933589335993360933619336293363933649336593366933679336893369933709337193372933739337493375933769337793378933799338093381933829338393384933859338693387933889338993390933919339293393933949339593396933979339893399934009340193402934039340493405934069340793408934099341093411934129341393414934159341693417934189341993420934219342293423934249342593426934279342893429934309343193432934339343493435934369343793438934399344093441934429344393444934459344693447934489344993450934519345293453934549345593456934579345893459934609346193462934639346493465934669346793468934699347093471934729347393474934759347693477934789347993480934819348293483934849348593486934879348893489934909349193492934939349493495934969349793498934999350093501935029350393504935059350693507935089350993510935119351293513935149351593516935179351893519935209352193522935239352493525935269352793528935299353093531935329353393534935359353693537935389353993540935419354293543935449354593546935479354893549935509355193552935539355493555935569355793558935599356093561935629356393564935659356693567935689356993570935719357293573935749357593576935779357893579935809358193582935839358493585935869358793588935899359093591935929359393594935959359693597935989359993600936019360293603936049360593606936079360893609936109361193612936139361493615936169361793618936199362093621936229362393624936259362693627936289362993630936319363293633936349363593636936379363893639936409364193642936439364493645936469364793648936499365093651936529365393654936559365693657936589365993660936619366293663936649366593666936679366893669936709367193672936739367493675936769367793678936799368093681936829368393684936859368693687936889368993690936919369293693936949369593696936979369893699937009370193702937039370493705937069370793708937099371093711937129371393714937159371693717937189371993720937219372293723937249372593726937279372893729937309373193732937339373493735937369373793738937399374093741937429374393744937459374693747937489374993750937519375293753937549375593756937579375893759937609376193762937639376493765937669376793768937699377093771937729377393774937759377693777937789377993780937819378293783937849378593786937879378893789937909379193792937939379493795937969379793798937999380093801938029380393804938059380693807938089380993810938119381293813938149381593816938179381893819938209382193822938239382493825938269382793828938299383093831938329383393834938359383693837938389383993840938419384293843938449384593846938479384893849938509385193852938539385493855938569385793858938599386093861938629386393864938659386693867938689386993870938719387293873938749387593876938779387893879938809388193882938839388493885938869388793888938899389093891938929389393894938959389693897938989389993900939019390293903939049390593906939079390893909939109391193912939139391493915939169391793918939199392093921939229392393924939259392693927939289392993930939319393293933939349393593936939379393893939939409394193942939439394493945939469394793948939499395093951939529395393954939559395693957939589395993960939619396293963939649396593966939679396893969939709397193972939739397493975939769397793978939799398093981939829398393984939859398693987939889398993990939919399293993939949399593996939979399893999940009400194002940039400494005940069400794008940099401094011940129401394014940159401694017940189401994020940219402294023940249402594026940279402894029940309403194032940339403494035940369403794038940399404094041940429404394044940459404694047940489404994050940519405294053940549405594056940579405894059940609406194062940639406494065940669406794068940699407094071940729407394074940759407694077940789407994080940819408294083940849408594086940879408894089940909409194092940939409494095940969409794098940999410094101941029410394104941059410694107941089410994110941119411294113941149411594116941179411894119941209412194122941239412494125941269412794128941299413094131941329413394134941359413694137941389413994140941419414294143941449414594146941479414894149941509415194152941539415494155941569415794158941599416094161941629416394164941659416694167941689416994170941719417294173941749417594176941779417894179941809418194182941839418494185941869418794188941899419094191941929419394194941959419694197941989419994200942019420294203942049420594206942079420894209942109421194212942139421494215942169421794218942199422094221942229422394224942259422694227942289422994230942319423294233942349423594236942379423894239942409424194242942439424494245942469424794248942499425094251942529425394254942559425694257942589425994260942619426294263942649426594266942679426894269942709427194272942739427494275942769427794278942799428094281942829428394284942859428694287942889428994290942919429294293942949429594296942979429894299943009430194302943039430494305943069430794308943099431094311943129431394314943159431694317943189431994320943219432294323943249432594326943279432894329943309433194332943339433494335943369433794338943399434094341943429434394344943459434694347943489434994350943519435294353943549435594356943579435894359943609436194362943639436494365943669436794368943699437094371943729437394374943759437694377943789437994380943819438294383943849438594386943879438894389943909439194392943939439494395943969439794398943999440094401944029440394404944059440694407944089440994410944119441294413944149441594416944179441894419944209442194422944239442494425944269442794428944299443094431944329443394434944359443694437944389443994440944419444294443944449444594446944479444894449944509445194452944539445494455944569445794458944599446094461944629446394464944659446694467944689446994470944719447294473944749447594476944779447894479944809448194482944839448494485944869448794488944899449094491944929449394494944959449694497944989449994500945019450294503945049450594506945079450894509945109451194512945139451494515945169451794518945199452094521945229452394524945259452694527945289452994530945319453294533945349453594536945379453894539945409454194542945439454494545945469454794548945499455094551945529455394554945559455694557945589455994560945619456294563945649456594566945679456894569945709457194572945739457494575945769457794578945799458094581945829458394584945859458694587945889458994590945919459294593945949459594596945979459894599946009460194602946039460494605946069460794608946099461094611946129461394614946159461694617946189461994620946219462294623946249462594626946279462894629946309463194632946339463494635946369463794638946399464094641946429464394644946459464694647946489464994650946519465294653946549465594656946579465894659946609466194662946639466494665946669466794668946699467094671946729467394674946759467694677946789467994680946819468294683946849468594686946879468894689946909469194692946939469494695946969469794698946999470094701947029470394704947059470694707947089470994710947119471294713947149471594716947179471894719947209472194722947239472494725947269472794728947299473094731947329473394734947359473694737947389473994740947419474294743947449474594746947479474894749947509475194752947539475494755947569475794758947599476094761947629476394764947659476694767947689476994770947719477294773947749477594776947779477894779947809478194782947839478494785947869478794788947899479094791947929479394794947959479694797947989479994800948019480294803948049480594806948079480894809948109481194812948139481494815948169481794818948199482094821948229482394824948259482694827948289482994830948319483294833948349483594836948379483894839948409484194842948439484494845948469484794848948499485094851948529485394854948559485694857948589485994860948619486294863948649486594866948679486894869948709487194872948739487494875948769487794878948799488094881948829488394884948859488694887948889488994890948919489294893948949489594896948979489894899949009490194902949039490494905949069490794908949099491094911949129491394914949159491694917949189491994920949219492294923949249492594926949279492894929949309493194932949339493494935949369493794938949399494094941949429494394944949459494694947949489494994950949519495294953949549495594956949579495894959949609496194962949639496494965949669496794968949699497094971949729497394974949759497694977949789497994980949819498294983949849498594986949879498894989949909499194992949939499494995949969499794998949999500095001950029500395004950059500695007950089500995010950119501295013950149501595016950179501895019950209502195022950239502495025950269502795028950299503095031950329503395034950359503695037950389503995040950419504295043950449504595046950479504895049950509505195052950539505495055950569505795058950599506095061950629506395064950659506695067950689506995070950719507295073950749507595076950779507895079950809508195082950839508495085950869508795088950899509095091950929509395094950959509695097950989509995100951019510295103951049510595106951079510895109951109511195112951139511495115951169511795118951199512095121951229512395124951259512695127951289512995130951319513295133951349513595136951379513895139951409514195142951439514495145951469514795148951499515095151951529515395154951559515695157951589515995160951619516295163951649516595166951679516895169951709517195172951739517495175951769517795178951799518095181951829518395184951859518695187951889518995190951919519295193951949519595196951979519895199952009520195202952039520495205952069520795208952099521095211952129521395214952159521695217952189521995220952219522295223952249522595226952279522895229952309523195232952339523495235952369523795238952399524095241952429524395244952459524695247952489524995250952519525295253952549525595256952579525895259952609526195262952639526495265952669526795268952699527095271952729527395274952759527695277952789527995280952819528295283952849528595286952879528895289952909529195292952939529495295952969529795298952999530095301953029530395304953059530695307953089530995310953119531295313953149531595316953179531895319953209532195322953239532495325953269532795328953299533095331953329533395334953359533695337953389533995340953419534295343953449534595346953479534895349953509535195352953539535495355953569535795358953599536095361953629536395364953659536695367953689536995370953719537295373953749537595376953779537895379953809538195382953839538495385953869538795388953899539095391953929539395394953959539695397953989539995400954019540295403954049540595406954079540895409954109541195412954139541495415954169541795418954199542095421954229542395424954259542695427954289542995430954319543295433954349543595436954379543895439954409544195442954439544495445954469544795448954499545095451954529545395454954559545695457954589545995460954619546295463954649546595466954679546895469954709547195472954739547495475954769547795478954799548095481954829548395484954859548695487954889548995490954919549295493954949549595496954979549895499955009550195502955039550495505955069550795508955099551095511955129551395514955159551695517955189551995520955219552295523955249552595526955279552895529955309553195532955339553495535955369553795538955399554095541955429554395544955459554695547955489554995550955519555295553955549555595556955579555895559955609556195562955639556495565955669556795568955699557095571955729557395574955759557695577955789557995580955819558295583955849558595586955879558895589955909559195592955939559495595955969559795598955999560095601956029560395604956059560695607956089560995610956119561295613956149561595616956179561895619956209562195622956239562495625956269562795628956299563095631956329563395634956359563695637956389563995640956419564295643956449564595646956479564895649956509565195652956539565495655956569565795658956599566095661956629566395664956659566695667956689566995670956719567295673956749567595676956779567895679956809568195682956839568495685956869568795688956899569095691956929569395694956959569695697956989569995700957019570295703957049570595706957079570895709957109571195712957139571495715957169571795718957199572095721957229572395724957259572695727957289572995730957319573295733957349573595736957379573895739957409574195742957439574495745957469574795748957499575095751957529575395754957559575695757957589575995760957619576295763957649576595766957679576895769957709577195772957739577495775957769577795778957799578095781957829578395784957859578695787957889578995790957919579295793957949579595796957979579895799958009580195802958039580495805958069580795808958099581095811958129581395814958159581695817958189581995820958219582295823958249582595826958279582895829958309583195832958339583495835958369583795838958399584095841958429584395844958459584695847958489584995850958519585295853958549585595856958579585895859958609586195862958639586495865958669586795868958699587095871958729587395874958759587695877958789587995880958819588295883958849588595886958879588895889958909589195892958939589495895958969589795898958999590095901959029590395904959059590695907959089590995910959119591295913959149591595916959179591895919959209592195922959239592495925959269592795928959299593095931959329593395934959359593695937959389593995940959419594295943959449594595946959479594895949959509595195952959539595495955959569595795958959599596095961959629596395964959659596695967959689596995970959719597295973959749597595976959779597895979959809598195982959839598495985959869598795988959899599095991959929599395994959959599695997959989599996000960019600296003960049600596006960079600896009960109601196012960139601496015960169601796018960199602096021960229602396024960259602696027960289602996030960319603296033960349603596036960379603896039960409604196042960439604496045960469604796048960499605096051960529605396054960559605696057960589605996060960619606296063960649606596066960679606896069960709607196072960739607496075960769607796078960799608096081960829608396084960859608696087960889608996090960919609296093960949609596096960979609896099961009610196102961039610496105961069610796108961099611096111961129611396114961159611696117961189611996120961219612296123961249612596126961279612896129961309613196132961339613496135961369613796138961399614096141961429614396144961459614696147961489614996150961519615296153961549615596156961579615896159961609616196162961639616496165961669616796168961699617096171961729617396174961759617696177961789617996180961819618296183961849618596186961879618896189961909619196192961939619496195961969619796198961999620096201962029620396204962059620696207962089620996210962119621296213962149621596216962179621896219962209622196222962239622496225962269622796228962299623096231962329623396234962359623696237962389623996240962419624296243962449624596246962479624896249962509625196252962539625496255962569625796258962599626096261962629626396264962659626696267962689626996270962719627296273962749627596276962779627896279962809628196282962839628496285962869628796288962899629096291962929629396294962959629696297962989629996300963019630296303963049630596306963079630896309963109631196312963139631496315963169631796318963199632096321963229632396324963259632696327963289632996330963319633296333963349633596336963379633896339963409634196342963439634496345963469634796348963499635096351963529635396354963559635696357963589635996360963619636296363963649636596366963679636896369963709637196372963739637496375963769637796378963799638096381963829638396384963859638696387963889638996390963919639296393963949639596396963979639896399964009640196402964039640496405964069640796408964099641096411964129641396414964159641696417964189641996420964219642296423964249642596426964279642896429964309643196432964339643496435964369643796438964399644096441964429644396444964459644696447964489644996450964519645296453964549645596456964579645896459964609646196462964639646496465964669646796468964699647096471964729647396474964759647696477964789647996480964819648296483964849648596486964879648896489964909649196492964939649496495964969649796498964999650096501965029650396504965059650696507965089650996510965119651296513965149651596516965179651896519965209652196522965239652496525965269652796528965299653096531965329653396534965359653696537965389653996540965419654296543965449654596546965479654896549965509655196552965539655496555965569655796558965599656096561965629656396564965659656696567965689656996570965719657296573965749657596576965779657896579965809658196582965839658496585965869658796588965899659096591965929659396594965959659696597965989659996600966019660296603966049660596606966079660896609966109661196612966139661496615966169661796618966199662096621966229662396624966259662696627966289662996630966319663296633966349663596636966379663896639966409664196642966439664496645966469664796648966499665096651966529665396654966559665696657966589665996660966619666296663966649666596666966679666896669966709667196672966739667496675966769667796678966799668096681966829668396684966859668696687966889668996690966919669296693966949669596696966979669896699967009670196702967039670496705967069670796708967099671096711967129671396714967159671696717967189671996720967219672296723967249672596726967279672896729967309673196732967339673496735967369673796738967399674096741967429674396744967459674696747967489674996750967519675296753967549675596756967579675896759967609676196762967639676496765967669676796768967699677096771967729677396774967759677696777967789677996780967819678296783967849678596786967879678896789967909679196792967939679496795967969679796798967999680096801968029680396804968059680696807968089680996810968119681296813968149681596816968179681896819968209682196822968239682496825968269682796828968299683096831968329683396834968359683696837968389683996840968419684296843968449684596846968479684896849968509685196852968539685496855968569685796858968599686096861968629686396864968659686696867968689686996870968719687296873968749687596876968779687896879968809688196882968839688496885968869688796888968899689096891968929689396894968959689696897968989689996900969019690296903969049690596906969079690896909969109691196912969139691496915969169691796918969199692096921969229692396924969259692696927969289692996930969319693296933969349693596936969379693896939969409694196942969439694496945969469694796948969499695096951969529695396954969559695696957969589695996960969619696296963969649696596966969679696896969969709697196972969739697496975969769697796978969799698096981969829698396984969859698696987969889698996990969919699296993969949699596996969979699896999970009700197002970039700497005970069700797008970099701097011970129701397014970159701697017970189701997020970219702297023970249702597026970279702897029970309703197032970339703497035970369703797038970399704097041970429704397044970459704697047970489704997050970519705297053970549705597056970579705897059970609706197062970639706497065970669706797068970699707097071970729707397074970759707697077970789707997080970819708297083970849708597086970879708897089970909709197092970939709497095970969709797098970999710097101971029710397104971059710697107971089710997110971119711297113971149711597116971179711897119971209712197122971239712497125971269712797128971299713097131971329713397134971359713697137971389713997140971419714297143971449714597146971479714897149971509715197152971539715497155971569715797158971599716097161971629716397164971659716697167971689716997170971719717297173971749717597176971779717897179971809718197182971839718497185971869718797188971899719097191971929719397194971959719697197971989719997200972019720297203972049720597206972079720897209972109721197212972139721497215972169721797218972199722097221972229722397224972259722697227972289722997230972319723297233972349723597236972379723897239972409724197242972439724497245972469724797248972499725097251972529725397254972559725697257972589725997260972619726297263972649726597266972679726897269972709727197272972739727497275972769727797278972799728097281972829728397284972859728697287972889728997290972919729297293972949729597296972979729897299973009730197302973039730497305973069730797308973099731097311973129731397314973159731697317973189731997320973219732297323973249732597326973279732897329973309733197332973339733497335973369733797338973399734097341973429734397344973459734697347973489734997350973519735297353973549735597356973579735897359973609736197362973639736497365973669736797368973699737097371973729737397374973759737697377973789737997380973819738297383973849738597386973879738897389973909739197392973939739497395973969739797398973999740097401974029740397404974059740697407974089740997410974119741297413974149741597416974179741897419974209742197422974239742497425974269742797428974299743097431974329743397434974359743697437974389743997440974419744297443974449744597446974479744897449974509745197452974539745497455974569745797458974599746097461974629746397464974659746697467974689746997470974719747297473974749747597476974779747897479974809748197482974839748497485974869748797488974899749097491974929749397494974959749697497974989749997500975019750297503975049750597506975079750897509975109751197512975139751497515975169751797518975199752097521975229752397524975259752697527975289752997530975319753297533975349753597536975379753897539975409754197542975439754497545975469754797548975499755097551975529755397554975559755697557975589755997560975619756297563975649756597566975679756897569975709757197572975739757497575975769757797578975799758097581975829758397584975859758697587975889758997590975919759297593975949759597596975979759897599976009760197602976039760497605976069760797608976099761097611976129761397614976159761697617976189761997620976219762297623976249762597626976279762897629976309763197632976339763497635976369763797638976399764097641976429764397644976459764697647976489764997650976519765297653976549765597656976579765897659976609766197662976639766497665976669766797668976699767097671976729767397674976759767697677976789767997680976819768297683976849768597686976879768897689976909769197692976939769497695976969769797698976999770097701977029770397704977059770697707977089770997710977119771297713977149771597716977179771897719977209772197722977239772497725977269772797728977299773097731977329773397734977359773697737977389773997740977419774297743977449774597746977479774897749977509775197752977539775497755977569775797758977599776097761977629776397764977659776697767977689776997770977719777297773977749777597776977779777897779977809778197782977839778497785977869778797788977899779097791977929779397794977959779697797977989779997800978019780297803978049780597806978079780897809978109781197812978139781497815978169781797818978199782097821978229782397824978259782697827978289782997830978319783297833978349783597836978379783897839978409784197842978439784497845978469784797848978499785097851978529785397854978559785697857978589785997860978619786297863978649786597866978679786897869978709787197872978739787497875978769787797878978799788097881978829788397884978859788697887978889788997890978919789297893978949789597896978979789897899979009790197902979039790497905979069790797908979099791097911979129791397914979159791697917979189791997920979219792297923979249792597926979279792897929979309793197932979339793497935979369793797938979399794097941979429794397944979459794697947979489794997950979519795297953979549795597956979579795897959979609796197962979639796497965979669796797968979699797097971979729797397974979759797697977979789797997980979819798297983979849798597986979879798897989979909799197992979939799497995979969799797998979999800098001980029800398004980059800698007980089800998010980119801298013980149801598016980179801898019980209802198022980239802498025980269802798028980299803098031980329803398034980359803698037980389803998040980419804298043980449804598046980479804898049980509805198052980539805498055980569805798058980599806098061980629806398064980659806698067980689806998070980719807298073980749807598076980779807898079980809808198082980839808498085980869808798088980899809098091980929809398094980959809698097980989809998100981019810298103981049810598106981079810898109981109811198112981139811498115981169811798118981199812098121981229812398124981259812698127981289812998130981319813298133981349813598136981379813898139981409814198142981439814498145981469814798148981499815098151981529815398154981559815698157981589815998160981619816298163981649816598166981679816898169981709817198172981739817498175981769817798178981799818098181981829818398184981859818698187981889818998190981919819298193981949819598196981979819898199982009820198202982039820498205982069820798208982099821098211982129821398214982159821698217982189821998220982219822298223982249822598226982279822898229982309823198232982339823498235982369823798238982399824098241982429824398244982459824698247982489824998250982519825298253982549825598256982579825898259982609826198262982639826498265982669826798268982699827098271982729827398274982759827698277982789827998280982819828298283982849828598286982879828898289982909829198292982939829498295982969829798298982999830098301983029830398304983059830698307983089830998310983119831298313983149831598316983179831898319983209832198322983239832498325983269832798328983299833098331983329833398334983359833698337983389833998340983419834298343983449834598346983479834898349983509835198352983539835498355983569835798358983599836098361983629836398364983659836698367983689836998370983719837298373983749837598376983779837898379983809838198382983839838498385983869838798388983899839098391983929839398394983959839698397983989839998400984019840298403984049840598406984079840898409984109841198412984139841498415984169841798418984199842098421984229842398424984259842698427984289842998430984319843298433984349843598436984379843898439984409844198442984439844498445984469844798448984499845098451984529845398454984559845698457984589845998460984619846298463984649846598466984679846898469984709847198472984739847498475984769847798478984799848098481984829848398484984859848698487984889848998490984919849298493984949849598496984979849898499985009850198502985039850498505985069850798508985099851098511985129851398514985159851698517985189851998520985219852298523985249852598526985279852898529985309853198532985339853498535985369853798538985399854098541985429854398544985459854698547985489854998550985519855298553985549855598556985579855898559985609856198562985639856498565985669856798568985699857098571985729857398574985759857698577985789857998580985819858298583985849858598586985879858898589985909859198592985939859498595985969859798598985999860098601986029860398604986059860698607986089860998610986119861298613986149861598616986179861898619986209862198622986239862498625986269862798628986299863098631986329863398634986359863698637986389863998640986419864298643986449864598646986479864898649986509865198652986539865498655986569865798658986599866098661986629866398664986659866698667986689866998670986719867298673986749867598676986779867898679986809868198682986839868498685986869868798688986899869098691986929869398694986959869698697986989869998700987019870298703987049870598706987079870898709987109871198712987139871498715987169871798718987199872098721987229872398724987259872698727987289872998730987319873298733987349873598736987379873898739987409874198742987439874498745987469874798748987499875098751987529875398754987559875698757987589875998760987619876298763987649876598766987679876898769987709877198772987739877498775987769877798778987799878098781987829878398784987859878698787987889878998790987919879298793987949879598796987979879898799988009880198802988039880498805988069880798808988099881098811988129881398814988159881698817988189881998820988219882298823988249882598826988279882898829988309883198832988339883498835988369883798838988399884098841988429884398844988459884698847988489884998850988519885298853988549885598856988579885898859988609886198862988639886498865988669886798868988699887098871988729887398874988759887698877988789887998880988819888298883988849888598886988879888898889988909889198892988939889498895988969889798898988999890098901989029890398904989059890698907989089890998910989119891298913989149891598916989179891898919989209892198922989239892498925989269892798928989299893098931989329893398934989359893698937989389893998940989419894298943989449894598946989479894898949989509895198952989539895498955989569895798958989599896098961989629896398964989659896698967989689896998970989719897298973989749897598976989779897898979989809898198982989839898498985989869898798988989899899098991989929899398994989959899698997989989899999000990019900299003990049900599006990079900899009990109901199012990139901499015990169901799018990199902099021990229902399024990259902699027990289902999030990319903299033990349903599036990379903899039990409904199042990439904499045990469904799048990499905099051990529905399054990559905699057990589905999060990619906299063990649906599066990679906899069990709907199072990739907499075990769907799078990799908099081990829908399084990859908699087990889908999090990919909299093990949909599096990979909899099991009910199102991039910499105991069910799108991099911099111991129911399114991159911699117991189911999120991219912299123991249912599126991279912899129991309913199132991339913499135991369913799138991399914099141991429914399144991459914699147991489914999150991519915299153991549915599156991579915899159991609916199162991639916499165991669916799168991699917099171991729917399174991759917699177991789917999180991819918299183991849918599186991879918899189991909919199192991939919499195991969919799198991999920099201992029920399204992059920699207992089920999210992119921299213992149921599216992179921899219992209922199222992239922499225992269922799228992299923099231992329923399234992359923699237992389923999240992419924299243992449924599246992479924899249992509925199252992539925499255992569925799258992599926099261992629926399264992659926699267992689926999270992719927299273992749927599276992779927899279992809928199282992839928499285992869928799288992899929099291992929929399294992959929699297992989929999300993019930299303993049930599306993079930899309993109931199312993139931499315993169931799318993199932099321993229932399324993259932699327993289932999330993319933299333993349933599336993379933899339993409934199342993439934499345993469934799348993499935099351993529935399354993559935699357993589935999360993619936299363993649936599366993679936899369993709937199372993739937499375993769937799378993799938099381993829938399384993859938699387993889938999390993919939299393993949939599396993979939899399994009940199402994039940499405994069940799408994099941099411994129941399414994159941699417994189941999420994219942299423994249942599426994279942899429994309943199432994339943499435994369943799438994399944099441994429944399444994459944699447994489944999450994519945299453994549945599456994579945899459994609946199462994639946499465994669946799468994699947099471994729947399474994759947699477994789947999480994819948299483994849948599486994879948899489994909949199492994939949499495994969949799498994999950099501995029950399504995059950699507995089950999510995119951299513995149951599516995179951899519995209952199522995239952499525995269952799528995299953099531995329953399534995359953699537995389953999540995419954299543995449954599546995479954899549995509955199552995539955499555995569955799558995599956099561995629956399564995659956699567995689956999570995719957299573995749957599576995779957899579995809958199582995839958499585995869958799588995899959099591995929959399594995959959699597995989959999600996019960299603996049960599606996079960899609996109961199612996139961499615996169961799618996199962099621996229962399624996259962699627996289962999630996319963299633996349963599636996379963899639996409964199642996439964499645996469964799648996499965099651996529965399654996559965699657996589965999660996619966299663996649966599666996679966899669996709967199672996739967499675996769967799678996799968099681996829968399684996859968699687996889968999690996919969299693996949969599696996979969899699997009970199702997039970499705997069970799708997099971099711997129971399714997159971699717997189971999720997219972299723997249972599726997279972899729997309973199732997339973499735997369973799738997399974099741997429974399744997459974699747997489974999750997519975299753997549975599756997579975899759997609976199762997639976499765997669976799768997699977099771997729977399774997759977699777997789977999780997819978299783997849978599786997879978899789997909979199792997939979499795997969979799798997999980099801998029980399804998059980699807998089980999810998119981299813998149981599816998179981899819998209982199822998239982499825998269982799828998299983099831998329983399834998359983699837998389983999840998419984299843998449984599846998479984899849998509985199852998539985499855998569985799858998599986099861998629986399864998659986699867998689986999870998719987299873998749987599876998779987899879998809988199882998839988499885998869988799888998899989099891998929989399894998959989699897998989989999900999019990299903999049990599906999079990899909999109991199912999139991499915999169991799918999199992099921999229992399924999259992699927999289992999930999319993299933999349993599936999379993899939999409994199942999439994499945999469994799948999499995099951999529995399954999559995699957999589995999960999619996299963999649996599966999679996899969999709997199972999739997499975999769997799978999799998099981999829998399984999859998699987999889998999990999919999299993999949999599996999979999899999100000100001100002100003100004100005100006100007100008100009100010100011100012100013100014100015100016100017100018100019100020100021100022100023100024100025100026100027100028100029100030100031100032100033100034100035100036100037100038100039100040100041100042100043100044100045100046100047100048100049100050100051100052100053100054100055100056100057100058100059100060100061100062100063100064100065100066100067100068100069100070100071100072100073100074100075100076100077100078100079100080100081100082100083100084100085100086100087100088100089100090100091100092100093100094100095100096100097100098100099100100100101100102100103100104100105100106100107100108100109100110100111100112100113100114100115100116100117100118100119100120100121100122100123100124100125100126100127100128100129100130100131100132100133100134100135100136100137100138100139100140100141100142100143100144100145100146100147100148100149100150100151100152100153100154100155100156100157100158100159100160100161100162100163100164100165100166100167100168100169100170100171100172100173100174100175100176100177100178100179100180100181100182100183100184100185100186100187100188100189100190100191100192100193100194100195100196100197100198100199100200100201100202100203100204100205100206100207100208100209100210100211100212100213100214100215100216100217100218100219100220100221100222100223100224100225100226100227100228100229100230100231100232100233100234100235100236100237100238100239100240100241100242100243100244100245100246100247100248100249100250100251100252100253100254100255100256100257100258100259100260100261100262100263100264100265100266100267100268100269100270100271100272100273100274100275100276100277100278100279100280100281100282100283100284100285100286100287100288100289100290100291100292100293100294100295100296100297100298100299100300100301100302100303100304100305100306100307100308100309100310100311100312100313100314100315100316100317100318100319100320100321100322100323100324100325100326100327100328100329100330100331100332100333100334100335100336100337100338100339100340100341100342100343100344100345100346100347100348100349100350100351100352100353100354100355100356100357100358100359100360100361100362100363100364100365100366100367100368100369100370100371100372100373100374100375100376100377100378100379100380100381100382100383100384100385100386100387100388100389100390100391100392100393100394100395100396100397100398100399100400100401100402100403100404100405100406100407100408100409100410100411100412100413100414100415100416100417100418100419100420100421100422100423100424100425100426100427100428100429100430100431100432100433100434100435100436100437100438100439100440100441100442100443100444100445100446100447100448100449100450100451100452100453100454100455100456100457100458100459100460100461100462100463100464100465100466100467100468100469100470100471100472100473100474100475100476100477100478100479100480100481100482100483100484100485100486100487100488100489100490100491100492100493100494100495100496100497100498100499100500100501100502100503100504100505100506100507100508100509100510100511100512100513100514100515100516100517100518100519100520100521100522100523100524100525100526100527100528100529100530100531100532100533100534100535100536100537100538100539100540100541100542100543100544100545100546100547100548100549100550100551100552100553100554100555100556100557100558100559100560100561100562100563100564100565100566100567100568100569100570100571100572100573100574100575100576100577100578100579100580100581100582100583100584100585100586100587100588100589100590100591100592100593100594100595100596100597100598100599100600100601100602100603100604100605100606100607100608100609100610100611100612100613100614100615100616100617100618100619100620100621100622100623100624100625100626100627100628100629100630100631100632100633100634100635100636100637100638100639100640100641100642100643100644100645100646100647100648100649100650100651100652100653100654100655100656100657100658100659100660100661100662100663100664100665100666100667100668100669100670100671100672100673100674100675100676100677100678100679100680100681100682100683100684100685100686100687100688100689100690100691100692100693100694100695100696100697100698100699100700100701100702100703100704100705100706100707100708100709100710100711100712100713100714100715100716100717100718100719100720100721100722100723100724100725100726100727100728100729100730100731100732100733100734100735100736100737100738100739100740100741100742100743100744100745100746100747100748100749100750100751100752100753100754100755100756100757100758100759100760100761100762100763100764100765100766100767100768100769100770100771100772100773100774100775100776100777100778100779100780100781100782100783100784100785100786100787100788100789100790100791100792100793100794100795100796100797100798100799100800100801100802100803100804100805100806100807100808100809100810100811100812100813100814100815100816100817100818100819100820100821100822100823100824100825100826100827100828100829100830100831100832100833100834100835100836100837100838100839100840100841100842100843100844100845100846100847100848100849100850100851100852100853100854100855100856100857100858100859100860100861100862100863100864100865100866100867100868100869100870100871100872100873100874100875100876100877100878100879100880100881100882100883100884100885100886100887100888100889100890100891100892100893100894100895100896100897100898100899100900100901100902100903100904100905100906100907100908100909100910100911100912100913100914100915100916100917100918100919100920100921100922100923100924100925100926100927100928100929100930100931100932100933100934100935100936100937100938100939100940100941100942100943100944100945100946100947100948100949100950100951100952100953100954100955100956100957100958100959100960100961100962100963100964100965100966100967100968100969100970100971100972100973100974100975100976100977100978100979100980100981100982100983100984100985100986100987100988100989100990100991100992100993100994100995100996100997100998100999101000101001101002101003101004101005101006101007101008101009101010101011101012101013101014101015101016101017101018101019101020101021101022101023101024101025101026101027101028101029101030101031101032101033101034101035101036101037101038101039101040101041101042101043101044101045101046101047101048101049101050101051101052101053101054101055101056101057101058101059101060101061101062101063101064101065101066101067101068101069101070101071101072101073101074101075101076101077101078101079101080101081101082101083101084101085101086101087101088101089101090101091101092101093101094101095101096101097101098101099101100101101101102101103101104101105101106101107101108101109101110101111101112101113101114101115101116101117101118101119101120101121101122101123101124101125101126101127101128101129101130101131101132101133101134101135101136101137101138101139101140101141101142101143101144101145101146101147101148101149101150101151101152101153101154101155101156101157101158101159101160101161101162101163101164101165101166101167101168101169101170101171101172101173101174101175101176101177101178101179101180101181101182101183101184101185101186101187101188101189101190101191101192101193101194101195101196101197101198101199101200101201101202101203101204101205101206101207101208101209101210101211101212101213101214101215101216101217101218101219101220101221101222101223101224101225101226101227101228101229101230101231101232101233101234101235101236101237101238101239101240101241101242101243101244101245101246101247101248101249101250101251101252101253101254101255101256101257101258101259101260101261101262101263101264101265101266101267101268101269101270101271101272101273101274101275101276101277101278101279101280101281101282101283101284101285101286101287101288101289101290101291101292101293101294101295101296101297101298101299101300101301101302101303101304101305101306101307101308101309101310101311101312101313101314101315101316101317101318101319101320101321101322101323101324101325101326101327101328101329101330101331101332101333101334101335101336101337101338101339101340101341101342101343101344101345101346101347101348101349101350101351101352101353101354101355101356101357101358101359101360101361101362101363101364101365101366101367101368101369101370101371101372101373101374101375101376101377101378101379101380101381101382101383101384101385101386101387101388101389101390101391101392101393101394101395101396101397101398101399101400101401101402101403101404101405101406101407101408101409101410101411101412101413101414101415101416101417101418101419101420101421101422101423101424101425101426101427101428101429101430101431101432101433101434101435101436101437101438101439101440101441101442101443101444101445101446101447101448101449101450101451101452101453101454101455101456101457101458101459101460101461101462101463101464101465101466101467101468101469101470101471101472101473101474101475101476101477101478101479101480101481101482101483101484101485101486101487101488101489101490101491101492101493101494101495101496101497101498101499101500101501101502101503101504101505101506101507101508101509101510101511101512101513101514101515101516101517101518101519101520101521101522101523101524101525101526101527101528101529101530101531101532101533101534101535101536101537101538101539101540101541101542101543101544101545101546101547101548101549101550101551101552101553101554101555101556101557101558101559101560101561101562101563101564101565101566101567101568101569101570101571101572101573101574101575101576101577101578101579101580101581101582101583101584101585101586101587101588101589101590101591101592101593101594101595101596101597101598101599101600101601101602101603101604101605101606101607101608101609101610101611101612101613101614101615101616101617101618101619101620101621101622101623101624101625101626101627101628101629101630101631101632101633101634101635101636101637101638101639101640101641101642101643101644101645101646101647101648101649101650101651101652101653101654101655101656101657101658101659101660101661101662101663101664101665101666101667101668101669101670101671101672101673101674101675101676101677101678101679101680101681101682101683101684101685101686101687101688101689101690101691101692101693101694101695101696101697101698101699101700101701101702101703101704101705101706101707101708101709101710101711101712101713101714101715101716101717101718101719101720101721101722101723101724101725101726101727101728101729101730101731101732101733101734101735101736101737101738101739101740101741101742101743101744101745101746101747101748101749101750101751101752101753101754101755101756101757101758101759101760101761101762101763101764101765101766101767101768101769101770101771101772101773101774101775101776101777101778101779101780101781101782101783101784101785101786101787101788101789101790101791101792101793101794101795101796101797101798101799101800101801101802101803101804101805101806101807101808101809101810101811101812101813101814101815101816101817101818101819101820101821101822101823101824101825101826101827101828101829101830101831101832101833101834101835101836101837101838101839101840101841101842101843101844101845101846101847101848101849101850101851101852101853101854101855101856101857101858101859101860101861101862101863101864101865101866101867101868101869101870101871101872101873101874101875101876101877101878101879101880101881101882101883101884101885101886101887101888101889101890101891101892101893101894101895101896101897101898101899101900101901101902101903101904101905101906101907101908101909101910101911101912101913101914101915101916101917101918101919101920101921101922101923101924101925101926101927101928101929101930101931101932101933101934101935101936101937101938101939101940101941101942101943101944101945101946101947101948101949101950101951101952101953101954101955101956101957101958101959101960101961101962101963101964101965101966101967101968101969101970101971101972101973101974101975101976101977101978101979101980101981101982101983101984101985101986101987101988101989101990101991101992101993101994101995101996101997101998101999102000102001102002102003102004102005102006102007102008102009102010102011102012102013102014102015102016102017102018102019102020102021102022102023102024102025102026102027102028102029102030102031102032102033102034102035102036102037102038102039102040102041102042102043102044102045102046102047102048102049102050102051102052102053102054102055102056102057102058102059102060102061102062102063102064102065102066102067102068102069102070102071102072102073102074102075102076102077102078102079102080102081102082102083102084102085102086102087102088102089102090102091102092102093102094102095102096102097102098102099102100102101102102102103102104102105102106102107102108102109102110102111102112102113102114102115102116102117102118102119102120102121102122102123102124102125102126102127102128102129102130102131102132102133102134102135102136102137102138102139102140102141102142102143102144102145102146102147102148102149102150102151102152102153102154102155102156102157102158102159102160102161102162102163102164102165102166102167102168102169102170102171102172102173102174102175102176102177102178102179102180102181102182102183102184102185102186102187102188102189102190102191102192102193102194102195102196102197102198102199102200102201102202102203102204102205102206102207102208102209102210102211102212102213102214102215102216102217102218102219102220102221102222102223102224102225102226102227102228102229102230102231102232102233102234102235102236102237102238102239102240102241102242102243102244102245102246102247102248102249102250102251102252102253102254102255102256102257102258102259102260102261102262102263102264102265102266102267102268102269102270102271102272102273102274102275102276102277102278102279102280102281102282102283102284102285102286102287102288102289102290102291102292102293102294102295102296102297102298102299102300102301102302102303102304102305102306102307102308102309102310102311102312102313102314102315102316102317102318102319102320102321102322102323102324102325102326102327102328102329102330102331102332102333102334102335102336102337102338102339102340102341102342102343102344102345102346102347102348102349102350102351102352102353102354102355102356102357102358102359102360102361102362102363102364102365102366102367102368102369102370102371102372102373102374102375102376102377102378102379102380102381102382102383102384102385102386102387102388102389102390102391102392102393102394102395102396102397102398102399102400102401102402102403102404102405102406102407102408102409102410102411102412102413102414102415102416102417102418102419102420102421102422102423102424102425102426102427102428102429102430102431102432102433102434102435102436102437102438102439102440102441102442102443102444102445102446102447102448102449102450102451102452102453102454102455102456102457102458102459102460102461102462102463102464102465102466102467102468102469102470102471102472102473102474102475102476102477102478102479102480102481102482102483102484102485102486102487102488102489102490102491102492102493102494102495102496102497102498102499102500102501102502102503102504102505102506102507102508102509102510102511102512102513102514102515102516102517102518102519102520102521102522102523102524102525102526102527102528102529102530102531102532102533102534102535102536102537102538102539102540102541102542102543102544102545102546102547102548102549102550102551102552102553102554102555102556102557102558102559102560102561102562102563102564102565102566102567102568102569102570102571102572102573102574102575102576102577102578102579102580102581102582102583102584102585102586102587102588102589102590102591102592102593102594102595102596102597102598102599102600102601102602102603102604102605102606102607102608102609102610102611102612102613102614102615102616102617102618102619102620102621102622102623102624102625102626102627102628102629102630102631102632102633102634102635102636102637102638102639102640102641102642102643102644102645102646102647102648102649102650102651102652102653102654102655102656102657102658102659102660102661102662102663102664102665102666102667102668102669102670102671102672102673102674102675102676102677102678102679102680102681102682102683102684102685102686102687102688102689102690102691102692102693102694102695102696102697102698102699102700102701102702102703102704102705102706102707102708102709102710102711102712102713102714102715102716102717102718102719102720102721102722102723102724102725102726102727102728102729102730102731102732102733102734102735102736102737102738102739102740102741102742102743102744102745102746102747102748102749102750102751102752102753102754102755102756102757102758102759102760102761102762102763102764102765102766102767102768102769102770102771102772102773102774102775102776102777102778102779102780102781102782102783102784102785102786102787102788102789102790102791102792102793102794102795102796102797102798102799102800102801102802102803102804102805102806102807102808102809102810102811102812102813102814102815102816102817102818102819102820102821102822102823102824102825102826102827102828102829102830102831102832102833102834102835102836102837102838102839102840102841102842102843102844102845102846102847102848102849102850102851102852102853102854102855102856102857102858102859102860102861102862102863102864102865102866102867102868102869102870102871102872102873102874102875102876102877102878102879102880102881102882102883102884102885102886102887102888102889102890102891102892102893102894102895102896102897102898102899102900102901102902102903102904102905102906102907102908102909102910102911102912102913102914102915102916102917102918102919102920102921102922102923102924102925102926102927102928102929102930102931102932102933102934102935102936102937102938102939102940102941102942102943102944102945102946102947102948102949102950102951102952102953102954102955102956102957102958102959102960102961102962102963102964102965102966102967102968102969102970102971102972102973102974102975102976102977102978102979102980102981102982102983102984102985102986102987102988102989102990102991102992102993102994102995102996102997102998102999103000103001103002103003103004103005103006103007103008103009103010103011103012103013103014103015103016103017103018103019103020103021103022103023103024103025103026103027103028103029103030103031103032103033103034103035103036103037103038103039103040103041103042103043103044103045103046103047103048103049103050103051103052103053103054103055103056103057103058103059103060103061103062103063103064103065103066103067103068103069103070103071103072103073103074103075103076103077103078103079103080103081103082103083103084103085103086103087103088103089103090103091103092103093103094103095103096103097103098103099103100103101103102103103103104103105103106103107103108103109103110103111103112103113103114103115103116103117103118103119103120103121103122103123103124103125103126103127103128103129103130103131103132103133103134103135103136103137103138103139103140103141103142103143103144103145103146103147103148103149103150103151103152103153103154103155103156103157103158103159103160103161103162103163103164103165103166103167103168103169103170103171103172103173103174103175103176103177103178103179103180103181103182103183103184103185103186103187103188103189103190103191103192103193103194103195103196103197103198103199103200103201103202103203103204103205103206103207103208103209103210103211103212103213103214103215103216103217103218103219103220103221103222103223103224103225103226103227103228103229103230103231103232103233103234103235103236103237103238103239103240103241103242103243103244103245103246103247103248103249103250103251103252103253103254103255103256103257103258103259103260103261103262103263103264103265103266103267103268103269103270103271103272103273103274103275103276103277103278103279103280103281103282103283103284103285103286103287103288103289103290103291103292103293103294103295103296103297103298103299103300103301103302103303103304103305103306103307103308103309103310103311103312103313103314103315103316103317103318103319103320103321103322103323103324103325103326103327103328103329103330103331103332103333103334103335103336103337103338103339103340103341103342103343103344103345103346103347103348103349103350103351103352103353103354103355103356103357103358103359103360103361103362103363103364103365103366103367103368103369103370103371103372103373103374103375103376103377103378103379103380103381103382103383103384103385103386103387103388103389103390103391103392103393103394103395103396103397103398103399103400103401103402103403103404103405103406103407103408103409103410103411103412103413103414103415103416103417103418103419103420103421103422103423103424103425103426103427103428103429103430103431103432103433103434103435103436103437103438103439103440103441103442103443103444103445103446103447103448103449103450103451103452103453103454103455103456103457103458103459103460103461103462103463103464103465103466103467103468103469103470103471103472103473103474103475103476103477103478103479103480103481103482103483103484103485103486103487103488103489103490103491103492103493103494103495103496103497103498103499103500103501103502103503103504103505103506103507103508103509103510103511103512103513103514103515103516103517103518103519103520103521103522103523103524103525103526103527103528103529103530103531103532103533103534103535103536103537103538103539103540103541103542103543103544103545103546103547103548103549103550103551103552103553103554103555103556103557103558103559103560103561103562103563103564103565103566103567103568103569103570103571103572103573103574103575103576103577103578103579103580103581103582103583103584103585103586103587103588103589103590103591103592103593103594103595103596103597103598103599103600103601103602103603103604103605103606103607103608103609103610103611103612103613103614103615103616103617103618103619103620103621103622103623103624103625103626103627103628103629103630103631103632103633103634103635103636103637103638103639103640103641103642103643103644103645103646103647103648103649103650103651103652103653103654103655103656103657103658103659103660103661103662103663103664103665103666103667103668103669103670103671103672103673103674103675103676103677103678103679103680103681103682103683103684103685103686103687103688103689103690103691103692103693103694103695103696103697103698103699103700103701103702103703103704103705103706103707103708103709103710103711103712103713103714103715103716103717103718103719103720103721103722103723103724103725103726103727103728103729103730103731103732103733103734103735103736103737103738103739103740103741103742103743103744103745103746103747103748103749103750103751103752103753103754103755103756103757103758103759103760103761103762103763103764103765103766103767103768103769103770103771103772103773103774103775103776103777103778103779103780103781103782103783103784103785103786103787103788103789103790103791103792103793103794103795103796103797103798103799103800103801103802103803103804103805103806103807103808103809103810103811103812103813103814103815103816103817103818103819103820103821103822103823103824103825103826103827103828103829103830103831103832103833103834103835103836103837103838103839103840103841103842103843103844103845103846103847103848103849103850103851103852103853103854103855103856103857103858103859103860103861103862103863103864103865103866103867103868103869103870103871103872103873103874103875103876103877103878103879103880103881103882103883103884103885103886103887103888103889103890103891103892103893103894103895103896103897103898103899103900103901103902103903103904103905103906103907103908103909103910103911103912103913103914103915103916103917103918103919103920103921103922103923103924103925103926103927103928103929103930103931103932103933103934103935103936103937103938103939103940103941103942103943103944103945103946103947103948103949103950103951103952103953103954103955103956103957103958103959103960103961103962103963103964103965103966103967103968103969103970103971103972103973103974103975103976103977103978103979103980103981103982103983103984103985103986103987103988103989103990103991103992103993103994103995103996103997103998103999104000104001104002104003104004104005104006104007104008104009104010104011104012104013104014104015104016104017104018104019104020104021104022104023104024104025104026104027104028104029104030104031104032104033104034104035104036104037104038104039104040104041104042104043104044104045104046104047104048104049104050104051104052104053104054104055104056104057104058104059104060104061104062104063104064104065104066104067104068104069104070104071104072104073104074104075104076104077104078104079104080104081104082104083104084104085104086104087104088104089104090104091104092104093104094104095104096104097104098104099104100104101104102104103104104104105104106104107104108104109104110104111104112104113104114104115104116104117104118104119104120104121104122104123104124104125104126104127104128104129104130104131104132104133104134104135104136104137104138104139104140104141104142104143104144104145104146104147104148104149104150104151104152104153104154104155104156104157104158104159104160104161104162104163104164104165104166104167104168104169104170104171104172104173104174104175104176104177104178104179104180104181104182104183104184104185104186104187104188104189104190104191104192104193104194104195104196104197104198104199104200104201104202104203104204104205104206104207104208104209104210104211104212104213104214104215104216104217104218104219104220104221104222104223104224104225104226104227104228104229104230104231104232104233104234104235104236104237104238104239104240104241104242104243104244104245104246104247104248104249104250104251104252104253104254104255104256104257104258104259104260104261104262104263104264104265104266104267104268104269104270104271104272104273104274104275104276104277104278104279104280104281104282104283104284104285104286104287104288104289104290104291104292104293104294104295104296104297104298104299104300104301104302104303104304104305104306104307104308104309104310104311104312104313104314104315104316104317104318104319104320104321104322104323104324104325104326104327104328104329104330104331104332104333104334104335104336104337104338104339104340104341104342104343104344104345104346104347104348104349104350104351104352104353104354104355104356104357104358104359104360104361104362104363104364104365104366104367104368104369104370104371104372104373104374104375104376104377104378104379104380104381104382104383104384104385104386104387104388104389104390104391104392104393104394104395104396104397104398104399104400104401104402104403104404104405104406104407104408104409104410104411104412104413104414104415104416104417104418104419104420104421104422104423104424104425104426104427104428104429104430104431104432104433104434104435104436104437104438104439104440104441104442104443104444104445104446104447104448104449104450104451104452104453104454104455104456104457104458104459104460104461104462104463104464104465104466104467104468104469104470104471104472104473104474104475104476104477104478104479104480104481104482104483104484104485104486104487104488104489104490104491104492104493104494104495104496104497104498104499104500104501104502104503104504104505104506104507104508104509104510104511104512104513104514104515104516104517104518104519104520104521104522104523104524104525104526104527104528104529104530104531104532104533104534104535104536104537104538104539104540104541104542104543104544104545104546104547104548104549104550104551104552104553104554104555104556104557104558104559104560104561104562104563104564104565104566104567104568104569104570104571104572104573104574104575104576104577104578104579104580104581104582104583104584104585104586104587104588104589104590104591104592104593104594104595104596104597104598104599104600104601104602104603104604104605104606104607104608104609104610104611104612104613104614104615104616104617104618104619104620104621104622104623104624104625104626104627104628104629104630104631104632104633104634104635104636104637104638104639104640104641104642104643104644104645104646104647104648104649104650104651104652104653104654104655104656104657104658104659104660104661104662104663104664104665104666104667104668104669104670104671104672104673104674104675104676104677104678104679104680104681104682104683104684104685104686104687104688104689104690104691104692104693104694104695104696104697104698104699104700104701104702104703104704104705104706104707104708104709104710104711104712104713104714104715104716104717104718104719104720104721104722104723104724104725104726104727104728104729104730104731104732104733104734104735104736104737104738104739104740104741104742104743104744104745104746104747104748104749104750104751104752104753104754104755104756104757104758104759104760104761104762104763104764104765104766104767104768104769104770104771104772104773104774104775104776104777104778104779104780104781104782104783104784104785104786104787104788104789104790104791104792104793104794104795104796104797104798104799104800104801104802104803104804104805104806104807104808104809104810104811104812104813104814104815104816104817104818104819104820104821104822104823104824104825104826104827104828104829104830104831104832104833104834104835104836104837104838104839104840104841104842104843104844104845104846104847104848104849104850104851104852104853104854104855104856104857104858104859104860104861104862104863104864104865104866104867104868104869104870104871104872104873104874104875104876104877104878104879104880104881104882104883104884104885104886104887104888104889104890104891104892104893104894104895104896104897104898104899104900104901104902104903104904104905104906104907104908104909104910104911104912104913104914104915104916104917104918104919104920104921104922104923104924104925104926104927104928104929104930104931104932104933104934104935104936104937104938104939104940104941104942104943104944104945104946104947104948104949104950104951104952104953104954104955104956104957104958104959104960104961104962104963104964104965104966104967104968104969104970104971104972104973104974104975104976104977104978104979104980104981104982104983104984104985104986104987104988104989104990104991104992104993104994104995104996104997104998104999105000105001105002105003105004105005105006105007105008105009105010105011105012105013105014105015105016105017105018105019105020105021105022105023105024105025105026105027105028105029105030105031105032105033105034105035105036105037105038105039105040105041105042105043105044105045105046105047105048105049105050105051105052105053105054105055105056105057105058105059105060105061105062105063105064105065105066105067105068105069105070105071105072105073105074105075105076105077105078105079105080105081105082105083105084105085105086105087105088105089105090105091105092105093105094105095105096105097105098105099105100105101105102105103105104105105105106105107105108105109105110105111105112105113105114105115105116105117105118105119105120105121105122105123105124105125105126105127105128105129105130105131105132105133105134105135105136105137105138105139105140105141105142105143105144105145105146105147105148105149105150105151105152105153105154105155105156105157105158105159105160105161105162105163105164105165105166105167105168105169105170105171105172105173105174105175105176105177105178105179105180105181105182105183105184105185105186105187105188105189105190105191105192105193105194105195105196105197105198105199105200105201105202105203105204105205105206105207105208105209105210105211105212105213105214105215105216105217105218105219105220105221105222105223105224105225105226105227105228105229105230105231105232105233105234105235105236105237105238105239105240105241105242105243105244105245105246105247105248105249105250105251105252105253105254105255105256105257105258105259105260105261105262105263105264105265105266105267105268105269105270105271105272105273105274105275105276105277105278105279105280105281105282105283105284105285105286105287105288105289105290105291105292105293105294105295105296105297105298105299105300105301105302105303105304105305105306105307105308105309105310105311105312105313105314105315105316105317105318105319105320105321105322105323105324105325105326105327105328105329105330105331105332105333105334105335105336105337105338105339105340105341105342105343105344105345105346105347105348105349105350105351105352105353105354105355105356105357105358105359105360105361105362105363105364105365105366105367105368105369105370105371105372105373105374105375105376105377105378105379105380105381105382105383105384105385105386105387105388105389105390105391105392105393105394105395105396105397105398105399105400105401105402105403105404105405105406105407105408105409105410105411105412105413105414105415105416105417105418105419105420105421105422105423105424105425105426105427105428105429105430105431105432105433105434105435105436105437105438105439105440105441105442105443105444105445105446105447105448105449105450105451105452105453105454105455105456105457105458105459105460105461105462105463105464105465105466105467105468105469105470105471105472105473105474105475105476105477105478105479105480105481105482105483105484105485105486105487105488105489105490105491105492105493105494105495105496105497105498105499105500105501105502105503105504105505105506105507105508105509105510105511105512105513105514105515105516105517105518105519105520105521105522105523105524105525105526105527105528105529105530105531105532105533105534105535105536105537105538105539105540105541105542105543105544105545105546105547105548105549105550105551105552105553105554105555105556105557105558105559105560105561105562105563105564105565105566105567105568105569105570105571105572105573105574105575105576105577105578105579105580105581105582105583105584105585105586105587105588105589105590105591105592105593105594105595105596105597105598105599105600105601105602105603105604105605105606105607105608105609105610105611105612105613105614105615105616105617105618105619105620105621105622105623105624105625105626105627105628105629105630105631105632105633105634105635105636105637105638105639105640105641105642105643105644105645105646105647105648105649105650105651105652105653105654105655105656105657105658105659105660105661105662105663105664105665105666105667105668105669105670105671105672105673105674105675105676105677105678105679105680105681105682105683105684105685105686105687105688105689105690105691105692105693105694105695105696105697105698105699105700105701105702105703105704105705105706105707105708105709105710105711105712105713105714105715105716105717105718105719105720105721105722105723105724105725105726105727105728105729105730105731105732105733105734105735105736105737105738105739105740105741105742105743105744105745105746105747105748105749105750105751105752105753105754105755105756105757105758105759105760105761105762105763105764105765105766105767105768105769105770105771105772105773105774105775105776105777105778105779105780105781105782105783105784105785105786105787105788105789105790105791105792105793105794105795105796105797105798105799105800105801105802105803105804105805105806105807105808105809105810105811105812105813105814105815105816105817105818105819105820105821105822105823105824105825105826105827105828105829105830105831105832105833105834105835105836105837105838105839105840105841105842105843105844105845105846105847105848105849105850105851105852105853105854105855105856105857105858105859105860105861105862105863105864105865105866105867105868105869105870105871105872105873105874105875105876105877105878105879105880105881105882105883105884105885105886105887105888105889105890105891105892105893105894105895105896105897105898105899105900105901105902105903105904105905105906105907105908105909105910105911105912105913105914105915105916105917105918105919105920105921105922105923105924105925105926105927105928105929105930105931105932105933105934105935105936105937105938105939105940105941105942105943105944105945105946105947105948105949105950105951105952105953105954105955105956105957105958105959105960105961105962105963105964105965105966105967105968105969105970105971105972105973105974105975105976105977105978105979105980105981105982105983105984105985105986105987105988105989105990105991105992105993105994105995105996105997105998105999106000106001106002106003106004106005106006106007106008106009106010106011106012106013106014106015106016106017106018106019106020106021106022106023106024106025106026106027106028106029106030106031106032106033106034106035106036106037106038106039106040106041106042106043106044106045106046106047106048106049106050106051106052106053106054106055106056106057106058106059106060106061106062106063106064106065106066106067106068106069106070106071106072106073106074106075106076106077106078106079106080106081106082106083106084106085106086106087106088106089106090106091106092106093106094106095106096106097106098106099106100106101106102106103106104106105106106106107106108106109106110106111106112106113106114106115106116106117106118106119106120106121106122106123106124106125106126106127106128106129106130106131106132106133106134106135106136106137106138106139106140106141106142106143106144106145106146106147106148106149106150106151106152106153106154106155106156106157106158106159106160106161106162106163106164106165106166106167106168106169106170106171106172106173106174106175106176106177106178106179106180106181106182106183106184106185106186106187106188106189106190106191106192106193106194106195106196106197106198106199106200106201106202106203106204106205106206106207106208106209106210106211106212106213106214106215106216106217106218106219106220106221106222106223106224106225106226106227106228106229106230106231106232106233106234106235106236106237106238106239106240106241106242106243106244106245106246106247106248106249106250106251106252106253106254106255106256106257106258106259106260106261106262106263106264106265106266106267106268106269106270106271106272106273106274106275106276106277106278106279106280106281106282106283106284106285106286106287106288106289106290106291106292106293106294106295106296106297106298106299106300106301106302106303106304106305106306106307106308106309106310106311106312106313106314106315106316106317106318106319106320106321106322106323106324106325106326106327106328106329106330106331106332106333106334106335106336106337106338106339106340106341106342106343106344106345106346106347106348106349106350106351106352106353106354106355106356106357106358106359106360106361106362106363106364106365106366106367106368106369106370106371106372106373106374106375106376106377106378106379106380106381106382106383106384106385106386106387106388106389106390106391106392106393106394106395106396106397106398106399106400106401106402106403106404106405106406106407106408106409106410106411106412106413106414106415106416106417106418106419106420106421106422106423106424106425106426106427106428106429106430106431106432106433106434106435106436106437106438106439106440106441106442106443106444106445106446106447106448106449106450106451106452106453106454106455106456106457106458106459106460106461106462106463106464106465106466106467106468106469106470106471106472106473106474106475106476106477106478106479106480106481106482106483106484106485106486106487106488106489106490106491106492106493106494106495106496106497106498106499106500106501106502106503106504106505106506106507106508106509106510106511106512106513106514106515106516106517106518106519106520106521106522106523106524106525106526106527106528106529106530106531106532106533106534106535106536106537106538106539106540106541106542106543106544106545106546106547106548106549106550106551106552106553106554106555106556106557106558106559106560106561106562106563106564106565106566106567106568106569106570106571106572106573106574106575106576106577106578106579106580106581106582106583106584106585106586106587106588106589106590106591106592106593106594106595106596106597106598106599106600106601106602106603106604106605106606106607106608106609106610106611106612106613106614106615106616106617106618106619106620106621106622106623106624106625106626106627106628106629106630106631106632106633106634106635106636106637106638106639106640106641106642106643106644106645106646106647106648106649106650106651106652106653106654106655106656106657106658106659106660106661106662106663106664106665106666106667106668106669106670106671106672106673106674106675106676106677106678106679106680106681106682106683106684106685106686106687106688106689106690106691106692106693106694106695106696106697106698106699106700106701106702106703106704106705106706106707106708106709106710106711106712106713106714106715106716106717106718106719106720106721106722106723106724106725106726106727106728106729106730106731106732106733106734106735106736106737106738106739106740106741106742106743106744106745106746106747106748106749106750106751106752106753106754106755106756106757106758106759106760106761106762106763106764106765106766106767106768106769106770106771106772106773106774106775106776106777106778106779106780106781106782106783106784106785106786106787106788106789106790106791106792106793106794106795106796106797106798106799106800106801106802106803106804106805106806106807106808106809106810106811106812106813106814106815106816106817106818106819106820106821106822106823106824106825106826106827106828106829106830106831106832106833106834106835106836106837106838106839106840106841106842106843106844106845106846106847106848106849106850106851106852106853106854106855106856106857106858106859106860106861106862106863106864106865106866106867106868106869106870106871106872106873106874106875106876106877106878106879106880106881106882106883106884106885106886106887106888106889106890106891106892106893106894106895106896106897106898106899106900106901106902106903106904106905106906106907106908106909106910106911106912106913106914106915106916106917106918106919106920106921106922106923106924106925106926106927106928106929106930106931106932106933106934106935106936106937106938106939106940106941106942106943106944106945106946106947106948106949106950106951106952106953106954106955106956106957106958106959106960106961106962106963106964106965106966106967106968106969106970106971106972106973106974106975106976106977106978106979106980106981106982106983106984106985106986106987106988106989106990106991106992106993106994106995106996106997106998106999107000107001107002107003107004107005107006107007107008107009107010107011107012107013107014107015107016107017107018107019107020107021107022107023107024107025107026107027107028107029107030107031107032107033107034107035107036107037107038107039107040107041107042107043107044107045107046107047107048107049107050107051107052107053107054107055107056107057107058107059107060107061107062107063107064107065107066107067107068107069107070107071107072107073107074107075107076107077107078107079107080107081107082107083107084107085107086107087107088107089107090107091107092107093107094107095107096107097107098107099107100107101107102107103107104107105107106107107107108107109107110107111107112107113107114107115107116107117107118107119107120107121107122107123107124107125107126107127107128107129107130107131107132107133107134107135107136107137107138107139107140107141107142107143107144107145107146107147107148107149107150107151107152107153107154107155107156107157107158107159107160107161107162107163107164107165107166107167107168107169107170107171107172107173107174107175107176107177107178107179107180107181107182107183107184107185107186107187107188107189107190107191107192107193107194107195107196107197107198107199107200107201107202107203107204107205107206107207107208107209107210107211107212107213107214107215107216107217107218107219107220107221107222107223107224107225107226107227107228107229107230107231107232107233107234107235107236107237107238107239107240107241107242107243107244107245107246107247107248107249107250107251107252107253107254107255107256107257107258107259107260107261107262107263107264107265107266107267107268107269107270107271107272107273107274107275107276107277107278107279107280107281107282107283107284107285107286107287107288107289107290107291107292107293107294107295107296107297107298107299107300107301107302107303107304107305107306107307107308107309107310107311107312107313107314107315107316107317107318107319107320107321107322107323107324107325107326107327107328107329107330107331107332107333107334107335107336107337107338107339107340107341107342107343107344107345107346107347107348107349107350107351107352107353107354107355107356107357107358107359107360107361107362107363107364107365107366107367107368107369107370107371107372107373107374107375107376107377107378107379107380107381107382107383107384107385107386107387107388107389107390107391107392107393107394107395107396107397107398107399107400107401107402107403107404107405107406107407107408107409107410107411107412107413107414107415107416107417107418107419107420107421107422107423107424107425107426107427107428107429107430107431107432107433107434107435107436107437107438107439107440107441107442107443107444107445107446107447107448107449107450107451107452107453107454107455107456107457107458107459107460107461107462107463107464107465107466107467107468107469107470107471107472107473107474107475107476107477107478107479107480107481107482107483107484107485107486107487107488107489107490107491107492107493107494107495107496107497107498107499107500107501107502107503107504107505107506107507107508107509107510107511107512107513107514107515107516107517107518107519107520107521107522107523107524107525107526107527107528107529107530107531107532107533107534107535107536107537107538107539107540107541107542107543107544107545107546107547107548107549107550107551107552107553107554107555107556107557107558107559107560107561107562107563107564107565107566107567107568107569107570107571107572107573107574107575107576107577107578107579107580107581107582107583107584107585107586107587107588107589107590107591107592107593107594107595107596107597107598107599107600107601107602107603107604107605107606107607107608107609107610107611107612107613107614107615107616107617107618107619107620107621107622107623107624107625107626107627107628107629107630107631107632107633107634107635107636107637107638107639107640107641107642107643107644107645107646107647107648107649107650107651107652107653107654107655107656107657107658107659107660107661107662107663107664107665107666107667107668107669107670107671107672107673107674107675107676107677107678107679107680107681107682107683107684107685107686107687107688107689107690107691107692107693107694107695107696107697107698107699107700107701107702107703107704107705107706107707107708107709107710107711107712107713107714107715107716107717107718107719107720107721107722107723107724107725107726107727107728107729107730107731107732107733107734107735107736107737107738107739107740107741107742107743107744107745107746107747107748107749107750107751107752107753107754107755107756107757107758107759107760107761107762107763107764107765107766107767107768107769107770107771107772107773107774107775107776107777107778107779107780107781107782107783107784107785107786107787107788107789107790107791107792107793107794107795107796107797107798107799107800107801107802107803107804107805107806107807107808107809107810107811107812107813107814107815107816107817107818107819107820107821107822107823107824107825107826107827107828107829107830107831107832107833107834107835107836107837107838107839107840107841107842107843107844107845107846107847107848107849107850107851107852107853107854107855107856107857107858107859107860107861107862107863107864107865107866107867107868107869107870107871107872107873107874107875107876107877107878107879107880107881107882107883107884107885107886107887107888107889107890107891107892107893107894107895107896107897107898107899107900107901107902107903107904107905107906107907107908107909107910107911107912107913107914107915107916107917107918107919107920107921107922107923107924107925107926107927107928107929107930107931107932107933107934107935107936107937107938107939107940107941107942107943107944107945107946107947107948107949107950107951107952107953107954107955107956107957107958107959107960107961107962107963107964107965107966107967107968107969107970107971107972107973107974107975107976107977107978107979107980107981107982107983107984107985107986107987107988107989107990107991107992107993107994107995107996107997107998107999108000108001108002108003108004108005108006108007108008108009108010108011108012108013108014108015108016108017108018108019108020108021108022108023108024108025108026108027108028108029108030108031108032108033108034108035108036108037108038108039108040108041108042108043108044108045108046108047108048108049108050108051108052108053108054108055108056108057108058108059108060108061108062108063108064108065108066108067108068108069108070108071108072108073108074108075108076108077108078108079108080108081108082108083108084108085108086108087108088108089108090108091108092108093108094108095108096108097108098108099108100108101108102108103108104108105108106108107108108108109108110108111108112108113108114108115108116108117108118108119108120108121108122108123108124108125108126108127108128108129108130108131108132108133108134108135108136108137108138108139108140108141108142108143108144108145108146108147108148108149108150108151108152108153108154108155108156108157108158108159108160108161108162108163108164108165108166108167108168108169108170108171108172108173108174108175108176108177108178108179108180108181108182108183108184108185108186108187108188108189108190108191108192108193108194108195108196108197108198108199108200108201108202108203108204108205108206108207108208108209108210108211108212108213108214108215108216108217108218108219108220108221108222108223108224108225108226108227108228108229108230108231108232108233108234108235108236108237108238108239108240108241108242108243108244108245108246108247108248108249108250108251108252108253108254108255108256108257108258108259108260108261108262108263108264108265108266108267108268108269108270108271108272108273108274108275108276108277108278108279108280108281108282108283108284108285108286108287108288108289108290108291108292108293108294108295108296108297108298108299108300108301108302108303108304108305108306108307108308108309108310108311108312108313108314108315108316108317108318108319108320108321108322108323108324108325108326108327108328108329108330108331108332108333108334108335108336108337108338108339108340108341108342108343108344108345108346108347108348108349108350108351108352108353108354108355108356108357108358108359108360108361108362108363108364108365108366108367108368108369108370108371108372108373108374108375108376108377108378108379108380108381108382108383108384108385108386108387108388108389108390108391108392108393108394108395108396108397108398108399108400108401108402108403108404108405108406108407108408108409108410108411108412108413108414108415108416108417108418108419108420108421108422108423108424108425108426108427108428108429108430108431108432108433108434108435108436108437108438108439108440108441108442108443108444108445108446108447108448108449108450108451108452108453108454108455108456108457108458108459108460108461108462108463108464108465108466108467108468108469108470108471108472108473108474108475108476108477108478108479108480108481108482108483108484108485108486108487108488108489108490108491108492108493108494108495108496108497108498108499108500108501108502108503108504108505108506108507108508108509108510108511108512108513108514108515108516108517108518108519108520108521108522108523108524108525108526108527108528108529108530108531108532108533108534108535108536108537108538108539108540108541108542108543108544108545108546108547108548108549108550108551108552108553108554108555108556108557108558108559108560108561108562108563108564108565108566108567108568108569108570108571108572108573108574108575108576108577108578108579108580108581108582108583108584108585108586108587108588108589108590108591108592108593108594108595108596108597108598108599108600108601108602108603108604108605108606108607108608108609108610108611108612108613108614108615108616108617108618108619108620108621108622108623108624108625108626108627108628108629108630108631108632108633108634108635108636108637108638108639108640108641108642108643108644108645108646108647108648108649108650108651108652108653108654108655108656108657108658108659108660108661108662108663108664108665108666108667108668108669108670108671108672108673108674108675108676108677108678108679108680108681108682108683108684108685108686108687108688108689108690108691108692108693108694108695108696108697108698108699108700108701108702108703108704108705108706108707108708108709108710108711108712108713108714108715108716108717108718108719108720108721108722108723108724108725108726108727108728108729108730108731108732108733108734108735108736108737108738108739108740108741108742108743108744108745108746108747108748108749108750108751108752108753108754108755108756108757108758108759108760108761108762108763108764108765108766108767108768108769108770108771108772108773108774108775108776108777108778108779108780108781108782108783108784108785108786108787108788108789108790108791108792108793108794108795108796108797108798108799108800108801108802108803108804108805108806108807108808108809108810108811108812108813108814108815108816108817108818108819108820108821108822108823108824108825108826108827108828108829108830108831108832108833108834108835108836108837108838108839108840108841108842108843108844108845108846108847108848108849108850108851108852108853108854108855108856108857108858108859108860108861108862108863108864108865108866108867108868108869108870108871108872108873108874108875108876108877108878108879108880108881108882108883108884108885108886108887108888108889108890108891108892108893108894108895108896108897108898108899108900108901108902108903108904108905108906108907108908108909108910108911108912108913108914108915108916108917108918108919108920108921108922108923108924108925108926108927108928108929108930108931108932108933108934108935108936108937108938108939108940108941108942108943108944108945108946108947108948108949108950108951108952108953108954108955108956108957108958108959108960108961108962108963108964108965108966108967108968108969108970108971108972108973108974108975108976108977108978108979108980108981108982108983108984108985108986108987108988108989108990108991108992108993108994108995108996108997108998108999109000109001109002109003109004109005109006109007109008109009109010109011109012109013109014109015109016109017109018109019109020109021109022109023109024109025109026109027109028109029109030109031109032109033109034109035109036109037109038109039109040109041109042109043109044109045109046109047109048109049109050109051109052109053109054109055109056109057109058109059109060109061109062109063109064109065109066109067109068109069109070109071109072109073109074109075109076109077109078109079109080109081109082109083109084109085109086109087109088109089109090109091109092109093109094109095109096109097109098109099109100109101109102109103109104109105109106109107109108109109109110109111109112109113109114109115109116109117109118109119109120109121109122109123109124109125109126109127109128109129109130109131109132109133109134109135109136109137109138109139109140109141109142109143109144109145109146109147109148109149109150109151109152109153109154109155109156109157109158109159109160109161109162109163109164109165109166109167109168109169109170109171109172109173109174109175109176109177109178109179109180109181109182109183109184109185109186109187109188109189109190109191109192109193109194109195109196109197109198109199109200109201109202109203109204109205109206109207109208109209109210109211109212109213109214109215109216109217109218109219109220109221109222109223109224109225109226109227109228109229109230109231109232109233109234109235109236109237109238109239109240109241109242109243109244109245109246109247109248109249109250109251109252109253109254109255109256109257109258109259109260109261109262109263109264109265109266109267109268109269109270109271109272109273109274109275109276109277109278109279109280109281109282109283109284109285109286109287109288109289109290109291109292109293109294109295109296109297109298109299109300109301109302109303109304109305109306109307109308109309109310109311109312109313109314109315109316109317109318109319109320109321109322109323109324109325109326109327109328109329109330109331109332109333109334109335109336109337109338109339109340109341109342109343109344109345109346109347109348109349109350109351109352109353109354109355109356109357109358109359109360109361109362109363109364109365109366109367109368109369109370109371109372109373109374109375109376109377109378109379109380109381109382109383109384109385109386109387109388109389109390109391109392109393109394109395109396109397109398109399109400109401109402109403109404109405109406109407109408109409109410109411109412109413109414109415109416109417109418109419109420109421109422109423109424109425109426109427109428109429109430109431109432109433109434109435109436109437109438109439109440109441109442109443109444109445109446109447109448109449109450109451109452109453109454109455109456109457109458109459109460109461109462109463109464109465109466109467109468109469109470109471109472109473109474109475109476109477109478109479109480109481109482109483109484109485109486109487109488109489109490109491109492109493109494109495109496109497109498109499109500109501109502109503109504109505109506109507109508109509109510109511109512109513109514109515109516109517109518109519109520109521109522109523109524109525109526109527109528109529109530109531109532109533109534109535109536109537109538109539109540109541109542109543109544109545109546109547109548109549109550109551109552109553109554109555109556109557109558109559109560109561109562109563109564109565109566109567109568109569109570109571109572109573109574109575109576109577109578109579109580109581109582109583109584109585109586109587109588109589109590109591109592109593109594109595109596109597109598109599109600109601109602109603109604109605109606109607109608109609109610109611109612109613109614109615109616109617109618109619109620109621109622109623109624109625109626109627109628109629109630109631109632109633109634109635109636109637109638109639109640109641109642109643109644109645109646109647109648109649109650109651109652109653109654109655109656109657109658109659109660109661109662109663109664109665109666109667109668109669109670109671109672109673109674109675109676109677109678109679109680109681109682109683109684109685109686109687109688109689109690109691109692109693109694109695109696109697109698109699109700109701109702109703109704109705109706109707109708109709109710109711109712109713109714109715109716109717109718109719109720109721109722109723109724109725109726109727109728109729109730109731109732109733109734109735109736109737109738109739109740109741109742109743109744109745109746109747109748109749109750109751109752109753109754109755109756109757109758109759109760109761109762109763109764109765109766109767109768109769109770109771109772109773109774109775109776109777109778109779109780109781109782109783109784109785109786109787109788109789109790109791109792109793109794109795109796109797109798109799109800109801109802109803109804109805109806109807109808109809109810109811109812109813109814109815109816109817109818109819109820109821109822109823109824109825109826109827109828109829109830109831109832109833109834109835109836109837109838109839109840109841109842109843109844109845109846109847109848109849109850109851109852109853109854109855109856109857109858109859109860109861109862109863109864109865109866109867109868109869109870109871109872109873109874109875109876109877109878109879109880109881109882109883109884109885109886109887109888109889109890109891109892109893109894109895109896109897109898109899109900109901109902109903109904109905109906109907109908109909109910109911109912109913109914109915109916109917109918109919109920109921109922109923109924109925109926109927109928109929109930109931109932109933109934109935109936109937109938109939109940109941109942109943109944109945109946109947109948109949109950109951109952109953109954109955109956109957109958109959109960109961109962109963109964109965109966109967109968109969109970109971109972109973109974109975109976109977109978109979109980109981109982109983109984109985109986109987109988109989109990109991109992109993109994109995109996109997109998109999110000110001110002110003110004110005110006110007110008110009110010110011110012110013110014110015110016110017110018110019110020110021110022110023110024110025110026110027110028110029110030110031110032110033110034110035110036110037110038110039110040110041110042110043110044110045110046110047110048110049110050110051110052110053110054110055110056110057110058110059110060110061110062110063110064110065110066110067110068110069110070110071110072110073110074110075110076110077110078110079110080110081110082110083110084110085110086110087110088110089110090110091110092110093110094110095110096110097110098110099110100110101110102110103110104110105110106110107110108110109110110110111110112110113110114110115110116110117110118110119110120110121110122110123110124110125110126110127110128110129110130110131110132110133110134110135110136110137110138110139110140110141110142110143110144110145110146110147110148110149110150110151110152110153110154110155110156110157110158110159110160110161110162110163110164110165110166110167110168110169110170110171110172110173110174110175110176110177110178110179110180110181110182110183110184110185110186110187110188110189110190110191110192110193110194110195110196110197110198110199110200110201110202110203110204110205110206110207110208110209110210110211110212110213110214110215110216110217110218110219110220110221110222110223110224110225110226110227110228110229110230110231110232110233110234110235110236110237110238110239110240110241110242110243110244110245110246110247110248110249110250110251110252110253110254110255110256110257110258110259110260110261110262110263110264110265110266110267110268110269110270110271110272110273110274110275110276110277110278110279110280110281110282110283110284110285110286110287110288110289110290110291110292110293110294110295110296110297110298110299110300110301110302110303110304110305110306110307110308110309110310110311110312110313110314110315110316110317110318110319110320110321110322110323110324110325110326110327110328110329110330110331110332110333110334110335110336110337110338110339110340110341110342110343110344110345110346110347110348110349110350110351110352110353110354110355110356110357110358110359110360110361110362110363110364110365110366110367110368110369110370110371110372110373110374110375110376110377110378110379110380110381110382110383110384110385110386110387110388110389110390110391110392110393110394110395110396110397110398110399110400110401110402110403110404110405110406110407110408110409110410110411110412110413110414110415110416110417110418110419110420110421110422110423110424110425110426110427110428110429110430110431110432110433110434110435110436110437110438110439110440110441110442110443110444110445110446110447110448110449110450110451110452110453110454110455110456110457110458110459110460110461110462110463110464110465110466110467110468110469110470110471110472110473110474110475110476110477110478110479110480110481110482110483110484110485110486110487110488110489110490110491110492110493110494110495110496110497110498110499110500110501110502110503110504110505110506110507110508110509110510110511110512110513110514110515110516110517110518110519110520110521110522110523110524110525110526110527110528110529110530110531110532110533110534110535110536110537110538110539110540110541110542110543110544110545110546110547110548110549110550110551110552110553110554110555110556110557110558110559110560110561110562110563110564110565110566110567110568110569110570110571110572110573110574110575110576110577110578110579110580110581110582110583110584110585110586110587110588110589110590110591110592110593110594110595110596110597110598110599110600110601110602110603110604110605110606110607110608110609110610110611110612110613110614110615110616110617110618110619110620110621110622110623110624110625110626110627110628110629110630110631110632110633110634110635110636110637110638110639110640110641110642110643110644110645110646110647110648110649110650110651110652110653110654110655110656110657110658110659110660110661110662110663110664110665110666110667110668110669110670110671110672110673110674110675110676110677110678110679110680110681110682110683110684110685110686110687110688110689110690110691110692110693110694110695110696110697110698110699110700110701110702110703110704110705110706110707110708110709110710110711110712110713110714110715110716110717110718110719110720110721110722110723110724110725110726110727110728110729110730110731110732110733110734110735110736110737110738110739110740110741110742110743110744110745110746110747110748110749110750110751110752110753110754110755110756110757110758110759110760110761110762110763110764110765110766110767110768110769110770110771110772110773110774110775110776110777110778110779110780110781110782110783110784110785110786110787110788110789110790110791110792110793110794110795110796110797110798110799110800110801110802110803110804110805110806110807110808110809110810110811110812110813110814110815110816110817110818110819110820110821110822110823110824110825110826110827110828110829110830110831110832110833110834110835110836110837110838110839110840110841110842110843110844110845110846110847110848110849110850110851110852110853110854110855110856110857110858110859110860110861110862110863110864110865110866110867110868110869110870110871110872110873110874110875110876110877110878110879110880110881110882110883110884110885110886110887110888110889110890110891110892110893110894110895110896110897110898110899110900110901110902110903110904110905110906110907110908110909110910110911110912110913110914110915110916110917110918110919110920110921110922110923110924110925110926110927110928110929110930110931110932110933110934110935110936110937110938110939110940110941110942110943110944110945110946110947110948110949110950110951110952110953110954110955110956110957110958110959110960110961110962110963110964110965110966110967110968110969110970110971110972110973110974110975110976110977110978110979110980110981110982110983110984110985110986110987110988110989110990110991110992110993110994110995110996110997110998110999111000111001111002111003111004111005111006111007111008111009111010111011111012111013111014111015111016111017111018111019111020111021111022111023111024111025111026111027111028111029111030111031111032111033111034111035111036111037111038111039111040111041111042111043111044111045111046111047111048111049111050111051111052111053111054111055111056111057111058111059111060111061111062111063111064111065111066111067111068111069111070111071111072111073111074111075111076111077111078111079111080111081111082111083111084111085111086111087111088111089111090111091111092111093111094111095111096111097111098111099111100111101111102111103111104111105111106111107111108111109111110111111111112111113111114111115111116111117111118111119111120111121111122111123111124111125111126111127111128111129111130111131111132111133111134111135111136111137111138111139111140111141111142111143111144111145111146111147111148111149111150111151111152111153111154111155111156111157111158111159111160111161111162111163111164111165111166111167111168111169111170111171111172111173111174111175111176111177111178111179111180111181111182111183111184111185111186111187111188111189111190111191111192111193111194111195111196111197111198111199111200111201111202111203111204111205111206111207111208111209111210111211111212111213111214111215111216111217111218111219111220111221111222111223111224111225111226111227111228111229111230111231111232111233111234111235111236111237111238111239111240111241111242111243111244111245111246111247111248111249111250111251111252111253111254111255111256111257111258111259111260111261111262111263111264111265111266111267111268111269111270111271111272111273111274111275111276111277111278111279111280111281111282111283111284111285111286111287111288111289111290111291111292111293111294111295111296111297111298111299111300111301111302111303111304111305111306111307111308111309111310111311111312111313111314111315111316111317111318111319111320111321111322111323111324111325111326111327111328111329111330111331111332111333111334111335111336111337111338111339111340111341111342111343111344111345111346111347111348111349111350111351111352111353111354111355111356111357111358111359111360111361111362111363111364111365111366111367111368111369111370111371111372111373111374111375111376111377111378111379111380111381111382111383111384111385111386111387111388111389111390111391111392111393111394111395111396111397111398111399111400111401111402111403111404111405111406111407111408111409111410111411111412111413111414111415111416111417111418111419111420111421111422111423111424111425111426111427111428111429111430111431111432111433111434111435111436111437111438111439111440111441111442111443111444111445111446111447111448111449111450111451111452111453111454111455111456111457111458111459111460111461111462111463111464111465111466111467111468111469111470111471111472111473111474111475111476111477111478111479111480111481111482111483111484111485111486111487111488111489111490111491111492111493111494111495111496111497111498111499111500111501111502111503111504111505111506111507111508111509111510111511111512111513111514111515111516111517111518111519111520111521111522111523111524111525111526111527111528111529111530111531111532111533111534111535111536111537111538111539111540111541111542111543111544111545111546111547111548111549111550111551111552111553111554111555111556111557111558111559111560111561111562111563111564111565111566111567111568111569111570111571111572111573111574111575111576111577111578111579111580111581111582111583111584111585111586111587111588111589111590111591111592111593111594111595111596111597111598111599111600111601111602111603111604111605111606111607111608111609111610111611111612111613111614111615111616111617111618111619111620111621111622111623111624111625111626111627111628111629111630111631111632111633111634111635111636111637111638111639111640111641111642111643111644111645111646111647111648111649111650111651111652111653111654111655111656111657111658111659111660111661111662111663111664111665111666111667111668111669111670111671111672111673111674111675111676111677111678111679111680111681111682111683111684111685111686111687111688111689111690111691111692111693111694111695111696111697111698111699111700111701111702111703111704111705111706111707111708111709111710111711111712111713111714111715111716111717111718111719111720111721111722111723111724111725111726111727111728111729111730111731111732111733111734111735111736111737111738111739111740111741111742111743111744111745111746111747111748111749111750111751111752111753111754111755111756111757111758111759111760111761111762111763111764111765111766111767111768111769111770111771111772111773111774111775111776111777111778111779111780111781111782111783111784111785111786111787111788111789111790111791111792111793111794111795111796111797111798111799111800111801111802111803111804111805111806111807111808111809111810111811111812111813111814111815111816111817111818111819111820111821111822111823111824111825111826111827111828111829111830111831111832111833111834111835111836111837111838111839111840111841111842111843111844111845111846111847111848111849111850111851111852111853111854111855111856111857111858111859111860111861111862111863111864111865111866111867111868111869111870111871111872111873111874111875111876111877111878111879111880111881111882111883111884111885111886111887111888111889111890111891111892111893111894111895111896111897111898111899111900111901111902111903111904111905111906111907111908111909111910111911111912111913111914111915111916111917111918111919111920111921111922111923111924111925111926111927111928111929111930111931111932111933111934111935111936111937111938111939111940111941111942111943111944111945111946111947111948111949111950111951111952111953111954111955111956111957111958111959111960111961111962111963111964111965111966111967111968111969111970111971111972111973111974111975111976111977111978111979111980111981111982111983111984111985111986111987111988111989111990111991111992111993111994111995111996111997111998111999112000112001112002112003112004112005112006112007112008112009112010112011112012112013112014112015112016112017112018112019112020112021112022112023112024112025112026112027112028112029112030112031112032112033112034112035112036112037112038112039112040112041112042112043112044112045112046112047112048112049112050112051112052112053112054112055112056112057112058112059112060112061112062112063112064112065112066112067112068112069112070112071112072112073112074112075112076112077112078112079112080112081112082112083112084112085112086112087112088112089112090112091112092112093112094112095112096112097112098112099112100112101112102112103112104112105112106112107112108112109112110112111112112112113112114112115112116112117112118112119112120112121112122112123112124112125112126112127112128112129112130112131112132112133112134112135112136112137112138112139112140112141112142112143112144112145112146112147112148112149112150112151112152112153112154112155112156112157112158112159112160112161112162112163112164112165112166112167112168112169112170112171112172112173112174112175112176112177112178112179112180112181112182112183112184112185112186112187112188112189112190112191112192112193112194112195112196112197112198112199112200112201112202112203112204112205112206112207112208112209112210112211112212112213112214112215112216112217112218112219112220112221112222112223112224112225112226112227112228112229112230112231112232112233112234112235112236112237112238112239112240112241112242112243112244112245112246112247112248112249112250112251112252112253112254112255112256112257112258112259112260112261112262112263112264112265112266112267112268112269112270112271112272112273112274112275112276112277112278112279112280112281112282112283112284112285112286112287112288112289112290112291112292112293112294112295112296112297112298112299112300112301112302112303112304112305112306112307112308112309112310112311112312112313112314112315112316112317112318112319112320112321112322112323112324112325112326112327112328112329112330112331112332112333112334112335112336112337112338112339112340112341112342112343112344112345112346112347112348112349112350112351112352112353112354112355112356112357112358112359112360112361112362112363112364112365112366112367112368112369112370112371112372112373112374112375112376112377112378112379112380112381112382112383112384112385112386112387112388112389112390112391112392112393112394112395112396112397112398112399112400112401112402112403112404112405112406112407112408112409112410112411112412112413112414112415112416112417112418112419112420112421112422112423112424112425112426112427112428112429112430112431112432112433112434112435112436112437112438112439112440112441112442112443112444112445112446112447112448112449112450112451112452112453112454112455112456112457112458112459112460112461112462112463112464112465112466112467112468112469112470112471112472112473112474112475112476112477112478112479112480112481112482112483112484112485112486112487112488112489112490112491112492112493112494112495112496112497112498112499112500112501112502112503112504112505112506112507112508112509112510112511112512112513112514112515112516112517112518112519112520112521112522112523112524112525112526112527112528112529112530112531112532112533112534112535112536112537112538112539112540112541112542112543112544112545112546112547112548112549112550112551112552112553112554112555112556112557112558112559112560112561112562112563112564112565112566112567112568112569112570112571112572112573112574112575112576112577112578112579112580112581112582112583112584112585112586112587112588112589112590112591112592112593112594112595112596112597112598112599112600112601112602112603112604112605112606112607112608112609112610112611112612112613112614112615112616112617112618112619112620112621112622112623112624112625112626112627112628112629112630112631112632112633112634112635112636112637112638112639112640112641112642112643112644112645112646112647112648112649112650112651112652112653112654112655112656112657112658112659112660112661112662112663112664112665112666112667112668112669112670112671112672112673112674112675112676112677112678112679112680112681112682112683112684112685112686112687112688112689112690112691112692112693112694112695112696112697112698112699112700112701112702112703112704112705112706112707112708112709112710112711112712112713112714112715112716112717112718112719112720112721112722112723112724112725112726112727112728112729112730112731112732112733112734112735112736112737112738112739112740112741112742112743112744112745112746112747112748112749112750112751112752112753112754112755112756112757112758112759112760112761112762112763112764112765112766112767112768112769112770112771112772112773112774112775112776112777112778112779112780112781112782112783112784112785112786112787112788112789112790112791112792112793112794112795112796112797112798112799112800112801112802112803112804112805112806112807112808112809112810112811112812112813112814112815112816112817112818112819112820112821112822112823112824112825112826112827112828112829112830112831112832112833112834112835112836112837112838112839112840112841112842112843112844112845112846112847112848112849112850112851112852112853112854112855112856112857112858112859112860112861112862112863112864112865112866112867112868112869112870112871112872112873112874112875112876112877112878112879112880112881112882112883112884112885112886112887112888112889112890112891112892112893112894112895112896112897112898112899112900112901112902112903112904112905112906112907112908112909112910112911112912112913112914112915112916112917112918112919112920112921112922112923112924112925112926112927112928112929112930112931112932112933112934112935112936112937112938112939112940112941112942112943112944112945112946112947112948112949112950112951112952112953112954112955112956112957112958112959112960112961112962112963112964112965112966112967112968112969112970112971112972112973112974112975112976112977112978112979112980112981112982112983112984112985112986112987112988112989112990112991112992112993112994112995112996112997112998112999113000113001113002113003113004113005113006113007113008113009113010113011113012113013113014113015113016113017113018113019113020113021113022113023113024113025113026113027113028113029113030113031113032113033113034113035113036113037113038113039113040113041113042113043113044113045113046113047113048113049113050113051113052113053113054113055113056113057113058113059113060113061113062113063113064113065113066113067113068113069113070113071113072113073113074113075113076113077113078113079113080113081113082113083113084113085113086113087113088113089113090113091113092113093113094113095113096113097113098113099113100113101113102113103113104113105113106113107113108113109113110113111113112113113113114113115113116113117113118113119113120113121113122113123113124113125113126113127113128113129113130113131113132113133113134113135113136113137113138113139113140113141113142113143113144113145113146113147113148113149113150113151113152113153113154113155113156113157113158113159113160113161113162113163113164113165113166113167113168113169113170113171113172113173113174113175113176113177113178113179113180113181113182113183113184113185113186113187113188113189113190113191113192113193113194113195113196113197113198113199113200113201113202113203113204113205113206113207113208113209113210113211113212113213113214113215113216113217113218113219113220113221113222113223113224113225113226113227113228113229113230113231113232113233113234113235113236113237113238113239113240113241113242113243113244113245113246113247113248113249113250113251113252113253113254113255113256113257113258113259113260113261113262113263113264113265113266113267113268113269113270113271113272113273113274113275113276113277113278113279113280113281113282113283113284113285113286113287113288113289113290113291113292113293113294113295113296113297113298113299113300113301113302113303113304113305113306113307113308113309113310113311113312113313113314113315113316113317113318113319113320113321113322113323113324113325113326113327113328113329113330113331113332113333113334113335113336113337113338113339113340113341113342113343113344113345113346113347113348113349113350113351113352113353113354113355113356113357113358113359113360113361113362113363113364113365113366113367113368113369113370113371113372113373113374113375113376113377113378113379113380113381113382113383113384113385113386113387113388113389113390113391113392113393113394113395113396113397113398113399113400113401113402113403113404113405113406113407113408113409113410113411113412113413113414113415113416113417113418113419113420113421113422113423113424113425113426113427113428113429113430113431113432113433113434113435113436113437113438113439113440113441113442113443113444113445113446113447113448113449113450113451113452113453113454113455113456113457113458113459113460113461113462113463113464113465113466113467113468113469113470113471113472113473113474113475113476113477113478113479113480113481113482113483113484113485113486113487113488113489113490113491113492113493113494113495113496113497113498113499113500113501113502113503113504113505113506113507113508113509113510113511113512113513113514113515113516113517113518113519113520113521113522113523113524113525113526113527113528113529113530113531113532113533113534113535113536113537113538113539113540113541113542113543113544113545113546113547113548113549113550113551113552113553113554113555113556113557113558113559113560113561113562113563113564113565113566113567113568113569113570113571113572113573113574113575113576113577113578113579113580113581113582113583113584113585113586113587113588113589113590113591113592113593113594113595113596113597113598113599113600113601113602113603113604113605113606113607113608113609113610113611113612113613113614113615113616113617113618113619113620113621113622113623113624113625113626113627113628113629113630113631113632113633113634113635113636113637113638113639113640113641113642113643113644113645113646113647113648113649113650113651113652113653113654113655113656113657113658113659113660113661113662113663113664113665113666113667113668113669113670113671113672113673113674113675113676113677113678113679113680113681113682113683113684113685113686113687113688113689113690113691113692113693113694113695113696113697113698113699113700113701113702113703113704113705113706113707113708113709113710113711113712113713113714113715113716113717113718113719113720113721113722113723113724113725113726113727113728113729113730113731113732113733113734113735113736113737113738113739113740113741113742113743113744113745113746113747113748113749113750113751113752113753113754113755113756113757113758113759113760113761113762113763113764113765113766113767113768113769113770113771113772113773113774113775113776113777113778113779113780113781113782113783113784113785113786113787113788113789113790113791113792113793113794113795113796113797113798113799113800113801113802113803113804113805113806113807113808113809113810113811113812113813113814113815113816113817113818113819113820113821113822113823113824113825113826113827113828113829113830113831113832113833113834113835113836113837113838113839113840113841113842113843113844113845113846113847113848113849113850113851113852113853113854113855113856113857113858113859113860113861113862113863113864113865113866113867113868113869113870113871113872113873113874113875113876113877113878113879113880113881113882113883113884113885113886113887113888113889113890113891113892113893113894113895113896113897113898113899113900113901113902113903113904113905113906113907113908113909113910113911113912113913113914113915113916113917113918113919113920113921113922113923113924113925113926113927113928113929113930113931113932113933113934113935113936113937113938113939113940113941113942113943113944113945113946113947113948113949113950113951113952113953113954113955113956113957113958113959113960113961113962113963113964113965113966113967113968113969113970113971113972113973113974113975113976113977113978113979113980113981113982113983113984113985113986113987113988113989113990113991113992113993113994113995113996113997113998113999114000114001114002114003114004114005114006114007114008114009114010114011114012114013114014114015114016114017114018114019114020114021114022114023114024114025114026114027114028114029114030114031114032114033114034114035114036114037114038114039114040114041114042114043114044114045114046114047114048114049114050114051114052114053114054114055114056114057114058114059114060114061114062114063114064114065114066114067114068114069114070114071114072114073114074114075114076114077114078114079114080114081114082114083114084114085114086114087114088114089114090114091114092114093114094114095114096114097114098114099114100114101114102114103114104114105114106114107114108114109114110114111114112114113114114114115114116114117114118114119114120114121114122114123114124114125114126114127114128114129114130114131114132114133114134114135114136114137114138114139114140114141114142114143114144114145114146114147114148114149114150114151114152114153114154114155114156114157114158114159114160114161114162114163114164114165114166114167114168114169114170114171114172114173114174114175114176114177114178114179114180114181114182114183114184114185114186114187114188114189114190114191114192114193114194114195114196114197114198114199114200114201114202114203114204114205114206114207114208114209114210114211114212114213114214114215114216114217114218114219114220114221114222114223114224114225114226114227114228114229114230114231114232114233114234114235114236114237114238114239114240114241114242114243114244114245114246114247114248114249114250114251114252114253114254114255114256114257114258114259114260114261114262114263114264114265114266114267114268114269114270114271114272114273114274114275114276114277114278114279114280114281114282114283114284114285114286114287114288114289114290114291114292114293114294114295114296114297114298114299114300114301114302114303114304114305114306114307114308114309114310114311114312114313114314114315114316114317114318114319114320114321114322114323114324114325114326114327114328114329114330114331114332114333114334114335114336114337114338114339114340114341114342114343114344114345114346114347114348114349114350114351114352114353114354114355114356114357114358114359114360114361114362114363114364114365114366114367114368114369114370114371114372114373114374114375114376114377114378114379114380114381114382114383114384114385114386114387114388114389114390114391114392114393114394114395114396114397114398114399114400114401114402114403114404114405114406114407114408114409114410114411114412114413114414114415114416114417114418114419114420114421114422114423114424114425114426114427114428114429114430114431114432114433114434114435114436114437114438114439114440114441114442114443114444114445114446114447114448114449114450114451114452114453114454114455114456114457114458114459114460114461114462114463114464114465114466114467114468114469114470114471114472114473114474114475114476114477114478114479114480114481114482114483114484114485114486114487114488114489114490114491114492114493114494114495114496114497114498114499114500114501114502114503114504114505114506114507114508114509114510114511114512114513114514114515114516114517114518114519114520114521114522114523114524114525114526114527114528114529114530114531114532114533114534114535114536114537114538114539114540114541114542114543114544114545114546114547114548114549114550114551114552114553114554114555114556114557114558114559114560114561114562114563114564114565114566114567114568114569114570114571114572114573114574114575114576114577114578114579114580114581114582114583114584114585114586114587114588114589114590114591114592114593114594114595114596114597114598114599114600114601114602114603114604114605114606114607114608114609114610114611114612114613114614114615114616114617114618114619114620114621114622114623114624114625114626114627114628114629114630114631114632114633114634114635114636114637114638114639114640114641114642114643114644114645114646114647114648114649114650114651114652114653114654114655114656114657114658114659114660114661114662114663114664114665114666114667114668114669114670114671114672114673114674114675114676114677114678114679114680114681114682114683114684114685114686114687114688114689114690114691114692114693114694114695114696114697114698114699114700114701114702114703114704114705114706114707114708114709114710114711114712114713114714114715114716114717114718114719114720114721114722114723114724114725114726114727114728114729114730114731114732114733114734114735114736114737114738114739114740114741114742114743114744114745114746114747114748114749114750114751114752114753114754114755114756114757114758114759114760114761114762114763114764114765114766114767114768114769114770114771114772114773114774114775114776114777114778114779114780114781114782114783114784114785114786114787114788114789114790114791114792114793114794114795114796114797114798114799114800114801114802114803114804114805114806114807114808114809114810114811114812114813114814114815114816114817114818114819114820114821114822114823114824114825114826114827114828114829114830114831114832114833114834114835114836114837114838114839114840114841114842114843114844114845114846114847114848114849114850114851114852114853114854114855114856114857114858114859114860114861114862114863114864114865114866114867114868114869114870114871114872114873114874114875114876114877114878114879114880114881114882114883114884114885114886114887114888114889114890114891114892114893114894114895114896114897114898114899114900114901114902114903114904114905114906114907114908114909114910114911114912114913114914114915114916114917114918114919114920114921114922114923114924114925114926114927114928114929114930114931114932114933114934114935114936114937114938114939114940114941114942114943114944114945114946114947114948114949114950114951114952114953114954114955114956114957114958114959114960114961114962114963114964114965114966114967114968114969114970114971114972114973114974114975114976114977114978114979114980114981114982114983114984114985114986114987114988114989114990114991114992114993114994114995114996114997114998114999115000115001115002115003115004115005115006115007115008115009115010115011115012115013115014115015115016115017115018115019115020115021115022115023115024115025115026115027115028115029115030115031115032115033115034115035115036115037115038115039115040115041115042115043115044115045115046115047115048115049115050115051115052115053115054115055115056115057115058115059115060115061115062115063115064115065115066115067115068115069115070115071115072115073115074115075115076115077115078115079115080115081115082115083115084115085115086115087115088115089115090115091115092115093115094115095115096115097115098115099115100115101115102115103115104115105115106115107115108115109115110115111115112115113115114115115115116115117115118115119115120115121115122115123115124115125115126115127115128115129115130115131115132115133115134115135115136115137115138115139115140115141115142115143115144115145115146115147115148115149115150115151115152115153115154115155115156115157115158115159115160115161115162115163115164115165115166115167115168115169115170115171115172115173115174115175115176115177115178115179115180115181115182115183115184115185115186115187115188115189115190115191115192115193115194115195115196115197115198115199115200115201115202115203115204115205115206115207115208115209115210115211115212115213115214115215115216115217115218115219115220115221115222115223115224115225115226115227115228115229115230115231115232115233115234115235115236115237115238115239115240115241115242115243115244115245115246115247115248115249115250115251115252115253115254115255115256115257115258115259115260115261115262115263115264115265115266115267115268115269115270115271115272115273115274115275115276115277115278115279115280115281115282115283115284115285115286115287115288115289115290115291115292115293115294115295115296115297115298115299115300115301115302115303115304115305115306115307115308115309115310115311115312115313115314115315115316115317115318115319115320115321115322115323115324115325115326115327115328115329115330115331115332115333115334115335115336115337115338115339115340115341115342115343115344115345115346115347115348115349115350115351115352115353115354115355115356115357115358115359115360115361115362115363115364115365115366115367115368115369115370115371115372115373115374115375115376115377115378115379115380115381115382115383115384115385115386115387115388115389115390115391115392115393115394115395115396115397115398115399115400115401115402115403115404115405115406115407115408115409115410115411115412115413115414115415115416115417115418115419115420115421115422115423115424115425115426115427115428115429115430115431115432115433115434115435115436115437115438115439115440115441115442115443115444115445115446115447115448115449115450115451115452115453115454115455115456115457115458115459115460115461115462115463115464115465115466115467115468115469115470115471115472115473115474115475115476115477115478115479115480115481115482115483115484115485115486115487115488115489115490115491115492115493115494115495115496115497115498115499115500115501115502115503115504115505115506115507115508115509115510115511115512115513115514115515115516115517115518115519115520115521115522115523115524115525115526115527115528115529115530115531115532115533115534115535115536115537115538115539115540115541115542115543115544115545115546115547115548115549115550115551115552115553115554115555115556115557115558115559115560115561115562115563115564115565115566115567115568115569115570115571115572115573115574115575115576115577115578115579115580115581115582115583115584115585115586115587115588115589115590115591115592115593115594115595115596115597115598115599115600115601115602115603115604115605115606115607115608115609115610115611115612115613115614115615115616115617115618115619115620115621115622115623115624115625115626115627115628115629115630115631115632115633115634115635115636115637115638115639115640115641115642115643115644115645115646115647115648115649115650115651115652115653115654115655115656115657115658115659115660115661115662115663115664115665115666115667115668115669115670115671115672115673115674115675115676115677115678115679115680115681115682115683115684115685115686115687115688115689115690115691115692115693115694115695115696115697115698115699115700115701115702115703115704115705115706115707115708115709115710115711115712115713115714115715115716115717115718115719115720115721115722115723115724115725115726115727115728115729115730115731115732115733115734115735115736115737115738115739115740115741115742115743115744115745115746115747115748115749115750115751115752115753115754115755115756115757115758115759115760115761115762115763115764115765115766115767115768115769115770115771115772115773115774115775115776115777115778115779115780115781115782115783115784115785115786115787115788115789115790115791115792115793115794115795115796115797115798115799115800115801115802115803115804115805115806115807115808115809115810115811115812115813115814115815115816115817115818115819115820115821115822115823115824115825115826115827115828115829115830115831115832115833115834115835115836115837115838115839115840115841115842115843115844115845115846115847115848115849115850115851115852115853115854115855115856115857115858115859115860115861115862115863115864115865115866115867115868115869115870115871115872115873115874115875115876115877115878115879115880115881115882115883115884115885115886115887115888115889115890115891115892115893115894115895115896115897115898115899115900115901115902115903115904115905115906115907115908115909115910115911115912115913115914115915115916115917115918115919115920115921115922115923115924115925115926115927115928115929115930115931115932115933115934115935115936115937115938115939115940115941115942115943115944115945115946115947115948115949115950115951115952115953115954115955115956115957115958115959115960115961115962115963115964115965115966115967115968115969115970115971115972115973115974115975115976115977115978115979115980115981115982115983115984115985115986115987115988115989115990115991115992115993115994115995115996115997115998115999116000116001116002116003116004116005116006116007116008116009116010116011116012116013116014116015116016116017116018116019116020116021116022116023116024116025116026116027116028116029116030116031116032116033116034116035116036116037116038116039116040116041116042116043116044116045116046116047116048116049116050116051116052116053116054116055116056116057116058116059116060116061116062116063116064116065116066116067116068116069116070116071116072116073116074116075116076116077116078116079116080116081116082116083116084116085116086116087116088116089116090116091116092116093116094116095116096116097116098116099116100116101116102116103116104116105116106116107116108116109116110116111116112116113116114116115116116116117116118116119116120116121116122116123116124116125116126116127116128116129116130116131116132116133116134116135116136116137116138116139116140116141116142116143116144116145116146116147116148116149116150116151116152116153116154116155116156116157116158116159116160116161116162116163116164116165116166116167116168116169116170116171116172116173116174116175116176116177116178116179116180116181116182116183116184116185116186116187116188116189116190116191116192116193116194116195116196116197116198116199116200116201116202116203116204116205116206116207116208116209116210116211116212116213116214116215116216116217116218116219116220116221116222116223116224116225116226116227116228116229116230116231116232116233116234116235116236116237116238116239116240116241116242116243116244116245116246116247116248116249116250116251116252116253116254116255116256116257116258116259116260116261116262116263116264116265116266116267116268116269116270116271116272116273116274116275116276116277116278116279116280116281116282116283116284116285116286116287116288116289116290116291116292116293116294116295116296116297116298116299116300116301116302116303116304116305116306116307116308116309116310116311116312116313116314116315116316116317116318116319116320116321116322116323116324116325116326116327116328116329116330116331116332116333116334116335116336116337116338116339116340116341116342116343116344116345116346116347116348116349116350116351116352116353116354116355116356116357116358116359116360116361116362116363116364116365116366116367116368116369116370116371116372116373116374116375116376116377116378116379116380116381116382116383116384116385116386116387116388116389116390116391116392116393116394116395116396116397116398116399116400116401116402116403116404116405116406116407116408116409116410116411116412116413116414116415116416116417116418116419116420116421116422116423116424116425116426116427116428116429116430116431116432116433116434116435116436116437116438116439116440116441116442116443116444116445116446116447116448116449116450116451116452116453116454116455116456116457116458116459116460116461116462116463116464116465116466116467116468116469116470116471116472116473116474116475116476116477116478116479116480116481116482116483116484116485116486116487116488116489116490116491116492116493116494116495116496116497116498116499116500116501116502116503116504116505116506116507116508116509116510116511116512116513116514116515116516116517116518116519116520116521116522116523116524116525116526116527116528116529116530116531116532116533116534116535116536116537116538116539116540116541116542116543116544116545116546116547116548116549116550116551116552116553116554116555116556116557116558116559116560116561116562116563116564116565116566116567116568116569116570116571116572116573116574116575116576116577116578116579116580116581116582116583116584116585116586116587116588116589116590116591116592116593116594116595116596116597116598116599116600116601116602116603116604116605116606116607116608116609116610116611116612116613116614116615116616116617116618116619116620116621116622116623116624116625116626116627116628116629116630116631116632116633116634116635116636116637116638116639116640116641116642116643116644116645116646116647116648116649116650116651116652116653116654116655116656116657116658116659116660116661116662116663116664116665116666116667116668116669116670116671116672116673116674116675116676116677116678116679116680116681116682116683116684116685116686116687116688116689116690116691116692116693116694116695116696116697116698116699116700116701116702116703116704116705116706116707116708116709116710116711116712116713116714116715116716116717116718116719116720116721116722116723116724116725116726116727116728116729116730116731116732116733116734116735116736116737116738116739116740116741116742116743116744116745116746116747116748116749116750116751116752116753116754116755116756116757116758116759116760116761116762116763116764116765116766116767116768116769116770116771116772116773116774116775116776116777116778116779116780116781116782116783116784116785116786116787116788116789116790116791116792116793116794116795116796116797116798116799116800116801116802116803116804116805116806116807116808116809116810116811116812116813116814116815116816116817116818116819116820116821116822116823116824116825116826116827116828116829116830116831116832116833116834116835116836116837116838116839116840116841116842116843116844116845116846116847116848116849116850116851116852116853116854116855116856116857116858116859116860116861116862116863116864116865116866116867116868116869116870116871116872116873116874116875116876116877116878116879116880116881116882116883116884116885116886116887116888116889116890116891116892116893116894116895116896116897116898116899116900116901116902116903116904116905116906116907116908116909116910116911116912116913116914116915116916116917116918116919116920116921116922116923116924116925116926116927116928116929116930116931116932116933116934116935116936116937116938116939116940116941116942116943116944116945116946116947116948116949116950116951116952116953116954116955116956116957116958116959116960116961116962116963116964116965116966116967116968116969116970116971116972116973116974116975116976116977116978116979116980116981116982116983116984116985116986116987116988116989116990116991116992116993116994116995116996116997116998116999117000117001117002117003117004117005117006117007117008117009117010117011117012117013117014117015117016117017117018117019117020117021117022117023117024117025117026117027117028117029117030117031117032117033117034117035117036117037117038117039117040117041117042117043117044117045117046117047117048117049117050117051117052117053117054117055117056117057117058117059117060117061117062117063117064117065117066117067117068117069117070117071117072117073117074117075117076117077117078117079117080117081117082117083117084117085117086117087117088117089117090117091117092117093117094117095117096117097117098117099117100117101117102117103117104117105117106117107117108117109117110117111117112117113117114117115117116117117117118117119117120117121117122117123117124117125117126117127117128117129117130117131117132117133117134117135117136117137117138117139117140117141117142117143117144117145117146117147117148117149117150117151117152117153117154117155117156117157117158117159117160117161117162117163117164117165117166117167117168117169117170117171117172117173117174117175117176117177117178117179117180117181117182117183117184117185117186117187117188117189117190117191117192117193117194117195117196117197117198117199117200117201117202117203117204117205117206117207117208117209117210117211117212117213117214117215117216117217117218117219117220117221117222117223117224117225117226117227117228117229117230117231117232117233117234117235117236117237117238117239117240117241117242117243117244117245117246117247117248117249117250117251117252117253117254117255117256117257117258117259117260117261117262117263117264117265117266117267117268117269117270117271117272117273117274117275117276117277117278117279117280117281117282117283117284117285117286117287117288117289117290117291117292117293117294117295117296117297117298117299117300117301117302117303117304117305117306117307117308117309117310117311117312117313117314117315117316117317117318117319117320117321117322117323117324117325117326117327117328117329117330117331117332117333117334117335117336117337117338117339117340117341117342117343117344117345117346117347117348117349117350117351117352117353117354117355117356117357117358117359117360117361117362117363117364117365117366117367117368117369117370117371117372117373117374117375117376117377117378117379117380117381117382117383117384117385117386117387117388117389117390117391117392117393117394117395117396117397117398117399117400117401117402117403117404117405117406117407117408117409117410117411117412117413117414117415117416117417117418117419117420117421117422117423117424117425117426117427117428117429117430117431117432117433117434117435117436117437117438117439117440117441117442117443117444117445117446117447117448117449117450117451117452117453117454117455117456117457117458117459117460117461117462117463117464117465117466117467117468117469117470117471117472117473117474117475117476117477117478117479117480117481117482117483117484117485117486117487117488117489117490117491117492117493117494117495117496117497117498117499117500117501117502117503117504117505117506117507117508117509117510117511117512117513117514117515117516117517117518117519117520117521117522117523117524117525117526117527117528117529117530117531117532117533117534117535117536117537117538117539117540117541117542117543117544117545117546117547117548117549117550117551117552117553117554117555117556117557117558117559117560117561117562117563117564117565117566117567117568117569117570117571117572117573117574117575117576117577117578117579117580117581117582117583117584117585117586117587117588117589117590117591117592117593117594117595117596117597117598117599117600117601117602117603117604117605117606117607117608117609117610117611117612117613117614117615117616117617117618117619117620117621117622117623117624117625117626117627117628117629117630117631117632117633117634117635117636117637117638117639117640117641117642117643117644117645117646117647117648117649117650117651117652117653117654117655117656117657117658117659117660117661117662117663117664117665117666117667117668117669117670117671117672117673117674117675117676117677117678117679117680117681117682117683117684117685117686117687117688117689117690117691117692117693117694117695117696117697117698117699117700117701117702117703117704117705117706117707117708117709117710117711117712117713117714117715117716117717117718117719117720117721117722117723117724117725117726117727117728117729117730117731117732117733117734117735117736117737117738117739117740117741117742117743117744117745117746117747117748117749117750117751117752117753117754117755117756117757117758117759117760117761117762117763117764117765117766117767117768117769117770117771117772117773117774117775117776117777117778117779117780117781117782117783117784117785117786117787117788117789117790117791117792117793117794117795117796117797117798117799117800117801117802117803117804117805117806117807117808117809117810117811117812117813117814117815117816117817117818117819117820117821117822117823117824117825117826117827117828117829117830117831117832117833117834117835117836117837117838117839117840117841117842117843117844117845117846117847117848117849117850117851117852117853117854117855117856117857117858117859117860117861117862117863117864117865117866117867117868117869117870117871117872117873117874117875117876117877117878117879117880117881117882117883117884117885117886117887117888117889117890117891117892117893117894117895117896117897117898117899117900117901117902117903117904117905117906117907117908117909117910117911117912117913117914117915117916117917117918117919117920117921117922117923117924117925117926117927117928117929117930117931117932117933117934117935117936117937117938117939117940117941117942117943117944117945117946117947117948117949117950117951117952117953117954117955117956117957117958117959117960117961117962117963117964117965117966117967117968117969117970117971117972117973117974117975117976117977117978117979117980117981117982117983117984117985117986117987117988117989117990117991117992117993117994117995117996117997117998117999118000118001118002118003118004118005118006118007118008118009118010118011118012118013118014118015118016118017118018118019118020118021118022118023118024118025118026118027118028118029118030118031118032118033118034118035118036118037118038118039118040118041118042118043118044118045118046118047118048118049118050118051118052118053118054118055118056118057118058118059118060118061118062118063118064118065118066118067118068118069118070118071118072118073118074118075118076118077118078118079118080118081118082118083118084118085118086118087118088118089118090118091118092118093118094118095118096118097118098118099118100118101118102118103118104118105118106118107118108118109118110118111118112118113118114118115118116118117118118118119118120118121118122118123118124118125118126118127118128118129118130118131118132118133118134118135118136118137118138118139118140118141118142118143118144118145118146118147118148118149118150118151118152118153118154118155118156118157118158118159118160118161118162118163118164118165118166118167118168118169118170118171118172118173118174118175118176118177118178118179118180118181118182118183118184118185118186118187118188118189118190118191118192118193118194118195118196118197118198118199118200118201118202118203118204118205118206118207118208118209118210118211118212118213118214118215118216118217118218118219118220118221118222118223118224118225118226118227118228118229118230118231118232118233118234118235118236118237118238118239118240118241118242118243118244118245118246118247118248118249118250118251118252118253118254118255118256118257118258118259118260118261118262118263118264118265118266118267118268118269118270118271118272118273118274118275118276118277118278118279118280118281118282118283118284118285118286118287118288118289118290118291118292118293118294118295118296118297118298118299118300118301118302118303118304118305118306118307118308118309118310118311118312118313118314118315118316118317118318118319118320118321118322118323118324118325118326118327118328118329118330118331118332118333118334118335118336118337118338118339118340118341118342118343118344118345118346118347118348118349118350118351118352118353118354118355118356118357118358118359118360118361118362118363118364118365118366118367118368118369118370118371118372118373118374118375118376118377118378118379118380118381118382118383118384118385118386118387118388118389118390118391118392118393118394118395118396118397118398118399118400118401118402118403118404118405118406118407118408118409118410118411118412118413118414118415118416118417118418118419118420118421118422118423118424118425118426118427118428118429118430118431118432118433118434118435118436118437118438118439118440118441118442118443118444118445118446118447118448118449118450118451118452118453118454118455118456118457118458118459118460118461118462118463118464118465118466118467118468118469118470118471118472118473118474118475118476118477118478118479118480118481118482118483118484118485118486118487118488118489118490118491118492118493118494118495118496118497118498118499118500118501118502118503118504118505118506118507118508118509118510118511118512118513118514118515118516118517118518118519118520118521118522118523118524118525118526118527118528118529118530118531118532118533118534118535118536118537118538118539118540118541118542118543118544118545118546118547118548118549118550118551118552118553118554118555118556118557118558118559118560118561118562118563118564118565118566118567118568118569118570118571118572118573118574118575118576118577118578118579118580118581118582118583118584118585118586118587118588118589118590118591118592118593118594118595118596118597118598118599118600118601118602118603118604118605118606118607118608118609118610118611118612118613118614118615118616118617118618118619118620118621118622118623118624118625118626118627118628118629118630118631118632118633118634118635118636118637118638118639118640118641118642118643118644118645118646118647118648118649118650118651118652118653118654118655118656118657118658118659118660118661118662118663118664118665118666118667118668118669118670118671118672118673118674118675118676118677118678118679118680118681118682118683118684118685118686118687118688118689118690118691118692118693118694118695118696118697118698118699118700118701118702118703118704118705118706118707118708118709118710118711118712118713118714118715118716118717118718118719118720118721118722118723118724118725118726118727118728118729118730118731118732118733118734118735118736118737118738118739118740118741118742118743118744118745118746118747118748118749118750118751118752118753118754118755118756118757118758118759118760118761118762118763118764118765118766118767118768118769118770118771118772118773118774118775118776118777118778118779118780118781118782118783118784118785118786118787118788118789118790118791118792118793118794118795118796118797118798118799118800118801118802118803118804118805118806118807118808118809118810118811118812118813118814118815118816118817118818118819118820118821118822118823118824118825118826118827118828118829118830118831118832118833118834118835118836118837118838118839118840118841118842118843118844118845118846118847118848118849118850118851118852118853118854118855118856118857118858118859118860118861118862118863118864118865118866118867118868118869118870118871118872118873118874118875118876118877118878118879118880118881118882118883118884118885118886118887118888118889118890118891118892118893118894118895118896118897118898118899118900118901118902118903118904118905118906118907118908118909118910118911118912118913118914118915118916118917118918118919118920118921118922118923118924118925118926118927118928118929118930118931118932118933118934118935118936118937118938118939118940118941118942118943118944118945118946118947118948118949118950118951118952118953118954118955118956118957118958118959118960118961118962118963118964118965118966118967118968118969118970118971118972118973118974118975118976118977118978118979118980118981118982118983118984118985118986118987118988118989118990118991118992118993118994118995118996118997118998118999119000119001119002119003119004119005119006119007119008119009119010119011119012119013119014119015119016119017119018119019119020119021119022119023119024119025119026119027119028119029119030119031119032119033119034119035119036119037119038119039119040119041119042119043119044119045119046119047119048119049119050119051119052119053119054119055119056119057119058119059119060119061119062119063119064119065119066119067119068119069119070119071119072119073119074119075119076119077119078119079119080119081119082119083119084119085119086119087119088119089119090119091119092119093119094119095119096119097119098119099119100119101119102119103119104119105119106119107119108119109119110119111119112119113119114119115119116119117119118119119119120119121119122119123119124119125119126119127119128119129119130119131119132119133119134119135119136119137119138119139119140119141119142119143119144119145119146119147119148119149119150119151119152119153119154119155119156119157119158119159119160119161119162119163119164119165119166119167119168119169119170119171119172119173119174119175119176119177119178119179119180119181119182119183119184119185119186119187119188119189119190119191119192119193119194119195119196119197119198119199119200119201119202119203119204119205119206119207119208119209119210119211119212119213119214119215119216119217119218119219119220119221119222119223119224119225119226119227119228119229119230119231119232119233119234119235119236119237119238119239119240119241119242119243119244119245119246119247119248119249119250119251119252119253119254119255119256119257119258119259119260119261119262119263119264119265119266119267119268119269119270119271119272119273119274119275119276119277119278119279119280119281119282119283119284119285119286119287119288119289119290119291119292119293119294119295119296119297119298119299119300119301119302119303119304119305119306119307119308119309119310119311119312119313119314119315119316119317119318119319119320119321119322119323119324119325119326119327119328119329119330119331119332119333119334119335119336119337119338119339119340119341119342119343119344119345119346119347119348119349119350119351119352119353119354119355119356119357119358119359119360119361119362119363119364119365119366119367119368119369119370119371119372119373119374119375119376119377119378119379119380119381119382119383119384119385119386119387119388119389119390119391119392119393119394119395119396119397119398119399119400119401119402119403119404119405119406119407119408119409119410119411119412119413119414119415119416119417119418119419119420119421119422119423119424119425119426119427119428119429119430119431119432119433119434119435119436119437119438119439119440119441119442119443119444119445119446119447119448119449119450119451119452119453119454119455119456119457119458119459119460119461119462119463119464119465119466119467119468119469119470119471119472119473119474119475119476119477119478119479119480119481119482119483119484119485119486119487119488119489119490119491119492119493119494119495119496119497119498119499119500119501119502119503119504119505119506119507119508119509119510119511119512119513119514119515119516119517119518119519119520119521119522119523119524119525119526119527119528119529119530119531119532119533119534119535119536119537119538119539119540119541119542119543119544119545119546119547119548119549119550119551119552119553119554119555119556119557119558119559119560119561119562119563119564119565119566119567119568119569119570119571119572119573119574119575119576119577119578119579119580119581119582119583119584119585119586119587119588119589119590119591119592119593119594119595119596119597119598119599119600119601119602119603119604119605119606119607119608119609119610119611119612119613119614119615119616119617119618119619119620119621119622119623119624119625119626119627119628119629119630119631119632119633119634119635119636119637119638119639119640119641119642119643119644119645119646119647119648119649119650119651119652119653119654119655119656119657119658119659119660119661119662119663119664119665119666119667119668119669119670119671119672119673119674119675119676119677119678119679119680119681119682119683119684119685119686119687119688119689119690119691119692119693119694119695119696119697119698119699119700119701119702119703119704119705119706119707119708119709119710119711119712119713119714119715119716119717119718119719119720119721119722119723119724119725119726119727119728119729119730119731119732119733119734119735119736119737119738119739119740119741119742119743119744119745119746119747119748119749119750119751119752119753119754119755119756119757119758119759119760119761119762119763119764119765119766119767119768119769119770119771119772119773119774119775119776119777119778119779119780119781119782119783119784119785119786119787119788119789119790119791119792119793119794119795119796119797119798119799119800119801119802119803119804119805119806119807119808119809119810119811119812119813119814119815119816119817119818119819119820119821119822119823119824119825119826119827119828119829119830119831119832119833119834119835119836119837119838119839119840119841119842119843119844119845119846119847119848119849119850119851119852119853119854119855119856119857119858119859119860119861119862119863119864119865119866119867119868119869119870119871119872119873119874119875119876119877119878119879119880119881119882119883119884119885119886119887119888119889119890119891119892119893119894119895119896119897119898119899119900119901119902119903119904119905119906119907119908119909119910119911119912119913119914119915119916119917119918119919119920119921119922119923119924119925119926119927119928119929119930119931119932119933119934119935119936119937119938119939119940119941119942119943119944119945119946119947119948119949119950119951119952119953119954119955119956119957119958119959119960119961119962119963119964119965119966119967119968119969119970119971119972119973119974119975119976119977119978119979119980119981119982119983119984119985119986119987119988119989119990119991119992119993119994119995119996119997119998119999120000120001120002120003120004120005120006120007120008120009120010120011120012120013120014120015120016120017120018120019120020120021120022120023120024120025120026120027120028120029120030120031120032120033120034120035120036120037120038120039120040120041120042120043120044120045120046120047120048120049120050120051120052120053120054120055120056120057120058120059120060120061120062120063120064120065120066120067120068120069120070120071120072120073120074120075120076120077120078120079120080120081120082120083120084120085120086120087120088120089120090120091120092120093120094120095120096120097120098120099120100120101120102120103120104120105120106120107120108120109120110120111120112120113120114120115120116120117120118120119120120120121120122120123120124120125120126120127120128120129120130120131120132120133120134120135120136120137120138120139120140120141120142120143120144120145120146120147120148120149120150120151120152120153120154120155120156120157120158120159120160120161120162120163120164120165120166120167120168120169120170120171120172120173120174120175120176120177120178120179120180120181120182120183120184120185120186120187120188120189120190120191120192120193120194120195120196120197120198120199120200120201120202120203120204120205120206120207120208120209120210120211120212120213120214120215120216120217120218120219120220120221120222120223120224120225120226120227120228120229120230120231120232120233120234120235120236120237120238120239120240120241120242120243120244120245120246120247120248120249120250120251120252120253120254120255120256120257120258120259120260120261120262120263120264120265120266120267120268120269120270120271120272120273120274120275120276120277120278120279120280120281120282120283120284120285120286120287120288120289120290120291120292120293120294120295120296120297120298120299120300120301120302120303120304120305120306120307120308120309120310120311120312120313120314120315120316120317120318120319120320120321120322120323120324120325120326120327120328120329120330120331120332120333120334120335120336120337120338120339120340120341120342120343120344120345120346120347120348120349120350120351120352120353120354120355120356120357120358120359120360120361120362120363120364120365120366120367120368120369120370120371120372120373120374120375120376120377120378120379120380120381120382120383120384120385120386120387120388120389120390120391120392120393120394120395120396120397120398120399120400120401120402120403120404120405120406120407120408120409120410120411120412120413120414120415120416120417120418120419120420120421120422120423120424120425120426120427120428120429120430120431120432120433120434120435120436120437120438120439120440120441120442120443120444120445120446120447120448120449120450120451120452120453120454120455120456120457120458120459120460120461120462120463120464120465120466120467120468120469120470120471120472120473120474120475120476120477120478120479120480120481120482120483120484120485120486120487120488120489120490120491120492120493120494120495120496120497120498120499120500120501120502120503120504120505120506120507120508120509120510120511120512120513120514120515120516120517120518120519120520120521120522120523120524120525120526120527120528120529120530120531120532120533120534120535120536120537120538120539120540120541120542120543120544120545120546120547120548120549120550120551120552120553120554120555120556120557120558120559120560120561120562120563120564120565120566120567120568120569120570120571120572120573120574120575120576120577120578120579120580120581120582120583120584120585120586120587120588120589120590120591120592120593120594120595120596120597120598120599120600120601120602120603120604120605120606120607120608120609120610120611120612120613120614120615120616120617120618120619120620120621120622120623120624120625120626120627120628120629120630120631120632120633120634120635120636120637120638120639120640120641120642120643120644120645120646120647120648120649120650120651120652120653120654120655120656120657120658120659120660120661120662120663120664120665120666120667120668120669120670120671120672120673120674120675120676120677120678120679120680120681120682120683120684120685120686120687120688120689120690120691120692120693120694120695120696120697120698120699120700120701120702120703120704120705120706120707120708120709120710120711120712120713120714120715120716120717120718120719120720120721120722120723120724120725120726120727120728120729120730120731120732120733120734120735120736120737120738120739120740120741120742120743120744120745120746120747120748120749120750120751120752120753120754120755120756120757120758120759120760120761120762120763120764120765120766120767120768120769120770120771120772120773120774120775120776120777120778120779120780120781120782120783120784120785120786120787120788120789120790120791120792120793120794120795120796120797120798120799120800120801120802120803120804120805120806120807120808120809120810120811120812120813120814120815120816120817120818120819120820120821120822120823120824120825120826120827120828120829120830120831120832120833120834120835120836120837120838120839120840120841120842120843120844120845120846120847120848120849120850120851120852120853120854120855120856120857120858120859120860120861120862120863120864120865120866120867120868120869120870120871120872120873120874120875120876120877120878120879120880120881120882120883120884120885120886120887120888120889120890120891120892120893120894120895120896120897120898120899120900120901120902120903120904120905120906120907120908120909120910120911120912120913120914120915120916120917120918120919120920120921120922120923120924120925120926120927120928120929120930120931120932120933120934120935120936120937120938120939120940120941120942120943120944120945120946120947120948120949120950120951120952120953120954120955120956120957120958120959120960120961120962120963120964120965120966120967120968120969120970120971120972120973120974120975120976120977120978120979120980120981120982120983120984120985120986120987120988120989120990120991120992120993120994120995120996120997120998120999121000121001121002121003121004121005121006121007121008121009121010121011121012121013121014121015121016121017121018121019121020121021121022121023121024121025121026121027121028121029121030121031121032121033121034121035121036121037121038121039121040121041121042121043121044121045121046121047121048121049121050121051121052121053121054121055121056121057121058121059121060121061121062121063121064121065121066121067121068121069121070121071121072121073121074121075121076121077121078121079121080121081121082121083121084121085121086121087121088121089121090121091121092121093121094121095121096121097121098121099121100121101121102121103121104121105121106121107121108121109121110121111121112121113121114121115121116121117121118121119121120121121121122121123121124121125121126121127121128121129121130121131121132121133121134121135121136121137121138121139121140121141121142121143121144121145121146121147121148121149121150121151121152121153121154121155121156121157121158121159121160121161121162121163121164121165121166121167121168121169121170121171121172121173121174121175121176121177121178121179121180121181121182121183121184121185121186121187121188121189121190121191121192121193121194121195121196121197121198121199121200121201121202121203121204121205121206121207121208121209121210121211121212121213121214121215121216121217121218121219121220121221121222121223121224121225121226121227121228121229121230121231121232121233121234121235121236121237121238121239121240121241121242121243121244121245121246121247121248121249121250121251121252121253121254121255121256121257121258121259121260121261121262121263121264121265121266121267121268121269121270121271121272121273121274121275121276121277121278121279121280121281121282121283121284121285121286121287121288121289121290121291121292121293121294121295121296121297121298121299121300121301121302121303121304121305121306121307121308121309121310121311121312121313121314121315121316121317121318121319121320121321121322121323121324121325121326121327121328121329121330121331121332121333121334121335121336121337121338121339121340121341121342121343121344121345121346121347121348121349121350121351121352121353121354121355121356121357121358121359121360121361121362121363121364121365121366121367121368121369121370121371121372121373121374121375121376121377121378121379121380121381121382121383121384121385121386121387121388121389121390121391121392121393121394121395121396121397121398121399121400121401121402121403121404121405121406121407121408121409121410121411121412121413121414121415121416121417121418121419121420121421121422121423121424121425121426121427121428121429121430121431121432121433121434121435121436121437121438121439121440121441121442121443121444121445121446121447121448121449121450121451121452121453121454121455121456121457121458121459121460121461121462121463121464121465121466121467121468121469121470121471121472121473121474121475121476121477121478121479121480121481121482121483121484121485121486121487121488121489121490121491121492121493121494121495121496121497121498121499121500121501121502121503121504121505121506121507121508121509121510121511121512121513121514121515121516121517121518121519121520121521121522121523121524121525121526121527121528121529121530121531121532121533121534121535121536121537121538121539121540121541121542121543121544121545121546121547121548121549121550121551121552121553121554121555121556121557121558121559121560121561121562121563121564121565121566121567121568121569121570121571121572121573121574121575121576121577121578121579121580121581121582121583121584121585121586121587121588121589121590121591121592121593121594121595121596121597121598121599121600121601121602121603121604121605121606121607121608121609121610121611121612121613121614121615121616121617121618121619121620121621121622121623121624121625121626121627121628121629121630121631121632121633121634121635121636121637121638121639121640121641121642121643121644121645121646121647121648121649121650121651121652121653121654121655121656121657121658121659121660121661121662121663121664121665121666121667121668121669121670121671121672121673121674121675121676121677121678121679121680121681121682121683121684121685121686121687121688121689121690121691121692121693121694121695121696121697121698121699121700121701121702121703121704121705121706121707121708121709121710121711121712121713121714121715121716121717121718121719121720121721121722121723121724121725121726121727121728121729121730121731121732121733121734121735121736121737121738121739121740121741121742121743121744121745121746121747121748121749121750121751121752121753121754121755121756121757121758121759121760121761121762121763121764121765121766121767121768121769121770121771121772121773121774121775121776121777121778121779121780121781121782121783121784121785121786121787121788121789121790121791121792121793121794121795121796121797121798121799121800121801121802121803121804121805121806121807121808121809121810121811121812121813121814121815121816121817121818121819121820121821121822121823121824121825121826121827121828121829121830121831121832121833121834121835121836121837121838121839121840121841121842121843121844121845121846121847121848121849121850121851121852121853121854121855121856121857121858121859121860121861121862121863121864121865121866121867121868121869121870121871121872121873121874121875121876121877121878121879121880121881121882121883121884121885121886121887121888121889121890121891121892121893121894121895121896121897121898121899121900121901121902121903121904121905121906121907121908121909121910121911121912121913121914121915121916121917121918121919121920121921121922121923121924121925121926121927121928121929121930121931121932121933121934121935121936121937121938121939121940121941121942121943121944121945121946121947121948121949121950121951121952121953121954121955121956121957121958121959121960121961121962121963121964121965121966121967121968121969121970121971121972121973121974121975121976121977121978121979121980121981121982121983121984121985121986121987121988121989121990121991121992121993121994121995121996121997121998121999122000122001122002122003122004122005122006122007122008122009122010122011122012122013122014122015122016122017122018122019122020122021122022122023122024122025122026122027122028122029122030122031122032122033122034122035122036122037122038122039122040122041122042122043122044122045122046122047122048122049122050122051122052122053122054122055122056122057122058122059122060122061122062122063122064122065122066122067122068122069122070122071122072122073122074122075122076122077122078122079122080122081122082122083122084122085122086122087122088122089122090122091122092122093122094122095122096122097122098122099122100122101122102122103122104122105122106122107122108122109122110122111122112122113122114122115122116122117122118122119122120122121122122122123122124122125122126122127122128122129122130122131122132122133122134122135122136122137122138122139122140122141122142122143122144122145122146122147122148122149122150122151122152122153122154122155122156122157122158122159122160122161122162122163122164122165122166122167122168122169122170122171122172122173122174122175122176122177122178122179122180122181122182122183122184122185122186122187122188122189122190122191122192122193122194122195122196122197122198122199122200122201122202122203122204122205122206122207122208122209122210122211122212122213122214122215122216122217122218122219122220122221122222122223122224122225122226122227122228122229122230122231122232122233122234122235122236122237122238122239122240122241122242122243122244122245122246122247122248122249122250122251122252122253122254122255122256122257122258122259122260122261122262122263122264122265122266122267122268122269122270122271122272122273122274122275122276122277122278122279122280122281122282122283122284122285122286122287122288122289122290122291122292122293122294122295122296122297122298122299122300122301122302122303122304122305122306122307122308122309122310122311122312122313122314122315122316122317122318122319122320122321122322122323122324122325122326122327122328122329122330122331122332122333122334122335122336122337122338122339122340122341122342122343122344122345122346122347122348122349122350122351122352122353122354122355122356122357122358122359122360122361122362122363122364122365122366122367122368122369122370122371122372122373122374122375122376122377122378122379122380122381122382122383122384122385122386122387122388122389122390122391122392122393122394122395122396122397122398122399122400122401122402122403122404122405122406122407122408122409122410122411122412122413122414122415122416122417122418122419122420122421122422122423122424122425122426122427122428122429122430122431122432122433122434122435122436122437122438122439122440122441122442122443122444122445122446122447122448122449122450122451122452122453122454122455122456122457122458122459122460122461122462122463122464122465122466122467122468122469122470122471122472122473122474122475122476122477122478122479122480122481122482122483122484122485122486122487122488122489122490122491122492122493122494122495122496122497122498122499122500122501122502122503122504122505122506122507122508122509122510122511122512122513122514122515122516122517122518122519122520122521122522122523122524122525122526122527122528122529122530122531122532122533122534122535122536122537122538122539122540122541122542122543122544122545122546122547122548122549122550122551122552122553122554122555122556122557122558122559122560122561122562122563122564122565122566122567122568122569122570122571122572122573122574122575122576122577122578122579122580122581122582122583122584122585122586122587122588122589122590122591122592122593122594122595122596122597122598122599122600122601122602122603122604122605122606122607122608122609122610122611122612122613122614122615122616122617122618122619122620122621122622122623122624122625122626122627122628122629122630122631122632122633122634122635122636122637122638122639122640122641122642122643122644122645122646122647122648122649122650122651122652122653122654122655122656122657122658122659122660122661122662122663122664122665122666122667122668122669122670122671122672122673122674122675122676122677122678122679122680122681122682122683122684122685122686122687122688122689122690122691122692122693122694122695122696122697122698122699122700122701122702122703122704122705122706122707122708122709122710122711122712122713122714122715122716122717122718122719122720122721122722122723122724122725122726122727122728122729122730122731122732122733122734122735122736122737122738122739122740122741122742122743122744122745122746122747122748122749122750122751122752122753122754122755122756122757122758122759122760122761122762122763122764122765122766122767122768122769122770122771122772122773122774122775122776122777122778122779122780122781122782122783122784122785122786122787122788122789122790122791122792122793122794122795122796122797122798122799122800122801122802122803122804122805122806122807122808122809122810122811122812122813122814122815122816122817122818122819122820122821122822122823122824122825122826122827122828122829122830122831122832122833122834122835122836122837122838122839122840122841122842122843122844122845122846122847122848122849122850122851122852122853122854122855122856122857122858122859122860122861122862122863122864122865122866122867122868122869122870122871122872122873122874122875122876122877122878122879122880122881122882122883122884122885122886122887122888122889122890122891122892122893122894122895122896122897122898122899122900122901122902122903122904122905122906122907122908122909122910122911122912122913122914122915122916122917122918122919122920122921122922122923122924122925122926122927122928122929122930122931122932122933122934122935122936122937122938122939122940122941122942122943122944122945122946122947122948122949122950122951122952122953122954122955122956122957122958122959122960122961122962122963122964122965122966122967122968122969122970122971122972122973122974122975122976122977122978122979122980122981122982122983122984122985122986122987122988122989122990122991122992122993122994122995122996122997122998122999123000123001123002123003123004123005123006123007123008123009123010123011123012123013123014123015123016123017123018123019123020123021123022123023123024123025123026123027123028123029123030123031123032123033123034123035123036123037123038123039123040123041123042123043123044123045123046123047123048123049123050123051123052123053123054123055123056123057123058123059123060123061123062123063123064123065123066123067123068123069123070123071123072123073123074123075123076123077123078123079123080123081123082123083123084123085123086123087123088123089123090123091123092123093123094123095123096123097123098123099123100123101123102123103123104123105123106123107123108123109123110123111123112123113123114123115123116123117123118123119123120123121123122123123123124123125123126123127123128123129123130123131123132123133123134123135123136123137123138123139123140123141123142123143123144123145123146123147123148123149123150123151123152123153123154123155123156123157123158123159123160123161123162123163123164123165123166123167123168123169123170123171123172123173123174123175123176123177123178123179123180123181123182123183123184123185123186123187123188123189123190123191123192123193123194123195123196123197123198123199123200123201123202123203123204123205123206123207123208123209123210123211123212123213123214123215123216123217123218123219123220123221123222123223123224123225123226123227123228123229123230123231123232123233123234123235123236123237123238123239123240123241123242123243123244123245123246123247123248123249123250123251123252123253123254123255123256123257123258123259123260123261123262123263123264123265123266123267123268123269123270123271123272123273123274123275123276123277123278123279123280123281123282123283123284123285123286123287123288123289123290123291123292123293123294123295123296123297123298123299123300123301123302123303123304123305123306123307123308123309123310123311123312123313123314123315123316123317123318123319123320123321123322123323123324123325123326123327123328123329123330123331123332123333123334123335123336123337123338123339123340123341123342123343123344123345123346123347123348123349123350123351123352123353123354123355123356123357123358123359123360123361123362123363123364123365123366123367123368123369123370123371123372123373123374123375123376123377123378123379123380123381123382123383123384123385123386123387123388123389123390123391123392123393123394123395123396123397123398123399123400123401123402123403123404123405123406123407123408123409123410123411123412123413123414123415123416123417123418123419123420123421123422123423123424123425123426123427123428123429123430123431123432123433123434123435123436123437123438123439123440123441123442123443123444123445123446123447123448123449123450123451123452123453123454123455123456123457123458123459123460123461123462123463123464123465123466123467123468123469123470123471123472123473123474123475123476123477123478123479123480123481123482123483123484123485123486123487123488123489123490123491123492123493123494123495123496123497123498123499123500123501123502123503123504123505123506123507123508123509123510123511123512123513123514123515123516123517123518123519123520123521123522123523123524123525123526123527123528123529123530123531123532123533123534123535123536123537123538123539123540123541123542123543123544123545123546123547123548123549123550123551123552123553123554123555123556123557123558123559123560123561123562123563123564123565123566123567123568123569123570123571123572123573123574123575123576123577123578123579123580123581123582123583123584123585123586123587123588123589123590123591123592123593123594123595123596123597123598123599123600123601123602123603123604123605123606123607123608123609123610123611123612123613123614123615123616123617123618123619123620123621123622123623123624123625123626123627123628123629123630123631123632123633123634123635123636123637123638123639123640123641123642123643123644123645123646123647123648123649123650123651123652123653123654123655123656123657123658123659123660123661123662123663123664123665123666123667123668123669123670123671123672123673123674123675123676123677123678123679123680123681123682123683123684123685123686123687123688123689123690123691123692123693123694123695123696123697123698123699123700123701123702123703123704123705123706123707123708123709123710123711123712123713123714123715123716123717123718123719123720123721123722123723123724123725123726123727123728123729123730123731123732123733123734123735123736123737123738123739123740123741123742123743123744123745123746123747123748123749123750123751123752123753123754123755123756123757123758123759123760123761123762123763123764123765123766123767123768123769123770123771123772123773123774123775123776123777123778123779123780123781123782123783123784123785123786123787123788123789123790123791123792123793123794123795123796123797123798123799123800123801123802123803123804123805123806123807123808123809123810123811123812123813123814123815123816123817123818123819123820123821123822123823123824123825123826123827123828123829123830123831123832123833123834123835123836123837123838123839123840123841123842123843123844123845123846123847123848123849123850123851123852123853123854123855123856123857123858123859123860123861123862123863123864123865123866123867123868123869123870123871123872123873123874123875123876123877123878123879123880123881123882123883123884123885123886123887123888123889123890123891123892123893123894123895123896123897123898123899123900123901123902123903123904123905123906123907123908123909123910123911123912123913123914123915123916123917123918123919123920123921123922123923123924123925123926123927123928123929123930123931123932123933123934123935123936123937123938123939123940123941123942123943123944123945123946123947123948123949123950123951123952123953123954123955123956123957123958123959123960123961123962123963123964123965123966123967123968123969123970123971123972123973123974123975123976123977123978123979123980123981123982123983123984123985123986123987123988123989123990123991123992123993123994123995123996123997123998123999124000124001124002124003124004124005124006124007124008124009124010124011124012124013124014124015124016124017124018124019124020124021124022124023124024124025124026124027124028124029124030124031124032124033124034124035124036124037124038124039124040124041124042124043124044124045124046124047124048124049124050124051124052124053124054124055124056124057124058124059124060124061124062124063124064124065124066124067124068124069124070124071124072124073124074124075124076124077124078124079124080124081124082124083124084124085124086124087124088124089124090124091124092124093124094124095124096124097124098124099124100124101124102124103124104124105124106124107124108124109124110124111124112124113124114124115124116124117124118124119124120124121124122124123124124124125124126124127124128124129124130124131124132124133124134124135124136124137124138124139124140124141124142124143124144124145124146124147124148124149124150124151124152124153124154124155124156124157124158124159124160124161124162124163124164124165124166124167124168124169124170124171124172124173124174124175124176124177124178124179124180124181124182124183124184124185124186124187124188124189124190124191124192124193124194124195124196124197124198124199124200124201124202124203124204124205124206124207124208124209124210124211124212124213124214124215124216124217124218124219124220124221124222124223124224124225124226124227124228124229124230124231124232124233124234124235124236124237124238124239124240124241124242124243124244124245124246124247124248124249124250124251124252124253124254124255124256124257124258124259124260124261124262124263124264124265124266124267124268124269124270124271124272124273124274124275124276124277124278124279124280124281124282124283124284124285124286124287124288124289124290124291124292124293124294124295124296124297124298124299124300124301124302124303124304124305124306124307124308124309124310124311124312124313124314124315124316124317124318124319124320124321124322124323124324124325124326124327124328124329124330124331124332124333124334124335124336124337124338124339124340124341124342124343124344124345124346124347124348124349124350124351124352124353124354124355124356124357124358124359124360124361124362124363124364124365124366124367124368124369124370124371124372124373124374124375124376124377124378124379124380124381124382124383124384124385124386124387124388124389124390124391124392124393124394124395124396124397124398124399124400124401124402124403124404124405124406124407124408124409124410124411124412124413124414124415124416124417124418124419124420124421124422124423124424124425124426124427124428124429124430124431124432124433124434124435124436124437124438124439124440124441124442124443124444124445124446124447124448124449124450124451124452124453124454124455124456124457124458124459124460124461124462124463124464124465124466124467124468124469124470124471124472124473124474124475124476124477124478124479124480124481124482124483124484124485124486124487124488124489124490124491124492124493124494124495124496124497124498124499124500124501124502124503124504124505124506124507124508124509124510124511124512124513124514124515124516124517124518124519124520124521124522124523124524124525124526124527124528124529124530124531124532124533124534124535124536124537124538124539124540124541124542124543124544124545124546124547124548124549124550124551124552124553124554124555124556124557124558124559124560124561124562124563124564124565124566124567124568124569124570124571124572124573124574124575124576124577124578124579124580124581124582124583124584124585124586124587124588124589124590124591124592124593124594124595124596124597124598124599124600124601124602124603124604124605124606124607124608124609124610124611124612124613124614124615124616124617124618
  1. [/
  2. / Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  3. /
  4. / Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. /]
  7. [section:reference Reference]
  8. [xinclude quickref.xml]
  9. [include requirements/asynchronous_operations.qbk]
  10. [include requirements/read_write_operations.qbk]
  11. [include requirements/synchronous_socket_operations.qbk]
  12. [include requirements/asynchronous_socket_operations.qbk]
  13. [include requirements/AcceptableProtocol.qbk]
  14. [include requirements/AcceptHandler.qbk]
  15. [include requirements/AsyncRandomAccessReadDevice.qbk]
  16. [include requirements/AsyncRandomAccessWriteDevice.qbk]
  17. [include requirements/AsyncReadStream.qbk]
  18. [include requirements/AsyncWriteStream.qbk]
  19. [include requirements/BufferedHandshakeHandler.qbk]
  20. [include requirements/CompletionCondition.qbk]
  21. [include requirements/CompletionHandler.qbk]
  22. [include requirements/ConnectCondition.qbk]
  23. [include requirements/ConnectHandler.qbk]
  24. [include requirements/ConstBufferSequence.qbk]
  25. [include requirements/DynamicBuffer.qbk]
  26. [include requirements/DynamicBuffer_v1.qbk]
  27. [include requirements/DynamicBuffer_v2.qbk]
  28. [include requirements/Endpoint.qbk]
  29. [include requirements/EndpointSequence.qbk]
  30. [include requirements/ExecutionContext.qbk]
  31. [include requirements/Executor.qbk]
  32. [include requirements/GettableSerialPortOption.qbk]
  33. [include requirements/GettableSocketOption.qbk]
  34. [include requirements/Handler.qbk]
  35. [include requirements/HandshakeHandler.qbk]
  36. [include requirements/InternetProtocol.qbk]
  37. [include requirements/IoControlCommand.qbk]
  38. [include requirements/IoObjectService.qbk]
  39. [include requirements/IteratorConnectHandler.qbk]
  40. [include requirements/LegacyCompletionHandler.qbk]
  41. [include requirements/MoveAcceptHandler.qbk]
  42. [include requirements/MutableBufferSequence.qbk]
  43. [include requirements/ProtoAllocator.qbk]
  44. [include requirements/Protocol.qbk]
  45. [include requirements/RangeConnectHandler.qbk]
  46. [include requirements/ReadHandler.qbk]
  47. [include requirements/ResolveHandler.qbk]
  48. [include requirements/Service.qbk]
  49. [include requirements/SettableSerialPortOption.qbk]
  50. [include requirements/SettableSocketOption.qbk]
  51. [include requirements/ShutdownHandler.qbk]
  52. [include requirements/SignalHandler.qbk]
  53. [include requirements/SyncRandomAccessReadDevice.qbk]
  54. [include requirements/SyncRandomAccessWriteDevice.qbk]
  55. [include requirements/SyncReadStream.qbk]
  56. [include requirements/SyncWriteStream.qbk]
  57. [include requirements/TimeTraits.qbk]
  58. [include requirements/WaitHandler.qbk]
  59. [include requirements/WaitTraits.qbk]
  60. [include requirements/WriteHandler.qbk]
  61. [section:asio_handler_allocate asio_handler_allocate]
  62. [indexterm1 boost_asio.indexterm.asio_handler_allocate..asio_handler_allocate]
  63. Default allocation function for handlers.
  64. void * asio_handler_allocate(
  65. std::size_t size,
  66. ... );
  67. Asynchronous operations may need to allocate temporary objects. Since asynchronous operations have a handler function object, these temporary objects can be said to be associated with the handler.
  68. Implement asio\_handler\_allocate and asio\_handler\_deallocate for your own handlers to provide custom allocation for these temporary objects.
  69. The default implementation of these allocation hooks uses `operator new` and `operator delete`.
  70. [heading Remarks]
  71. All temporary objects associated with a handler will be deallocated before the upcall to the handler is performed. This allows the same memory to be reused for a subsequent asynchronous operation initiated by the handler.
  72. [heading Example]
  73. class my_handler;
  74. void* asio_handler_allocate(std::size_t size, my_handler* context)
  75. {
  76. return ::operator new(size);
  77. }
  78. void asio_handler_deallocate(void* pointer, std::size_t size,
  79. my_handler* context)
  80. {
  81. ::operator delete(pointer);
  82. }
  83. [heading Requirements]
  84. ['Header: ][^boost/asio/handler_alloc_hook.hpp]
  85. ['Convenience header: ][^boost/asio.hpp]
  86. [endsect]
  87. [section:asio_handler_deallocate asio_handler_deallocate]
  88. [indexterm1 boost_asio.indexterm.asio_handler_deallocate..asio_handler_deallocate]
  89. Default deallocation function for handlers.
  90. void asio_handler_deallocate(
  91. void * pointer,
  92. std::size_t size,
  93. ... );
  94. Implement asio\_handler\_allocate and asio\_handler\_deallocate for your own handlers to provide custom allocation for the associated temporary objects.
  95. The default implementation of these allocation hooks uses `operator new` and `operator delete`.
  96. [heading Requirements]
  97. ['Header: ][^boost/asio/handler_alloc_hook.hpp]
  98. ['Convenience header: ][^boost/asio.hpp]
  99. [endsect]
  100. [section:asio_handler_invoke asio_handler_invoke]
  101. [indexterm1 boost_asio.indexterm.asio_handler_invoke..asio_handler_invoke]
  102. Default invoke function for handlers.
  103. Default handler invocation hook used for non-const function objects.
  104. template<
  105. typename Function>
  106. void ``[link boost_asio.reference.asio_handler_invoke.overload1 asio_handler_invoke]``(
  107. Function & function,
  108. ... );
  109. `` [''''&raquo;''' [link boost_asio.reference.asio_handler_invoke.overload1 more...]]``
  110. Default handler invocation hook used for const function objects.
  111. template<
  112. typename Function>
  113. void ``[link boost_asio.reference.asio_handler_invoke.overload2 asio_handler_invoke]``(
  114. const Function & function,
  115. ... );
  116. `` [''''&raquo;''' [link boost_asio.reference.asio_handler_invoke.overload2 more...]]``
  117. Completion handlers for asynchronous operations are invoked by the [link boost_asio.reference.io_context `io_context`] associated with the corresponding object (e.g. a socket or deadline\_timer). Certain guarantees are made on when the handler may be invoked, in particular that a handler can only be invoked from a thread that is currently calling `run()` on the corresponding [link boost_asio.reference.io_context `io_context`] object. Handlers may subsequently be invoked through other objects (such as [link boost_asio.reference.io_context__strand `io_context::strand`] objects) that provide additional guarantees.
  118. When asynchronous operations are composed from other asynchronous operations, all intermediate handlers should be invoked using the same method as the final handler. This is required to ensure that user-defined objects are not accessed in a way that may violate the guarantees. This hooking function ensures that the invoked method used for the final handler is accessible at each intermediate step.
  119. Implement asio\_handler\_invoke for your own handlers to specify a custom invocation strategy.
  120. This default implementation invokes the function object like so:
  121. function();
  122. If necessary, the default implementation makes a copy of the function object so that the non-const operator() can be used.
  123. [heading Example]
  124. class my_handler;
  125. template <typename Function>
  126. void asio_handler_invoke(Function function, my_handler* context)
  127. {
  128. context->strand_.dispatch(function);
  129. }
  130. [heading Requirements]
  131. ['Header: ][^boost/asio/handler_invoke_hook.hpp]
  132. ['Convenience header: ][^boost/asio.hpp]
  133. [section:overload1 asio_handler_invoke (1 of 2 overloads)]
  134. Default handler invocation hook used for non-const function objects.
  135. template<
  136. typename Function>
  137. void asio_handler_invoke(
  138. Function & function,
  139. ... );
  140. [endsect]
  141. [section:overload2 asio_handler_invoke (2 of 2 overloads)]
  142. Default handler invocation hook used for const function objects.
  143. template<
  144. typename Function>
  145. void asio_handler_invoke(
  146. const Function & function,
  147. ... );
  148. [endsect]
  149. [endsect]
  150. [section:asio_handler_is_continuation asio_handler_is_continuation]
  151. [indexterm1 boost_asio.indexterm.asio_handler_is_continuation..asio_handler_is_continuation]
  152. Default continuation function for handlers.
  153. bool asio_handler_is_continuation(
  154. ... );
  155. Asynchronous operations may represent a continuation of the asynchronous control flow associated with the current handler. The implementation can use this knowledge to optimise scheduling of the handler.
  156. Implement asio\_handler\_is\_continuation for your own handlers to indicate when a handler represents a continuation.
  157. The default implementation of the continuation hook returns `false`.
  158. [heading Example]
  159. class my_handler;
  160. bool asio_handler_is_continuation(my_handler* context)
  161. {
  162. return true;
  163. }
  164. [heading Requirements]
  165. ['Header: ][^boost/asio/handler_continuation_hook.hpp]
  166. ['Convenience header: ][^boost/asio.hpp]
  167. [endsect]
  168. [section:associated_allocator associated_allocator]
  169. Traits type used to obtain the allocator associated with an object.
  170. template<
  171. typename T,
  172. typename Allocator = std::allocator<void>>
  173. struct associated_allocator
  174. [heading Types]
  175. [table
  176. [[Name][Description]]
  177. [
  178. [[link boost_asio.reference.associated_allocator.type [*type]]]
  179. [If T has a nested type allocator_type, T::allocator_type. Otherwise Allocator. ]
  180. ]
  181. ]
  182. [heading Member Functions]
  183. [table
  184. [[Name][Description]]
  185. [
  186. [[link boost_asio.reference.associated_allocator.get [*get]]]
  187. [If T has a nested type allocator_type, returns t.get_allocator(). Otherwise returns a. ]
  188. ]
  189. ]
  190. A program may specialise this traits type if the `T` template parameter in the specialisation is a user-defined type. The template parameter `Allocator` shall be a type meeting the Allocator requirements.
  191. Specialisations shall meet the following requirements, where `t` is a const reference to an object of type `T`, and `a` is an object of type `Allocator`.
  192. * Provide a nested typedef `type` that identifies a type meeting the Allocator requirements.
  193. * Provide a noexcept static member function named `get`, callable as `get(t)` and with return type `type`.
  194. * Provide a noexcept static member function named `get`, callable as `get(t,a)` and with return type `type`.
  195. [heading Requirements]
  196. ['Header: ][^boost/asio/associated_allocator.hpp]
  197. ['Convenience header: ][^boost/asio.hpp]
  198. [section:get associated_allocator::get]
  199. [indexterm2 boost_asio.indexterm.associated_allocator.get..get..associated_allocator]
  200. If `T` has a nested type `allocator_type`, returns `t.get_allocator()`. Otherwise returns `a`.
  201. static type get(
  202. const T & t,
  203. const Allocator & a = Allocator());
  204. [endsect]
  205. [section:type associated_allocator::type]
  206. [indexterm2 boost_asio.indexterm.associated_allocator.type..type..associated_allocator]
  207. If `T` has a nested type `allocator_type`, `T::allocator_type`. Otherwise `Allocator`.
  208. typedef see_below type;
  209. [heading Requirements]
  210. ['Header: ][^boost/asio/associated_allocator.hpp]
  211. ['Convenience header: ][^boost/asio.hpp]
  212. [endsect]
  213. [endsect]
  214. [section:associated_executor associated_executor]
  215. Traits type used to obtain the executor associated with an object.
  216. template<
  217. typename T,
  218. typename ``[link boost_asio.reference.Executor1 Executor]`` = system_executor>
  219. struct associated_executor
  220. [heading Types]
  221. [table
  222. [[Name][Description]]
  223. [
  224. [[link boost_asio.reference.associated_executor.type [*type]]]
  225. [If T has a nested type executor_type, T::executor_type. Otherwise Executor. ]
  226. ]
  227. ]
  228. [heading Member Functions]
  229. [table
  230. [[Name][Description]]
  231. [
  232. [[link boost_asio.reference.associated_executor.get [*get]]]
  233. [If T has a nested type executor_type, returns t.get_executor(). Otherwise returns ex. ]
  234. ]
  235. ]
  236. A program may specialise this traits type if the `T` template parameter in the specialisation is a user-defined type. The template parameter `Executor` shall be a type meeting the Executor requirements.
  237. Specialisations shall meet the following requirements, where `t` is a const reference to an object of type `T`, and `e` is an object of type `Executor`.
  238. * Provide a nested typedef `type` that identifies a type meeting the Executor requirements.
  239. * Provide a noexcept static member function named `get`, callable as `get(t)` and with return type `type`.
  240. * Provide a noexcept static member function named `get`, callable as `get(t,e)` and with return type `type`.
  241. [heading Requirements]
  242. ['Header: ][^boost/asio/associated_executor.hpp]
  243. ['Convenience header: ][^boost/asio.hpp]
  244. [section:get associated_executor::get]
  245. [indexterm2 boost_asio.indexterm.associated_executor.get..get..associated_executor]
  246. If `T` has a nested type `executor_type`, returns `t.get_executor()`. Otherwise returns `ex`.
  247. static type get(
  248. const T & t,
  249. const Executor & ex = Executor());
  250. [endsect]
  251. [section:type associated_executor::type]
  252. [indexterm2 boost_asio.indexterm.associated_executor.type..type..associated_executor]
  253. If `T` has a nested type `executor_type`, `T::executor_type`. Otherwise `Executor`.
  254. typedef see_below type;
  255. [heading Requirements]
  256. ['Header: ][^boost/asio/associated_executor.hpp]
  257. ['Convenience header: ][^boost/asio.hpp]
  258. [endsect]
  259. [endsect]
  260. [section:async_completion async_completion]
  261. Helper template to deduce the handler type from a CompletionToken, capture a local copy of the handler, and then create an [link boost_asio.reference.async_result `async_result`] for the handler.
  262. template<
  263. typename CompletionToken,
  264. typename Signature>
  265. struct async_completion
  266. [heading Types]
  267. [table
  268. [[Name][Description]]
  269. [
  270. [[link boost_asio.reference.async_completion.completion_handler_type [*completion_handler_type]]]
  271. [The real handler type to be used for the asynchronous operation. ]
  272. ]
  273. ]
  274. [heading Member Functions]
  275. [table
  276. [[Name][Description]]
  277. [
  278. [[link boost_asio.reference.async_completion.async_completion [*async_completion]]]
  279. [Constructor. ]
  280. ]
  281. ]
  282. [heading Data Members]
  283. [table
  284. [[Name][Description]]
  285. [
  286. [[link boost_asio.reference.async_completion.completion_handler [*completion_handler]]]
  287. [A copy of, or reference to, a real handler object. ]
  288. ]
  289. [
  290. [[link boost_asio.reference.async_completion.result [*result]]]
  291. [The result of the asynchronous operation's initiating function. ]
  292. ]
  293. ]
  294. [heading Requirements]
  295. ['Header: ][^boost/asio/async_result.hpp]
  296. ['Convenience header: ][^boost/asio.hpp]
  297. [section:async_completion async_completion::async_completion]
  298. [indexterm2 boost_asio.indexterm.async_completion.async_completion..async_completion..async_completion]
  299. Constructor.
  300. async_completion(
  301. CompletionToken & token);
  302. The constructor creates the concrete completion handler and makes the link between the handler and the asynchronous result.
  303. [endsect]
  304. [section:completion_handler async_completion::completion_handler]
  305. [indexterm2 boost_asio.indexterm.async_completion.completion_handler..completion_handler..async_completion]
  306. A copy of, or reference to, a real handler object.
  307. conditional< is_same< CompletionToken, completion_handler_type >::value, completion_handler_type &, completion_handler_type >::type completion_handler;
  308. [endsect]
  309. [section:completion_handler_type async_completion::completion_handler_type]
  310. [indexterm2 boost_asio.indexterm.async_completion.completion_handler_type..completion_handler_type..async_completion]
  311. The real handler type to be used for the asynchronous operation.
  312. typedef boost::asio::async_result< typename decay< CompletionToken >::type, Signature >::completion_handler_type completion_handler_type;
  313. [heading Types]
  314. [table
  315. [[Name][Description]]
  316. [
  317. [[link boost_asio.reference.async_result.completion_handler_type [*completion_handler_type]]]
  318. [The concrete completion handler type for the specific signature. ]
  319. ]
  320. [
  321. [[link boost_asio.reference.async_result.return_type [*return_type]]]
  322. [The return type of the initiating function. ]
  323. ]
  324. ]
  325. [heading Member Functions]
  326. [table
  327. [[Name][Description]]
  328. [
  329. [[link boost_asio.reference.async_result.async_result [*async_result]]]
  330. [Construct an async result from a given handler. ]
  331. ]
  332. [
  333. [[link boost_asio.reference.async_result.get [*get]]]
  334. [Obtain the value to be returned from the initiating function. ]
  335. ]
  336. [
  337. [[link boost_asio.reference.async_result.initiate [*initiate]]]
  338. [Initiate the asynchronous operation that will produce the result, and obtain the value to be returned from the initiating function. ]
  339. ]
  340. ]
  341. The [link boost_asio.reference.async_result `async_result`] traits class is used for determining:
  342. * the concrete completion handler type to be called at the end of the asynchronous operation;
  343. * the initiating function return type; and
  344. * how the return value of the initiating function is obtained.
  345. The trait allows the handler and return types to be determined at the point where the specific completion handler signature is known.
  346. This template may be specialised for user-defined completion token types. The primary template assumes that the CompletionToken is the completion handler.
  347. [heading Requirements]
  348. ['Header: ][^boost/asio/async_result.hpp]
  349. ['Convenience header: ][^boost/asio.hpp]
  350. [endsect]
  351. [section:result async_completion::result]
  352. [indexterm2 boost_asio.indexterm.async_completion.result..result..async_completion]
  353. The result of the asynchronous operation's initiating function.
  354. async_result< typename decay< CompletionToken >::type, Signature > result;
  355. [endsect]
  356. [endsect]
  357. [section:async_compose async_compose]
  358. [indexterm1 boost_asio.indexterm.async_compose..async_compose]
  359. Launch an asynchronous operation with a stateful implementation.
  360. template<
  361. typename CompletionToken,
  362. typename Signature,
  363. typename Implementation,
  364. typename... IoObjectsOrExecutors>
  365. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_compose(
  366. Implementation && implementation,
  367. CompletionToken & token,
  368. IoObjectsOrExecutors &&... io_objects_or_executors);
  369. The async\_compose function simplifies the implementation of composed asynchronous operations automatically wrapping a stateful function object with a conforming intermediate completion handler.
  370. [heading Parameters]
  371. [variablelist
  372. [[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.]]
  373. [[token][The completion token.]]
  374. [[io_objects_or_executors][Zero or more I/O objects or I/O executors for which outstanding work must be maintained.]]
  375. ]
  376. [heading Example:]
  377. struct async_echo_implementation
  378. {
  379. tcp::socket& socket_;
  380. boost::asio::mutable_buffer buffer_;
  381. enum { starting, reading, writing } state_;
  382. template <typename Self>
  383. void operator()(Self& self,
  384. boost::system::error_code error = {},
  385. std::size_t n = 0)
  386. {
  387. switch (state_)
  388. {
  389. case starting:
  390. state_ = reading;
  391. socket_.async_read_some(
  392. buffer_, std::move(self));
  393. break;
  394. case reading:
  395. if (error)
  396. {
  397. self.complete(error, 0);
  398. }
  399. else
  400. {
  401. state_ = writing;
  402. boost::asio::async_write(socket_, buffer_,
  403. boost::asio::transfer_exactly(n),
  404. std::move(self));
  405. }
  406. break;
  407. case writing:
  408. self.complete(error, n);
  409. break;
  410. }
  411. }
  412. };
  413. template <typename CompletionToken>
  414. auto async_echo(tcp::socket& socket,
  415. boost::asio::mutable_buffer buffer,
  416. CompletionToken&& token) ->
  417. typename boost::asio::async_result<
  418. typename std::decay<CompletionToken>::type,
  419. void(boost::system::error_code, std::size_t)>::return_type
  420. {
  421. return boost::asio::async_compose<CompletionToken,
  422. void(boost::system::error_code, std::size_t)>(
  423. async_echo_implementation{socket, buffer,
  424. async_echo_implementation::starting},
  425. token, socket);
  426. }
  427. [heading Requirements]
  428. ['Header: ][^boost/asio/compose.hpp]
  429. ['Convenience header: ][^boost/asio.hpp]
  430. [endsect]
  431. [section:async_connect async_connect]
  432. [indexterm1 boost_asio.indexterm.async_connect..async_connect]
  433. The `async_connect` function is a composed asynchronous operation that establishes a socket connection by trying each endpoint in a sequence.
  434. Asynchronously establishes a socket connection by trying each endpoint in a sequence.
  435. template<
  436. typename ``[link boost_asio.reference.Protocol Protocol]``,
  437. typename ``[link boost_asio.reference.Executor1 Executor]``,
  438. typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``,
  439. typename ``[link boost_asio.reference.RangeConnectHandler RangeConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  440. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_connect.overload1 async_connect]``(
  441. basic_socket< Protocol, Executor > & s,
  442. const EndpointSequence & endpoints,
  443. RangeConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  444. typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type * = 0);
  445. `` [''''&raquo;''' [link boost_asio.reference.async_connect.overload1 more...]]``
  446. (Deprecated: Use range overload.) Asynchronously establishes a socket connection by trying each endpoint in a sequence.
  447. template<
  448. typename ``[link boost_asio.reference.Protocol Protocol]``,
  449. typename ``[link boost_asio.reference.Executor1 Executor]``,
  450. typename Iterator,
  451. typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  452. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_connect.overload2 async_connect]``(
  453. basic_socket< Protocol, Executor > & s,
  454. Iterator begin,
  455. IteratorConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  456. typename enable_if<!is_endpoint_sequence< Iterator >::value >::type * = 0);
  457. `` [''''&raquo;''' [link boost_asio.reference.async_connect.overload2 more...]]``
  458. Asynchronously establishes a socket connection by trying each endpoint in a sequence.
  459. template<
  460. typename ``[link boost_asio.reference.Protocol Protocol]``,
  461. typename ``[link boost_asio.reference.Executor1 Executor]``,
  462. typename Iterator,
  463. typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  464. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_connect.overload3 async_connect]``(
  465. basic_socket< Protocol, Executor > & s,
  466. Iterator begin,
  467. Iterator end,
  468. IteratorConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  469. `` [''''&raquo;''' [link boost_asio.reference.async_connect.overload3 more...]]``
  470. template<
  471. typename ``[link boost_asio.reference.Protocol Protocol]``,
  472. typename ``[link boost_asio.reference.Executor1 Executor]``,
  473. typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``,
  474. typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``,
  475. typename ``[link boost_asio.reference.RangeConnectHandler RangeConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  476. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_connect.overload4 async_connect]``(
  477. basic_socket< Protocol, Executor > & s,
  478. const EndpointSequence & endpoints,
  479. ConnectCondition connect_condition,
  480. RangeConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  481. typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type * = 0);
  482. `` [''''&raquo;''' [link boost_asio.reference.async_connect.overload4 more...]]``
  483. (Deprecated: Use range overload.) Asynchronously establishes a socket connection by trying each endpoint in a sequence.
  484. template<
  485. typename ``[link boost_asio.reference.Protocol Protocol]``,
  486. typename ``[link boost_asio.reference.Executor1 Executor]``,
  487. typename Iterator,
  488. typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``,
  489. typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  490. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_connect.overload5 async_connect]``(
  491. basic_socket< Protocol, Executor > & s,
  492. Iterator begin,
  493. ConnectCondition connect_condition,
  494. IteratorConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  495. typename enable_if<!is_endpoint_sequence< Iterator >::value >::type * = 0);
  496. `` [''''&raquo;''' [link boost_asio.reference.async_connect.overload5 more...]]``
  497. Asynchronously establishes a socket connection by trying each endpoint in a sequence.
  498. template<
  499. typename ``[link boost_asio.reference.Protocol Protocol]``,
  500. typename ``[link boost_asio.reference.Executor1 Executor]``,
  501. typename Iterator,
  502. typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``,
  503. typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  504. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_connect.overload6 async_connect]``(
  505. basic_socket< Protocol, Executor > & s,
  506. Iterator begin,
  507. Iterator end,
  508. ConnectCondition connect_condition,
  509. IteratorConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  510. `` [''''&raquo;''' [link boost_asio.reference.async_connect.overload6 more...]]``
  511. [heading Requirements]
  512. ['Header: ][^boost/asio/connect.hpp]
  513. ['Convenience header: ][^boost/asio.hpp]
  514. [section:overload1 async_connect (1 of 6 overloads)]
  515. Asynchronously establishes a socket connection by trying each endpoint in a sequence.
  516. template<
  517. typename ``[link boost_asio.reference.Protocol Protocol]``,
  518. typename ``[link boost_asio.reference.Executor1 Executor]``,
  519. typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``,
  520. typename ``[link boost_asio.reference.RangeConnectHandler RangeConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  521. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect(
  522. basic_socket< Protocol, Executor > & s,
  523. const EndpointSequence & endpoints,
  524. RangeConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  525. typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type * = 0);
  526. This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `async_connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
  527. [heading Parameters]
  528. [variablelist
  529. [[s][The socket to be connected. If the socket is already open, it will be closed.]]
  530. [[endpoints][A sequence of endpoints.]]
  531. [[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:
  532. ``
  533. void handler(
  534. // Result of operation. if the sequence is empty, set to
  535. // boost::asio::error::not_found. Otherwise, contains the
  536. // error from the last connection attempt.
  537. const boost::system::error_code& error,
  538. // On success, the successfully connected endpoint.
  539. // Otherwise, a default-constructed endpoint.
  540. const typename Protocol::endpoint& endpoint
  541. );
  542. ``
  543. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  544. ]
  545. [heading Example]
  546. tcp::resolver r(my_context);
  547. tcp::resolver::query q("host", "service");
  548. tcp::socket s(my_context);
  549. // ...
  550. r.async_resolve(q, resolve_handler);
  551. // ...
  552. void resolve_handler(
  553. const boost::system::error_code& ec,
  554. tcp::resolver::results_type results)
  555. {
  556. if (!ec)
  557. {
  558. boost::asio::async_connect(s, results, connect_handler);
  559. }
  560. }
  561. // ...
  562. void connect_handler(
  563. const boost::system::error_code& ec,
  564. const tcp::endpoint& endpoint)
  565. {
  566. // ...
  567. }
  568. [endsect]
  569. [section:overload2 async_connect (2 of 6 overloads)]
  570. (Deprecated: Use range overload.) Asynchronously establishes a socket connection by trying each endpoint in a sequence.
  571. template<
  572. typename ``[link boost_asio.reference.Protocol Protocol]``,
  573. typename ``[link boost_asio.reference.Executor1 Executor]``,
  574. typename Iterator,
  575. typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  576. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect(
  577. basic_socket< Protocol, Executor > & s,
  578. Iterator begin,
  579. IteratorConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  580. typename enable_if<!is_endpoint_sequence< Iterator >::value >::type * = 0);
  581. This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `async_connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
  582. [heading Parameters]
  583. [variablelist
  584. [[s][The socket to be connected. If the socket is already open, it will be closed.]]
  585. [[begin][An iterator pointing to the start of a sequence of endpoints.]]
  586. [[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:
  587. ``
  588. void handler(
  589. // Result of operation. if the sequence is empty, set to
  590. // boost::asio::error::not_found. Otherwise, contains the
  591. // error from the last connection attempt.
  592. const boost::system::error_code& error,
  593. // On success, an iterator denoting the successfully
  594. // connected endpoint. Otherwise, the end iterator.
  595. Iterator iterator
  596. );
  597. ``
  598. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  599. ]
  600. [heading Remarks]
  601. This overload assumes that a default constructed object of type `Iterator` represents the end of the sequence. This is a valid assumption for iterator types such as `boost::asio::ip::tcp::resolver::iterator`.
  602. [endsect]
  603. [section:overload3 async_connect (3 of 6 overloads)]
  604. Asynchronously establishes a socket connection by trying each endpoint in a sequence.
  605. template<
  606. typename ``[link boost_asio.reference.Protocol Protocol]``,
  607. typename ``[link boost_asio.reference.Executor1 Executor]``,
  608. typename Iterator,
  609. typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  610. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect(
  611. basic_socket< Protocol, Executor > & s,
  612. Iterator begin,
  613. Iterator end,
  614. IteratorConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  615. This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `async_connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
  616. [heading Parameters]
  617. [variablelist
  618. [[s][The socket to be connected. If the socket is already open, it will be closed.]]
  619. [[begin][An iterator pointing to the start of a sequence of endpoints.]]
  620. [[end][An iterator pointing to the end of a sequence of endpoints.]]
  621. [[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:
  622. ``
  623. void handler(
  624. // Result of operation. if the sequence is empty, set to
  625. // boost::asio::error::not_found. Otherwise, contains the
  626. // error from the last connection attempt.
  627. const boost::system::error_code& error,
  628. // On success, an iterator denoting the successfully
  629. // connected endpoint. Otherwise, the end iterator.
  630. Iterator iterator
  631. );
  632. ``
  633. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  634. ]
  635. [heading Example]
  636. std::vector<tcp::endpoint> endpoints = ...;
  637. tcp::socket s(my_context);
  638. boost::asio::async_connect(s,
  639. endpoints.begin(), endpoints.end(),
  640. connect_handler);
  641. // ...
  642. void connect_handler(
  643. const boost::system::error_code& ec,
  644. std::vector<tcp::endpoint>::iterator i)
  645. {
  646. // ...
  647. }
  648. [endsect]
  649. [section:overload4 async_connect (4 of 6 overloads)]
  650. Asynchronously establishes a socket connection by trying each endpoint in a sequence.
  651. template<
  652. typename ``[link boost_asio.reference.Protocol Protocol]``,
  653. typename ``[link boost_asio.reference.Executor1 Executor]``,
  654. typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``,
  655. typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``,
  656. typename ``[link boost_asio.reference.RangeConnectHandler RangeConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  657. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect(
  658. basic_socket< Protocol, Executor > & s,
  659. const EndpointSequence & endpoints,
  660. ConnectCondition connect_condition,
  661. RangeConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  662. typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type * = 0);
  663. This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `async_connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
  664. [heading Parameters]
  665. [variablelist
  666. [[s][The socket to be connected. If the socket is already open, it will be closed.]]
  667. [[endpoints][A sequence of endpoints.]]
  668. [[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be:
  669. ``
  670. bool connect_condition(
  671. const boost::system::error_code& ec,
  672. const typename Protocol::endpoint& next);
  673. ``
  674. The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is the next endpoint to be tried. The function object should return true if the next endpoint should be tried, and false if it should be skipped.]]
  675. [[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:
  676. ``
  677. void handler(
  678. // Result of operation. if the sequence is empty, set to
  679. // boost::asio::error::not_found. Otherwise, contains the
  680. // error from the last connection attempt.
  681. const boost::system::error_code& error,
  682. // On success, an iterator denoting the successfully
  683. // connected endpoint. Otherwise, the end iterator.
  684. Iterator iterator
  685. );
  686. ``
  687. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  688. ]
  689. [heading Example]
  690. The following connect condition function object can be used to output information about the individual connection attempts:
  691. struct my_connect_condition
  692. {
  693. bool operator()(
  694. const boost::system::error_code& ec,
  695. const::tcp::endpoint& next)
  696. {
  697. if (ec) std::cout << "Error: " << ec.message() << std::endl;
  698. std::cout << "Trying: " << next << std::endl;
  699. return true;
  700. }
  701. };
  702. It would be used with the `boost::asio::connect` function as follows:
  703. tcp::resolver r(my_context);
  704. tcp::resolver::query q("host", "service");
  705. tcp::socket s(my_context);
  706. // ...
  707. r.async_resolve(q, resolve_handler);
  708. // ...
  709. void resolve_handler(
  710. const boost::system::error_code& ec,
  711. tcp::resolver::results_type results)
  712. {
  713. if (!ec)
  714. {
  715. boost::asio::async_connect(s, results,
  716. my_connect_condition(),
  717. connect_handler);
  718. }
  719. }
  720. // ...
  721. void connect_handler(
  722. const boost::system::error_code& ec,
  723. const tcp::endpoint& endpoint)
  724. {
  725. if (ec)
  726. {
  727. // An error occurred.
  728. }
  729. else
  730. {
  731. std::cout << "Connected to: " << endpoint << std::endl;
  732. }
  733. }
  734. [endsect]
  735. [section:overload5 async_connect (5 of 6 overloads)]
  736. (Deprecated: Use range overload.) Asynchronously establishes a socket connection by trying each endpoint in a sequence.
  737. template<
  738. typename ``[link boost_asio.reference.Protocol Protocol]``,
  739. typename ``[link boost_asio.reference.Executor1 Executor]``,
  740. typename Iterator,
  741. typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``,
  742. typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  743. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect(
  744. basic_socket< Protocol, Executor > & s,
  745. Iterator begin,
  746. ConnectCondition connect_condition,
  747. IteratorConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  748. typename enable_if<!is_endpoint_sequence< Iterator >::value >::type * = 0);
  749. This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `async_connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
  750. [heading Parameters]
  751. [variablelist
  752. [[s][The socket to be connected. If the socket is already open, it will be closed.]]
  753. [[begin][An iterator pointing to the start of a sequence of endpoints.]]
  754. [[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be:
  755. ``
  756. bool connect_condition(
  757. const boost::system::error_code& ec,
  758. const typename Protocol::endpoint& next);
  759. ``
  760. The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is the next endpoint to be tried. The function object should return true if the next endpoint should be tried, and false if it should be skipped.]]
  761. [[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:
  762. ``
  763. void handler(
  764. // Result of operation. if the sequence is empty, set to
  765. // boost::asio::error::not_found. Otherwise, contains the
  766. // error from the last connection attempt.
  767. const boost::system::error_code& error,
  768. // On success, an iterator denoting the successfully
  769. // connected endpoint. Otherwise, the end iterator.
  770. Iterator iterator
  771. );
  772. ``
  773. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  774. ]
  775. [heading Remarks]
  776. This overload assumes that a default constructed object of type `Iterator` represents the end of the sequence. This is a valid assumption for iterator types such as `boost::asio::ip::tcp::resolver::iterator`.
  777. [endsect]
  778. [section:overload6 async_connect (6 of 6 overloads)]
  779. Asynchronously establishes a socket connection by trying each endpoint in a sequence.
  780. template<
  781. typename ``[link boost_asio.reference.Protocol Protocol]``,
  782. typename ``[link boost_asio.reference.Executor1 Executor]``,
  783. typename Iterator,
  784. typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``,
  785. typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  786. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect(
  787. basic_socket< Protocol, Executor > & s,
  788. Iterator begin,
  789. Iterator end,
  790. ConnectCondition connect_condition,
  791. IteratorConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  792. This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `async_connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
  793. [heading Parameters]
  794. [variablelist
  795. [[s][The socket to be connected. If the socket is already open, it will be closed.]]
  796. [[begin][An iterator pointing to the start of a sequence of endpoints.]]
  797. [[end][An iterator pointing to the end of a sequence of endpoints.]]
  798. [[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be:
  799. ``
  800. bool connect_condition(
  801. const boost::system::error_code& ec,
  802. const typename Protocol::endpoint& next);
  803. ``
  804. The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is the next endpoint to be tried. The function object should return true if the next endpoint should be tried, and false if it should be skipped.]]
  805. [[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:
  806. ``
  807. void handler(
  808. // Result of operation. if the sequence is empty, set to
  809. // boost::asio::error::not_found. Otherwise, contains the
  810. // error from the last connection attempt.
  811. const boost::system::error_code& error,
  812. // On success, an iterator denoting the successfully
  813. // connected endpoint. Otherwise, the end iterator.
  814. Iterator iterator
  815. );
  816. ``
  817. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  818. ]
  819. [heading Example]
  820. The following connect condition function object can be used to output information about the individual connection attempts:
  821. struct my_connect_condition
  822. {
  823. bool operator()(
  824. const boost::system::error_code& ec,
  825. const::tcp::endpoint& next)
  826. {
  827. if (ec) std::cout << "Error: " << ec.message() << std::endl;
  828. std::cout << "Trying: " << next << std::endl;
  829. return true;
  830. }
  831. };
  832. It would be used with the `boost::asio::connect` function as follows:
  833. tcp::resolver r(my_context);
  834. tcp::resolver::query q("host", "service");
  835. tcp::socket s(my_context);
  836. // ...
  837. r.async_resolve(q, resolve_handler);
  838. // ...
  839. void resolve_handler(
  840. const boost::system::error_code& ec,
  841. tcp::resolver::iterator i)
  842. {
  843. if (!ec)
  844. {
  845. tcp::resolver::iterator end;
  846. boost::asio::async_connect(s, i, end,
  847. my_connect_condition(),
  848. connect_handler);
  849. }
  850. }
  851. // ...
  852. void connect_handler(
  853. const boost::system::error_code& ec,
  854. tcp::resolver::iterator i)
  855. {
  856. if (ec)
  857. {
  858. // An error occurred.
  859. }
  860. else
  861. {
  862. std::cout << "Connected to: " << i->endpoint() << std::endl;
  863. }
  864. }
  865. [endsect]
  866. [endsect]
  867. [section:async_initiate async_initiate]
  868. [indexterm1 boost_asio.indexterm.async_initiate..async_initiate]
  869. template<
  870. typename CompletionToken,
  871. completion_signature Signature,
  872. typename Initiation,
  873. typename... Args>
  874. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_initiate(
  875. Initiation && initiation,
  876. CompletionToken & ,
  877. Args &&... args);
  878. [heading Requirements]
  879. ['Header: ][^boost/asio/async_result.hpp]
  880. ['Convenience header: ][^boost/asio.hpp]
  881. [endsect]
  882. [section:async_read async_read]
  883. [indexterm1 boost_asio.indexterm.async_read..async_read]
  884. The `async_read` function is a composed asynchronous operation that reads a certain amount of data from a stream before completion.
  885. Start an asynchronous operation to read a certain amount of data from a stream.
  886. template<
  887. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  888. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  889. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  890. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload1 async_read]``(
  891. AsyncReadStream & s,
  892. const MutableBufferSequence & buffers,
  893. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  894. typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type * = 0);
  895. `` [''''&raquo;''' [link boost_asio.reference.async_read.overload1 more...]]``
  896. template<
  897. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  898. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  899. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
  900. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  901. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload2 async_read]``(
  902. AsyncReadStream & s,
  903. const MutableBufferSequence & buffers,
  904. CompletionCondition completion_condition,
  905. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  906. typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type * = 0);
  907. `` [''''&raquo;''' [link boost_asio.reference.async_read.overload2 more...]]``
  908. template<
  909. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  910. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
  911. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  912. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload3 async_read]``(
  913. AsyncReadStream & s,
  914. DynamicBuffer_v1 && buffers,
  915. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  916. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  917. `` [''''&raquo;''' [link boost_asio.reference.async_read.overload3 more...]]``
  918. template<
  919. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  920. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
  921. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
  922. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  923. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload4 async_read]``(
  924. AsyncReadStream & s,
  925. DynamicBuffer_v1 && buffers,
  926. CompletionCondition completion_condition,
  927. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  928. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  929. `` [''''&raquo;''' [link boost_asio.reference.async_read.overload4 more...]]``
  930. template<
  931. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  932. typename Allocator,
  933. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  934. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload5 async_read]``(
  935. AsyncReadStream & s,
  936. basic_streambuf< Allocator > & b,
  937. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  938. `` [''''&raquo;''' [link boost_asio.reference.async_read.overload5 more...]]``
  939. template<
  940. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  941. typename Allocator,
  942. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
  943. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  944. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload6 async_read]``(
  945. AsyncReadStream & s,
  946. basic_streambuf< Allocator > & b,
  947. CompletionCondition completion_condition,
  948. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  949. `` [''''&raquo;''' [link boost_asio.reference.async_read.overload6 more...]]``
  950. template<
  951. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  952. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
  953. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  954. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload7 async_read]``(
  955. AsyncReadStream & s,
  956. DynamicBuffer_v2 buffers,
  957. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  958. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  959. `` [''''&raquo;''' [link boost_asio.reference.async_read.overload7 more...]]``
  960. template<
  961. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  962. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
  963. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
  964. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  965. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload8 async_read]``(
  966. AsyncReadStream & s,
  967. DynamicBuffer_v2 buffers,
  968. CompletionCondition completion_condition,
  969. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  970. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  971. `` [''''&raquo;''' [link boost_asio.reference.async_read.overload8 more...]]``
  972. [heading Requirements]
  973. ['Header: ][^boost/asio/read.hpp]
  974. ['Convenience header: ][^boost/asio.hpp]
  975. [section:overload1 async_read (1 of 8 overloads)]
  976. Start an asynchronous operation to read a certain amount of data from a stream.
  977. template<
  978. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  979. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  980. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  981. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read(
  982. AsyncReadStream & s,
  983. const MutableBufferSequence & buffers,
  984. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  985. typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type * = 0);
  986. This function is used to asynchronously read a certain number of bytes of data from a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  987. * The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
  988. * An error occurred.
  989. This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other read operations (such as async\_read, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
  990. [heading Parameters]
  991. [variablelist
  992. [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
  993. [[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.]]
  994. [[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:
  995. ``
  996. void handler(
  997. const boost::system::error_code& error, // Result of operation.
  998. std::size_t bytes_transferred // Number of bytes copied into the
  999. // buffers. If an error occurred,
  1000. // this will be the number of
  1001. // bytes successfully transferred
  1002. // prior to the error.
  1003. );
  1004. ``
  1005. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  1006. ]
  1007. [heading Example]
  1008. To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  1009. boost::asio::async_read(s, boost::asio::buffer(data, size), handler);
  1010. See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  1011. [heading Remarks]
  1012. This overload is equivalent to calling:
  1013. boost::asio::async_read(
  1014. s, buffers,
  1015. boost::asio::transfer_all(),
  1016. handler);
  1017. [endsect]
  1018. [section:overload2 async_read (2 of 8 overloads)]
  1019. Start an asynchronous operation to read a certain amount of data from a stream.
  1020. template<
  1021. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  1022. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  1023. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
  1024. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1025. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read(
  1026. AsyncReadStream & s,
  1027. const MutableBufferSequence & buffers,
  1028. CompletionCondition completion_condition,
  1029. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  1030. typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type * = 0);
  1031. This function is used to asynchronously read a certain number of bytes of data from a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  1032. * The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
  1033. * The completion\_condition function object returns 0.
  1034. [heading Parameters]
  1035. [variablelist
  1036. [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
  1037. [[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.]]
  1038. [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
  1039. ``
  1040. std::size_t completion_condition(
  1041. // Result of latest async_read_some operation.
  1042. const boost::system::error_code& error,
  1043. // Number of bytes transferred so far.
  1044. std::size_t bytes_transferred
  1045. );
  1046. ``
  1047. A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's async\_read\_some function.]]
  1048. [[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:
  1049. ``
  1050. void handler(
  1051. const boost::system::error_code& error, // Result of operation.
  1052. std::size_t bytes_transferred // Number of bytes copied into the
  1053. // buffers. If an error occurred,
  1054. // this will be the number of
  1055. // bytes successfully transferred
  1056. // prior to the error.
  1057. );
  1058. ``
  1059. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  1060. ]
  1061. [heading Example]
  1062. To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  1063. boost::asio::async_read(s,
  1064. boost::asio::buffer(data, size),
  1065. boost::asio::transfer_at_least(32),
  1066. handler);
  1067. See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  1068. [endsect]
  1069. [section:overload3 async_read (3 of 8 overloads)]
  1070. Start an asynchronous operation to read a certain amount of data from a stream.
  1071. template<
  1072. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  1073. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
  1074. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1075. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read(
  1076. AsyncReadStream & s,
  1077. DynamicBuffer_v1 && buffers,
  1078. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  1079. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  1080. This function is used to asynchronously read a certain number of bytes of data from a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  1081. * The specified dynamic buffer sequence is full (that is, it has reached maximum size).
  1082. * An error occurred.
  1083. This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other read operations (such as async\_read, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
  1084. [heading Parameters]
  1085. [variablelist
  1086. [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
  1087. [[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.]]
  1088. [[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:
  1089. ``
  1090. void handler(
  1091. const boost::system::error_code& error, // Result of operation.
  1092. std::size_t bytes_transferred // Number of bytes copied into the
  1093. // buffers. If an error occurred,
  1094. // this will be the number of
  1095. // bytes successfully transferred
  1096. // prior to the error.
  1097. );
  1098. ``
  1099. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  1100. ]
  1101. [heading Remarks]
  1102. This overload is equivalent to calling:
  1103. boost::asio::async_read(
  1104. s, buffers,
  1105. boost::asio::transfer_all(),
  1106. handler);
  1107. [endsect]
  1108. [section:overload4 async_read (4 of 8 overloads)]
  1109. Start an asynchronous operation to read a certain amount of data from a stream.
  1110. template<
  1111. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  1112. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
  1113. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
  1114. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1115. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read(
  1116. AsyncReadStream & s,
  1117. DynamicBuffer_v1 && buffers,
  1118. CompletionCondition completion_condition,
  1119. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  1120. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  1121. This function is used to asynchronously read a certain number of bytes of data from a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  1122. * The specified dynamic buffer sequence is full (that is, it has reached maximum size).
  1123. * The completion\_condition function object returns 0.
  1124. This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other read operations (such as async\_read, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
  1125. [heading Parameters]
  1126. [variablelist
  1127. [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
  1128. [[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.]]
  1129. [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
  1130. ``
  1131. std::size_t completion_condition(
  1132. // Result of latest async_read_some operation.
  1133. const boost::system::error_code& error,
  1134. // Number of bytes transferred so far.
  1135. std::size_t bytes_transferred
  1136. );
  1137. ``
  1138. A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's async\_read\_some function.]]
  1139. [[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:
  1140. ``
  1141. void handler(
  1142. const boost::system::error_code& error, // Result of operation.
  1143. std::size_t bytes_transferred // Number of bytes copied into the
  1144. // buffers. If an error occurred,
  1145. // this will be the number of
  1146. // bytes successfully transferred
  1147. // prior to the error.
  1148. );
  1149. ``
  1150. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
  1151. ]
  1152. [endsect]
  1153. [section:overload5 async_read (5 of 8 overloads)]
  1154. Start an asynchronous operation to read a certain amount of data from a stream.
  1155. template<
  1156. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  1157. typename Allocator,
  1158. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1159. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read(
  1160. AsyncReadStream & s,
  1161. basic_streambuf< Allocator > & b,
  1162. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  1163. This function is used to asynchronously read a certain number of bytes of data from a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  1164. * The supplied buffer is full (that is, it has reached maximum size).
  1165. * An error occurred.
  1166. This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other read operations (such as async\_read, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
  1167. [heading Parameters]
  1168. [variablelist
  1169. [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
  1170. [[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.]]
  1171. [[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:
  1172. ``
  1173. void handler(
  1174. const boost::system::error_code& error, // Result of operation.
  1175. std::size_t bytes_transferred // Number of bytes copied into the
  1176. // buffers. If an error occurred,
  1177. // this will be the number of
  1178. // bytes successfully transferred
  1179. // prior to the error.
  1180. );
  1181. ``
  1182. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  1183. ]
  1184. [heading Remarks]
  1185. This overload is equivalent to calling:
  1186. boost::asio::async_read(
  1187. s, b,
  1188. boost::asio::transfer_all(),
  1189. handler);
  1190. [endsect]
  1191. [section:overload6 async_read (6 of 8 overloads)]
  1192. Start an asynchronous operation to read a certain amount of data from a stream.
  1193. template<
  1194. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  1195. typename Allocator,
  1196. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
  1197. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1198. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read(
  1199. AsyncReadStream & s,
  1200. basic_streambuf< Allocator > & b,
  1201. CompletionCondition completion_condition,
  1202. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  1203. This function is used to asynchronously read a certain number of bytes of data from a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  1204. * The supplied buffer is full (that is, it has reached maximum size).
  1205. * The completion\_condition function object returns 0.
  1206. This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other read operations (such as async\_read, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
  1207. [heading Parameters]
  1208. [variablelist
  1209. [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
  1210. [[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.]]
  1211. [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
  1212. ``
  1213. std::size_t completion_condition(
  1214. // Result of latest async_read_some operation.
  1215. const boost::system::error_code& error,
  1216. // Number of bytes transferred so far.
  1217. std::size_t bytes_transferred
  1218. );
  1219. ``
  1220. A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's async\_read\_some function.]]
  1221. [[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:
  1222. ``
  1223. void handler(
  1224. const boost::system::error_code& error, // Result of operation.
  1225. std::size_t bytes_transferred // Number of bytes copied into the
  1226. // buffers. If an error occurred,
  1227. // this will be the number of
  1228. // bytes successfully transferred
  1229. // prior to the error.
  1230. );
  1231. ``
  1232. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
  1233. ]
  1234. [endsect]
  1235. [section:overload7 async_read (7 of 8 overloads)]
  1236. Start an asynchronous operation to read a certain amount of data from a stream.
  1237. template<
  1238. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  1239. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
  1240. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1241. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read(
  1242. AsyncReadStream & s,
  1243. DynamicBuffer_v2 buffers,
  1244. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  1245. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  1246. This function is used to asynchronously read a certain number of bytes of data from a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  1247. * The specified dynamic buffer sequence is full (that is, it has reached maximum size).
  1248. * An error occurred.
  1249. This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other read operations (such as async\_read, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
  1250. [heading Parameters]
  1251. [variablelist
  1252. [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
  1253. [[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.]]
  1254. [[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:
  1255. ``
  1256. void handler(
  1257. const boost::system::error_code& error, // Result of operation.
  1258. std::size_t bytes_transferred // Number of bytes copied into the
  1259. // buffers. If an error occurred,
  1260. // this will be the number of
  1261. // bytes successfully transferred
  1262. // prior to the error.
  1263. );
  1264. ``
  1265. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  1266. ]
  1267. [heading Remarks]
  1268. This overload is equivalent to calling:
  1269. boost::asio::async_read(
  1270. s, buffers,
  1271. boost::asio::transfer_all(),
  1272. handler);
  1273. [endsect]
  1274. [section:overload8 async_read (8 of 8 overloads)]
  1275. Start an asynchronous operation to read a certain amount of data from a stream.
  1276. template<
  1277. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  1278. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
  1279. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
  1280. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1281. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read(
  1282. AsyncReadStream & s,
  1283. DynamicBuffer_v2 buffers,
  1284. CompletionCondition completion_condition,
  1285. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  1286. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  1287. This function is used to asynchronously read a certain number of bytes of data from a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  1288. * The specified dynamic buffer sequence is full (that is, it has reached maximum size).
  1289. * The completion\_condition function object returns 0.
  1290. This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other read operations (such as async\_read, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
  1291. [heading Parameters]
  1292. [variablelist
  1293. [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
  1294. [[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.]]
  1295. [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
  1296. ``
  1297. std::size_t completion_condition(
  1298. // Result of latest async_read_some operation.
  1299. const boost::system::error_code& error,
  1300. // Number of bytes transferred so far.
  1301. std::size_t bytes_transferred
  1302. );
  1303. ``
  1304. A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's async\_read\_some function.]]
  1305. [[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:
  1306. ``
  1307. void handler(
  1308. const boost::system::error_code& error, // Result of operation.
  1309. std::size_t bytes_transferred // Number of bytes copied into the
  1310. // buffers. If an error occurred,
  1311. // this will be the number of
  1312. // bytes successfully transferred
  1313. // prior to the error.
  1314. );
  1315. ``
  1316. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
  1317. ]
  1318. [endsect]
  1319. [endsect]
  1320. [section:async_read_at async_read_at]
  1321. [indexterm1 boost_asio.indexterm.async_read_at..async_read_at]
  1322. The `async_read_at` function is a composed asynchronous operation that reads a certain amount of data at the specified offset.
  1323. Start an asynchronous operation to read a certain amount of data at the specified offset.
  1324. template<
  1325. typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``,
  1326. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  1327. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1328. ``[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]``(
  1329. AsyncRandomAccessReadDevice & d,
  1330. uint64_t offset,
  1331. const MutableBufferSequence & buffers,
  1332. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  1333. `` [''''&raquo;''' [link boost_asio.reference.async_read_at.overload1 more...]]``
  1334. template<
  1335. typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``,
  1336. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  1337. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
  1338. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1339. ``[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]``(
  1340. AsyncRandomAccessReadDevice & d,
  1341. uint64_t offset,
  1342. const MutableBufferSequence & buffers,
  1343. CompletionCondition completion_condition,
  1344. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  1345. `` [''''&raquo;''' [link boost_asio.reference.async_read_at.overload2 more...]]``
  1346. template<
  1347. typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``,
  1348. typename Allocator,
  1349. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1350. ``[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]``(
  1351. AsyncRandomAccessReadDevice & d,
  1352. uint64_t offset,
  1353. basic_streambuf< Allocator > & b,
  1354. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  1355. `` [''''&raquo;''' [link boost_asio.reference.async_read_at.overload3 more...]]``
  1356. template<
  1357. typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``,
  1358. typename Allocator,
  1359. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
  1360. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1361. ``[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]``(
  1362. AsyncRandomAccessReadDevice & d,
  1363. uint64_t offset,
  1364. basic_streambuf< Allocator > & b,
  1365. CompletionCondition completion_condition,
  1366. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  1367. `` [''''&raquo;''' [link boost_asio.reference.async_read_at.overload4 more...]]``
  1368. [heading Requirements]
  1369. ['Header: ][^boost/asio/read_at.hpp]
  1370. ['Convenience header: ][^boost/asio.hpp]
  1371. [section:overload1 async_read_at (1 of 4 overloads)]
  1372. Start an asynchronous operation to read a certain amount of data at the specified offset.
  1373. template<
  1374. typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``,
  1375. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  1376. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1377. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_at(
  1378. AsyncRandomAccessReadDevice & d,
  1379. uint64_t offset,
  1380. const MutableBufferSequence & buffers,
  1381. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  1382. This function is used to asynchronously read a certain number of bytes of data from a random access device at the specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  1383. * The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
  1384. * An error occurred.
  1385. This operation is implemented in terms of zero or more calls to the device's async\_read\_some\_at function.
  1386. [heading Parameters]
  1387. [variablelist
  1388. [[d][The device from which the data is to be read. The type must support the AsyncRandomAccessReadDevice concept.]]
  1389. [[offset][The offset at which the data will be read.]]
  1390. [[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.]]
  1391. [[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:
  1392. ``
  1393. void handler(
  1394. // Result of operation.
  1395. const boost::system::error_code& error,
  1396. // Number of bytes copied into the buffers. If an error
  1397. // occurred, this will be the number of bytes successfully
  1398. // transferred prior to the error.
  1399. std::size_t bytes_transferred
  1400. );
  1401. ``
  1402. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  1403. ]
  1404. [heading Example]
  1405. To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  1406. boost::asio::async_read_at(d, 42, boost::asio::buffer(data, size), handler);
  1407. See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  1408. [heading Remarks]
  1409. This overload is equivalent to calling:
  1410. boost::asio::async_read_at(
  1411. d, 42, buffers,
  1412. boost::asio::transfer_all(),
  1413. handler);
  1414. [endsect]
  1415. [section:overload2 async_read_at (2 of 4 overloads)]
  1416. Start an asynchronous operation to read a certain amount of data at the specified offset.
  1417. template<
  1418. typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``,
  1419. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  1420. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
  1421. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1422. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_at(
  1423. AsyncRandomAccessReadDevice & d,
  1424. uint64_t offset,
  1425. const MutableBufferSequence & buffers,
  1426. CompletionCondition completion_condition,
  1427. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  1428. This function is used to asynchronously read a certain number of bytes of data from a random access device at the specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  1429. * The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
  1430. * The completion\_condition function object returns 0.
  1431. [heading Parameters]
  1432. [variablelist
  1433. [[d][The device from which the data is to be read. The type must support the AsyncRandomAccessReadDevice concept.]]
  1434. [[offset][The offset at which the data will be read.]]
  1435. [[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.]]
  1436. [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
  1437. ``
  1438. std::size_t completion_condition(
  1439. // Result of latest async_read_some_at operation.
  1440. const boost::system::error_code& error,
  1441. // Number of bytes transferred so far.
  1442. std::size_t bytes_transferred
  1443. );
  1444. ``
  1445. A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the device's async\_read\_some\_at function.]]
  1446. [[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:
  1447. ``
  1448. void handler(
  1449. // Result of operation.
  1450. const boost::system::error_code& error,
  1451. // Number of bytes copied into the buffers. If an error
  1452. // occurred, this will be the number of bytes successfully
  1453. // transferred prior to the error.
  1454. std::size_t bytes_transferred
  1455. );
  1456. ``
  1457. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  1458. ]
  1459. [heading Example]
  1460. To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  1461. boost::asio::async_read_at(d, 42,
  1462. boost::asio::buffer(data, size),
  1463. boost::asio::transfer_at_least(32),
  1464. handler);
  1465. See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  1466. [endsect]
  1467. [section:overload3 async_read_at (3 of 4 overloads)]
  1468. Start an asynchronous operation to read a certain amount of data at the specified offset.
  1469. template<
  1470. typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``,
  1471. typename Allocator,
  1472. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1473. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_at(
  1474. AsyncRandomAccessReadDevice & d,
  1475. uint64_t offset,
  1476. basic_streambuf< Allocator > & b,
  1477. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  1478. This function is used to asynchronously read a certain number of bytes of data from a random access device at the specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  1479. * An error occurred.
  1480. This operation is implemented in terms of zero or more calls to the device's async\_read\_some\_at function.
  1481. [heading Parameters]
  1482. [variablelist
  1483. [[d][The device from which the data is to be read. The type must support the AsyncRandomAccessReadDevice concept.]]
  1484. [[offset][The offset at which the data will be read.]]
  1485. [[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.]]
  1486. [[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:
  1487. ``
  1488. void handler(
  1489. // Result of operation.
  1490. const boost::system::error_code& error,
  1491. // Number of bytes copied into the buffers. If an error
  1492. // occurred, this will be the number of bytes successfully
  1493. // transferred prior to the error.
  1494. std::size_t bytes_transferred
  1495. );
  1496. ``
  1497. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  1498. ]
  1499. [heading Remarks]
  1500. This overload is equivalent to calling:
  1501. boost::asio::async_read_at(
  1502. d, 42, b,
  1503. boost::asio::transfer_all(),
  1504. handler);
  1505. [endsect]
  1506. [section:overload4 async_read_at (4 of 4 overloads)]
  1507. Start an asynchronous operation to read a certain amount of data at the specified offset.
  1508. template<
  1509. typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``,
  1510. typename Allocator,
  1511. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
  1512. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1513. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_at(
  1514. AsyncRandomAccessReadDevice & d,
  1515. uint64_t offset,
  1516. basic_streambuf< Allocator > & b,
  1517. CompletionCondition completion_condition,
  1518. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  1519. This function is used to asynchronously read a certain number of bytes of data from a random access device at the specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  1520. * The completion\_condition function object returns 0.
  1521. This operation is implemented in terms of zero or more calls to the device's async\_read\_some\_at function.
  1522. [heading Parameters]
  1523. [variablelist
  1524. [[d][The device from which the data is to be read. The type must support the AsyncRandomAccessReadDevice concept.]]
  1525. [[offset][The offset at which the data will be read.]]
  1526. [[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.]]
  1527. [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
  1528. ``
  1529. std::size_t completion_condition(
  1530. // Result of latest async_read_some_at operation.
  1531. const boost::system::error_code& error,
  1532. // Number of bytes transferred so far.
  1533. std::size_t bytes_transferred
  1534. );
  1535. ``
  1536. A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the device's async\_read\_some\_at function.]]
  1537. [[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:
  1538. ``
  1539. void handler(
  1540. // Result of operation.
  1541. const boost::system::error_code& error,
  1542. // Number of bytes copied into the buffers. If an error
  1543. // occurred, this will be the number of bytes successfully
  1544. // transferred prior to the error.
  1545. std::size_t bytes_transferred
  1546. );
  1547. ``
  1548. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
  1549. ]
  1550. [endsect]
  1551. [endsect]
  1552. [section:async_read_until async_read_until]
  1553. [indexterm1 boost_asio.indexterm.async_read_until..async_read_until]
  1554. The `async_read_until` function is a composed asynchronous operation that reads data into a dynamic buffer sequence, or into a streambuf, until it contains a delimiter, matches a regular expression, or a function object indicates a match.
  1555. Start an asynchronous operation to read data into a dynamic buffer sequence until it contains a specified delimiter.
  1556. template<
  1557. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  1558. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
  1559. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1560. ``[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]``(
  1561. AsyncReadStream & s,
  1562. DynamicBuffer_v1 && buffers,
  1563. char delim,
  1564. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  1565. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  1566. `` [''''&raquo;''' [link boost_asio.reference.async_read_until.overload1 more...]]``
  1567. template<
  1568. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  1569. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
  1570. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1571. ``[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]``(
  1572. AsyncReadStream & s,
  1573. DynamicBuffer_v1 && buffers,
  1574. string_view delim,
  1575. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  1576. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  1577. `` [''''&raquo;''' [link boost_asio.reference.async_read_until.overload2 more...]]``
  1578. Start an asynchronous operation to read data into a dynamic buffer sequence until some part of its data matches a regular expression.
  1579. template<
  1580. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  1581. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
  1582. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1583. ``[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]``(
  1584. AsyncReadStream & s,
  1585. DynamicBuffer_v1 && buffers,
  1586. const boost::regex & expr,
  1587. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  1588. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  1589. `` [''''&raquo;''' [link boost_asio.reference.async_read_until.overload3 more...]]``
  1590. Start an asynchronous operation to read data into a dynamic buffer sequence until a function object indicates a match.
  1591. template<
  1592. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  1593. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
  1594. typename MatchCondition,
  1595. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1596. ``[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]``(
  1597. AsyncReadStream & s,
  1598. DynamicBuffer_v1 && buffers,
  1599. MatchCondition match_condition,
  1600. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  1601. typename enable_if< is_match_condition< MatchCondition >::value &&is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  1602. `` [''''&raquo;''' [link boost_asio.reference.async_read_until.overload4 more...]]``
  1603. Start an asynchronous operation to read data into a streambuf until it contains a specified delimiter.
  1604. template<
  1605. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  1606. typename Allocator,
  1607. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1608. ``[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]``(
  1609. AsyncReadStream & s,
  1610. boost::asio::basic_streambuf< Allocator > & b,
  1611. char delim,
  1612. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  1613. `` [''''&raquo;''' [link boost_asio.reference.async_read_until.overload5 more...]]``
  1614. template<
  1615. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  1616. typename Allocator,
  1617. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1618. ``[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]``(
  1619. AsyncReadStream & s,
  1620. boost::asio::basic_streambuf< Allocator > & b,
  1621. string_view delim,
  1622. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  1623. `` [''''&raquo;''' [link boost_asio.reference.async_read_until.overload6 more...]]``
  1624. Start an asynchronous operation to read data into a streambuf until some part of its data matches a regular expression.
  1625. template<
  1626. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  1627. typename Allocator,
  1628. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1629. ``[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]``(
  1630. AsyncReadStream & s,
  1631. boost::asio::basic_streambuf< Allocator > & b,
  1632. const boost::regex & expr,
  1633. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  1634. `` [''''&raquo;''' [link boost_asio.reference.async_read_until.overload7 more...]]``
  1635. Start an asynchronous operation to read data into a streambuf until a function object indicates a match.
  1636. template<
  1637. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  1638. typename Allocator,
  1639. typename MatchCondition,
  1640. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1641. ``[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]``(
  1642. AsyncReadStream & s,
  1643. boost::asio::basic_streambuf< Allocator > & b,
  1644. MatchCondition match_condition,
  1645. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  1646. typename enable_if< is_match_condition< MatchCondition >::value >::type * = 0);
  1647. `` [''''&raquo;''' [link boost_asio.reference.async_read_until.overload8 more...]]``
  1648. Start an asynchronous operation to read data into a dynamic buffer sequence until it contains a specified delimiter.
  1649. template<
  1650. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  1651. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
  1652. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1653. ``[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]``(
  1654. AsyncReadStream & s,
  1655. DynamicBuffer_v2 buffers,
  1656. char delim,
  1657. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  1658. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  1659. `` [''''&raquo;''' [link boost_asio.reference.async_read_until.overload9 more...]]``
  1660. template<
  1661. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  1662. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
  1663. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1664. ``[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]``(
  1665. AsyncReadStream & s,
  1666. DynamicBuffer_v2 buffers,
  1667. string_view delim,
  1668. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  1669. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  1670. `` [''''&raquo;''' [link boost_asio.reference.async_read_until.overload10 more...]]``
  1671. Start an asynchronous operation to read data into a dynamic buffer sequence until some part of its data matches a regular expression.
  1672. template<
  1673. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  1674. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
  1675. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1676. ``[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]``(
  1677. AsyncReadStream & s,
  1678. DynamicBuffer_v2 buffers,
  1679. const boost::regex & expr,
  1680. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  1681. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  1682. `` [''''&raquo;''' [link boost_asio.reference.async_read_until.overload11 more...]]``
  1683. Start an asynchronous operation to read data into a dynamic buffer sequence until a function object indicates a match.
  1684. template<
  1685. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  1686. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
  1687. typename MatchCondition,
  1688. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1689. ``[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]``(
  1690. AsyncReadStream & s,
  1691. DynamicBuffer_v2 buffers,
  1692. MatchCondition match_condition,
  1693. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  1694. typename enable_if< is_match_condition< MatchCondition >::value &&is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  1695. `` [''''&raquo;''' [link boost_asio.reference.async_read_until.overload12 more...]]``
  1696. [heading Requirements]
  1697. ['Header: ][^boost/asio/read_until.hpp]
  1698. ['Convenience header: ][^boost/asio.hpp]
  1699. [section:overload1 async_read_until (1 of 12 overloads)]
  1700. Start an asynchronous operation to read data into a dynamic buffer sequence until it contains a specified delimiter.
  1701. template<
  1702. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  1703. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
  1704. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1705. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until(
  1706. AsyncReadStream & s,
  1707. DynamicBuffer_v1 && buffers,
  1708. char delim,
  1709. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  1710. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  1711. This function is used to asynchronously read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains the specified delimiter. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  1712. * The get area of the dynamic buffer sequence contains the specified delimiter.
  1713. * An error occurred.
  1714. This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the dynamic buffer sequence's get area already contains the delimiter, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
  1715. [heading Parameters]
  1716. [variablelist
  1717. [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
  1718. [[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.]]
  1719. [[delim][The delimiter character.]]
  1720. [[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:
  1721. ``
  1722. void handler(
  1723. // Result of operation.
  1724. const boost::system::error_code& error,
  1725. // The number of bytes in the dynamic buffer sequence's
  1726. // get area up to and including the delimiter.
  1727. // 0 if an error occurred.
  1728. std::size_t bytes_transferred
  1729. );
  1730. ``
  1731. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  1732. ]
  1733. [heading Remarks]
  1734. After a successful async\_read\_until operation, the dynamic buffer sequence may contain additional data beyond the delimiter. An application will typically leave that data in the dynamic buffer sequence for a subsequent async\_read\_until operation to examine.
  1735. [heading Example]
  1736. To asynchronously read data into a `std::string` until a newline is encountered:
  1737. std::string data;
  1738. ...
  1739. void handler(const boost::system::error_code& e, std::size_t size)
  1740. {
  1741. if (!e)
  1742. {
  1743. std::string line = data.substr(0, n);
  1744. data.erase(0, n);
  1745. ...
  1746. }
  1747. }
  1748. ...
  1749. boost::asio::async_read_until(s, data, '\n', handler);
  1750. After the `async_read_until` operation completes successfully, the buffer `data` contains the delimiter:
  1751. { 'a', 'b', ..., 'c', '\n', 'd', 'e', ... }
  1752. The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains:
  1753. { 'a', 'b', ..., 'c', '\n' }
  1754. After the call to `erase`, the remaining data is left in the buffer `data` as follows:
  1755. { 'd', 'e', ... }
  1756. This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation.
  1757. [endsect]
  1758. [section:overload2 async_read_until (2 of 12 overloads)]
  1759. Start an asynchronous operation to read data into a dynamic buffer sequence until it contains a specified delimiter.
  1760. template<
  1761. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  1762. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
  1763. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1764. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until(
  1765. AsyncReadStream & s,
  1766. DynamicBuffer_v1 && buffers,
  1767. string_view delim,
  1768. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  1769. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  1770. This function is used to asynchronously read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains the specified delimiter. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  1771. * The get area of the dynamic buffer sequence contains the specified delimiter.
  1772. * An error occurred.
  1773. This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the dynamic buffer sequence's get area already contains the delimiter, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
  1774. [heading Parameters]
  1775. [variablelist
  1776. [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
  1777. [[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.]]
  1778. [[delim][The delimiter string.]]
  1779. [[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:
  1780. ``
  1781. void handler(
  1782. // Result of operation.
  1783. const boost::system::error_code& error,
  1784. // The number of bytes in the dynamic buffer sequence's
  1785. // get area up to and including the delimiter.
  1786. // 0 if an error occurred.
  1787. std::size_t bytes_transferred
  1788. );
  1789. ``
  1790. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  1791. ]
  1792. [heading Remarks]
  1793. After a successful async\_read\_until operation, the dynamic buffer sequence may contain additional data beyond the delimiter. An application will typically leave that data in the dynamic buffer sequence for a subsequent async\_read\_until operation to examine.
  1794. [heading Example]
  1795. To asynchronously read data into a `std::string` until a CR-LF sequence is encountered:
  1796. std::string data;
  1797. ...
  1798. void handler(const boost::system::error_code& e, std::size_t size)
  1799. {
  1800. if (!e)
  1801. {
  1802. std::string line = data.substr(0, n);
  1803. data.erase(0, n);
  1804. ...
  1805. }
  1806. }
  1807. ...
  1808. boost::asio::async_read_until(s, data, "\r\n", handler);
  1809. After the `async_read_until` operation completes successfully, the string `data` contains the delimiter:
  1810. { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... }
  1811. The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains:
  1812. { 'a', 'b', ..., 'c', '\r', '\n' }
  1813. After the call to `erase`, the remaining data is left in the string `data` as follows:
  1814. { 'd', 'e', ... }
  1815. This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation.
  1816. [endsect]
  1817. [section:overload3 async_read_until (3 of 12 overloads)]
  1818. Start an asynchronous operation to read data into a dynamic buffer sequence until some part of its data matches a regular expression.
  1819. template<
  1820. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  1821. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
  1822. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1823. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until(
  1824. AsyncReadStream & s,
  1825. DynamicBuffer_v1 && buffers,
  1826. const boost::regex & expr,
  1827. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  1828. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  1829. This function is used to asynchronously read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains some data that matches a regular expression. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  1830. * A substring of the dynamic buffer sequence's get area matches the regular expression.
  1831. * An error occurred.
  1832. This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the dynamic buffer sequence's get area already contains data that matches the regular expression, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
  1833. [heading Parameters]
  1834. [variablelist
  1835. [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
  1836. [[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.]]
  1837. [[expr][The regular expression.]]
  1838. [[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:
  1839. ``
  1840. void handler(
  1841. // Result of operation.
  1842. const boost::system::error_code& error,
  1843. // The number of bytes in the dynamic buffer
  1844. // sequence's get area up to and including the
  1845. // substring that matches the regular expression.
  1846. // 0 if an error occurred.
  1847. std::size_t bytes_transferred
  1848. );
  1849. ``
  1850. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  1851. ]
  1852. [heading Remarks]
  1853. After a successful async\_read\_until operation, the dynamic buffer sequence may contain additional data beyond that which matched the regular expression. An application will typically leave that data in the dynamic buffer sequence for a subsequent async\_read\_until operation to examine.
  1854. [heading Example]
  1855. To asynchronously read data into a `std::string` until a CR-LF sequence is encountered:
  1856. std::string data;
  1857. ...
  1858. void handler(const boost::system::error_code& e, std::size_t size)
  1859. {
  1860. if (!e)
  1861. {
  1862. std::string line = data.substr(0, n);
  1863. data.erase(0, n);
  1864. ...
  1865. }
  1866. }
  1867. ...
  1868. boost::asio::async_read_until(s, data,
  1869. boost::regex("\r\n"), handler);
  1870. After the `async_read_until` operation completes successfully, the string `data` contains the data which matched the regular expression:
  1871. { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... }
  1872. The call to `substr` then extracts the data up to and including the match, so that the string `line` contains:
  1873. { 'a', 'b', ..., 'c', '\r', '\n' }
  1874. After the call to `erase`, the remaining data is left in the string `data` as follows:
  1875. { 'd', 'e', ... }
  1876. This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation.
  1877. [endsect]
  1878. [section:overload4 async_read_until (4 of 12 overloads)]
  1879. Start an asynchronous operation to read data into a dynamic buffer sequence until a function object indicates a match.
  1880. template<
  1881. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  1882. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
  1883. typename MatchCondition,
  1884. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1885. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until(
  1886. AsyncReadStream & s,
  1887. DynamicBuffer_v1 && buffers,
  1888. MatchCondition match_condition,
  1889. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  1890. typename enable_if< is_match_condition< MatchCondition >::value &&is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  1891. This function is used to asynchronously read data into the specified dynamic buffer sequence until a user-defined match condition function object, when applied to the data contained in the dynamic buffer sequence, indicates a successful match. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  1892. * The match condition function object returns a std::pair where the second element evaluates to true.
  1893. * An error occurred.
  1894. This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the match condition function object already indicates a match, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
  1895. [heading Parameters]
  1896. [variablelist
  1897. [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
  1898. [[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.]]
  1899. [[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be:
  1900. ``
  1901. pair<iterator, bool> match_condition(iterator begin, iterator end);
  1902. ``
  1903. where `iterator` represents the type:
  1904. ``
  1905. buffers_iterator<typename DynamicBuffer_v1::const_buffers_type>
  1906. ``
  1907. The iterator parameters `begin` and `end` define the range of bytes to be scanned to determine whether there is a match. The `first` member of the return value is an iterator marking one-past-the-end of the bytes that have been consumed by the match function. This iterator is used to calculate the `begin` parameter for any subsequent invocation of the match condition. The `second` member of the return value is true if a match has been found, false otherwise.]]
  1908. [[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:
  1909. ``
  1910. void handler(
  1911. // Result of operation.
  1912. const boost::system::error_code& error,
  1913. // The number of bytes in the dynamic buffer sequence's
  1914. // get area that have been fully consumed by the match
  1915. // function. O if an error occurred.
  1916. std::size_t bytes_transferred
  1917. );
  1918. ``
  1919. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  1920. ]
  1921. [heading Remarks]
  1922. After a successful async\_read\_until operation, the dynamic buffer sequence may contain additional data beyond that which matched the function object. An application will typically leave that data in the dynamic buffer sequence for a subsequent async\_read\_until operation to examine.
  1923. The default implementation of the `is_match_condition` type trait evaluates to true for function pointers and function objects with a `result_type` typedef. It must be specialised for other user-defined function objects.
  1924. [heading Examples]
  1925. To asynchronously read data into a `std::string` until whitespace is encountered:
  1926. typedef boost::asio::buffers_iterator<
  1927. boost::asio::const_buffers_1> iterator;
  1928. std::pair<iterator, bool>
  1929. match_whitespace(iterator begin, iterator end)
  1930. {
  1931. iterator i = begin;
  1932. while (i != end)
  1933. if (std::isspace(*i++))
  1934. return std::make_pair(i, true);
  1935. return std::make_pair(i, false);
  1936. }
  1937. ...
  1938. void handler(const boost::system::error_code& e, std::size_t size);
  1939. ...
  1940. std::string data;
  1941. boost::asio::async_read_until(s, data, match_whitespace, handler);
  1942. To asynchronously read data into a `std::string` until a matching character is found:
  1943. class match_char
  1944. {
  1945. public:
  1946. explicit match_char(char c) : c_(c) {}
  1947. template <typename Iterator>
  1948. std::pair<Iterator, bool> operator()(
  1949. Iterator begin, Iterator end) const
  1950. {
  1951. Iterator i = begin;
  1952. while (i != end)
  1953. if (c_ == *i++)
  1954. return std::make_pair(i, true);
  1955. return std::make_pair(i, false);
  1956. }
  1957. private:
  1958. char c_;
  1959. };
  1960. namespace asio {
  1961. template <> struct is_match_condition<match_char>
  1962. : public boost::true_type {};
  1963. } // namespace asio
  1964. ...
  1965. void handler(const boost::system::error_code& e, std::size_t size);
  1966. ...
  1967. std::string data;
  1968. boost::asio::async_read_until(s, data, match_char('a'), handler);
  1969. [endsect]
  1970. [section:overload5 async_read_until (5 of 12 overloads)]
  1971. Start an asynchronous operation to read data into a streambuf until it contains a specified delimiter.
  1972. template<
  1973. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  1974. typename Allocator,
  1975. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  1976. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until(
  1977. AsyncReadStream & s,
  1978. boost::asio::basic_streambuf< Allocator > & b,
  1979. char delim,
  1980. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  1981. This function is used to asynchronously read data into the specified streambuf until the streambuf's get area contains the specified delimiter. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  1982. * The get area of the streambuf contains the specified delimiter.
  1983. * An error occurred.
  1984. This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the streambuf's get area already contains the delimiter, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
  1985. [heading Parameters]
  1986. [variablelist
  1987. [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
  1988. [[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.]]
  1989. [[delim][The delimiter character.]]
  1990. [[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:
  1991. ``
  1992. void handler(
  1993. // Result of operation.
  1994. const boost::system::error_code& error,
  1995. // The number of bytes in the streambuf's get
  1996. // area up to and including the delimiter.
  1997. // 0 if an error occurred.
  1998. std::size_t bytes_transferred
  1999. );
  2000. ``
  2001. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  2002. ]
  2003. [heading Remarks]
  2004. After a successful async\_read\_until operation, the streambuf may contain additional data beyond the delimiter. An application will typically leave that data in the streambuf for a subsequent async\_read\_until operation to examine.
  2005. [heading Example]
  2006. To asynchronously read data into a streambuf until a newline is encountered:
  2007. boost::asio::streambuf b;
  2008. ...
  2009. void handler(const boost::system::error_code& e, std::size_t size)
  2010. {
  2011. if (!e)
  2012. {
  2013. std::istream is(&b);
  2014. std::string line;
  2015. std::getline(is, line);
  2016. ...
  2017. }
  2018. }
  2019. ...
  2020. boost::asio::async_read_until(s, b, '\n', handler);
  2021. After the `async_read_until` operation completes successfully, the buffer `b` contains the delimiter:
  2022. { 'a', 'b', ..., 'c', '\n', 'd', 'e', ... }
  2023. The call to `std::getline` then extracts the data up to and including the newline (which is discarded), so that the string `line` contains:
  2024. { 'a', 'b', ..., 'c' }
  2025. The remaining data is left in the buffer `b` as follows:
  2026. { 'd', 'e', ... }
  2027. This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation.
  2028. [endsect]
  2029. [section:overload6 async_read_until (6 of 12 overloads)]
  2030. Start an asynchronous operation to read data into a streambuf until it contains a specified delimiter.
  2031. template<
  2032. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  2033. typename Allocator,
  2034. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  2035. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until(
  2036. AsyncReadStream & s,
  2037. boost::asio::basic_streambuf< Allocator > & b,
  2038. string_view delim,
  2039. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  2040. This function is used to asynchronously read data into the specified streambuf until the streambuf's get area contains the specified delimiter. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  2041. * The get area of the streambuf contains the specified delimiter.
  2042. * An error occurred.
  2043. This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the streambuf's get area already contains the delimiter, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
  2044. [heading Parameters]
  2045. [variablelist
  2046. [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
  2047. [[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.]]
  2048. [[delim][The delimiter string.]]
  2049. [[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:
  2050. ``
  2051. void handler(
  2052. // Result of operation.
  2053. const boost::system::error_code& error,
  2054. // The number of bytes in the streambuf's get
  2055. // area up to and including the delimiter.
  2056. // 0 if an error occurred.
  2057. std::size_t bytes_transferred
  2058. );
  2059. ``
  2060. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  2061. ]
  2062. [heading Remarks]
  2063. After a successful async\_read\_until operation, the streambuf may contain additional data beyond the delimiter. An application will typically leave that data in the streambuf for a subsequent async\_read\_until operation to examine.
  2064. [heading Example]
  2065. To asynchronously read data into a streambuf until a newline is encountered:
  2066. boost::asio::streambuf b;
  2067. ...
  2068. void handler(const boost::system::error_code& e, std::size_t size)
  2069. {
  2070. if (!e)
  2071. {
  2072. std::istream is(&b);
  2073. std::string line;
  2074. std::getline(is, line);
  2075. ...
  2076. }
  2077. }
  2078. ...
  2079. boost::asio::async_read_until(s, b, "\r\n", handler);
  2080. After the `async_read_until` operation completes successfully, the buffer `b` contains the delimiter:
  2081. { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... }
  2082. The call to `std::getline` then extracts the data up to and including the newline (which is discarded), so that the string `line` contains:
  2083. { 'a', 'b', ..., 'c', '\r' }
  2084. The remaining data is left in the buffer `b` as follows:
  2085. { 'd', 'e', ... }
  2086. This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation.
  2087. [endsect]
  2088. [section:overload7 async_read_until (7 of 12 overloads)]
  2089. Start an asynchronous operation to read data into a streambuf until some part of its data matches a regular expression.
  2090. template<
  2091. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  2092. typename Allocator,
  2093. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  2094. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until(
  2095. AsyncReadStream & s,
  2096. boost::asio::basic_streambuf< Allocator > & b,
  2097. const boost::regex & expr,
  2098. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  2099. This function is used to asynchronously read data into the specified streambuf until the streambuf's get area contains some data that matches a regular expression. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  2100. * A substring of the streambuf's get area matches the regular expression.
  2101. * An error occurred.
  2102. This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the streambuf's get area already contains data that matches the regular expression, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
  2103. [heading Parameters]
  2104. [variablelist
  2105. [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
  2106. [[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.]]
  2107. [[expr][The regular expression.]]
  2108. [[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:
  2109. ``
  2110. void handler(
  2111. // Result of operation.
  2112. const boost::system::error_code& error,
  2113. // The number of bytes in the streambuf's get
  2114. // area up to and including the substring
  2115. // that matches the regular. expression.
  2116. // 0 if an error occurred.
  2117. std::size_t bytes_transferred
  2118. );
  2119. ``
  2120. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  2121. ]
  2122. [heading Remarks]
  2123. After a successful async\_read\_until operation, the streambuf may contain additional data beyond that which matched the regular expression. An application will typically leave that data in the streambuf for a subsequent async\_read\_until operation to examine.
  2124. [heading Example]
  2125. To asynchronously read data into a streambuf until a CR-LF sequence is encountered:
  2126. boost::asio::streambuf b;
  2127. ...
  2128. void handler(const boost::system::error_code& e, std::size_t size)
  2129. {
  2130. if (!e)
  2131. {
  2132. std::istream is(&b);
  2133. std::string line;
  2134. std::getline(is, line);
  2135. ...
  2136. }
  2137. }
  2138. ...
  2139. boost::asio::async_read_until(s, b, boost::regex("\r\n"), handler);
  2140. After the `async_read_until` operation completes successfully, the buffer `b` contains the data which matched the regular expression:
  2141. { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... }
  2142. The call to `std::getline` then extracts the data up to and including the newline (which is discarded), so that the string `line` contains:
  2143. { 'a', 'b', ..., 'c', '\r' }
  2144. The remaining data is left in the buffer `b` as follows:
  2145. { 'd', 'e', ... }
  2146. This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation.
  2147. [endsect]
  2148. [section:overload8 async_read_until (8 of 12 overloads)]
  2149. Start an asynchronous operation to read data into a streambuf until a function object indicates a match.
  2150. template<
  2151. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  2152. typename Allocator,
  2153. typename MatchCondition,
  2154. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  2155. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until(
  2156. AsyncReadStream & s,
  2157. boost::asio::basic_streambuf< Allocator > & b,
  2158. MatchCondition match_condition,
  2159. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  2160. typename enable_if< is_match_condition< MatchCondition >::value >::type * = 0);
  2161. This function is used to asynchronously read data into the specified streambuf until a user-defined match condition function object, when applied to the data contained in the streambuf, indicates a successful match. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  2162. * The match condition function object returns a std::pair where the second element evaluates to true.
  2163. * An error occurred.
  2164. This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the match condition function object already indicates a match, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
  2165. [heading Parameters]
  2166. [variablelist
  2167. [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
  2168. [[b][A streambuf object into which the data will be read.]]
  2169. [[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be:
  2170. ``
  2171. pair<iterator, bool> match_condition(iterator begin, iterator end);
  2172. ``
  2173. where `iterator` represents the type:
  2174. ``
  2175. buffers_iterator<basic_streambuf<Allocator>::const_buffers_type>
  2176. ``
  2177. The iterator parameters `begin` and `end` define the range of bytes to be scanned to determine whether there is a match. The `first` member of the return value is an iterator marking one-past-the-end of the bytes that have been consumed by the match function. This iterator is used to calculate the `begin` parameter for any subsequent invocation of the match condition. The `second` member of the return value is true if a match has been found, false otherwise.]]
  2178. [[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:
  2179. ``
  2180. void handler(
  2181. // Result of operation.
  2182. const boost::system::error_code& error,
  2183. // The number of bytes in the streambuf's get
  2184. // area that have been fully consumed by the
  2185. // match function. O if an error occurred.
  2186. std::size_t bytes_transferred
  2187. );
  2188. ``
  2189. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  2190. ]
  2191. [heading Remarks]
  2192. After a successful async\_read\_until operation, the streambuf may contain additional data beyond that which matched the function object. An application will typically leave that data in the streambuf for a subsequent async\_read\_until operation to examine.
  2193. The default implementation of the `is_match_condition` type trait evaluates to true for function pointers and function objects with a `result_type` typedef. It must be specialised for other user-defined function objects.
  2194. [heading Examples]
  2195. To asynchronously read data into a streambuf until whitespace is encountered:
  2196. typedef boost::asio::buffers_iterator<
  2197. boost::asio::streambuf::const_buffers_type> iterator;
  2198. std::pair<iterator, bool>
  2199. match_whitespace(iterator begin, iterator end)
  2200. {
  2201. iterator i = begin;
  2202. while (i != end)
  2203. if (std::isspace(*i++))
  2204. return std::make_pair(i, true);
  2205. return std::make_pair(i, false);
  2206. }
  2207. ...
  2208. void handler(const boost::system::error_code& e, std::size_t size);
  2209. ...
  2210. boost::asio::streambuf b;
  2211. boost::asio::async_read_until(s, b, match_whitespace, handler);
  2212. To asynchronously read data into a streambuf until a matching character is found:
  2213. class match_char
  2214. {
  2215. public:
  2216. explicit match_char(char c) : c_(c) {}
  2217. template <typename Iterator>
  2218. std::pair<Iterator, bool> operator()(
  2219. Iterator begin, Iterator end) const
  2220. {
  2221. Iterator i = begin;
  2222. while (i != end)
  2223. if (c_ == *i++)
  2224. return std::make_pair(i, true);
  2225. return std::make_pair(i, false);
  2226. }
  2227. private:
  2228. char c_;
  2229. };
  2230. namespace asio {
  2231. template <> struct is_match_condition<match_char>
  2232. : public boost::true_type {};
  2233. } // namespace asio
  2234. ...
  2235. void handler(const boost::system::error_code& e, std::size_t size);
  2236. ...
  2237. boost::asio::streambuf b;
  2238. boost::asio::async_read_until(s, b, match_char('a'), handler);
  2239. [endsect]
  2240. [section:overload9 async_read_until (9 of 12 overloads)]
  2241. Start an asynchronous operation to read data into a dynamic buffer sequence until it contains a specified delimiter.
  2242. template<
  2243. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  2244. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
  2245. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  2246. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until(
  2247. AsyncReadStream & s,
  2248. DynamicBuffer_v2 buffers,
  2249. char delim,
  2250. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  2251. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  2252. This function is used to asynchronously read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains the specified delimiter. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  2253. * The get area of the dynamic buffer sequence contains the specified delimiter.
  2254. * An error occurred.
  2255. This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the dynamic buffer sequence's get area already contains the delimiter, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
  2256. [heading Parameters]
  2257. [variablelist
  2258. [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
  2259. [[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.]]
  2260. [[delim][The delimiter character.]]
  2261. [[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:
  2262. ``
  2263. void handler(
  2264. // Result of operation.
  2265. const boost::system::error_code& error,
  2266. // The number of bytes in the dynamic buffer sequence's
  2267. // get area up to and including the delimiter.
  2268. // 0 if an error occurred.
  2269. std::size_t bytes_transferred
  2270. );
  2271. ``
  2272. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  2273. ]
  2274. [heading Remarks]
  2275. After a successful async\_read\_until operation, the dynamic buffer sequence may contain additional data beyond the delimiter. An application will typically leave that data in the dynamic buffer sequence for a subsequent async\_read\_until operation to examine.
  2276. [heading Example]
  2277. To asynchronously read data into a `std::string` until a newline is encountered:
  2278. std::string data;
  2279. ...
  2280. void handler(const boost::system::error_code& e, std::size_t size)
  2281. {
  2282. if (!e)
  2283. {
  2284. std::string line = data.substr(0, n);
  2285. data.erase(0, n);
  2286. ...
  2287. }
  2288. }
  2289. ...
  2290. boost::asio::async_read_until(s, data, '\n', handler);
  2291. After the `async_read_until` operation completes successfully, the buffer `data` contains the delimiter:
  2292. { 'a', 'b', ..., 'c', '\n', 'd', 'e', ... }
  2293. The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains:
  2294. { 'a', 'b', ..., 'c', '\n' }
  2295. After the call to `erase`, the remaining data is left in the buffer `data` as follows:
  2296. { 'd', 'e', ... }
  2297. This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation.
  2298. [endsect]
  2299. [section:overload10 async_read_until (10 of 12 overloads)]
  2300. Start an asynchronous operation to read data into a dynamic buffer sequence until it contains a specified delimiter.
  2301. template<
  2302. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  2303. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
  2304. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  2305. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until(
  2306. AsyncReadStream & s,
  2307. DynamicBuffer_v2 buffers,
  2308. string_view delim,
  2309. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  2310. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  2311. This function is used to asynchronously read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains the specified delimiter. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  2312. * The get area of the dynamic buffer sequence contains the specified delimiter.
  2313. * An error occurred.
  2314. This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the dynamic buffer sequence's get area already contains the delimiter, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
  2315. [heading Parameters]
  2316. [variablelist
  2317. [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
  2318. [[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.]]
  2319. [[delim][The delimiter string.]]
  2320. [[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:
  2321. ``
  2322. void handler(
  2323. // Result of operation.
  2324. const boost::system::error_code& error,
  2325. // The number of bytes in the dynamic buffer sequence's
  2326. // get area up to and including the delimiter.
  2327. // 0 if an error occurred.
  2328. std::size_t bytes_transferred
  2329. );
  2330. ``
  2331. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  2332. ]
  2333. [heading Remarks]
  2334. After a successful async\_read\_until operation, the dynamic buffer sequence may contain additional data beyond the delimiter. An application will typically leave that data in the dynamic buffer sequence for a subsequent async\_read\_until operation to examine.
  2335. [heading Example]
  2336. To asynchronously read data into a `std::string` until a CR-LF sequence is encountered:
  2337. std::string data;
  2338. ...
  2339. void handler(const boost::system::error_code& e, std::size_t size)
  2340. {
  2341. if (!e)
  2342. {
  2343. std::string line = data.substr(0, n);
  2344. data.erase(0, n);
  2345. ...
  2346. }
  2347. }
  2348. ...
  2349. boost::asio::async_read_until(s, data, "\r\n", handler);
  2350. After the `async_read_until` operation completes successfully, the string `data` contains the delimiter:
  2351. { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... }
  2352. The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains:
  2353. { 'a', 'b', ..., 'c', '\r', '\n' }
  2354. After the call to `erase`, the remaining data is left in the string `data` as follows:
  2355. { 'd', 'e', ... }
  2356. This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation.
  2357. [endsect]
  2358. [section:overload11 async_read_until (11 of 12 overloads)]
  2359. Start an asynchronous operation to read data into a dynamic buffer sequence until some part of its data matches a regular expression.
  2360. template<
  2361. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  2362. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
  2363. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  2364. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until(
  2365. AsyncReadStream & s,
  2366. DynamicBuffer_v2 buffers,
  2367. const boost::regex & expr,
  2368. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  2369. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  2370. This function is used to asynchronously read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains some data that matches a regular expression. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  2371. * A substring of the dynamic buffer sequence's get area matches the regular expression.
  2372. * An error occurred.
  2373. This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the dynamic buffer sequence's get area already contains data that matches the regular expression, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
  2374. [heading Parameters]
  2375. [variablelist
  2376. [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
  2377. [[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.]]
  2378. [[expr][The regular expression.]]
  2379. [[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:
  2380. ``
  2381. void handler(
  2382. // Result of operation.
  2383. const boost::system::error_code& error,
  2384. // The number of bytes in the dynamic buffer
  2385. // sequence's get area up to and including the
  2386. // substring that matches the regular expression.
  2387. // 0 if an error occurred.
  2388. std::size_t bytes_transferred
  2389. );
  2390. ``
  2391. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  2392. ]
  2393. [heading Remarks]
  2394. After a successful async\_read\_until operation, the dynamic buffer sequence may contain additional data beyond that which matched the regular expression. An application will typically leave that data in the dynamic buffer sequence for a subsequent async\_read\_until operation to examine.
  2395. [heading Example]
  2396. To asynchronously read data into a `std::string` until a CR-LF sequence is encountered:
  2397. std::string data;
  2398. ...
  2399. void handler(const boost::system::error_code& e, std::size_t size)
  2400. {
  2401. if (!e)
  2402. {
  2403. std::string line = data.substr(0, n);
  2404. data.erase(0, n);
  2405. ...
  2406. }
  2407. }
  2408. ...
  2409. boost::asio::async_read_until(s, data,
  2410. boost::regex("\r\n"), handler);
  2411. After the `async_read_until` operation completes successfully, the string `data` contains the data which matched the regular expression:
  2412. { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... }
  2413. The call to `substr` then extracts the data up to and including the match, so that the string `line` contains:
  2414. { 'a', 'b', ..., 'c', '\r', '\n' }
  2415. After the call to `erase`, the remaining data is left in the string `data` as follows:
  2416. { 'd', 'e', ... }
  2417. This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation.
  2418. [endsect]
  2419. [section:overload12 async_read_until (12 of 12 overloads)]
  2420. Start an asynchronous operation to read data into a dynamic buffer sequence until a function object indicates a match.
  2421. template<
  2422. typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
  2423. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
  2424. typename MatchCondition,
  2425. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  2426. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until(
  2427. AsyncReadStream & s,
  2428. DynamicBuffer_v2 buffers,
  2429. MatchCondition match_condition,
  2430. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  2431. typename enable_if< is_match_condition< MatchCondition >::value &&is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  2432. This function is used to asynchronously read data into the specified dynamic buffer sequence until a user-defined match condition function object, when applied to the data contained in the dynamic buffer sequence, indicates a successful match. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  2433. * The match condition function object returns a std::pair where the second element evaluates to true.
  2434. * An error occurred.
  2435. This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the match condition function object already indicates a match, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes.
  2436. [heading Parameters]
  2437. [variablelist
  2438. [[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
  2439. [[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.]]
  2440. [[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be:
  2441. ``
  2442. pair<iterator, bool> match_condition(iterator begin, iterator end);
  2443. ``
  2444. where `iterator` represents the type:
  2445. ``
  2446. buffers_iterator<typename DynamicBuffer_v2::const_buffers_type>
  2447. ``
  2448. The iterator parameters `begin` and `end` define the range of bytes to be scanned to determine whether there is a match. The `first` member of the return value is an iterator marking one-past-the-end of the bytes that have been consumed by the match function. This iterator is used to calculate the `begin` parameter for any subsequent invocation of the match condition. The `second` member of the return value is true if a match has been found, false otherwise.]]
  2449. [[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:
  2450. ``
  2451. void handler(
  2452. // Result of operation.
  2453. const boost::system::error_code& error,
  2454. // The number of bytes in the dynamic buffer sequence's
  2455. // get area that have been fully consumed by the match
  2456. // function. O if an error occurred.
  2457. std::size_t bytes_transferred
  2458. );
  2459. ``
  2460. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  2461. ]
  2462. [heading Remarks]
  2463. After a successful async\_read\_until operation, the dynamic buffer sequence may contain additional data beyond that which matched the function object. An application will typically leave that data in the dynamic buffer sequence for a subsequent async\_read\_until operation to examine.
  2464. The default implementation of the `is_match_condition` type trait evaluates to true for function pointers and function objects with a `result_type` typedef. It must be specialised for other user-defined function objects.
  2465. [heading Examples]
  2466. To asynchronously read data into a `std::string` until whitespace is encountered:
  2467. typedef boost::asio::buffers_iterator<
  2468. boost::asio::const_buffers_1> iterator;
  2469. std::pair<iterator, bool>
  2470. match_whitespace(iterator begin, iterator end)
  2471. {
  2472. iterator i = begin;
  2473. while (i != end)
  2474. if (std::isspace(*i++))
  2475. return std::make_pair(i, true);
  2476. return std::make_pair(i, false);
  2477. }
  2478. ...
  2479. void handler(const boost::system::error_code& e, std::size_t size);
  2480. ...
  2481. std::string data;
  2482. boost::asio::async_read_until(s, data, match_whitespace, handler);
  2483. To asynchronously read data into a `std::string` until a matching character is found:
  2484. class match_char
  2485. {
  2486. public:
  2487. explicit match_char(char c) : c_(c) {}
  2488. template <typename Iterator>
  2489. std::pair<Iterator, bool> operator()(
  2490. Iterator begin, Iterator end) const
  2491. {
  2492. Iterator i = begin;
  2493. while (i != end)
  2494. if (c_ == *i++)
  2495. return std::make_pair(i, true);
  2496. return std::make_pair(i, false);
  2497. }
  2498. private:
  2499. char c_;
  2500. };
  2501. namespace asio {
  2502. template <> struct is_match_condition<match_char>
  2503. : public boost::true_type {};
  2504. } // namespace asio
  2505. ...
  2506. void handler(const boost::system::error_code& e, std::size_t size);
  2507. ...
  2508. std::string data;
  2509. boost::asio::async_read_until(s, data, match_char('a'), handler);
  2510. [endsect]
  2511. [endsect]
  2512. [section:async_result async_result]
  2513. An interface for customising the behaviour of an initiating function.
  2514. template<
  2515. typename CompletionToken,
  2516. typename Signature>
  2517. class async_result
  2518. [heading Types]
  2519. [table
  2520. [[Name][Description]]
  2521. [
  2522. [[link boost_asio.reference.async_result.completion_handler_type [*completion_handler_type]]]
  2523. [The concrete completion handler type for the specific signature. ]
  2524. ]
  2525. [
  2526. [[link boost_asio.reference.async_result.return_type [*return_type]]]
  2527. [The return type of the initiating function. ]
  2528. ]
  2529. ]
  2530. [heading Member Functions]
  2531. [table
  2532. [[Name][Description]]
  2533. [
  2534. [[link boost_asio.reference.async_result.async_result [*async_result]]]
  2535. [Construct an async result from a given handler. ]
  2536. ]
  2537. [
  2538. [[link boost_asio.reference.async_result.get [*get]]]
  2539. [Obtain the value to be returned from the initiating function. ]
  2540. ]
  2541. [
  2542. [[link boost_asio.reference.async_result.initiate [*initiate]]]
  2543. [Initiate the asynchronous operation that will produce the result, and obtain the value to be returned from the initiating function. ]
  2544. ]
  2545. ]
  2546. The [link boost_asio.reference.async_result `async_result`] traits class is used for determining:
  2547. * the concrete completion handler type to be called at the end of the asynchronous operation;
  2548. * the initiating function return type; and
  2549. * how the return value of the initiating function is obtained.
  2550. The trait allows the handler and return types to be determined at the point where the specific completion handler signature is known.
  2551. This template may be specialised for user-defined completion token types. The primary template assumes that the CompletionToken is the completion handler.
  2552. [heading Requirements]
  2553. ['Header: ][^boost/asio/async_result.hpp]
  2554. ['Convenience header: ][^boost/asio.hpp]
  2555. [section:async_result async_result::async_result]
  2556. [indexterm2 boost_asio.indexterm.async_result.async_result..async_result..async_result]
  2557. Construct an async result from a given handler.
  2558. async_result(
  2559. completion_handler_type & h);
  2560. When using a specalised [link boost_asio.reference.async_result `async_result`], the constructor has an opportunity to initialise some state associated with the completion handler, which is then returned from the initiating function.
  2561. [endsect]
  2562. [section:completion_handler_type async_result::completion_handler_type]
  2563. [indexterm2 boost_asio.indexterm.async_result.completion_handler_type..completion_handler_type..async_result]
  2564. The concrete completion handler type for the specific signature.
  2565. typedef CompletionToken completion_handler_type;
  2566. [heading Requirements]
  2567. ['Header: ][^boost/asio/async_result.hpp]
  2568. ['Convenience header: ][^boost/asio.hpp]
  2569. [endsect]
  2570. [section:get async_result::get]
  2571. [indexterm2 boost_asio.indexterm.async_result.get..get..async_result]
  2572. Obtain the value to be returned from the initiating function.
  2573. return_type get();
  2574. [endsect]
  2575. [section:initiate async_result::initiate]
  2576. [indexterm2 boost_asio.indexterm.async_result.initiate..initiate..async_result]
  2577. Initiate the asynchronous operation that will produce the result, and obtain the value to be returned from the initiating function.
  2578. template<
  2579. typename Initiation,
  2580. typename RawCompletionToken,
  2581. typename... Args>
  2582. static return_type initiate(
  2583. Initiation && initiation,
  2584. RawCompletionToken && token,
  2585. Args &&... args);
  2586. [endsect]
  2587. [section:return_type async_result::return_type]
  2588. [indexterm2 boost_asio.indexterm.async_result.return_type..return_type..async_result]
  2589. The return type of the initiating function.
  2590. typedef void return_type;
  2591. [heading Requirements]
  2592. ['Header: ][^boost/asio/async_result.hpp]
  2593. ['Convenience header: ][^boost/asio.hpp]
  2594. [endsect]
  2595. [endsect]
  2596. [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 >]
  2597. Partial specialisation of `async_result` for `std::packaged_task`.
  2598. template<
  2599. typename Result,
  2600. typename... Args,
  2601. typename Signature>
  2602. class async_result< std::packaged_task< Result(Args...)>, Signature >
  2603. [heading Types]
  2604. [table
  2605. [[Name][Description]]
  2606. [
  2607. [[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]]]
  2608. [The packaged task is the concrete completion handler type. ]
  2609. ]
  2610. [
  2611. [[link boost_asio.reference.async_result_lt__std__packaged_task_lt__Result_lp_Args_ellipsis__rp__gt__comma__Signature__gt_.return_type [*return_type]]]
  2612. [The return type of the initiating function is the future obtained from the packaged task. ]
  2613. ]
  2614. ]
  2615. [heading Member Functions]
  2616. [table
  2617. [[Name][Description]]
  2618. [
  2619. [[link boost_asio.reference.async_result_lt__std__packaged_task_lt__Result_lp_Args_ellipsis__rp__gt__comma__Signature__gt_.async_result [*async_result]]]
  2620. [The constructor extracts the future from the packaged task. ]
  2621. ]
  2622. [
  2623. [[link boost_asio.reference.async_result_lt__std__packaged_task_lt__Result_lp_Args_ellipsis__rp__gt__comma__Signature__gt_.get [*get]]]
  2624. [Returns the packaged task's future. ]
  2625. ]
  2626. ]
  2627. [heading Requirements]
  2628. ['Header: ][^boost/asio/packaged_task.hpp]
  2629. ['Convenience header: ][^boost/asio.hpp]
  2630. [section:async_result async_result< std::packaged_task< Result(Args...)>, Signature >::async_result]
  2631. [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 >]
  2632. The constructor extracts the future from the packaged task.
  2633. async_result(
  2634. completion_handler_type & h);
  2635. [endsect]
  2636. [section:completion_handler_type async_result< std::packaged_task< Result(Args...)>, Signature >::completion_handler_type]
  2637. [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 >]
  2638. The packaged task is the concrete completion handler type.
  2639. typedef std::packaged_task< Result(Args...)> completion_handler_type;
  2640. [heading Requirements]
  2641. ['Header: ][^boost/asio/packaged_task.hpp]
  2642. ['Convenience header: ][^boost/asio.hpp]
  2643. [endsect]
  2644. [section:get async_result< std::packaged_task< Result(Args...)>, Signature >::get]
  2645. [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 >]
  2646. Returns the packaged task's future.
  2647. return_type get();
  2648. [endsect]
  2649. [section:return_type async_result< std::packaged_task< Result(Args...)>, Signature >::return_type]
  2650. [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 >]
  2651. The return type of the initiating function is the future obtained from the packaged task.
  2652. typedef std::future< Result > return_type;
  2653. [heading Requirements]
  2654. ['Header: ][^boost/asio/packaged_task.hpp]
  2655. ['Convenience header: ][^boost/asio.hpp]
  2656. [endsect]
  2657. [endsect]
  2658. [section:async_write async_write]
  2659. [indexterm1 boost_asio.indexterm.async_write..async_write]
  2660. The `async_write` function is a composed asynchronous operation that writes a certain amount of data to a stream before completion.
  2661. Start an asynchronous operation to write all of the supplied data to a stream.
  2662. template<
  2663. typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
  2664. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  2665. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  2666. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload1 async_write]``(
  2667. AsyncWriteStream & s,
  2668. const ConstBufferSequence & buffers,
  2669. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  2670. typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type * = 0);
  2671. `` [''''&raquo;''' [link boost_asio.reference.async_write.overload1 more...]]``
  2672. Start an asynchronous operation to write a certain amount of data to a stream.
  2673. template<
  2674. typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
  2675. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  2676. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
  2677. typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
  2678. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload2 async_write]``(
  2679. AsyncWriteStream & s,
  2680. const ConstBufferSequence & buffers,
  2681. CompletionCondition completion_condition,
  2682. WriteHandler && handler,
  2683. typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type * = 0);
  2684. `` [''''&raquo;''' [link boost_asio.reference.async_write.overload2 more...]]``
  2685. Start an asynchronous operation to write all of the supplied data to a stream.
  2686. template<
  2687. typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
  2688. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
  2689. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  2690. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload3 async_write]``(
  2691. AsyncWriteStream & s,
  2692. DynamicBuffer_v1 && buffers,
  2693. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  2694. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  2695. `` [''''&raquo;''' [link boost_asio.reference.async_write.overload3 more...]]``
  2696. Start an asynchronous operation to write a certain amount of data to a stream.
  2697. template<
  2698. typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
  2699. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
  2700. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
  2701. typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
  2702. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload4 async_write]``(
  2703. AsyncWriteStream & s,
  2704. DynamicBuffer_v1 && buffers,
  2705. CompletionCondition completion_condition,
  2706. WriteHandler && handler,
  2707. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  2708. `` [''''&raquo;''' [link boost_asio.reference.async_write.overload4 more...]]``
  2709. Start an asynchronous operation to write all of the supplied data to a stream.
  2710. template<
  2711. typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
  2712. typename Allocator,
  2713. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  2714. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload5 async_write]``(
  2715. AsyncWriteStream & s,
  2716. basic_streambuf< Allocator > & b,
  2717. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  2718. `` [''''&raquo;''' [link boost_asio.reference.async_write.overload5 more...]]``
  2719. Start an asynchronous operation to write a certain amount of data to a stream.
  2720. template<
  2721. typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
  2722. typename Allocator,
  2723. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
  2724. typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
  2725. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload6 async_write]``(
  2726. AsyncWriteStream & s,
  2727. basic_streambuf< Allocator > & b,
  2728. CompletionCondition completion_condition,
  2729. WriteHandler && handler);
  2730. `` [''''&raquo;''' [link boost_asio.reference.async_write.overload6 more...]]``
  2731. Start an asynchronous operation to write all of the supplied data to a stream.
  2732. template<
  2733. typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
  2734. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
  2735. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  2736. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload7 async_write]``(
  2737. AsyncWriteStream & s,
  2738. DynamicBuffer_v2 buffers,
  2739. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  2740. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  2741. `` [''''&raquo;''' [link boost_asio.reference.async_write.overload7 more...]]``
  2742. Start an asynchronous operation to write a certain amount of data to a stream.
  2743. template<
  2744. typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
  2745. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
  2746. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
  2747. typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
  2748. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload8 async_write]``(
  2749. AsyncWriteStream & s,
  2750. DynamicBuffer_v2 buffers,
  2751. CompletionCondition completion_condition,
  2752. WriteHandler && handler,
  2753. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  2754. `` [''''&raquo;''' [link boost_asio.reference.async_write.overload8 more...]]``
  2755. [heading Requirements]
  2756. ['Header: ][^boost/asio/write.hpp]
  2757. ['Convenience header: ][^boost/asio.hpp]
  2758. [section:overload1 async_write (1 of 8 overloads)]
  2759. Start an asynchronous operation to write all of the supplied data to a stream.
  2760. template<
  2761. typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
  2762. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  2763. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  2764. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write(
  2765. AsyncWriteStream & s,
  2766. const ConstBufferSequence & buffers,
  2767. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  2768. typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type * = 0);
  2769. This function is used to asynchronously write a certain number of bytes of data to a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  2770. * 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.
  2771. * An error occurred.
  2772. This operation is implemented in terms of zero or more calls to the stream's async\_write\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other write operations (such as async\_write, the stream's async\_write\_some function, or any other composed operations that perform writes) until this operation completes.
  2773. [heading Parameters]
  2774. [variablelist
  2775. [[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]]
  2776. [[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.]]
  2777. [[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:
  2778. ``
  2779. void handler(
  2780. const boost::system::error_code& error, // Result of operation.
  2781. std::size_t bytes_transferred // Number of bytes written from the
  2782. // buffers. If an error occurred,
  2783. // this will be less than the sum
  2784. // of the buffer sizes.
  2785. );
  2786. ``
  2787. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  2788. ]
  2789. [heading Example]
  2790. To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  2791. boost::asio::async_write(s, boost::asio::buffer(data, size), handler);
  2792. See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  2793. [endsect]
  2794. [section:overload2 async_write (2 of 8 overloads)]
  2795. Start an asynchronous operation to write a certain amount of data to a stream.
  2796. template<
  2797. typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
  2798. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  2799. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
  2800. typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
  2801. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write(
  2802. AsyncWriteStream & s,
  2803. const ConstBufferSequence & buffers,
  2804. CompletionCondition completion_condition,
  2805. WriteHandler && handler,
  2806. typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type * = 0);
  2807. This function is used to asynchronously write a certain number of bytes of data to a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  2808. * 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.
  2809. * The completion\_condition function object returns 0.
  2810. This operation is implemented in terms of zero or more calls to the stream's async\_write\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other write operations (such as async\_write, the stream's async\_write\_some function, or any other composed operations that perform writes) until this operation completes.
  2811. [heading Parameters]
  2812. [variablelist
  2813. [[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]]
  2814. [[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.]]
  2815. [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
  2816. ``
  2817. std::size_t completion_condition(
  2818. // Result of latest async_write_some operation.
  2819. const boost::system::error_code& error,
  2820. // Number of bytes transferred so far.
  2821. std::size_t bytes_transferred
  2822. );
  2823. ``
  2824. A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's async\_write\_some function.]]
  2825. [[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:
  2826. ``
  2827. void handler(
  2828. const boost::system::error_code& error, // Result of operation.
  2829. std::size_t bytes_transferred // Number of bytes written from the
  2830. // buffers. If an error occurred,
  2831. // this will be less than the sum
  2832. // of the buffer sizes.
  2833. );
  2834. ``
  2835. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  2836. ]
  2837. [heading Example]
  2838. To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  2839. boost::asio::async_write(s,
  2840. boost::asio::buffer(data, size),
  2841. boost::asio::transfer_at_least(32),
  2842. handler);
  2843. See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  2844. [endsect]
  2845. [section:overload3 async_write (3 of 8 overloads)]
  2846. Start an asynchronous operation to write all of the supplied data to a stream.
  2847. template<
  2848. typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
  2849. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
  2850. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  2851. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write(
  2852. AsyncWriteStream & s,
  2853. DynamicBuffer_v1 && buffers,
  2854. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  2855. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  2856. This function is used to asynchronously write a certain number of bytes of data to a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  2857. * All of the data in the supplied dynamic buffer sequence has been written.
  2858. * An error occurred.
  2859. This operation is implemented in terms of zero or more calls to the stream's async\_write\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other write operations (such as async\_write, the stream's async\_write\_some function, or any other composed operations that perform writes) until this operation completes.
  2860. [heading Parameters]
  2861. [variablelist
  2862. [[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]]
  2863. [[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.]]
  2864. [[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:
  2865. ``
  2866. void handler(
  2867. const boost::system::error_code& error, // Result of operation.
  2868. std::size_t bytes_transferred // Number of bytes written from the
  2869. // buffers. If an error occurred,
  2870. // this will be less than the sum
  2871. // of the buffer sizes.
  2872. );
  2873. ``
  2874. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
  2875. ]
  2876. [endsect]
  2877. [section:overload4 async_write (4 of 8 overloads)]
  2878. Start an asynchronous operation to write a certain amount of data to a stream.
  2879. template<
  2880. typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
  2881. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
  2882. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
  2883. typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
  2884. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write(
  2885. AsyncWriteStream & s,
  2886. DynamicBuffer_v1 && buffers,
  2887. CompletionCondition completion_condition,
  2888. WriteHandler && handler,
  2889. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  2890. This function is used to asynchronously write a certain number of bytes of data to a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  2891. * All of the data in the supplied dynamic buffer sequence has been written.
  2892. * The completion\_condition function object returns 0.
  2893. This operation is implemented in terms of zero or more calls to the stream's async\_write\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other write operations (such as async\_write, the stream's async\_write\_some function, or any other composed operations that perform writes) until this operation completes.
  2894. [heading Parameters]
  2895. [variablelist
  2896. [[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]]
  2897. [[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.]]
  2898. [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
  2899. ``
  2900. std::size_t completion_condition(
  2901. // Result of latest async_write_some operation.
  2902. const boost::system::error_code& error,
  2903. // Number of bytes transferred so far.
  2904. std::size_t bytes_transferred
  2905. );
  2906. ``
  2907. A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's async\_write\_some function.]]
  2908. [[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:
  2909. ``
  2910. void handler(
  2911. const boost::system::error_code& error, // Result of operation.
  2912. std::size_t bytes_transferred // Number of bytes written from the
  2913. // buffers. If an error occurred,
  2914. // this will be less than the sum
  2915. // of the buffer sizes.
  2916. );
  2917. ``
  2918. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
  2919. ]
  2920. [endsect]
  2921. [section:overload5 async_write (5 of 8 overloads)]
  2922. Start an asynchronous operation to write all of the supplied data to a stream.
  2923. template<
  2924. typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
  2925. typename Allocator,
  2926. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  2927. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write(
  2928. AsyncWriteStream & s,
  2929. basic_streambuf< Allocator > & b,
  2930. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  2931. This function is used to asynchronously write a certain number of bytes of data to a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  2932. * All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written.
  2933. * An error occurred.
  2934. This operation is implemented in terms of zero or more calls to the stream's async\_write\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other write operations (such as async\_write, the stream's async\_write\_some function, or any other composed operations that perform writes) until this operation completes.
  2935. [heading Parameters]
  2936. [variablelist
  2937. [[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]]
  2938. [[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.]]
  2939. [[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:
  2940. ``
  2941. void handler(
  2942. const boost::system::error_code& error, // Result of operation.
  2943. std::size_t bytes_transferred // Number of bytes written from the
  2944. // buffers. If an error occurred,
  2945. // this will be less than the sum
  2946. // of the buffer sizes.
  2947. );
  2948. ``
  2949. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
  2950. ]
  2951. [endsect]
  2952. [section:overload6 async_write (6 of 8 overloads)]
  2953. Start an asynchronous operation to write a certain amount of data to a stream.
  2954. template<
  2955. typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
  2956. typename Allocator,
  2957. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
  2958. typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
  2959. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write(
  2960. AsyncWriteStream & s,
  2961. basic_streambuf< Allocator > & b,
  2962. CompletionCondition completion_condition,
  2963. WriteHandler && handler);
  2964. This function is used to asynchronously write a certain number of bytes of data to a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  2965. * All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written.
  2966. * The completion\_condition function object returns 0.
  2967. This operation is implemented in terms of zero or more calls to the stream's async\_write\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other write operations (such as async\_write, the stream's async\_write\_some function, or any other composed operations that perform writes) until this operation completes.
  2968. [heading Parameters]
  2969. [variablelist
  2970. [[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]]
  2971. [[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.]]
  2972. [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
  2973. ``
  2974. std::size_t completion_condition(
  2975. // Result of latest async_write_some operation.
  2976. const boost::system::error_code& error,
  2977. // Number of bytes transferred so far.
  2978. std::size_t bytes_transferred
  2979. );
  2980. ``
  2981. A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's async\_write\_some function.]]
  2982. [[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:
  2983. ``
  2984. void handler(
  2985. const boost::system::error_code& error, // Result of operation.
  2986. std::size_t bytes_transferred // Number of bytes written from the
  2987. // buffers. If an error occurred,
  2988. // this will be less than the sum
  2989. // of the buffer sizes.
  2990. );
  2991. ``
  2992. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
  2993. ]
  2994. [endsect]
  2995. [section:overload7 async_write (7 of 8 overloads)]
  2996. Start an asynchronous operation to write all of the supplied data to a stream.
  2997. template<
  2998. typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
  2999. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
  3000. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  3001. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write(
  3002. AsyncWriteStream & s,
  3003. DynamicBuffer_v2 buffers,
  3004. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  3005. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  3006. This function is used to asynchronously write a certain number of bytes of data to a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  3007. * All of the data in the supplied dynamic buffer sequence has been written.
  3008. * An error occurred.
  3009. This operation is implemented in terms of zero or more calls to the stream's async\_write\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other write operations (such as async\_write, the stream's async\_write\_some function, or any other composed operations that perform writes) until this operation completes.
  3010. [heading Parameters]
  3011. [variablelist
  3012. [[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]]
  3013. [[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.]]
  3014. [[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:
  3015. ``
  3016. void handler(
  3017. const boost::system::error_code& error, // Result of operation.
  3018. std::size_t bytes_transferred // Number of bytes written from the
  3019. // buffers. If an error occurred,
  3020. // this will be less than the sum
  3021. // of the buffer sizes.
  3022. );
  3023. ``
  3024. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
  3025. ]
  3026. [endsect]
  3027. [section:overload8 async_write (8 of 8 overloads)]
  3028. Start an asynchronous operation to write a certain amount of data to a stream.
  3029. template<
  3030. typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
  3031. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
  3032. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
  3033. typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
  3034. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write(
  3035. AsyncWriteStream & s,
  3036. DynamicBuffer_v2 buffers,
  3037. CompletionCondition completion_condition,
  3038. WriteHandler && handler,
  3039. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  3040. This function is used to asynchronously write a certain number of bytes of data to a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  3041. * All of the data in the supplied dynamic buffer sequence has been written.
  3042. * The completion\_condition function object returns 0.
  3043. This operation is implemented in terms of zero or more calls to the stream's async\_write\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other write operations (such as async\_write, the stream's async\_write\_some function, or any other composed operations that perform writes) until this operation completes.
  3044. [heading Parameters]
  3045. [variablelist
  3046. [[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]]
  3047. [[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.]]
  3048. [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
  3049. ``
  3050. std::size_t completion_condition(
  3051. // Result of latest async_write_some operation.
  3052. const boost::system::error_code& error,
  3053. // Number of bytes transferred so far.
  3054. std::size_t bytes_transferred
  3055. );
  3056. ``
  3057. A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's async\_write\_some function.]]
  3058. [[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:
  3059. ``
  3060. void handler(
  3061. const boost::system::error_code& error, // Result of operation.
  3062. std::size_t bytes_transferred // Number of bytes written from the
  3063. // buffers. If an error occurred,
  3064. // this will be less than the sum
  3065. // of the buffer sizes.
  3066. );
  3067. ``
  3068. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
  3069. ]
  3070. [endsect]
  3071. [endsect]
  3072. [section:async_write_at async_write_at]
  3073. [indexterm1 boost_asio.indexterm.async_write_at..async_write_at]
  3074. The `async_write_at` function is a composed asynchronous operation that writes a certain amount of data at the specified offset before completion.
  3075. Start an asynchronous operation to write all of the supplied data at the specified offset.
  3076. template<
  3077. typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``,
  3078. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  3079. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  3080. ``[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]``(
  3081. AsyncRandomAccessWriteDevice & d,
  3082. uint64_t offset,
  3083. const ConstBufferSequence & buffers,
  3084. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  3085. `` [''''&raquo;''' [link boost_asio.reference.async_write_at.overload1 more...]]``
  3086. Start an asynchronous operation to write a certain amount of data at the specified offset.
  3087. template<
  3088. typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``,
  3089. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  3090. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
  3091. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  3092. ``[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]``(
  3093. AsyncRandomAccessWriteDevice & d,
  3094. uint64_t offset,
  3095. const ConstBufferSequence & buffers,
  3096. CompletionCondition completion_condition,
  3097. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  3098. `` [''''&raquo;''' [link boost_asio.reference.async_write_at.overload2 more...]]``
  3099. Start an asynchronous operation to write all of the supplied data at the specified offset.
  3100. template<
  3101. typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``,
  3102. typename Allocator,
  3103. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  3104. ``[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]``(
  3105. AsyncRandomAccessWriteDevice & d,
  3106. uint64_t offset,
  3107. basic_streambuf< Allocator > & b,
  3108. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  3109. `` [''''&raquo;''' [link boost_asio.reference.async_write_at.overload3 more...]]``
  3110. Start an asynchronous operation to write a certain amount of data at the specified offset.
  3111. template<
  3112. typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``,
  3113. typename Allocator,
  3114. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
  3115. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  3116. ``[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]``(
  3117. AsyncRandomAccessWriteDevice & d,
  3118. uint64_t offset,
  3119. basic_streambuf< Allocator > & b,
  3120. CompletionCondition completion_condition,
  3121. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  3122. `` [''''&raquo;''' [link boost_asio.reference.async_write_at.overload4 more...]]``
  3123. [heading Requirements]
  3124. ['Header: ][^boost/asio/write_at.hpp]
  3125. ['Convenience header: ][^boost/asio.hpp]
  3126. [section:overload1 async_write_at (1 of 4 overloads)]
  3127. Start an asynchronous operation to write all of the supplied data at the specified offset.
  3128. template<
  3129. typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``,
  3130. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  3131. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  3132. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_at(
  3133. AsyncRandomAccessWriteDevice & d,
  3134. uint64_t offset,
  3135. const ConstBufferSequence & buffers,
  3136. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  3137. This function is used to asynchronously write a certain number of bytes of data to a random access device at a specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  3138. * 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.
  3139. * An error occurred.
  3140. This operation is implemented in terms of zero or more calls to the device's async\_write\_some\_at function, and is known as a ['composed operation]. The program must ensure that the device performs no ['overlapping] write operations (such as async\_write\_at, the device's async\_write\_some\_at function, or any other composed operations that perform writes) until this operation completes. Operations are overlapping if the regions defined by their offsets, and the numbers of bytes to write, intersect.
  3141. [heading Parameters]
  3142. [variablelist
  3143. [[d][The device to which the data is to be written. The type must support the AsyncRandomAccessWriteDevice concept.]]
  3144. [[offset][The offset at which the data will be written.]]
  3145. [[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.]]
  3146. [[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:
  3147. ``
  3148. void handler(
  3149. // Result of operation.
  3150. const boost::system::error_code& error,
  3151. // Number of bytes written from the buffers. If an error
  3152. // occurred, this will be less than the sum of the buffer sizes.
  3153. std::size_t bytes_transferred
  3154. );
  3155. ``
  3156. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  3157. ]
  3158. [heading Example]
  3159. To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  3160. boost::asio::async_write_at(d, 42, boost::asio::buffer(data, size), handler);
  3161. See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  3162. [endsect]
  3163. [section:overload2 async_write_at (2 of 4 overloads)]
  3164. Start an asynchronous operation to write a certain amount of data at the specified offset.
  3165. template<
  3166. typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``,
  3167. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  3168. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
  3169. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  3170. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_at(
  3171. AsyncRandomAccessWriteDevice & d,
  3172. uint64_t offset,
  3173. const ConstBufferSequence & buffers,
  3174. CompletionCondition completion_condition,
  3175. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  3176. This function is used to asynchronously write a certain number of bytes of data to a random access device at a specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  3177. * 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.
  3178. * The completion\_condition function object returns 0.
  3179. This operation is implemented in terms of zero or more calls to the device's async\_write\_some\_at function, and is known as a ['composed operation]. The program must ensure that the device performs no ['overlapping] write operations (such as async\_write\_at, the device's async\_write\_some\_at function, or any other composed operations that perform writes) until this operation completes. Operations are overlapping if the regions defined by their offsets, and the numbers of bytes to write, intersect.
  3180. [heading Parameters]
  3181. [variablelist
  3182. [[d][The device to which the data is to be written. The type must support the AsyncRandomAccessWriteDevice concept.]]
  3183. [[offset][The offset at which the data will be written.]]
  3184. [[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.]]
  3185. [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
  3186. ``
  3187. std::size_t completion_condition(
  3188. // Result of latest async_write_some_at operation.
  3189. const boost::system::error_code& error,
  3190. // Number of bytes transferred so far.
  3191. std::size_t bytes_transferred
  3192. );
  3193. ``
  3194. A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the device's async\_write\_some\_at function.]]
  3195. [[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:
  3196. ``
  3197. void handler(
  3198. // Result of operation.
  3199. const boost::system::error_code& error,
  3200. // Number of bytes written from the buffers. If an error
  3201. // occurred, this will be less than the sum of the buffer sizes.
  3202. std::size_t bytes_transferred
  3203. );
  3204. ``
  3205. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  3206. ]
  3207. [heading Example]
  3208. To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  3209. boost::asio::async_write_at(d, 42,
  3210. boost::asio::buffer(data, size),
  3211. boost::asio::transfer_at_least(32),
  3212. handler);
  3213. See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  3214. [endsect]
  3215. [section:overload3 async_write_at (3 of 4 overloads)]
  3216. Start an asynchronous operation to write all of the supplied data at the specified offset.
  3217. template<
  3218. typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``,
  3219. typename Allocator,
  3220. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  3221. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_at(
  3222. AsyncRandomAccessWriteDevice & d,
  3223. uint64_t offset,
  3224. basic_streambuf< Allocator > & b,
  3225. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  3226. This function is used to asynchronously write a certain number of bytes of data to a random access device at a specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  3227. * All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written.
  3228. * An error occurred.
  3229. This operation is implemented in terms of zero or more calls to the device's async\_write\_some\_at function, and is known as a ['composed operation]. The program must ensure that the device performs no ['overlapping] write operations (such as async\_write\_at, the device's async\_write\_some\_at function, or any other composed operations that perform writes) until this operation completes. Operations are overlapping if the regions defined by their offsets, and the numbers of bytes to write, intersect.
  3230. [heading Parameters]
  3231. [variablelist
  3232. [[d][The device to which the data is to be written. The type must support the AsyncRandomAccessWriteDevice concept.]]
  3233. [[offset][The offset at which the data will be written.]]
  3234. [[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.]]
  3235. [[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:
  3236. ``
  3237. void handler(
  3238. // Result of operation.
  3239. const boost::system::error_code& error,
  3240. // Number of bytes written from the buffers. If an error
  3241. // occurred, this will be less than the sum of the buffer sizes.
  3242. std::size_t bytes_transferred
  3243. );
  3244. ``
  3245. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
  3246. ]
  3247. [endsect]
  3248. [section:overload4 async_write_at (4 of 4 overloads)]
  3249. Start an asynchronous operation to write a certain amount of data at the specified offset.
  3250. template<
  3251. typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``,
  3252. typename Allocator,
  3253. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``,
  3254. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  3255. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_at(
  3256. AsyncRandomAccessWriteDevice & d,
  3257. uint64_t offset,
  3258. basic_streambuf< Allocator > & b,
  3259. CompletionCondition completion_condition,
  3260. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  3261. This function is used to asynchronously write a certain number of bytes of data to a random access device at a specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
  3262. * All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written.
  3263. * The completion\_condition function object returns 0.
  3264. This operation is implemented in terms of zero or more calls to the device's async\_write\_some\_at function, and is known as a ['composed operation]. The program must ensure that the device performs no ['overlapping] write operations (such as async\_write\_at, the device's async\_write\_some\_at function, or any other composed operations that perform writes) until this operation completes. Operations are overlapping if the regions defined by their offsets, and the numbers of bytes to write, intersect.
  3265. [heading Parameters]
  3266. [variablelist
  3267. [[d][The device to which the data is to be written. The type must support the AsyncRandomAccessWriteDevice concept.]]
  3268. [[offset][The offset at which the data will be written.]]
  3269. [[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.]]
  3270. [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
  3271. ``
  3272. std::size_t completion_condition(
  3273. // Result of latest async_write_some_at operation.
  3274. const boost::system::error_code& error,
  3275. // Number of bytes transferred so far.
  3276. std::size_t bytes_transferred
  3277. );
  3278. ``
  3279. A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the device's async\_write\_some\_at function.]]
  3280. [[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:
  3281. ``
  3282. void handler(
  3283. // Result of operation.
  3284. const boost::system::error_code& error,
  3285. // Number of bytes written from the buffers. If an error
  3286. // occurred, this will be less than the sum of the buffer sizes.
  3287. std::size_t bytes_transferred
  3288. );
  3289. ``
  3290. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
  3291. ]
  3292. [endsect]
  3293. [endsect]
  3294. [section:awaitable awaitable]
  3295. The return type of a coroutine or asynchronous operation.
  3296. template<
  3297. typename T,
  3298. typename ``[link boost_asio.reference.Executor1 Executor]`` = executor>
  3299. class awaitable
  3300. [heading Types]
  3301. [table
  3302. [[Name][Description]]
  3303. [
  3304. [[link boost_asio.reference.awaitable.executor_type [*executor_type]]]
  3305. [The executor type that will be used for the coroutine. ]
  3306. ]
  3307. [
  3308. [[link boost_asio.reference.awaitable.value_type [*value_type]]]
  3309. [The type of the awaited value. ]
  3310. ]
  3311. ]
  3312. [heading Member Functions]
  3313. [table
  3314. [[Name][Description]]
  3315. [
  3316. [[link boost_asio.reference.awaitable.awaitable [*awaitable]]]
  3317. [Default constructor.
  3318. [hr]
  3319. Move constructor. ]
  3320. ]
  3321. [
  3322. [[link boost_asio.reference.awaitable.valid [*valid]]]
  3323. [Checks if the awaitable refers to a future result. ]
  3324. ]
  3325. [
  3326. [[link boost_asio.reference.awaitable._awaitable [*~awaitable]]]
  3327. [Destructor. ]
  3328. ]
  3329. ]
  3330. [heading Requirements]
  3331. ['Header: ][^boost/asio/awaitable.hpp]
  3332. ['Convenience header: ][^boost/asio.hpp]
  3333. [section:awaitable awaitable::awaitable]
  3334. [indexterm2 boost_asio.indexterm.awaitable.awaitable..awaitable..awaitable]
  3335. Default constructor.
  3336. constexpr ``[link boost_asio.reference.awaitable.awaitable.overload1 awaitable]``();
  3337. `` [''''&raquo;''' [link boost_asio.reference.awaitable.awaitable.overload1 more...]]``
  3338. Move constructor.
  3339. ``[link boost_asio.reference.awaitable.awaitable.overload2 awaitable]``(
  3340. awaitable && other);
  3341. `` [''''&raquo;''' [link boost_asio.reference.awaitable.awaitable.overload2 more...]]``
  3342. [section:overload1 awaitable::awaitable (1 of 2 overloads)]
  3343. Default constructor.
  3344. constexpr awaitable();
  3345. [endsect]
  3346. [section:overload2 awaitable::awaitable (2 of 2 overloads)]
  3347. Move constructor.
  3348. awaitable(
  3349. awaitable && other);
  3350. [endsect]
  3351. [endsect]
  3352. [section:executor_type awaitable::executor_type]
  3353. [indexterm2 boost_asio.indexterm.awaitable.executor_type..executor_type..awaitable]
  3354. The executor type that will be used for the coroutine.
  3355. typedef Executor executor_type;
  3356. [heading Requirements]
  3357. ['Header: ][^boost/asio/awaitable.hpp]
  3358. ['Convenience header: ][^boost/asio.hpp]
  3359. [endsect]
  3360. [section:valid awaitable::valid]
  3361. [indexterm2 boost_asio.indexterm.awaitable.valid..valid..awaitable]
  3362. Checks if the awaitable refers to a future result.
  3363. bool valid() const;
  3364. [endsect]
  3365. [section:value_type awaitable::value_type]
  3366. [indexterm2 boost_asio.indexterm.awaitable.value_type..value_type..awaitable]
  3367. The type of the awaited value.
  3368. typedef T value_type;
  3369. [heading Requirements]
  3370. ['Header: ][^boost/asio/awaitable.hpp]
  3371. ['Convenience header: ][^boost/asio.hpp]
  3372. [endsect]
  3373. [section:_awaitable awaitable::~awaitable]
  3374. [indexterm2 boost_asio.indexterm.awaitable._awaitable..~awaitable..awaitable]
  3375. Destructor.
  3376. ~awaitable();
  3377. [endsect]
  3378. [endsect]
  3379. [section:bad_executor bad_executor]
  3380. Exception thrown when trying to access an empty polymorphic executor.
  3381. class bad_executor :
  3382. public std::exception
  3383. [heading Member Functions]
  3384. [table
  3385. [[Name][Description]]
  3386. [
  3387. [[link boost_asio.reference.bad_executor.bad_executor [*bad_executor]]]
  3388. [Constructor. ]
  3389. ]
  3390. [
  3391. [[link boost_asio.reference.bad_executor.what [*what]]]
  3392. [Obtain message associated with exception. ]
  3393. ]
  3394. ]
  3395. [heading Requirements]
  3396. ['Header: ][^boost/asio/executor.hpp]
  3397. ['Convenience header: ][^boost/asio.hpp]
  3398. [section:bad_executor bad_executor::bad_executor]
  3399. [indexterm2 boost_asio.indexterm.bad_executor.bad_executor..bad_executor..bad_executor]
  3400. Constructor.
  3401. bad_executor();
  3402. [endsect]
  3403. [section:what bad_executor::what]
  3404. [indexterm2 boost_asio.indexterm.bad_executor.what..what..bad_executor]
  3405. Obtain message associated with exception.
  3406. virtual const char * what() const;
  3407. [endsect]
  3408. [endsect]
  3409. [section:basic_datagram_socket basic_datagram_socket]
  3410. Provides datagram-oriented socket functionality.
  3411. template<
  3412. typename ``[link boost_asio.reference.Protocol Protocol]``,
  3413. typename ``[link boost_asio.reference.Executor1 Executor]``>
  3414. class basic_datagram_socket :
  3415. public basic_socket< Protocol, Executor >
  3416. [heading Types]
  3417. [table
  3418. [[Name][Description]]
  3419. [
  3420. [[link boost_asio.reference.basic_datagram_socket__rebind_executor [*rebind_executor]]]
  3421. [Rebinds the socket type to another executor. ]
  3422. ]
  3423. [
  3424. [[link boost_asio.reference.basic_datagram_socket.broadcast [*broadcast]]]
  3425. [Socket option to permit sending of broadcast messages. ]
  3426. ]
  3427. [
  3428. [[link boost_asio.reference.basic_datagram_socket.bytes_readable [*bytes_readable]]]
  3429. [IO control command to get the amount of data that can be read without blocking. ]
  3430. ]
  3431. [
  3432. [[link boost_asio.reference.basic_datagram_socket.debug [*debug]]]
  3433. [Socket option to enable socket-level debugging. ]
  3434. ]
  3435. [
  3436. [[link boost_asio.reference.basic_datagram_socket.do_not_route [*do_not_route]]]
  3437. [Socket option to prevent routing, use local interfaces only. ]
  3438. ]
  3439. [
  3440. [[link boost_asio.reference.basic_datagram_socket.enable_connection_aborted [*enable_connection_aborted]]]
  3441. [Socket option to report aborted connections on accept. ]
  3442. ]
  3443. [
  3444. [[link boost_asio.reference.basic_datagram_socket.endpoint_type [*endpoint_type]]]
  3445. [The endpoint type. ]
  3446. ]
  3447. [
  3448. [[link boost_asio.reference.basic_datagram_socket.executor_type [*executor_type]]]
  3449. [The type of the executor associated with the object. ]
  3450. ]
  3451. [
  3452. [[link boost_asio.reference.basic_datagram_socket.keep_alive [*keep_alive]]]
  3453. [Socket option to send keep-alives. ]
  3454. ]
  3455. [
  3456. [[link boost_asio.reference.basic_datagram_socket.linger [*linger]]]
  3457. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  3458. ]
  3459. [
  3460. [[link boost_asio.reference.basic_datagram_socket.lowest_layer_type [*lowest_layer_type]]]
  3461. [A basic_socket is always the lowest layer. ]
  3462. ]
  3463. [
  3464. [[link boost_asio.reference.basic_datagram_socket.message_flags [*message_flags]]]
  3465. [Bitmask type for flags that can be passed to send and receive operations. ]
  3466. ]
  3467. [
  3468. [[link boost_asio.reference.basic_datagram_socket.native_handle_type [*native_handle_type]]]
  3469. [The native representation of a socket. ]
  3470. ]
  3471. [
  3472. [[link boost_asio.reference.basic_datagram_socket.out_of_band_inline [*out_of_band_inline]]]
  3473. [Socket option for putting received out-of-band data inline. ]
  3474. ]
  3475. [
  3476. [[link boost_asio.reference.basic_datagram_socket.protocol_type [*protocol_type]]]
  3477. [The protocol type. ]
  3478. ]
  3479. [
  3480. [[link boost_asio.reference.basic_datagram_socket.receive_buffer_size [*receive_buffer_size]]]
  3481. [Socket option for the receive buffer size of a socket. ]
  3482. ]
  3483. [
  3484. [[link boost_asio.reference.basic_datagram_socket.receive_low_watermark [*receive_low_watermark]]]
  3485. [Socket option for the receive low watermark. ]
  3486. ]
  3487. [
  3488. [[link boost_asio.reference.basic_datagram_socket.reuse_address [*reuse_address]]]
  3489. [Socket option to allow the socket to be bound to an address that is already in use. ]
  3490. ]
  3491. [
  3492. [[link boost_asio.reference.basic_datagram_socket.send_buffer_size [*send_buffer_size]]]
  3493. [Socket option for the send buffer size of a socket. ]
  3494. ]
  3495. [
  3496. [[link boost_asio.reference.basic_datagram_socket.send_low_watermark [*send_low_watermark]]]
  3497. [Socket option for the send low watermark. ]
  3498. ]
  3499. [
  3500. [[link boost_asio.reference.basic_datagram_socket.shutdown_type [*shutdown_type]]]
  3501. [Different ways a socket may be shutdown. ]
  3502. ]
  3503. [
  3504. [[link boost_asio.reference.basic_datagram_socket.wait_type [*wait_type]]]
  3505. [Wait types. ]
  3506. ]
  3507. ]
  3508. [heading Member Functions]
  3509. [table
  3510. [[Name][Description]]
  3511. [
  3512. [[link boost_asio.reference.basic_datagram_socket.assign [*assign]]]
  3513. [Assign an existing native socket to the socket. ]
  3514. ]
  3515. [
  3516. [[link boost_asio.reference.basic_datagram_socket.async_connect [*async_connect]]]
  3517. [Start an asynchronous connect. ]
  3518. ]
  3519. [
  3520. [[link boost_asio.reference.basic_datagram_socket.async_receive [*async_receive]]]
  3521. [Start an asynchronous receive on a connected socket. ]
  3522. ]
  3523. [
  3524. [[link boost_asio.reference.basic_datagram_socket.async_receive_from [*async_receive_from]]]
  3525. [Start an asynchronous receive. ]
  3526. ]
  3527. [
  3528. [[link boost_asio.reference.basic_datagram_socket.async_send [*async_send]]]
  3529. [Start an asynchronous send on a connected socket. ]
  3530. ]
  3531. [
  3532. [[link boost_asio.reference.basic_datagram_socket.async_send_to [*async_send_to]]]
  3533. [Start an asynchronous send. ]
  3534. ]
  3535. [
  3536. [[link boost_asio.reference.basic_datagram_socket.async_wait [*async_wait]]]
  3537. [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  3538. ]
  3539. [
  3540. [[link boost_asio.reference.basic_datagram_socket.at_mark [*at_mark]]]
  3541. [Determine whether the socket is at the out-of-band data mark. ]
  3542. ]
  3543. [
  3544. [[link boost_asio.reference.basic_datagram_socket.available [*available]]]
  3545. [Determine the number of bytes available for reading. ]
  3546. ]
  3547. [
  3548. [[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket [*basic_datagram_socket]]]
  3549. [Construct a basic_datagram_socket without opening it.
  3550. [hr]
  3551. Construct and open a basic_datagram_socket.
  3552. [hr]
  3553. Construct a basic_datagram_socket, opening it and binding it to the given local endpoint.
  3554. [hr]
  3555. Construct a basic_datagram_socket on an existing native socket.
  3556. [hr]
  3557. Move-construct a basic_datagram_socket from another.
  3558. [hr]
  3559. Move-construct a basic_datagram_socket from a socket of another protocol type. ]
  3560. ]
  3561. [
  3562. [[link boost_asio.reference.basic_datagram_socket.bind [*bind]]]
  3563. [Bind the socket to the given local endpoint. ]
  3564. ]
  3565. [
  3566. [[link boost_asio.reference.basic_datagram_socket.cancel [*cancel]]]
  3567. [Cancel all asynchronous operations associated with the socket. ]
  3568. ]
  3569. [
  3570. [[link boost_asio.reference.basic_datagram_socket.close [*close]]]
  3571. [Close the socket. ]
  3572. ]
  3573. [
  3574. [[link boost_asio.reference.basic_datagram_socket.connect [*connect]]]
  3575. [Connect the socket to the specified endpoint. ]
  3576. ]
  3577. [
  3578. [[link boost_asio.reference.basic_datagram_socket.get_executor [*get_executor]]]
  3579. [Get the executor associated with the object. ]
  3580. ]
  3581. [
  3582. [[link boost_asio.reference.basic_datagram_socket.get_option [*get_option]]]
  3583. [Get an option from the socket. ]
  3584. ]
  3585. [
  3586. [[link boost_asio.reference.basic_datagram_socket.io_control [*io_control]]]
  3587. [Perform an IO control command on the socket. ]
  3588. ]
  3589. [
  3590. [[link boost_asio.reference.basic_datagram_socket.is_open [*is_open]]]
  3591. [Determine whether the socket is open. ]
  3592. ]
  3593. [
  3594. [[link boost_asio.reference.basic_datagram_socket.local_endpoint [*local_endpoint]]]
  3595. [Get the local endpoint of the socket. ]
  3596. ]
  3597. [
  3598. [[link boost_asio.reference.basic_datagram_socket.lowest_layer [*lowest_layer]]]
  3599. [Get a reference to the lowest layer.
  3600. [hr]
  3601. Get a const reference to the lowest layer. ]
  3602. ]
  3603. [
  3604. [[link boost_asio.reference.basic_datagram_socket.native_handle [*native_handle]]]
  3605. [Get the native socket representation. ]
  3606. ]
  3607. [
  3608. [[link boost_asio.reference.basic_datagram_socket.native_non_blocking [*native_non_blocking]]]
  3609. [Gets the non-blocking mode of the native socket implementation.
  3610. [hr]
  3611. Sets the non-blocking mode of the native socket implementation. ]
  3612. ]
  3613. [
  3614. [[link boost_asio.reference.basic_datagram_socket.non_blocking [*non_blocking]]]
  3615. [Gets the non-blocking mode of the socket.
  3616. [hr]
  3617. Sets the non-blocking mode of the socket. ]
  3618. ]
  3619. [
  3620. [[link boost_asio.reference.basic_datagram_socket.open [*open]]]
  3621. [Open the socket using the specified protocol. ]
  3622. ]
  3623. [
  3624. [[link boost_asio.reference.basic_datagram_socket.operator_eq_ [*operator=]]]
  3625. [Move-assign a basic_datagram_socket from another.
  3626. [hr]
  3627. Move-assign a basic_datagram_socket from a socket of another protocol type. ]
  3628. ]
  3629. [
  3630. [[link boost_asio.reference.basic_datagram_socket.receive [*receive]]]
  3631. [Receive some data on a connected socket. ]
  3632. ]
  3633. [
  3634. [[link boost_asio.reference.basic_datagram_socket.receive_from [*receive_from]]]
  3635. [Receive a datagram with the endpoint of the sender. ]
  3636. ]
  3637. [
  3638. [[link boost_asio.reference.basic_datagram_socket.release [*release]]]
  3639. [Release ownership of the underlying native socket. ]
  3640. ]
  3641. [
  3642. [[link boost_asio.reference.basic_datagram_socket.remote_endpoint [*remote_endpoint]]]
  3643. [Get the remote endpoint of the socket. ]
  3644. ]
  3645. [
  3646. [[link boost_asio.reference.basic_datagram_socket.send [*send]]]
  3647. [Send some data on a connected socket. ]
  3648. ]
  3649. [
  3650. [[link boost_asio.reference.basic_datagram_socket.send_to [*send_to]]]
  3651. [Send a datagram to the specified endpoint. ]
  3652. ]
  3653. [
  3654. [[link boost_asio.reference.basic_datagram_socket.set_option [*set_option]]]
  3655. [Set an option on the socket. ]
  3656. ]
  3657. [
  3658. [[link boost_asio.reference.basic_datagram_socket.shutdown [*shutdown]]]
  3659. [Disable sends or receives on the socket. ]
  3660. ]
  3661. [
  3662. [[link boost_asio.reference.basic_datagram_socket.wait [*wait]]]
  3663. [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  3664. ]
  3665. [
  3666. [[link boost_asio.reference.basic_datagram_socket._basic_datagram_socket [*~basic_datagram_socket]]]
  3667. [Destroys the socket. ]
  3668. ]
  3669. ]
  3670. [heading Data Members]
  3671. [table
  3672. [[Name][Description]]
  3673. [
  3674. [[link boost_asio.reference.basic_datagram_socket.max_connections [*max_connections]]]
  3675. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  3676. ]
  3677. [
  3678. [[link boost_asio.reference.basic_datagram_socket.max_listen_connections [*max_listen_connections]]]
  3679. [The maximum length of the queue of pending incoming connections. ]
  3680. ]
  3681. [
  3682. [[link boost_asio.reference.basic_datagram_socket.message_do_not_route [*message_do_not_route]]]
  3683. [Specify that the data should not be subject to routing. ]
  3684. ]
  3685. [
  3686. [[link boost_asio.reference.basic_datagram_socket.message_end_of_record [*message_end_of_record]]]
  3687. [Specifies that the data marks the end of a record. ]
  3688. ]
  3689. [
  3690. [[link boost_asio.reference.basic_datagram_socket.message_out_of_band [*message_out_of_band]]]
  3691. [Process out-of-band data. ]
  3692. ]
  3693. [
  3694. [[link boost_asio.reference.basic_datagram_socket.message_peek [*message_peek]]]
  3695. [Peek at incoming data without removing it from the input queue. ]
  3696. ]
  3697. ]
  3698. [heading Protected Data Members]
  3699. [table
  3700. [[Name][Description]]
  3701. [
  3702. [[link boost_asio.reference.basic_datagram_socket.impl_ [*impl_]]]
  3703. []
  3704. ]
  3705. ]
  3706. The [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] class template provides asynchronous and blocking datagram-oriented socket functionality.
  3707. [heading Thread Safety]
  3708. ['Distinct] ['objects:] Safe.
  3709. ['Shared] ['objects:] Unsafe.
  3710. [heading Requirements]
  3711. ['Header: ][^boost/asio/basic_datagram_socket.hpp]
  3712. ['Convenience header: ][^boost/asio.hpp]
  3713. [section:assign basic_datagram_socket::assign]
  3714. [indexterm2 boost_asio.indexterm.basic_datagram_socket.assign..assign..basic_datagram_socket]
  3715. Assign an existing native socket to the socket.
  3716. void ``[link boost_asio.reference.basic_datagram_socket.assign.overload1 assign]``(
  3717. const protocol_type & protocol,
  3718. const native_handle_type & native_socket);
  3719. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.assign.overload1 more...]]``
  3720. void ``[link boost_asio.reference.basic_datagram_socket.assign.overload2 assign]``(
  3721. const protocol_type & protocol,
  3722. const native_handle_type & native_socket,
  3723. boost::system::error_code & ec);
  3724. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.assign.overload2 more...]]``
  3725. [section:overload1 basic_datagram_socket::assign (1 of 2 overloads)]
  3726. ['Inherited from basic_socket.]
  3727. Assign an existing native socket to the socket.
  3728. void assign(
  3729. const protocol_type & protocol,
  3730. const native_handle_type & native_socket);
  3731. [endsect]
  3732. [section:overload2 basic_datagram_socket::assign (2 of 2 overloads)]
  3733. ['Inherited from basic_socket.]
  3734. Assign an existing native socket to the socket.
  3735. void assign(
  3736. const protocol_type & protocol,
  3737. const native_handle_type & native_socket,
  3738. boost::system::error_code & ec);
  3739. [endsect]
  3740. [endsect]
  3741. [section:async_connect basic_datagram_socket::async_connect]
  3742. ['Inherited from basic_socket.]
  3743. [indexterm2 boost_asio.indexterm.basic_datagram_socket.async_connect..async_connect..basic_datagram_socket]
  3744. Start an asynchronous connect.
  3745. template<
  3746. typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  3747. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect(
  3748. const endpoint_type & peer_endpoint,
  3749. ConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  3750. This function is used to asynchronously connect a socket to the specified remote endpoint. The function call always returns immediately.
  3751. The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
  3752. [heading Parameters]
  3753. [variablelist
  3754. [[peer_endpoint][The remote endpoint to which the socket will be connected. Copies will be made of the endpoint object as required.]]
  3755. [[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:
  3756. ``
  3757. void handler(
  3758. const boost::system::error_code& error // Result of operation
  3759. );
  3760. ``
  3761. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  3762. ]
  3763. [heading Example]
  3764. void connect_handler(const boost::system::error_code& error)
  3765. {
  3766. if (!error)
  3767. {
  3768. // Connect succeeded.
  3769. }
  3770. }
  3771. ...
  3772. boost::asio::ip::tcp::socket socket(my_context);
  3773. boost::asio::ip::tcp::endpoint endpoint(
  3774. boost::asio::ip::address::from_string("1.2.3.4"), 12345);
  3775. socket.async_connect(endpoint, connect_handler);
  3776. [endsect]
  3777. [section:async_receive basic_datagram_socket::async_receive]
  3778. [indexterm2 boost_asio.indexterm.basic_datagram_socket.async_receive..async_receive..basic_datagram_socket]
  3779. Start an asynchronous receive on a connected socket.
  3780. template<
  3781. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  3782. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  3783. ``[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]``(
  3784. const MutableBufferSequence & buffers,
  3785. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  3786. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.async_receive.overload1 more...]]``
  3787. template<
  3788. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  3789. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  3790. ``[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]``(
  3791. const MutableBufferSequence & buffers,
  3792. socket_base::message_flags flags,
  3793. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  3794. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.async_receive.overload2 more...]]``
  3795. [section:overload1 basic_datagram_socket::async_receive (1 of 2 overloads)]
  3796. Start an asynchronous receive on a connected socket.
  3797. template<
  3798. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  3799. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  3800. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive(
  3801. const MutableBufferSequence & buffers,
  3802. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  3803. This function is used to asynchronously receive data from the datagram socket. The function call always returns immediately.
  3804. [heading Parameters]
  3805. [variablelist
  3806. [[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.]]
  3807. [[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:
  3808. ``
  3809. void handler(
  3810. const boost::system::error_code& error, // Result of operation.
  3811. std::size_t bytes_transferred // Number of bytes received.
  3812. );
  3813. ``
  3814. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  3815. ]
  3816. [heading Remarks]
  3817. The async\_receive operation can only be used with a connected socket. Use the async\_receive\_from function to receive data on an unconnected datagram socket.
  3818. [heading Example]
  3819. To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  3820. socket.async_receive(boost::asio::buffer(data, size), handler);
  3821. See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  3822. [endsect]
  3823. [section:overload2 basic_datagram_socket::async_receive (2 of 2 overloads)]
  3824. Start an asynchronous receive on a connected socket.
  3825. template<
  3826. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  3827. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  3828. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive(
  3829. const MutableBufferSequence & buffers,
  3830. socket_base::message_flags flags,
  3831. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  3832. This function is used to asynchronously receive data from the datagram socket. The function call always returns immediately.
  3833. [heading Parameters]
  3834. [variablelist
  3835. [[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.]]
  3836. [[flags][Flags specifying how the receive call is to be made.]]
  3837. [[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:
  3838. ``
  3839. void handler(
  3840. const boost::system::error_code& error, // Result of operation.
  3841. std::size_t bytes_transferred // Number of bytes received.
  3842. );
  3843. ``
  3844. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  3845. ]
  3846. [heading Remarks]
  3847. The async\_receive operation can only be used with a connected socket. Use the async\_receive\_from function to receive data on an unconnected datagram socket.
  3848. [endsect]
  3849. [endsect]
  3850. [section:async_receive_from basic_datagram_socket::async_receive_from]
  3851. [indexterm2 boost_asio.indexterm.basic_datagram_socket.async_receive_from..async_receive_from..basic_datagram_socket]
  3852. Start an asynchronous receive.
  3853. template<
  3854. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  3855. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  3856. ``[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]``(
  3857. const MutableBufferSequence & buffers,
  3858. endpoint_type & sender_endpoint,
  3859. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  3860. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.async_receive_from.overload1 more...]]``
  3861. template<
  3862. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  3863. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  3864. ``[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]``(
  3865. const MutableBufferSequence & buffers,
  3866. endpoint_type & sender_endpoint,
  3867. socket_base::message_flags flags,
  3868. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  3869. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.async_receive_from.overload2 more...]]``
  3870. [section:overload1 basic_datagram_socket::async_receive_from (1 of 2 overloads)]
  3871. Start an asynchronous receive.
  3872. template<
  3873. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  3874. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  3875. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive_from(
  3876. const MutableBufferSequence & buffers,
  3877. endpoint_type & sender_endpoint,
  3878. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  3879. This function is used to asynchronously receive a datagram. The function call always returns immediately.
  3880. [heading Parameters]
  3881. [variablelist
  3882. [[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.]]
  3883. [[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.]]
  3884. [[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:
  3885. ``
  3886. void handler(
  3887. const boost::system::error_code& error, // Result of operation.
  3888. std::size_t bytes_transferred // Number of bytes received.
  3889. );
  3890. ``
  3891. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  3892. ]
  3893. [heading Example]
  3894. To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  3895. socket.async_receive_from(
  3896. boost::asio::buffer(data, size), sender_endpoint, handler);
  3897. See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  3898. [endsect]
  3899. [section:overload2 basic_datagram_socket::async_receive_from (2 of 2 overloads)]
  3900. Start an asynchronous receive.
  3901. template<
  3902. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  3903. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  3904. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive_from(
  3905. const MutableBufferSequence & buffers,
  3906. endpoint_type & sender_endpoint,
  3907. socket_base::message_flags flags,
  3908. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  3909. This function is used to asynchronously receive a datagram. The function call always returns immediately.
  3910. [heading Parameters]
  3911. [variablelist
  3912. [[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.]]
  3913. [[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.]]
  3914. [[flags][Flags specifying how the receive call is to be made.]]
  3915. [[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:
  3916. ``
  3917. void handler(
  3918. const boost::system::error_code& error, // Result of operation.
  3919. std::size_t bytes_transferred // Number of bytes received.
  3920. );
  3921. ``
  3922. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
  3923. ]
  3924. [endsect]
  3925. [endsect]
  3926. [section:async_send basic_datagram_socket::async_send]
  3927. [indexterm2 boost_asio.indexterm.basic_datagram_socket.async_send..async_send..basic_datagram_socket]
  3928. Start an asynchronous send on a connected socket.
  3929. template<
  3930. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  3931. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  3932. ``[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]``(
  3933. const ConstBufferSequence & buffers,
  3934. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  3935. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.async_send.overload1 more...]]``
  3936. template<
  3937. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  3938. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  3939. ``[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]``(
  3940. const ConstBufferSequence & buffers,
  3941. socket_base::message_flags flags,
  3942. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  3943. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.async_send.overload2 more...]]``
  3944. [section:overload1 basic_datagram_socket::async_send (1 of 2 overloads)]
  3945. Start an asynchronous send on a connected socket.
  3946. template<
  3947. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  3948. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  3949. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send(
  3950. const ConstBufferSequence & buffers,
  3951. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  3952. This function is used to asynchronously send data on the datagram socket. The function call always returns immediately.
  3953. [heading Parameters]
  3954. [variablelist
  3955. [[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.]]
  3956. [[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:
  3957. ``
  3958. void handler(
  3959. const boost::system::error_code& error, // Result of operation.
  3960. std::size_t bytes_transferred // Number of bytes sent.
  3961. );
  3962. ``
  3963. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  3964. ]
  3965. [heading Remarks]
  3966. The async\_send operation can only be used with a connected socket. Use the async\_send\_to function to send data on an unconnected datagram socket.
  3967. [heading Example]
  3968. To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  3969. socket.async_send(boost::asio::buffer(data, size), handler);
  3970. See the [link boost_asio.reference.buffer `buffer`] documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  3971. [endsect]
  3972. [section:overload2 basic_datagram_socket::async_send (2 of 2 overloads)]
  3973. Start an asynchronous send on a connected socket.
  3974. template<
  3975. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  3976. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  3977. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send(
  3978. const ConstBufferSequence & buffers,
  3979. socket_base::message_flags flags,
  3980. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  3981. This function is used to asynchronously send data on the datagram socket. The function call always returns immediately.
  3982. [heading Parameters]
  3983. [variablelist
  3984. [[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.]]
  3985. [[flags][Flags specifying how the send call is to be made.]]
  3986. [[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:
  3987. ``
  3988. void handler(
  3989. const boost::system::error_code& error, // Result of operation.
  3990. std::size_t bytes_transferred // Number of bytes sent.
  3991. );
  3992. ``
  3993. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  3994. ]
  3995. [heading Remarks]
  3996. The async\_send operation can only be used with a connected socket. Use the async\_send\_to function to send data on an unconnected datagram socket.
  3997. [endsect]
  3998. [endsect]
  3999. [section:async_send_to basic_datagram_socket::async_send_to]
  4000. [indexterm2 boost_asio.indexterm.basic_datagram_socket.async_send_to..async_send_to..basic_datagram_socket]
  4001. Start an asynchronous send.
  4002. template<
  4003. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  4004. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  4005. ``[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]``(
  4006. const ConstBufferSequence & buffers,
  4007. const endpoint_type & destination,
  4008. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  4009. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.async_send_to.overload1 more...]]``
  4010. template<
  4011. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  4012. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  4013. ``[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]``(
  4014. const ConstBufferSequence & buffers,
  4015. const endpoint_type & destination,
  4016. socket_base::message_flags flags,
  4017. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  4018. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.async_send_to.overload2 more...]]``
  4019. [section:overload1 basic_datagram_socket::async_send_to (1 of 2 overloads)]
  4020. Start an asynchronous send.
  4021. template<
  4022. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  4023. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  4024. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send_to(
  4025. const ConstBufferSequence & buffers,
  4026. const endpoint_type & destination,
  4027. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  4028. This function is used to asynchronously send a datagram to the specified remote endpoint. The function call always returns immediately.
  4029. [heading Parameters]
  4030. [variablelist
  4031. [[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.]]
  4032. [[destination][The remote endpoint to which the data will be sent. Copies will be made of the endpoint as required.]]
  4033. [[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:
  4034. ``
  4035. void handler(
  4036. const boost::system::error_code& error, // Result of operation.
  4037. std::size_t bytes_transferred // Number of bytes sent.
  4038. );
  4039. ``
  4040. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  4041. ]
  4042. [heading Example]
  4043. To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  4044. boost::asio::ip::udp::endpoint destination(
  4045. boost::asio::ip::address::from_string("1.2.3.4"), 12345);
  4046. socket.async_send_to(
  4047. boost::asio::buffer(data, size), destination, handler);
  4048. See the [link boost_asio.reference.buffer `buffer`] documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  4049. [endsect]
  4050. [section:overload2 basic_datagram_socket::async_send_to (2 of 2 overloads)]
  4051. Start an asynchronous send.
  4052. template<
  4053. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  4054. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  4055. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send_to(
  4056. const ConstBufferSequence & buffers,
  4057. const endpoint_type & destination,
  4058. socket_base::message_flags flags,
  4059. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  4060. This function is used to asynchronously send a datagram to the specified remote endpoint. The function call always returns immediately.
  4061. [heading Parameters]
  4062. [variablelist
  4063. [[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.]]
  4064. [[flags][Flags specifying how the send call is to be made.]]
  4065. [[destination][The remote endpoint to which the data will be sent. Copies will be made of the endpoint as required.]]
  4066. [[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:
  4067. ``
  4068. void handler(
  4069. const boost::system::error_code& error, // Result of operation.
  4070. std::size_t bytes_transferred // Number of bytes sent.
  4071. );
  4072. ``
  4073. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
  4074. ]
  4075. [endsect]
  4076. [endsect]
  4077. [section:async_wait basic_datagram_socket::async_wait]
  4078. ['Inherited from basic_socket.]
  4079. [indexterm2 boost_asio.indexterm.basic_datagram_socket.async_wait..async_wait..basic_datagram_socket]
  4080. Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions.
  4081. template<
  4082. typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  4083. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait(
  4084. wait_type w,
  4085. WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  4086. This function is used to perform an asynchronous wait for a socket to enter a ready to read, write or error condition state.
  4087. [heading Parameters]
  4088. [variablelist
  4089. [[w][Specifies the desired socket state.]]
  4090. [[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:
  4091. ``
  4092. void handler(
  4093. const boost::system::error_code& error // Result of operation
  4094. );
  4095. ``
  4096. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  4097. ]
  4098. [heading Example]
  4099. void wait_handler(const boost::system::error_code& error)
  4100. {
  4101. if (!error)
  4102. {
  4103. // Wait succeeded.
  4104. }
  4105. }
  4106. ...
  4107. boost::asio::ip::tcp::socket socket(my_context);
  4108. ...
  4109. socket.async_wait(boost::asio::ip::tcp::socket::wait_read, wait_handler);
  4110. [endsect]
  4111. [section:at_mark basic_datagram_socket::at_mark]
  4112. [indexterm2 boost_asio.indexterm.basic_datagram_socket.at_mark..at_mark..basic_datagram_socket]
  4113. Determine whether the socket is at the out-of-band data mark.
  4114. bool ``[link boost_asio.reference.basic_datagram_socket.at_mark.overload1 at_mark]``() const;
  4115. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.at_mark.overload1 more...]]``
  4116. bool ``[link boost_asio.reference.basic_datagram_socket.at_mark.overload2 at_mark]``(
  4117. boost::system::error_code & ec) const;
  4118. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.at_mark.overload2 more...]]``
  4119. [section:overload1 basic_datagram_socket::at_mark (1 of 2 overloads)]
  4120. ['Inherited from basic_socket.]
  4121. Determine whether the socket is at the out-of-band data mark.
  4122. bool at_mark() const;
  4123. This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
  4124. [heading Return Value]
  4125. A bool indicating whether the socket is at the out-of-band data mark.
  4126. [heading Exceptions]
  4127. [variablelist
  4128. [[boost::system::system_error][Thrown on failure. ]]
  4129. ]
  4130. [endsect]
  4131. [section:overload2 basic_datagram_socket::at_mark (2 of 2 overloads)]
  4132. ['Inherited from basic_socket.]
  4133. Determine whether the socket is at the out-of-band data mark.
  4134. bool at_mark(
  4135. boost::system::error_code & ec) const;
  4136. This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
  4137. [heading Parameters]
  4138. [variablelist
  4139. [[ec][Set to indicate what error occurred, if any.]]
  4140. ]
  4141. [heading Return Value]
  4142. A bool indicating whether the socket is at the out-of-band data mark.
  4143. [endsect]
  4144. [endsect]
  4145. [section:available basic_datagram_socket::available]
  4146. [indexterm2 boost_asio.indexterm.basic_datagram_socket.available..available..basic_datagram_socket]
  4147. Determine the number of bytes available for reading.
  4148. std::size_t ``[link boost_asio.reference.basic_datagram_socket.available.overload1 available]``() const;
  4149. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.available.overload1 more...]]``
  4150. std::size_t ``[link boost_asio.reference.basic_datagram_socket.available.overload2 available]``(
  4151. boost::system::error_code & ec) const;
  4152. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.available.overload2 more...]]``
  4153. [section:overload1 basic_datagram_socket::available (1 of 2 overloads)]
  4154. ['Inherited from basic_socket.]
  4155. Determine the number of bytes available for reading.
  4156. std::size_t available() const;
  4157. This function is used to determine the number of bytes that may be read without blocking.
  4158. [heading Return Value]
  4159. The number of bytes that may be read without blocking, or 0 if an error occurs.
  4160. [heading Exceptions]
  4161. [variablelist
  4162. [[boost::system::system_error][Thrown on failure. ]]
  4163. ]
  4164. [endsect]
  4165. [section:overload2 basic_datagram_socket::available (2 of 2 overloads)]
  4166. ['Inherited from basic_socket.]
  4167. Determine the number of bytes available for reading.
  4168. std::size_t available(
  4169. boost::system::error_code & ec) const;
  4170. This function is used to determine the number of bytes that may be read without blocking.
  4171. [heading Parameters]
  4172. [variablelist
  4173. [[ec][Set to indicate what error occurred, if any.]]
  4174. ]
  4175. [heading Return Value]
  4176. The number of bytes that may be read without blocking, or 0 if an error occurs.
  4177. [endsect]
  4178. [endsect]
  4179. [section:basic_datagram_socket basic_datagram_socket::basic_datagram_socket]
  4180. [indexterm2 boost_asio.indexterm.basic_datagram_socket.basic_datagram_socket..basic_datagram_socket..basic_datagram_socket]
  4181. Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] without opening it.
  4182. explicit ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload1 basic_datagram_socket]``(
  4183. const executor_type & ex);
  4184. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload1 more...]]``
  4185. template<
  4186. typename ExecutionContext>
  4187. explicit ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload2 basic_datagram_socket]``(
  4188. ExecutionContext & context,
  4189. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  4190. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload2 more...]]``
  4191. Construct and open a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`].
  4192. ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload3 basic_datagram_socket]``(
  4193. const executor_type & ex,
  4194. const protocol_type & protocol);
  4195. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload3 more...]]``
  4196. template<
  4197. typename ExecutionContext>
  4198. ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload4 basic_datagram_socket]``(
  4199. ExecutionContext & context,
  4200. const protocol_type & protocol,
  4201. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  4202. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload4 more...]]``
  4203. Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`], opening it and binding it to the given local endpoint.
  4204. ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload5 basic_datagram_socket]``(
  4205. const executor_type & ex,
  4206. const endpoint_type & endpoint);
  4207. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload5 more...]]``
  4208. template<
  4209. typename ExecutionContext>
  4210. ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload6 basic_datagram_socket]``(
  4211. ExecutionContext & context,
  4212. const endpoint_type & endpoint,
  4213. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  4214. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload6 more...]]``
  4215. Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] on an existing native socket.
  4216. ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload7 basic_datagram_socket]``(
  4217. const executor_type & ex,
  4218. const protocol_type & protocol,
  4219. const native_handle_type & native_socket);
  4220. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload7 more...]]``
  4221. template<
  4222. typename ExecutionContext>
  4223. ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload8 basic_datagram_socket]``(
  4224. ExecutionContext & context,
  4225. const protocol_type & protocol,
  4226. const native_handle_type & native_socket,
  4227. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  4228. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload8 more...]]``
  4229. Move-construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from another.
  4230. ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload9 basic_datagram_socket]``(
  4231. basic_datagram_socket && other);
  4232. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload9 more...]]``
  4233. Move-construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from a socket of another protocol type.
  4234. template<
  4235. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  4236. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  4237. ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload10 basic_datagram_socket]``(
  4238. basic_datagram_socket< Protocol1, Executor1 > && other,
  4239. typename enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type * = 0);
  4240. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload10 more...]]``
  4241. [section:overload1 basic_datagram_socket::basic_datagram_socket (1 of 10 overloads)]
  4242. Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] without opening it.
  4243. basic_datagram_socket(
  4244. const executor_type & ex);
  4245. This constructor creates a datagram socket without opening it. The `open()` function must be called before data can be sent or received on the socket.
  4246. [heading Parameters]
  4247. [variablelist
  4248. [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket. ]]
  4249. ]
  4250. [endsect]
  4251. [section:overload2 basic_datagram_socket::basic_datagram_socket (2 of 10 overloads)]
  4252. Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] without opening it.
  4253. template<
  4254. typename ExecutionContext>
  4255. basic_datagram_socket(
  4256. ExecutionContext & context,
  4257. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  4258. This constructor creates a datagram socket without opening it. The `open()` function must be called before data can be sent or received on the socket.
  4259. [heading Parameters]
  4260. [variablelist
  4261. [[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. ]]
  4262. ]
  4263. [endsect]
  4264. [section:overload3 basic_datagram_socket::basic_datagram_socket (3 of 10 overloads)]
  4265. Construct and open a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`].
  4266. basic_datagram_socket(
  4267. const executor_type & ex,
  4268. const protocol_type & protocol);
  4269. This constructor creates and opens a datagram socket.
  4270. [heading Parameters]
  4271. [variablelist
  4272. [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
  4273. [[protocol][An object specifying protocol parameters to be used.]]
  4274. ]
  4275. [heading Exceptions]
  4276. [variablelist
  4277. [[boost::system::system_error][Thrown on failure. ]]
  4278. ]
  4279. [endsect]
  4280. [section:overload4 basic_datagram_socket::basic_datagram_socket (4 of 10 overloads)]
  4281. Construct and open a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`].
  4282. template<
  4283. typename ExecutionContext>
  4284. basic_datagram_socket(
  4285. ExecutionContext & context,
  4286. const protocol_type & protocol,
  4287. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  4288. This constructor creates and opens a datagram socket.
  4289. [heading Parameters]
  4290. [variablelist
  4291. [[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.]]
  4292. [[protocol][An object specifying protocol parameters to be used.]]
  4293. ]
  4294. [heading Exceptions]
  4295. [variablelist
  4296. [[boost::system::system_error][Thrown on failure. ]]
  4297. ]
  4298. [endsect]
  4299. [section:overload5 basic_datagram_socket::basic_datagram_socket (5 of 10 overloads)]
  4300. Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`], opening it and binding it to the given local endpoint.
  4301. basic_datagram_socket(
  4302. const executor_type & ex,
  4303. const endpoint_type & endpoint);
  4304. This constructor creates a datagram socket and automatically opens it bound to the specified endpoint on the local machine. The protocol used is the protocol associated with the given endpoint.
  4305. [heading Parameters]
  4306. [variablelist
  4307. [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
  4308. [[endpoint][An endpoint on the local machine to which the datagram socket will be bound.]]
  4309. ]
  4310. [heading Exceptions]
  4311. [variablelist
  4312. [[boost::system::system_error][Thrown on failure. ]]
  4313. ]
  4314. [endsect]
  4315. [section:overload6 basic_datagram_socket::basic_datagram_socket (6 of 10 overloads)]
  4316. Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`], opening it and binding it to the given local endpoint.
  4317. template<
  4318. typename ExecutionContext>
  4319. basic_datagram_socket(
  4320. ExecutionContext & context,
  4321. const endpoint_type & endpoint,
  4322. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  4323. This constructor creates a datagram socket and automatically opens it bound to the specified endpoint on the local machine. The protocol used is the protocol associated with the given endpoint.
  4324. [heading Parameters]
  4325. [variablelist
  4326. [[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.]]
  4327. [[endpoint][An endpoint on the local machine to which the datagram socket will be bound.]]
  4328. ]
  4329. [heading Exceptions]
  4330. [variablelist
  4331. [[boost::system::system_error][Thrown on failure. ]]
  4332. ]
  4333. [endsect]
  4334. [section:overload7 basic_datagram_socket::basic_datagram_socket (7 of 10 overloads)]
  4335. Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] on an existing native socket.
  4336. basic_datagram_socket(
  4337. const executor_type & ex,
  4338. const protocol_type & protocol,
  4339. const native_handle_type & native_socket);
  4340. This constructor creates a datagram socket object to hold an existing native socket.
  4341. [heading Parameters]
  4342. [variablelist
  4343. [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
  4344. [[protocol][An object specifying protocol parameters to be used.]]
  4345. [[native_socket][The new underlying socket implementation.]]
  4346. ]
  4347. [heading Exceptions]
  4348. [variablelist
  4349. [[boost::system::system_error][Thrown on failure. ]]
  4350. ]
  4351. [endsect]
  4352. [section:overload8 basic_datagram_socket::basic_datagram_socket (8 of 10 overloads)]
  4353. Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] on an existing native socket.
  4354. template<
  4355. typename ExecutionContext>
  4356. basic_datagram_socket(
  4357. ExecutionContext & context,
  4358. const protocol_type & protocol,
  4359. const native_handle_type & native_socket,
  4360. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  4361. This constructor creates a datagram socket object to hold an existing native socket.
  4362. [heading Parameters]
  4363. [variablelist
  4364. [[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.]]
  4365. [[protocol][An object specifying protocol parameters to be used.]]
  4366. [[native_socket][The new underlying socket implementation.]]
  4367. ]
  4368. [heading Exceptions]
  4369. [variablelist
  4370. [[boost::system::system_error][Thrown on failure. ]]
  4371. ]
  4372. [endsect]
  4373. [section:overload9 basic_datagram_socket::basic_datagram_socket (9 of 10 overloads)]
  4374. Move-construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from another.
  4375. basic_datagram_socket(
  4376. basic_datagram_socket && other);
  4377. This constructor moves a datagram socket from one object to another.
  4378. [heading Parameters]
  4379. [variablelist
  4380. [[other][The other [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] object from which the move will occur.]]
  4381. ]
  4382. [heading Remarks]
  4383. Following the move, the moved-from object is in the same state as if constructed using the `basic_datagram_socket(const executor_type&)` constructor.
  4384. [endsect]
  4385. [section:overload10 basic_datagram_socket::basic_datagram_socket (10 of 10 overloads)]
  4386. Move-construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from a socket of another protocol type.
  4387. template<
  4388. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  4389. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  4390. basic_datagram_socket(
  4391. basic_datagram_socket< Protocol1, Executor1 > && other,
  4392. typename enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type * = 0);
  4393. This constructor moves a datagram socket from one object to another.
  4394. [heading Parameters]
  4395. [variablelist
  4396. [[other][The other [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] object from which the move will occur.]]
  4397. ]
  4398. [heading Remarks]
  4399. Following the move, the moved-from object is in the same state as if constructed using the `basic_datagram_socket(const executor_type&)` constructor.
  4400. [endsect]
  4401. [endsect]
  4402. [section:bind basic_datagram_socket::bind]
  4403. [indexterm2 boost_asio.indexterm.basic_datagram_socket.bind..bind..basic_datagram_socket]
  4404. Bind the socket to the given local endpoint.
  4405. void ``[link boost_asio.reference.basic_datagram_socket.bind.overload1 bind]``(
  4406. const endpoint_type & endpoint);
  4407. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.bind.overload1 more...]]``
  4408. void ``[link boost_asio.reference.basic_datagram_socket.bind.overload2 bind]``(
  4409. const endpoint_type & endpoint,
  4410. boost::system::error_code & ec);
  4411. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.bind.overload2 more...]]``
  4412. [section:overload1 basic_datagram_socket::bind (1 of 2 overloads)]
  4413. ['Inherited from basic_socket.]
  4414. Bind the socket to the given local endpoint.
  4415. void bind(
  4416. const endpoint_type & endpoint);
  4417. This function binds the socket to the specified endpoint on the local machine.
  4418. [heading Parameters]
  4419. [variablelist
  4420. [[endpoint][An endpoint on the local machine to which the socket will be bound.]]
  4421. ]
  4422. [heading Exceptions]
  4423. [variablelist
  4424. [[boost::system::system_error][Thrown on failure.]]
  4425. ]
  4426. [heading Example]
  4427. boost::asio::ip::tcp::socket socket(my_context);
  4428. socket.open(boost::asio::ip::tcp::v4());
  4429. socket.bind(boost::asio::ip::tcp::endpoint(
  4430. boost::asio::ip::tcp::v4(), 12345));
  4431. [endsect]
  4432. [section:overload2 basic_datagram_socket::bind (2 of 2 overloads)]
  4433. ['Inherited from basic_socket.]
  4434. Bind the socket to the given local endpoint.
  4435. void bind(
  4436. const endpoint_type & endpoint,
  4437. boost::system::error_code & ec);
  4438. This function binds the socket to the specified endpoint on the local machine.
  4439. [heading Parameters]
  4440. [variablelist
  4441. [[endpoint][An endpoint on the local machine to which the socket will be bound.]]
  4442. [[ec][Set to indicate what error occurred, if any.]]
  4443. ]
  4444. [heading Example]
  4445. boost::asio::ip::tcp::socket socket(my_context);
  4446. socket.open(boost::asio::ip::tcp::v4());
  4447. boost::system::error_code ec;
  4448. socket.bind(boost::asio::ip::tcp::endpoint(
  4449. boost::asio::ip::tcp::v4(), 12345), ec);
  4450. if (ec)
  4451. {
  4452. // An error occurred.
  4453. }
  4454. [endsect]
  4455. [endsect]
  4456. [section:broadcast basic_datagram_socket::broadcast]
  4457. ['Inherited from socket_base.]
  4458. [indexterm2 boost_asio.indexterm.basic_datagram_socket.broadcast..broadcast..basic_datagram_socket]
  4459. Socket option to permit sending of broadcast messages.
  4460. typedef implementation_defined broadcast;
  4461. Implements the SOL\_SOCKET/SO\_BROADCAST socket option.
  4462. [heading Examples]
  4463. Setting the option:
  4464. boost::asio::ip::udp::socket socket(my_context);
  4465. ...
  4466. boost::asio::socket_base::broadcast option(true);
  4467. socket.set_option(option);
  4468. Getting the current option value:
  4469. boost::asio::ip::udp::socket socket(my_context);
  4470. ...
  4471. boost::asio::socket_base::broadcast option;
  4472. socket.get_option(option);
  4473. bool is_set = option.value();
  4474. [heading Requirements]
  4475. ['Header: ][^boost/asio/basic_datagram_socket.hpp]
  4476. ['Convenience header: ][^boost/asio.hpp]
  4477. [endsect]
  4478. [section:bytes_readable basic_datagram_socket::bytes_readable]
  4479. ['Inherited from socket_base.]
  4480. [indexterm2 boost_asio.indexterm.basic_datagram_socket.bytes_readable..bytes_readable..basic_datagram_socket]
  4481. IO control command to get the amount of data that can be read without blocking.
  4482. typedef implementation_defined bytes_readable;
  4483. Implements the FIONREAD IO control command.
  4484. [heading Example]
  4485. boost::asio::ip::tcp::socket socket(my_context);
  4486. ...
  4487. boost::asio::socket_base::bytes_readable command(true);
  4488. socket.io_control(command);
  4489. std::size_t bytes_readable = command.get();
  4490. [heading Requirements]
  4491. ['Header: ][^boost/asio/basic_datagram_socket.hpp]
  4492. ['Convenience header: ][^boost/asio.hpp]
  4493. [endsect]
  4494. [section:cancel basic_datagram_socket::cancel]
  4495. [indexterm2 boost_asio.indexterm.basic_datagram_socket.cancel..cancel..basic_datagram_socket]
  4496. Cancel all asynchronous operations associated with the socket.
  4497. void ``[link boost_asio.reference.basic_datagram_socket.cancel.overload1 cancel]``();
  4498. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.cancel.overload1 more...]]``
  4499. void ``[link boost_asio.reference.basic_datagram_socket.cancel.overload2 cancel]``(
  4500. boost::system::error_code & ec);
  4501. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.cancel.overload2 more...]]``
  4502. [section:overload1 basic_datagram_socket::cancel (1 of 2 overloads)]
  4503. ['Inherited from basic_socket.]
  4504. Cancel all asynchronous operations associated with the socket.
  4505. void cancel();
  4506. This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
  4507. [heading Exceptions]
  4508. [variablelist
  4509. [[boost::system::system_error][Thrown on failure.]]
  4510. ]
  4511. [heading Remarks]
  4512. Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
  4513. * It will only cancel asynchronous operations that were initiated in the current thread.
  4514. * 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.
  4515. For portable cancellation, consider using one of the following alternatives:
  4516. * Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
  4517. * Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
  4518. When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above.
  4519. [endsect]
  4520. [section:overload2 basic_datagram_socket::cancel (2 of 2 overloads)]
  4521. ['Inherited from basic_socket.]
  4522. Cancel all asynchronous operations associated with the socket.
  4523. void cancel(
  4524. boost::system::error_code & ec);
  4525. This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
  4526. [heading Parameters]
  4527. [variablelist
  4528. [[ec][Set to indicate what error occurred, if any.]]
  4529. ]
  4530. [heading Remarks]
  4531. Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
  4532. * It will only cancel asynchronous operations that were initiated in the current thread.
  4533. * 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.
  4534. For portable cancellation, consider using one of the following alternatives:
  4535. * Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
  4536. * Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
  4537. When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above.
  4538. [endsect]
  4539. [endsect]
  4540. [section:close basic_datagram_socket::close]
  4541. [indexterm2 boost_asio.indexterm.basic_datagram_socket.close..close..basic_datagram_socket]
  4542. Close the socket.
  4543. void ``[link boost_asio.reference.basic_datagram_socket.close.overload1 close]``();
  4544. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.close.overload1 more...]]``
  4545. void ``[link boost_asio.reference.basic_datagram_socket.close.overload2 close]``(
  4546. boost::system::error_code & ec);
  4547. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.close.overload2 more...]]``
  4548. [section:overload1 basic_datagram_socket::close (1 of 2 overloads)]
  4549. ['Inherited from basic_socket.]
  4550. Close the socket.
  4551. void close();
  4552. This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
  4553. [heading Exceptions]
  4554. [variablelist
  4555. [[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
  4556. ]
  4557. [heading Remarks]
  4558. For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket.
  4559. [endsect]
  4560. [section:overload2 basic_datagram_socket::close (2 of 2 overloads)]
  4561. ['Inherited from basic_socket.]
  4562. Close the socket.
  4563. void close(
  4564. boost::system::error_code & ec);
  4565. This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
  4566. [heading Parameters]
  4567. [variablelist
  4568. [[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
  4569. ]
  4570. [heading Example]
  4571. boost::asio::ip::tcp::socket socket(my_context);
  4572. ...
  4573. boost::system::error_code ec;
  4574. socket.close(ec);
  4575. if (ec)
  4576. {
  4577. // An error occurred.
  4578. }
  4579. [heading Remarks]
  4580. For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket.
  4581. [endsect]
  4582. [endsect]
  4583. [section:connect basic_datagram_socket::connect]
  4584. [indexterm2 boost_asio.indexterm.basic_datagram_socket.connect..connect..basic_datagram_socket]
  4585. Connect the socket to the specified endpoint.
  4586. void ``[link boost_asio.reference.basic_datagram_socket.connect.overload1 connect]``(
  4587. const endpoint_type & peer_endpoint);
  4588. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.connect.overload1 more...]]``
  4589. void ``[link boost_asio.reference.basic_datagram_socket.connect.overload2 connect]``(
  4590. const endpoint_type & peer_endpoint,
  4591. boost::system::error_code & ec);
  4592. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.connect.overload2 more...]]``
  4593. [section:overload1 basic_datagram_socket::connect (1 of 2 overloads)]
  4594. ['Inherited from basic_socket.]
  4595. Connect the socket to the specified endpoint.
  4596. void connect(
  4597. const endpoint_type & peer_endpoint);
  4598. This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
  4599. The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
  4600. [heading Parameters]
  4601. [variablelist
  4602. [[peer_endpoint][The remote endpoint to which the socket will be connected.]]
  4603. ]
  4604. [heading Exceptions]
  4605. [variablelist
  4606. [[boost::system::system_error][Thrown on failure.]]
  4607. ]
  4608. [heading Example]
  4609. boost::asio::ip::tcp::socket socket(my_context);
  4610. boost::asio::ip::tcp::endpoint endpoint(
  4611. boost::asio::ip::address::from_string("1.2.3.4"), 12345);
  4612. socket.connect(endpoint);
  4613. [endsect]
  4614. [section:overload2 basic_datagram_socket::connect (2 of 2 overloads)]
  4615. ['Inherited from basic_socket.]
  4616. Connect the socket to the specified endpoint.
  4617. void connect(
  4618. const endpoint_type & peer_endpoint,
  4619. boost::system::error_code & ec);
  4620. This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
  4621. The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
  4622. [heading Parameters]
  4623. [variablelist
  4624. [[peer_endpoint][The remote endpoint to which the socket will be connected.]]
  4625. [[ec][Set to indicate what error occurred, if any.]]
  4626. ]
  4627. [heading Example]
  4628. boost::asio::ip::tcp::socket socket(my_context);
  4629. boost::asio::ip::tcp::endpoint endpoint(
  4630. boost::asio::ip::address::from_string("1.2.3.4"), 12345);
  4631. boost::system::error_code ec;
  4632. socket.connect(endpoint, ec);
  4633. if (ec)
  4634. {
  4635. // An error occurred.
  4636. }
  4637. [endsect]
  4638. [endsect]
  4639. [section:debug basic_datagram_socket::debug]
  4640. ['Inherited from socket_base.]
  4641. [indexterm2 boost_asio.indexterm.basic_datagram_socket.debug..debug..basic_datagram_socket]
  4642. Socket option to enable socket-level debugging.
  4643. typedef implementation_defined debug;
  4644. Implements the SOL\_SOCKET/SO\_DEBUG socket option.
  4645. [heading Examples]
  4646. Setting the option:
  4647. boost::asio::ip::tcp::socket socket(my_context);
  4648. ...
  4649. boost::asio::socket_base::debug option(true);
  4650. socket.set_option(option);
  4651. Getting the current option value:
  4652. boost::asio::ip::tcp::socket socket(my_context);
  4653. ...
  4654. boost::asio::socket_base::debug option;
  4655. socket.get_option(option);
  4656. bool is_set = option.value();
  4657. [heading Requirements]
  4658. ['Header: ][^boost/asio/basic_datagram_socket.hpp]
  4659. ['Convenience header: ][^boost/asio.hpp]
  4660. [endsect]
  4661. [section:do_not_route basic_datagram_socket::do_not_route]
  4662. ['Inherited from socket_base.]
  4663. [indexterm2 boost_asio.indexterm.basic_datagram_socket.do_not_route..do_not_route..basic_datagram_socket]
  4664. Socket option to prevent routing, use local interfaces only.
  4665. typedef implementation_defined do_not_route;
  4666. Implements the SOL\_SOCKET/SO\_DONTROUTE socket option.
  4667. [heading Examples]
  4668. Setting the option:
  4669. boost::asio::ip::udp::socket socket(my_context);
  4670. ...
  4671. boost::asio::socket_base::do_not_route option(true);
  4672. socket.set_option(option);
  4673. Getting the current option value:
  4674. boost::asio::ip::udp::socket socket(my_context);
  4675. ...
  4676. boost::asio::socket_base::do_not_route option;
  4677. socket.get_option(option);
  4678. bool is_set = option.value();
  4679. [heading Requirements]
  4680. ['Header: ][^boost/asio/basic_datagram_socket.hpp]
  4681. ['Convenience header: ][^boost/asio.hpp]
  4682. [endsect]
  4683. [section:enable_connection_aborted basic_datagram_socket::enable_connection_aborted]
  4684. ['Inherited from socket_base.]
  4685. [indexterm2 boost_asio.indexterm.basic_datagram_socket.enable_connection_aborted..enable_connection_aborted..basic_datagram_socket]
  4686. Socket option to report aborted connections on accept.
  4687. typedef implementation_defined enable_connection_aborted;
  4688. Implements a custom socket option that determines whether or not an accept operation is permitted to fail with `boost::asio::error::connection_aborted`. By default the option is false.
  4689. [heading Examples]
  4690. Setting the option:
  4691. boost::asio::ip::tcp::acceptor acceptor(my_context);
  4692. ...
  4693. boost::asio::socket_base::enable_connection_aborted option(true);
  4694. acceptor.set_option(option);
  4695. Getting the current option value:
  4696. boost::asio::ip::tcp::acceptor acceptor(my_context);
  4697. ...
  4698. boost::asio::socket_base::enable_connection_aborted option;
  4699. acceptor.get_option(option);
  4700. bool is_set = option.value();
  4701. [heading Requirements]
  4702. ['Header: ][^boost/asio/basic_datagram_socket.hpp]
  4703. ['Convenience header: ][^boost/asio.hpp]
  4704. [endsect]
  4705. [section:endpoint_type basic_datagram_socket::endpoint_type]
  4706. [indexterm2 boost_asio.indexterm.basic_datagram_socket.endpoint_type..endpoint_type..basic_datagram_socket]
  4707. The endpoint type.
  4708. typedef Protocol::endpoint endpoint_type;
  4709. [heading Requirements]
  4710. ['Header: ][^boost/asio/basic_datagram_socket.hpp]
  4711. ['Convenience header: ][^boost/asio.hpp]
  4712. [endsect]
  4713. [section:executor_type basic_datagram_socket::executor_type]
  4714. [indexterm2 boost_asio.indexterm.basic_datagram_socket.executor_type..executor_type..basic_datagram_socket]
  4715. The type of the executor associated with the object.
  4716. typedef Executor executor_type;
  4717. [heading Requirements]
  4718. ['Header: ][^boost/asio/basic_datagram_socket.hpp]
  4719. ['Convenience header: ][^boost/asio.hpp]
  4720. [endsect]
  4721. [section:get_executor basic_datagram_socket::get_executor]
  4722. ['Inherited from basic_socket.]
  4723. [indexterm2 boost_asio.indexterm.basic_datagram_socket.get_executor..get_executor..basic_datagram_socket]
  4724. Get the executor associated with the object.
  4725. executor_type get_executor();
  4726. [endsect]
  4727. [section:get_option basic_datagram_socket::get_option]
  4728. [indexterm2 boost_asio.indexterm.basic_datagram_socket.get_option..get_option..basic_datagram_socket]
  4729. Get an option from the socket.
  4730. template<
  4731. typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
  4732. void ``[link boost_asio.reference.basic_datagram_socket.get_option.overload1 get_option]``(
  4733. GettableSocketOption & option) const;
  4734. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.get_option.overload1 more...]]``
  4735. template<
  4736. typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
  4737. void ``[link boost_asio.reference.basic_datagram_socket.get_option.overload2 get_option]``(
  4738. GettableSocketOption & option,
  4739. boost::system::error_code & ec) const;
  4740. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.get_option.overload2 more...]]``
  4741. [section:overload1 basic_datagram_socket::get_option (1 of 2 overloads)]
  4742. ['Inherited from basic_socket.]
  4743. Get an option from the socket.
  4744. template<
  4745. typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
  4746. void get_option(
  4747. GettableSocketOption & option) const;
  4748. This function is used to get the current value of an option on the socket.
  4749. [heading Parameters]
  4750. [variablelist
  4751. [[option][The option value to be obtained from the socket.]]
  4752. ]
  4753. [heading Exceptions]
  4754. [variablelist
  4755. [[boost::system::system_error][Thrown on failure.]]
  4756. ]
  4757. [heading Example]
  4758. Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option:
  4759. boost::asio::ip::tcp::socket socket(my_context);
  4760. ...
  4761. boost::asio::ip::tcp::socket::keep_alive option;
  4762. socket.get_option(option);
  4763. bool is_set = option.value();
  4764. [endsect]
  4765. [section:overload2 basic_datagram_socket::get_option (2 of 2 overloads)]
  4766. ['Inherited from basic_socket.]
  4767. Get an option from the socket.
  4768. template<
  4769. typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
  4770. void get_option(
  4771. GettableSocketOption & option,
  4772. boost::system::error_code & ec) const;
  4773. This function is used to get the current value of an option on the socket.
  4774. [heading Parameters]
  4775. [variablelist
  4776. [[option][The option value to be obtained from the socket.]]
  4777. [[ec][Set to indicate what error occurred, if any.]]
  4778. ]
  4779. [heading Example]
  4780. Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option:
  4781. boost::asio::ip::tcp::socket socket(my_context);
  4782. ...
  4783. boost::asio::ip::tcp::socket::keep_alive option;
  4784. boost::system::error_code ec;
  4785. socket.get_option(option, ec);
  4786. if (ec)
  4787. {
  4788. // An error occurred.
  4789. }
  4790. bool is_set = option.value();
  4791. [endsect]
  4792. [endsect]
  4793. [section:impl_ basic_datagram_socket::impl_]
  4794. ['Inherited from basic_socket.]
  4795. [indexterm2 boost_asio.indexterm.basic_datagram_socket.impl_..impl_..basic_datagram_socket]
  4796. detail::io_object_impl< detail::reactive_socket_service< Protocol >, Executor > impl_;
  4797. [endsect]
  4798. [section:io_control basic_datagram_socket::io_control]
  4799. [indexterm2 boost_asio.indexterm.basic_datagram_socket.io_control..io_control..basic_datagram_socket]
  4800. Perform an IO control command on the socket.
  4801. template<
  4802. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  4803. void ``[link boost_asio.reference.basic_datagram_socket.io_control.overload1 io_control]``(
  4804. IoControlCommand & command);
  4805. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.io_control.overload1 more...]]``
  4806. template<
  4807. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  4808. void ``[link boost_asio.reference.basic_datagram_socket.io_control.overload2 io_control]``(
  4809. IoControlCommand & command,
  4810. boost::system::error_code & ec);
  4811. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.io_control.overload2 more...]]``
  4812. [section:overload1 basic_datagram_socket::io_control (1 of 2 overloads)]
  4813. ['Inherited from basic_socket.]
  4814. Perform an IO control command on the socket.
  4815. template<
  4816. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  4817. void io_control(
  4818. IoControlCommand & command);
  4819. This function is used to execute an IO control command on the socket.
  4820. [heading Parameters]
  4821. [variablelist
  4822. [[command][The IO control command to be performed on the socket.]]
  4823. ]
  4824. [heading Exceptions]
  4825. [variablelist
  4826. [[boost::system::system_error][Thrown on failure.]]
  4827. ]
  4828. [heading Example]
  4829. Getting the number of bytes ready to read:
  4830. boost::asio::ip::tcp::socket socket(my_context);
  4831. ...
  4832. boost::asio::ip::tcp::socket::bytes_readable command;
  4833. socket.io_control(command);
  4834. std::size_t bytes_readable = command.get();
  4835. [endsect]
  4836. [section:overload2 basic_datagram_socket::io_control (2 of 2 overloads)]
  4837. ['Inherited from basic_socket.]
  4838. Perform an IO control command on the socket.
  4839. template<
  4840. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  4841. void io_control(
  4842. IoControlCommand & command,
  4843. boost::system::error_code & ec);
  4844. This function is used to execute an IO control command on the socket.
  4845. [heading Parameters]
  4846. [variablelist
  4847. [[command][The IO control command to be performed on the socket.]]
  4848. [[ec][Set to indicate what error occurred, if any.]]
  4849. ]
  4850. [heading Example]
  4851. Getting the number of bytes ready to read:
  4852. boost::asio::ip::tcp::socket socket(my_context);
  4853. ...
  4854. boost::asio::ip::tcp::socket::bytes_readable command;
  4855. boost::system::error_code ec;
  4856. socket.io_control(command, ec);
  4857. if (ec)
  4858. {
  4859. // An error occurred.
  4860. }
  4861. std::size_t bytes_readable = command.get();
  4862. [endsect]
  4863. [endsect]
  4864. [section:is_open basic_datagram_socket::is_open]
  4865. ['Inherited from basic_socket.]
  4866. [indexterm2 boost_asio.indexterm.basic_datagram_socket.is_open..is_open..basic_datagram_socket]
  4867. Determine whether the socket is open.
  4868. bool is_open() const;
  4869. [endsect]
  4870. [section:keep_alive basic_datagram_socket::keep_alive]
  4871. ['Inherited from socket_base.]
  4872. [indexterm2 boost_asio.indexterm.basic_datagram_socket.keep_alive..keep_alive..basic_datagram_socket]
  4873. Socket option to send keep-alives.
  4874. typedef implementation_defined keep_alive;
  4875. Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option.
  4876. [heading Examples]
  4877. Setting the option:
  4878. boost::asio::ip::tcp::socket socket(my_context);
  4879. ...
  4880. boost::asio::socket_base::keep_alive option(true);
  4881. socket.set_option(option);
  4882. Getting the current option value:
  4883. boost::asio::ip::tcp::socket socket(my_context);
  4884. ...
  4885. boost::asio::socket_base::keep_alive option;
  4886. socket.get_option(option);
  4887. bool is_set = option.value();
  4888. [heading Requirements]
  4889. ['Header: ][^boost/asio/basic_datagram_socket.hpp]
  4890. ['Convenience header: ][^boost/asio.hpp]
  4891. [endsect]
  4892. [section:linger basic_datagram_socket::linger]
  4893. ['Inherited from socket_base.]
  4894. [indexterm2 boost_asio.indexterm.basic_datagram_socket.linger..linger..basic_datagram_socket]
  4895. Socket option to specify whether the socket lingers on close if unsent data is present.
  4896. typedef implementation_defined linger;
  4897. Implements the SOL\_SOCKET/SO\_LINGER socket option.
  4898. [heading Examples]
  4899. Setting the option:
  4900. boost::asio::ip::tcp::socket socket(my_context);
  4901. ...
  4902. boost::asio::socket_base::linger option(true, 30);
  4903. socket.set_option(option);
  4904. Getting the current option value:
  4905. boost::asio::ip::tcp::socket socket(my_context);
  4906. ...
  4907. boost::asio::socket_base::linger option;
  4908. socket.get_option(option);
  4909. bool is_set = option.enabled();
  4910. unsigned short timeout = option.timeout();
  4911. [heading Requirements]
  4912. ['Header: ][^boost/asio/basic_datagram_socket.hpp]
  4913. ['Convenience header: ][^boost/asio.hpp]
  4914. [endsect]
  4915. [section:local_endpoint basic_datagram_socket::local_endpoint]
  4916. [indexterm2 boost_asio.indexterm.basic_datagram_socket.local_endpoint..local_endpoint..basic_datagram_socket]
  4917. Get the local endpoint of the socket.
  4918. endpoint_type ``[link boost_asio.reference.basic_datagram_socket.local_endpoint.overload1 local_endpoint]``() const;
  4919. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.local_endpoint.overload1 more...]]``
  4920. endpoint_type ``[link boost_asio.reference.basic_datagram_socket.local_endpoint.overload2 local_endpoint]``(
  4921. boost::system::error_code & ec) const;
  4922. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.local_endpoint.overload2 more...]]``
  4923. [section:overload1 basic_datagram_socket::local_endpoint (1 of 2 overloads)]
  4924. ['Inherited from basic_socket.]
  4925. Get the local endpoint of the socket.
  4926. endpoint_type local_endpoint() const;
  4927. This function is used to obtain the locally bound endpoint of the socket.
  4928. [heading Return Value]
  4929. An object that represents the local endpoint of the socket.
  4930. [heading Exceptions]
  4931. [variablelist
  4932. [[boost::system::system_error][Thrown on failure.]]
  4933. ]
  4934. [heading Example]
  4935. boost::asio::ip::tcp::socket socket(my_context);
  4936. ...
  4937. boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint();
  4938. [endsect]
  4939. [section:overload2 basic_datagram_socket::local_endpoint (2 of 2 overloads)]
  4940. ['Inherited from basic_socket.]
  4941. Get the local endpoint of the socket.
  4942. endpoint_type local_endpoint(
  4943. boost::system::error_code & ec) const;
  4944. This function is used to obtain the locally bound endpoint of the socket.
  4945. [heading Parameters]
  4946. [variablelist
  4947. [[ec][Set to indicate what error occurred, if any.]]
  4948. ]
  4949. [heading Return Value]
  4950. An object that represents the local endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
  4951. [heading Example]
  4952. boost::asio::ip::tcp::socket socket(my_context);
  4953. ...
  4954. boost::system::error_code ec;
  4955. boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(ec);
  4956. if (ec)
  4957. {
  4958. // An error occurred.
  4959. }
  4960. [endsect]
  4961. [endsect]
  4962. [section:lowest_layer basic_datagram_socket::lowest_layer]
  4963. [indexterm2 boost_asio.indexterm.basic_datagram_socket.lowest_layer..lowest_layer..basic_datagram_socket]
  4964. Get a reference to the lowest layer.
  4965. lowest_layer_type & ``[link boost_asio.reference.basic_datagram_socket.lowest_layer.overload1 lowest_layer]``();
  4966. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.lowest_layer.overload1 more...]]``
  4967. Get a const reference to the lowest layer.
  4968. const lowest_layer_type & ``[link boost_asio.reference.basic_datagram_socket.lowest_layer.overload2 lowest_layer]``() const;
  4969. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.lowest_layer.overload2 more...]]``
  4970. [section:overload1 basic_datagram_socket::lowest_layer (1 of 2 overloads)]
  4971. ['Inherited from basic_socket.]
  4972. Get a reference to the lowest layer.
  4973. lowest_layer_type & lowest_layer();
  4974. This function returns a reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
  4975. [heading Return Value]
  4976. A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
  4977. [endsect]
  4978. [section:overload2 basic_datagram_socket::lowest_layer (2 of 2 overloads)]
  4979. ['Inherited from basic_socket.]
  4980. Get a const reference to the lowest layer.
  4981. const lowest_layer_type & lowest_layer() const;
  4982. This function returns a const reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
  4983. [heading Return Value]
  4984. A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
  4985. [endsect]
  4986. [endsect]
  4987. [section:lowest_layer_type basic_datagram_socket::lowest_layer_type]
  4988. ['Inherited from basic_socket.]
  4989. [indexterm2 boost_asio.indexterm.basic_datagram_socket.lowest_layer_type..lowest_layer_type..basic_datagram_socket]
  4990. A [link boost_asio.reference.basic_socket `basic_socket`] is always the lowest layer.
  4991. typedef basic_socket< Protocol, Executor > lowest_layer_type;
  4992. [heading Types]
  4993. [table
  4994. [[Name][Description]]
  4995. [
  4996. [[link boost_asio.reference.basic_socket__rebind_executor [*rebind_executor]]]
  4997. [Rebinds the socket type to another executor. ]
  4998. ]
  4999. [
  5000. [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]]
  5001. [Socket option to permit sending of broadcast messages. ]
  5002. ]
  5003. [
  5004. [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]]
  5005. [IO control command to get the amount of data that can be read without blocking. ]
  5006. ]
  5007. [
  5008. [[link boost_asio.reference.basic_socket.debug [*debug]]]
  5009. [Socket option to enable socket-level debugging. ]
  5010. ]
  5011. [
  5012. [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]]
  5013. [Socket option to prevent routing, use local interfaces only. ]
  5014. ]
  5015. [
  5016. [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]]
  5017. [Socket option to report aborted connections on accept. ]
  5018. ]
  5019. [
  5020. [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]]
  5021. [The endpoint type. ]
  5022. ]
  5023. [
  5024. [[link boost_asio.reference.basic_socket.executor_type [*executor_type]]]
  5025. [The type of the executor associated with the object. ]
  5026. ]
  5027. [
  5028. [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]]
  5029. [Socket option to send keep-alives. ]
  5030. ]
  5031. [
  5032. [[link boost_asio.reference.basic_socket.linger [*linger]]]
  5033. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  5034. ]
  5035. [
  5036. [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]]
  5037. [A basic_socket is always the lowest layer. ]
  5038. ]
  5039. [
  5040. [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]]
  5041. [Bitmask type for flags that can be passed to send and receive operations. ]
  5042. ]
  5043. [
  5044. [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]]
  5045. [The native representation of a socket. ]
  5046. ]
  5047. [
  5048. [[link boost_asio.reference.basic_socket.out_of_band_inline [*out_of_band_inline]]]
  5049. [Socket option for putting received out-of-band data inline. ]
  5050. ]
  5051. [
  5052. [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]]
  5053. [The protocol type. ]
  5054. ]
  5055. [
  5056. [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]]
  5057. [Socket option for the receive buffer size of a socket. ]
  5058. ]
  5059. [
  5060. [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]]
  5061. [Socket option for the receive low watermark. ]
  5062. ]
  5063. [
  5064. [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]]
  5065. [Socket option to allow the socket to be bound to an address that is already in use. ]
  5066. ]
  5067. [
  5068. [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]]
  5069. [Socket option for the send buffer size of a socket. ]
  5070. ]
  5071. [
  5072. [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]]
  5073. [Socket option for the send low watermark. ]
  5074. ]
  5075. [
  5076. [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]]
  5077. [Different ways a socket may be shutdown. ]
  5078. ]
  5079. [
  5080. [[link boost_asio.reference.basic_socket.wait_type [*wait_type]]]
  5081. [Wait types. ]
  5082. ]
  5083. ]
  5084. [heading Member Functions]
  5085. [table
  5086. [[Name][Description]]
  5087. [
  5088. [[link boost_asio.reference.basic_socket.assign [*assign]]]
  5089. [Assign an existing native socket to the socket. ]
  5090. ]
  5091. [
  5092. [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]]
  5093. [Start an asynchronous connect. ]
  5094. ]
  5095. [
  5096. [[link boost_asio.reference.basic_socket.async_wait [*async_wait]]]
  5097. [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  5098. ]
  5099. [
  5100. [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]]
  5101. [Determine whether the socket is at the out-of-band data mark. ]
  5102. ]
  5103. [
  5104. [[link boost_asio.reference.basic_socket.available [*available]]]
  5105. [Determine the number of bytes available for reading. ]
  5106. ]
  5107. [
  5108. [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]]]
  5109. [Construct a basic_socket without opening it.
  5110. [hr]
  5111. Construct and open a basic_socket.
  5112. [hr]
  5113. Construct a basic_socket, opening it and binding it to the given local endpoint.
  5114. [hr]
  5115. Construct a basic_socket on an existing native socket.
  5116. [hr]
  5117. Move-construct a basic_socket from another.
  5118. [hr]
  5119. Move-construct a basic_socket from a socket of another protocol type. ]
  5120. ]
  5121. [
  5122. [[link boost_asio.reference.basic_socket.bind [*bind]]]
  5123. [Bind the socket to the given local endpoint. ]
  5124. ]
  5125. [
  5126. [[link boost_asio.reference.basic_socket.cancel [*cancel]]]
  5127. [Cancel all asynchronous operations associated with the socket. ]
  5128. ]
  5129. [
  5130. [[link boost_asio.reference.basic_socket.close [*close]]]
  5131. [Close the socket. ]
  5132. ]
  5133. [
  5134. [[link boost_asio.reference.basic_socket.connect [*connect]]]
  5135. [Connect the socket to the specified endpoint. ]
  5136. ]
  5137. [
  5138. [[link boost_asio.reference.basic_socket.get_executor [*get_executor]]]
  5139. [Get the executor associated with the object. ]
  5140. ]
  5141. [
  5142. [[link boost_asio.reference.basic_socket.get_option [*get_option]]]
  5143. [Get an option from the socket. ]
  5144. ]
  5145. [
  5146. [[link boost_asio.reference.basic_socket.io_control [*io_control]]]
  5147. [Perform an IO control command on the socket. ]
  5148. ]
  5149. [
  5150. [[link boost_asio.reference.basic_socket.is_open [*is_open]]]
  5151. [Determine whether the socket is open. ]
  5152. ]
  5153. [
  5154. [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]]
  5155. [Get the local endpoint of the socket. ]
  5156. ]
  5157. [
  5158. [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]]
  5159. [Get a reference to the lowest layer.
  5160. [hr]
  5161. Get a const reference to the lowest layer. ]
  5162. ]
  5163. [
  5164. [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]]
  5165. [Get the native socket representation. ]
  5166. ]
  5167. [
  5168. [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]]
  5169. [Gets the non-blocking mode of the native socket implementation.
  5170. [hr]
  5171. Sets the non-blocking mode of the native socket implementation. ]
  5172. ]
  5173. [
  5174. [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]]
  5175. [Gets the non-blocking mode of the socket.
  5176. [hr]
  5177. Sets the non-blocking mode of the socket. ]
  5178. ]
  5179. [
  5180. [[link boost_asio.reference.basic_socket.open [*open]]]
  5181. [Open the socket using the specified protocol. ]
  5182. ]
  5183. [
  5184. [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]]
  5185. [Move-assign a basic_socket from another.
  5186. [hr]
  5187. Move-assign a basic_socket from a socket of another protocol type. ]
  5188. ]
  5189. [
  5190. [[link boost_asio.reference.basic_socket.release [*release]]]
  5191. [Release ownership of the underlying native socket. ]
  5192. ]
  5193. [
  5194. [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]]
  5195. [Get the remote endpoint of the socket. ]
  5196. ]
  5197. [
  5198. [[link boost_asio.reference.basic_socket.set_option [*set_option]]]
  5199. [Set an option on the socket. ]
  5200. ]
  5201. [
  5202. [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]]
  5203. [Disable sends or receives on the socket. ]
  5204. ]
  5205. [
  5206. [[link boost_asio.reference.basic_socket.wait [*wait]]]
  5207. [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  5208. ]
  5209. ]
  5210. [heading Protected Member Functions]
  5211. [table
  5212. [[Name][Description]]
  5213. [
  5214. [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]]]
  5215. [Protected destructor to prevent deletion through this type. ]
  5216. ]
  5217. ]
  5218. [heading Data Members]
  5219. [table
  5220. [[Name][Description]]
  5221. [
  5222. [[link boost_asio.reference.basic_socket.max_connections [*max_connections]]]
  5223. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  5224. ]
  5225. [
  5226. [[link boost_asio.reference.basic_socket.max_listen_connections [*max_listen_connections]]]
  5227. [The maximum length of the queue of pending incoming connections. ]
  5228. ]
  5229. [
  5230. [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]]]
  5231. [Specify that the data should not be subject to routing. ]
  5232. ]
  5233. [
  5234. [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]]]
  5235. [Specifies that the data marks the end of a record. ]
  5236. ]
  5237. [
  5238. [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]]]
  5239. [Process out-of-band data. ]
  5240. ]
  5241. [
  5242. [[link boost_asio.reference.basic_socket.message_peek [*message_peek]]]
  5243. [Peek at incoming data without removing it from the input queue. ]
  5244. ]
  5245. ]
  5246. [heading Protected Data Members]
  5247. [table
  5248. [[Name][Description]]
  5249. [
  5250. [[link boost_asio.reference.basic_socket.impl_ [*impl_]]]
  5251. []
  5252. ]
  5253. ]
  5254. The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
  5255. [heading Thread Safety]
  5256. ['Distinct] ['objects:] Safe.
  5257. ['Shared] ['objects:] Unsafe.
  5258. [heading Requirements]
  5259. ['Header: ][^boost/asio/basic_datagram_socket.hpp]
  5260. ['Convenience header: ][^boost/asio.hpp]
  5261. [endsect]
  5262. [section:max_connections basic_datagram_socket::max_connections]
  5263. ['Inherited from socket_base.]
  5264. [indexterm2 boost_asio.indexterm.basic_datagram_socket.max_connections..max_connections..basic_datagram_socket]
  5265. (Deprecated: Use max\_listen\_connections.) The maximum length of the queue of pending incoming connections.
  5266. static const int max_connections = implementation_defined;
  5267. [endsect]
  5268. [section:max_listen_connections basic_datagram_socket::max_listen_connections]
  5269. ['Inherited from socket_base.]
  5270. [indexterm2 boost_asio.indexterm.basic_datagram_socket.max_listen_connections..max_listen_connections..basic_datagram_socket]
  5271. The maximum length of the queue of pending incoming connections.
  5272. static const int max_listen_connections = implementation_defined;
  5273. [endsect]
  5274. [section:message_do_not_route basic_datagram_socket::message_do_not_route]
  5275. ['Inherited from socket_base.]
  5276. [indexterm2 boost_asio.indexterm.basic_datagram_socket.message_do_not_route..message_do_not_route..basic_datagram_socket]
  5277. Specify that the data should not be subject to routing.
  5278. static const int message_do_not_route = implementation_defined;
  5279. [endsect]
  5280. [section:message_end_of_record basic_datagram_socket::message_end_of_record]
  5281. ['Inherited from socket_base.]
  5282. [indexterm2 boost_asio.indexterm.basic_datagram_socket.message_end_of_record..message_end_of_record..basic_datagram_socket]
  5283. Specifies that the data marks the end of a record.
  5284. static const int message_end_of_record = implementation_defined;
  5285. [endsect]
  5286. [section:message_flags basic_datagram_socket::message_flags]
  5287. ['Inherited from socket_base.]
  5288. [indexterm2 boost_asio.indexterm.basic_datagram_socket.message_flags..message_flags..basic_datagram_socket]
  5289. Bitmask type for flags that can be passed to send and receive operations.
  5290. typedef int message_flags;
  5291. [heading Requirements]
  5292. ['Header: ][^boost/asio/basic_datagram_socket.hpp]
  5293. ['Convenience header: ][^boost/asio.hpp]
  5294. [endsect]
  5295. [section:message_out_of_band basic_datagram_socket::message_out_of_band]
  5296. ['Inherited from socket_base.]
  5297. [indexterm2 boost_asio.indexterm.basic_datagram_socket.message_out_of_band..message_out_of_band..basic_datagram_socket]
  5298. Process out-of-band data.
  5299. static const int message_out_of_band = implementation_defined;
  5300. [endsect]
  5301. [section:message_peek basic_datagram_socket::message_peek]
  5302. ['Inherited from socket_base.]
  5303. [indexterm2 boost_asio.indexterm.basic_datagram_socket.message_peek..message_peek..basic_datagram_socket]
  5304. Peek at incoming data without removing it from the input queue.
  5305. static const int message_peek = implementation_defined;
  5306. [endsect]
  5307. [section:native_handle basic_datagram_socket::native_handle]
  5308. ['Inherited from basic_socket.]
  5309. [indexterm2 boost_asio.indexterm.basic_datagram_socket.native_handle..native_handle..basic_datagram_socket]
  5310. Get the native socket representation.
  5311. native_handle_type native_handle();
  5312. This function may be used to obtain the underlying representation of the socket. This is intended to allow access to native socket functionality that is not otherwise provided.
  5313. [endsect]
  5314. [section:native_handle_type basic_datagram_socket::native_handle_type]
  5315. [indexterm2 boost_asio.indexterm.basic_datagram_socket.native_handle_type..native_handle_type..basic_datagram_socket]
  5316. The native representation of a socket.
  5317. typedef implementation_defined native_handle_type;
  5318. [heading Requirements]
  5319. ['Header: ][^boost/asio/basic_datagram_socket.hpp]
  5320. ['Convenience header: ][^boost/asio.hpp]
  5321. [endsect]
  5322. [section:native_non_blocking basic_datagram_socket::native_non_blocking]
  5323. [indexterm2 boost_asio.indexterm.basic_datagram_socket.native_non_blocking..native_non_blocking..basic_datagram_socket]
  5324. Gets the non-blocking mode of the native socket implementation.
  5325. bool ``[link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload1 native_non_blocking]``() const;
  5326. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload1 more...]]``
  5327. Sets the non-blocking mode of the native socket implementation.
  5328. void ``[link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload2 native_non_blocking]``(
  5329. bool mode);
  5330. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload2 more...]]``
  5331. void ``[link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload3 native_non_blocking]``(
  5332. bool mode,
  5333. boost::system::error_code & ec);
  5334. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload3 more...]]``
  5335. [section:overload1 basic_datagram_socket::native_non_blocking (1 of 3 overloads)]
  5336. ['Inherited from basic_socket.]
  5337. Gets the non-blocking mode of the native socket implementation.
  5338. bool native_non_blocking() const;
  5339. This function is used to retrieve the non-blocking mode of the underlying native socket. This mode has no effect on the behaviour of the socket object's synchronous operations.
  5340. [heading Return Value]
  5341. `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).
  5342. [heading Remarks]
  5343. The current non-blocking mode is cached by the socket object. Consequently, the return value may be incorrect if the non-blocking mode was set directly on the native socket.
  5344. [heading Example]
  5345. This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
  5346. template <typename Handler>
  5347. struct sendfile_op
  5348. {
  5349. tcp::socket& sock_;
  5350. int fd_;
  5351. Handler handler_;
  5352. off_t offset_;
  5353. std::size_t total_bytes_transferred_;
  5354. // Function call operator meeting WriteHandler requirements.
  5355. // Used as the handler for the async_write_some operation.
  5356. void operator()(boost::system::error_code ec, std::size_t)
  5357. {
  5358. // Put the underlying socket into non-blocking mode.
  5359. if (!ec)
  5360. if (!sock_.native_non_blocking())
  5361. sock_.native_non_blocking(true, ec);
  5362. if (!ec)
  5363. {
  5364. for (;;)
  5365. {
  5366. // Try the system call.
  5367. errno = 0;
  5368. int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
  5369. ec = boost::system::error_code(n < 0 ? errno : 0,
  5370. boost::asio::error::get_system_category());
  5371. total_bytes_transferred_ += ec ? 0 : n;
  5372. // Retry operation immediately if interrupted by signal.
  5373. if (ec == boost::asio::error::interrupted)
  5374. continue;
  5375. // Check if we need to run the operation again.
  5376. if (ec == boost::asio::error::would_block
  5377. || ec == boost::asio::error::try_again)
  5378. {
  5379. // We have to wait for the socket to become ready again.
  5380. sock_.async_wait(tcp::socket::wait_write, *this);
  5381. return;
  5382. }
  5383. if (ec || n == 0)
  5384. {
  5385. // An error occurred, or we have reached the end of the file.
  5386. // Either way we must exit the loop so we can call the handler.
  5387. break;
  5388. }
  5389. // Loop around to try calling sendfile again.
  5390. }
  5391. }
  5392. // Pass result back to user's handler.
  5393. handler_(ec, total_bytes_transferred_);
  5394. }
  5395. };
  5396. template <typename Handler>
  5397. void async_sendfile(tcp::socket& sock, int fd, Handler h)
  5398. {
  5399. sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
  5400. sock.async_wait(tcp::socket::wait_write, op);
  5401. }
  5402. [endsect]
  5403. [section:overload2 basic_datagram_socket::native_non_blocking (2 of 3 overloads)]
  5404. ['Inherited from basic_socket.]
  5405. Sets the non-blocking mode of the native socket implementation.
  5406. void native_non_blocking(
  5407. bool mode);
  5408. This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
  5409. [heading Parameters]
  5410. [variablelist
  5411. [[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).]]
  5412. ]
  5413. [heading Exceptions]
  5414. [variablelist
  5415. [[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.]]
  5416. ]
  5417. [heading Example]
  5418. This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
  5419. template <typename Handler>
  5420. struct sendfile_op
  5421. {
  5422. tcp::socket& sock_;
  5423. int fd_;
  5424. Handler handler_;
  5425. off_t offset_;
  5426. std::size_t total_bytes_transferred_;
  5427. // Function call operator meeting WriteHandler requirements.
  5428. // Used as the handler for the async_write_some operation.
  5429. void operator()(boost::system::error_code ec, std::size_t)
  5430. {
  5431. // Put the underlying socket into non-blocking mode.
  5432. if (!ec)
  5433. if (!sock_.native_non_blocking())
  5434. sock_.native_non_blocking(true, ec);
  5435. if (!ec)
  5436. {
  5437. for (;;)
  5438. {
  5439. // Try the system call.
  5440. errno = 0;
  5441. int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
  5442. ec = boost::system::error_code(n < 0 ? errno : 0,
  5443. boost::asio::error::get_system_category());
  5444. total_bytes_transferred_ += ec ? 0 : n;
  5445. // Retry operation immediately if interrupted by signal.
  5446. if (ec == boost::asio::error::interrupted)
  5447. continue;
  5448. // Check if we need to run the operation again.
  5449. if (ec == boost::asio::error::would_block
  5450. || ec == boost::asio::error::try_again)
  5451. {
  5452. // We have to wait for the socket to become ready again.
  5453. sock_.async_wait(tcp::socket::wait_write, *this);
  5454. return;
  5455. }
  5456. if (ec || n == 0)
  5457. {
  5458. // An error occurred, or we have reached the end of the file.
  5459. // Either way we must exit the loop so we can call the handler.
  5460. break;
  5461. }
  5462. // Loop around to try calling sendfile again.
  5463. }
  5464. }
  5465. // Pass result back to user's handler.
  5466. handler_(ec, total_bytes_transferred_);
  5467. }
  5468. };
  5469. template <typename Handler>
  5470. void async_sendfile(tcp::socket& sock, int fd, Handler h)
  5471. {
  5472. sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
  5473. sock.async_wait(tcp::socket::wait_write, op);
  5474. }
  5475. [endsect]
  5476. [section:overload3 basic_datagram_socket::native_non_blocking (3 of 3 overloads)]
  5477. ['Inherited from basic_socket.]
  5478. Sets the non-blocking mode of the native socket implementation.
  5479. void native_non_blocking(
  5480. bool mode,
  5481. boost::system::error_code & ec);
  5482. This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
  5483. [heading Parameters]
  5484. [variablelist
  5485. [[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).]]
  5486. [[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.]]
  5487. ]
  5488. [heading Example]
  5489. This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
  5490. template <typename Handler>
  5491. struct sendfile_op
  5492. {
  5493. tcp::socket& sock_;
  5494. int fd_;
  5495. Handler handler_;
  5496. off_t offset_;
  5497. std::size_t total_bytes_transferred_;
  5498. // Function call operator meeting WriteHandler requirements.
  5499. // Used as the handler for the async_write_some operation.
  5500. void operator()(boost::system::error_code ec, std::size_t)
  5501. {
  5502. // Put the underlying socket into non-blocking mode.
  5503. if (!ec)
  5504. if (!sock_.native_non_blocking())
  5505. sock_.native_non_blocking(true, ec);
  5506. if (!ec)
  5507. {
  5508. for (;;)
  5509. {
  5510. // Try the system call.
  5511. errno = 0;
  5512. int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
  5513. ec = boost::system::error_code(n < 0 ? errno : 0,
  5514. boost::asio::error::get_system_category());
  5515. total_bytes_transferred_ += ec ? 0 : n;
  5516. // Retry operation immediately if interrupted by signal.
  5517. if (ec == boost::asio::error::interrupted)
  5518. continue;
  5519. // Check if we need to run the operation again.
  5520. if (ec == boost::asio::error::would_block
  5521. || ec == boost::asio::error::try_again)
  5522. {
  5523. // We have to wait for the socket to become ready again.
  5524. sock_.async_wait(tcp::socket::wait_write, *this);
  5525. return;
  5526. }
  5527. if (ec || n == 0)
  5528. {
  5529. // An error occurred, or we have reached the end of the file.
  5530. // Either way we must exit the loop so we can call the handler.
  5531. break;
  5532. }
  5533. // Loop around to try calling sendfile again.
  5534. }
  5535. }
  5536. // Pass result back to user's handler.
  5537. handler_(ec, total_bytes_transferred_);
  5538. }
  5539. };
  5540. template <typename Handler>
  5541. void async_sendfile(tcp::socket& sock, int fd, Handler h)
  5542. {
  5543. sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
  5544. sock.async_wait(tcp::socket::wait_write, op);
  5545. }
  5546. [endsect]
  5547. [endsect]
  5548. [section:non_blocking basic_datagram_socket::non_blocking]
  5549. [indexterm2 boost_asio.indexterm.basic_datagram_socket.non_blocking..non_blocking..basic_datagram_socket]
  5550. Gets the non-blocking mode of the socket.
  5551. bool ``[link boost_asio.reference.basic_datagram_socket.non_blocking.overload1 non_blocking]``() const;
  5552. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.non_blocking.overload1 more...]]``
  5553. Sets the non-blocking mode of the socket.
  5554. void ``[link boost_asio.reference.basic_datagram_socket.non_blocking.overload2 non_blocking]``(
  5555. bool mode);
  5556. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.non_blocking.overload2 more...]]``
  5557. void ``[link boost_asio.reference.basic_datagram_socket.non_blocking.overload3 non_blocking]``(
  5558. bool mode,
  5559. boost::system::error_code & ec);
  5560. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.non_blocking.overload3 more...]]``
  5561. [section:overload1 basic_datagram_socket::non_blocking (1 of 3 overloads)]
  5562. ['Inherited from basic_socket.]
  5563. Gets the non-blocking mode of the socket.
  5564. bool non_blocking() const;
  5565. [heading Return Value]
  5566. `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.
  5567. [heading Remarks]
  5568. The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
  5569. [endsect]
  5570. [section:overload2 basic_datagram_socket::non_blocking (2 of 3 overloads)]
  5571. ['Inherited from basic_socket.]
  5572. Sets the non-blocking mode of the socket.
  5573. void non_blocking(
  5574. bool mode);
  5575. [heading Parameters]
  5576. [variablelist
  5577. [[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.]]
  5578. ]
  5579. [heading Exceptions]
  5580. [variablelist
  5581. [[boost::system::system_error][Thrown on failure.]]
  5582. ]
  5583. [heading Remarks]
  5584. The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
  5585. [endsect]
  5586. [section:overload3 basic_datagram_socket::non_blocking (3 of 3 overloads)]
  5587. ['Inherited from basic_socket.]
  5588. Sets the non-blocking mode of the socket.
  5589. void non_blocking(
  5590. bool mode,
  5591. boost::system::error_code & ec);
  5592. [heading Parameters]
  5593. [variablelist
  5594. [[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.]]
  5595. [[ec][Set to indicate what error occurred, if any.]]
  5596. ]
  5597. [heading Remarks]
  5598. The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
  5599. [endsect]
  5600. [endsect]
  5601. [section:open basic_datagram_socket::open]
  5602. [indexterm2 boost_asio.indexterm.basic_datagram_socket.open..open..basic_datagram_socket]
  5603. Open the socket using the specified protocol.
  5604. void ``[link boost_asio.reference.basic_datagram_socket.open.overload1 open]``(
  5605. const protocol_type & protocol = protocol_type());
  5606. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.open.overload1 more...]]``
  5607. void ``[link boost_asio.reference.basic_datagram_socket.open.overload2 open]``(
  5608. const protocol_type & protocol,
  5609. boost::system::error_code & ec);
  5610. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.open.overload2 more...]]``
  5611. [section:overload1 basic_datagram_socket::open (1 of 2 overloads)]
  5612. ['Inherited from basic_socket.]
  5613. Open the socket using the specified protocol.
  5614. void open(
  5615. const protocol_type & protocol = protocol_type());
  5616. This function opens the socket so that it will use the specified protocol.
  5617. [heading Parameters]
  5618. [variablelist
  5619. [[protocol][An object specifying protocol parameters to be used.]]
  5620. ]
  5621. [heading Exceptions]
  5622. [variablelist
  5623. [[boost::system::system_error][Thrown on failure.]]
  5624. ]
  5625. [heading Example]
  5626. boost::asio::ip::tcp::socket socket(my_context);
  5627. socket.open(boost::asio::ip::tcp::v4());
  5628. [endsect]
  5629. [section:overload2 basic_datagram_socket::open (2 of 2 overloads)]
  5630. ['Inherited from basic_socket.]
  5631. Open the socket using the specified protocol.
  5632. void open(
  5633. const protocol_type & protocol,
  5634. boost::system::error_code & ec);
  5635. This function opens the socket so that it will use the specified protocol.
  5636. [heading Parameters]
  5637. [variablelist
  5638. [[protocol][An object specifying which protocol is to be used.]]
  5639. [[ec][Set to indicate what error occurred, if any.]]
  5640. ]
  5641. [heading Example]
  5642. boost::asio::ip::tcp::socket socket(my_context);
  5643. boost::system::error_code ec;
  5644. socket.open(boost::asio::ip::tcp::v4(), ec);
  5645. if (ec)
  5646. {
  5647. // An error occurred.
  5648. }
  5649. [endsect]
  5650. [endsect]
  5651. [section:operator_eq_ basic_datagram_socket::operator=]
  5652. [indexterm2 boost_asio.indexterm.basic_datagram_socket.operator_eq_..operator=..basic_datagram_socket]
  5653. Move-assign a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from another.
  5654. basic_datagram_socket & ``[link boost_asio.reference.basic_datagram_socket.operator_eq_.overload1 operator=]``(
  5655. basic_datagram_socket && other);
  5656. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.operator_eq_.overload1 more...]]``
  5657. Move-assign a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from a socket of another protocol type.
  5658. template<
  5659. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  5660. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  5661. enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_datagram_socket & >::type ``[link boost_asio.reference.basic_datagram_socket.operator_eq_.overload2 operator=]``(
  5662. basic_datagram_socket< Protocol1, Executor1 > && other);
  5663. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.operator_eq_.overload2 more...]]``
  5664. [section:overload1 basic_datagram_socket::operator= (1 of 2 overloads)]
  5665. Move-assign a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from another.
  5666. basic_datagram_socket & operator=(
  5667. basic_datagram_socket && other);
  5668. This assignment operator moves a datagram socket from one object to another.
  5669. [heading Parameters]
  5670. [variablelist
  5671. [[other][The other [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] object from which the move will occur.]]
  5672. ]
  5673. [heading Remarks]
  5674. Following the move, the moved-from object is in the same state as if constructed using the `basic_datagram_socket(const executor_type&)` constructor.
  5675. [endsect]
  5676. [section:overload2 basic_datagram_socket::operator= (2 of 2 overloads)]
  5677. Move-assign a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from a socket of another protocol type.
  5678. template<
  5679. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  5680. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  5681. enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_datagram_socket & >::type operator=(
  5682. basic_datagram_socket< Protocol1, Executor1 > && other);
  5683. This assignment operator moves a datagram socket from one object to another.
  5684. [heading Parameters]
  5685. [variablelist
  5686. [[other][The other [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] object from which the move will occur.]]
  5687. ]
  5688. [heading Remarks]
  5689. Following the move, the moved-from object is in the same state as if constructed using the `basic_datagram_socket(const executor_type&)` constructor.
  5690. [endsect]
  5691. [endsect]
  5692. [section:out_of_band_inline basic_datagram_socket::out_of_band_inline]
  5693. ['Inherited from socket_base.]
  5694. [indexterm2 boost_asio.indexterm.basic_datagram_socket.out_of_band_inline..out_of_band_inline..basic_datagram_socket]
  5695. Socket option for putting received out-of-band data inline.
  5696. typedef implementation_defined out_of_band_inline;
  5697. Implements the SOL\_SOCKET/SO\_OOBINLINE socket option.
  5698. [heading Examples]
  5699. Setting the option:
  5700. boost::asio::ip::tcp::socket socket(my_context);
  5701. ...
  5702. boost::asio::socket_base::out_of_band_inline option(true);
  5703. socket.set_option(option);
  5704. Getting the current option value:
  5705. boost::asio::ip::tcp::socket socket(my_context);
  5706. ...
  5707. boost::asio::socket_base::out_of_band_inline option;
  5708. socket.get_option(option);
  5709. bool value = option.value();
  5710. [heading Requirements]
  5711. ['Header: ][^boost/asio/basic_datagram_socket.hpp]
  5712. ['Convenience header: ][^boost/asio.hpp]
  5713. [endsect]
  5714. [section:protocol_type basic_datagram_socket::protocol_type]
  5715. [indexterm2 boost_asio.indexterm.basic_datagram_socket.protocol_type..protocol_type..basic_datagram_socket]
  5716. The protocol type.
  5717. typedef Protocol protocol_type;
  5718. [heading Requirements]
  5719. ['Header: ][^boost/asio/basic_datagram_socket.hpp]
  5720. ['Convenience header: ][^boost/asio.hpp]
  5721. [endsect]
  5722. [section:receive basic_datagram_socket::receive]
  5723. [indexterm2 boost_asio.indexterm.basic_datagram_socket.receive..receive..basic_datagram_socket]
  5724. Receive some data on a connected socket.
  5725. template<
  5726. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  5727. std::size_t ``[link boost_asio.reference.basic_datagram_socket.receive.overload1 receive]``(
  5728. const MutableBufferSequence & buffers);
  5729. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.receive.overload1 more...]]``
  5730. template<
  5731. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  5732. std::size_t ``[link boost_asio.reference.basic_datagram_socket.receive.overload2 receive]``(
  5733. const MutableBufferSequence & buffers,
  5734. socket_base::message_flags flags);
  5735. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.receive.overload2 more...]]``
  5736. template<
  5737. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  5738. std::size_t ``[link boost_asio.reference.basic_datagram_socket.receive.overload3 receive]``(
  5739. const MutableBufferSequence & buffers,
  5740. socket_base::message_flags flags,
  5741. boost::system::error_code & ec);
  5742. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.receive.overload3 more...]]``
  5743. [section:overload1 basic_datagram_socket::receive (1 of 3 overloads)]
  5744. Receive some data on a connected socket.
  5745. template<
  5746. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  5747. std::size_t receive(
  5748. const MutableBufferSequence & buffers);
  5749. This function is used to receive data on the datagram socket. The function call will block until data has been received successfully or an error occurs.
  5750. [heading Parameters]
  5751. [variablelist
  5752. [[buffers][One or more buffers into which the data will be received.]]
  5753. ]
  5754. [heading Return Value]
  5755. The number of bytes received.
  5756. [heading Exceptions]
  5757. [variablelist
  5758. [[boost::system::system_error][Thrown on failure.]]
  5759. ]
  5760. [heading Remarks]
  5761. The receive operation can only be used with a connected socket. Use the receive\_from function to receive data on an unconnected datagram socket.
  5762. [heading Example]
  5763. To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  5764. socket.receive(boost::asio::buffer(data, size));
  5765. See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  5766. [endsect]
  5767. [section:overload2 basic_datagram_socket::receive (2 of 3 overloads)]
  5768. Receive some data on a connected socket.
  5769. template<
  5770. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  5771. std::size_t receive(
  5772. const MutableBufferSequence & buffers,
  5773. socket_base::message_flags flags);
  5774. This function is used to receive data on the datagram socket. The function call will block until data has been received successfully or an error occurs.
  5775. [heading Parameters]
  5776. [variablelist
  5777. [[buffers][One or more buffers into which the data will be received.]]
  5778. [[flags][Flags specifying how the receive call is to be made.]]
  5779. ]
  5780. [heading Return Value]
  5781. The number of bytes received.
  5782. [heading Exceptions]
  5783. [variablelist
  5784. [[boost::system::system_error][Thrown on failure.]]
  5785. ]
  5786. [heading Remarks]
  5787. The receive operation can only be used with a connected socket. Use the receive\_from function to receive data on an unconnected datagram socket.
  5788. [endsect]
  5789. [section:overload3 basic_datagram_socket::receive (3 of 3 overloads)]
  5790. Receive some data on a connected socket.
  5791. template<
  5792. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  5793. std::size_t receive(
  5794. const MutableBufferSequence & buffers,
  5795. socket_base::message_flags flags,
  5796. boost::system::error_code & ec);
  5797. This function is used to receive data on the datagram socket. The function call will block until data has been received successfully or an error occurs.
  5798. [heading Parameters]
  5799. [variablelist
  5800. [[buffers][One or more buffers into which the data will be received.]]
  5801. [[flags][Flags specifying how the receive call is to be made.]]
  5802. [[ec][Set to indicate what error occurred, if any.]]
  5803. ]
  5804. [heading Return Value]
  5805. The number of bytes received.
  5806. [heading Remarks]
  5807. The receive operation can only be used with a connected socket. Use the receive\_from function to receive data on an unconnected datagram socket.
  5808. [endsect]
  5809. [endsect]
  5810. [section:receive_buffer_size basic_datagram_socket::receive_buffer_size]
  5811. ['Inherited from socket_base.]
  5812. [indexterm2 boost_asio.indexterm.basic_datagram_socket.receive_buffer_size..receive_buffer_size..basic_datagram_socket]
  5813. Socket option for the receive buffer size of a socket.
  5814. typedef implementation_defined receive_buffer_size;
  5815. Implements the SOL\_SOCKET/SO\_RCVBUF socket option.
  5816. [heading Examples]
  5817. Setting the option:
  5818. boost::asio::ip::tcp::socket socket(my_context);
  5819. ...
  5820. boost::asio::socket_base::receive_buffer_size option(8192);
  5821. socket.set_option(option);
  5822. Getting the current option value:
  5823. boost::asio::ip::tcp::socket socket(my_context);
  5824. ...
  5825. boost::asio::socket_base::receive_buffer_size option;
  5826. socket.get_option(option);
  5827. int size = option.value();
  5828. [heading Requirements]
  5829. ['Header: ][^boost/asio/basic_datagram_socket.hpp]
  5830. ['Convenience header: ][^boost/asio.hpp]
  5831. [endsect]
  5832. [section:receive_from basic_datagram_socket::receive_from]
  5833. [indexterm2 boost_asio.indexterm.basic_datagram_socket.receive_from..receive_from..basic_datagram_socket]
  5834. Receive a datagram with the endpoint of the sender.
  5835. template<
  5836. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  5837. std::size_t ``[link boost_asio.reference.basic_datagram_socket.receive_from.overload1 receive_from]``(
  5838. const MutableBufferSequence & buffers,
  5839. endpoint_type & sender_endpoint);
  5840. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.receive_from.overload1 more...]]``
  5841. template<
  5842. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  5843. std::size_t ``[link boost_asio.reference.basic_datagram_socket.receive_from.overload2 receive_from]``(
  5844. const MutableBufferSequence & buffers,
  5845. endpoint_type & sender_endpoint,
  5846. socket_base::message_flags flags);
  5847. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.receive_from.overload2 more...]]``
  5848. template<
  5849. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  5850. std::size_t ``[link boost_asio.reference.basic_datagram_socket.receive_from.overload3 receive_from]``(
  5851. const MutableBufferSequence & buffers,
  5852. endpoint_type & sender_endpoint,
  5853. socket_base::message_flags flags,
  5854. boost::system::error_code & ec);
  5855. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.receive_from.overload3 more...]]``
  5856. [section:overload1 basic_datagram_socket::receive_from (1 of 3 overloads)]
  5857. Receive a datagram with the endpoint of the sender.
  5858. template<
  5859. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  5860. std::size_t receive_from(
  5861. const MutableBufferSequence & buffers,
  5862. endpoint_type & sender_endpoint);
  5863. This function is used to receive a datagram. The function call will block until data has been received successfully or an error occurs.
  5864. [heading Parameters]
  5865. [variablelist
  5866. [[buffers][One or more buffers into which the data will be received.]]
  5867. [[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the datagram.]]
  5868. ]
  5869. [heading Return Value]
  5870. The number of bytes received.
  5871. [heading Exceptions]
  5872. [variablelist
  5873. [[boost::system::system_error][Thrown on failure.]]
  5874. ]
  5875. [heading Example]
  5876. To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  5877. boost::asio::ip::udp::endpoint sender_endpoint;
  5878. socket.receive_from(
  5879. boost::asio::buffer(data, size), sender_endpoint);
  5880. See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  5881. [endsect]
  5882. [section:overload2 basic_datagram_socket::receive_from (2 of 3 overloads)]
  5883. Receive a datagram with the endpoint of the sender.
  5884. template<
  5885. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  5886. std::size_t receive_from(
  5887. const MutableBufferSequence & buffers,
  5888. endpoint_type & sender_endpoint,
  5889. socket_base::message_flags flags);
  5890. This function is used to receive a datagram. The function call will block until data has been received successfully or an error occurs.
  5891. [heading Parameters]
  5892. [variablelist
  5893. [[buffers][One or more buffers into which the data will be received.]]
  5894. [[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the datagram.]]
  5895. [[flags][Flags specifying how the receive call is to be made.]]
  5896. ]
  5897. [heading Return Value]
  5898. The number of bytes received.
  5899. [heading Exceptions]
  5900. [variablelist
  5901. [[boost::system::system_error][Thrown on failure. ]]
  5902. ]
  5903. [endsect]
  5904. [section:overload3 basic_datagram_socket::receive_from (3 of 3 overloads)]
  5905. Receive a datagram with the endpoint of the sender.
  5906. template<
  5907. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  5908. std::size_t receive_from(
  5909. const MutableBufferSequence & buffers,
  5910. endpoint_type & sender_endpoint,
  5911. socket_base::message_flags flags,
  5912. boost::system::error_code & ec);
  5913. This function is used to receive a datagram. The function call will block until data has been received successfully or an error occurs.
  5914. [heading Parameters]
  5915. [variablelist
  5916. [[buffers][One or more buffers into which the data will be received.]]
  5917. [[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the datagram.]]
  5918. [[flags][Flags specifying how the receive call is to be made.]]
  5919. [[ec][Set to indicate what error occurred, if any.]]
  5920. ]
  5921. [heading Return Value]
  5922. The number of bytes received.
  5923. [endsect]
  5924. [endsect]
  5925. [section:receive_low_watermark basic_datagram_socket::receive_low_watermark]
  5926. ['Inherited from socket_base.]
  5927. [indexterm2 boost_asio.indexterm.basic_datagram_socket.receive_low_watermark..receive_low_watermark..basic_datagram_socket]
  5928. Socket option for the receive low watermark.
  5929. typedef implementation_defined receive_low_watermark;
  5930. Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option.
  5931. [heading Examples]
  5932. Setting the option:
  5933. boost::asio::ip::tcp::socket socket(my_context);
  5934. ...
  5935. boost::asio::socket_base::receive_low_watermark option(1024);
  5936. socket.set_option(option);
  5937. Getting the current option value:
  5938. boost::asio::ip::tcp::socket socket(my_context);
  5939. ...
  5940. boost::asio::socket_base::receive_low_watermark option;
  5941. socket.get_option(option);
  5942. int size = option.value();
  5943. [heading Requirements]
  5944. ['Header: ][^boost/asio/basic_datagram_socket.hpp]
  5945. ['Convenience header: ][^boost/asio.hpp]
  5946. [endsect]
  5947. [section:release basic_datagram_socket::release]
  5948. [indexterm2 boost_asio.indexterm.basic_datagram_socket.release..release..basic_datagram_socket]
  5949. Release ownership of the underlying native socket.
  5950. native_handle_type ``[link boost_asio.reference.basic_datagram_socket.release.overload1 release]``();
  5951. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.release.overload1 more...]]``
  5952. native_handle_type ``[link boost_asio.reference.basic_datagram_socket.release.overload2 release]``(
  5953. boost::system::error_code & ec);
  5954. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.release.overload2 more...]]``
  5955. [section:overload1 basic_datagram_socket::release (1 of 2 overloads)]
  5956. ['Inherited from basic_socket.]
  5957. Release ownership of the underlying native socket.
  5958. native_handle_type release();
  5959. This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. Ownership of the native socket is then transferred to the caller.
  5960. [heading Exceptions]
  5961. [variablelist
  5962. [[boost::system::system_error][Thrown on failure.]]
  5963. ]
  5964. [heading Remarks]
  5965. This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms.
  5966. [endsect]
  5967. [section:overload2 basic_datagram_socket::release (2 of 2 overloads)]
  5968. ['Inherited from basic_socket.]
  5969. Release ownership of the underlying native socket.
  5970. native_handle_type release(
  5971. boost::system::error_code & ec);
  5972. This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. Ownership of the native socket is then transferred to the caller.
  5973. [heading Parameters]
  5974. [variablelist
  5975. [[ec][Set to indicate what error occurred, if any.]]
  5976. ]
  5977. [heading Remarks]
  5978. This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms.
  5979. [endsect]
  5980. [endsect]
  5981. [section:remote_endpoint basic_datagram_socket::remote_endpoint]
  5982. [indexterm2 boost_asio.indexterm.basic_datagram_socket.remote_endpoint..remote_endpoint..basic_datagram_socket]
  5983. Get the remote endpoint of the socket.
  5984. endpoint_type ``[link boost_asio.reference.basic_datagram_socket.remote_endpoint.overload1 remote_endpoint]``() const;
  5985. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.remote_endpoint.overload1 more...]]``
  5986. endpoint_type ``[link boost_asio.reference.basic_datagram_socket.remote_endpoint.overload2 remote_endpoint]``(
  5987. boost::system::error_code & ec) const;
  5988. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.remote_endpoint.overload2 more...]]``
  5989. [section:overload1 basic_datagram_socket::remote_endpoint (1 of 2 overloads)]
  5990. ['Inherited from basic_socket.]
  5991. Get the remote endpoint of the socket.
  5992. endpoint_type remote_endpoint() const;
  5993. This function is used to obtain the remote endpoint of the socket.
  5994. [heading Return Value]
  5995. An object that represents the remote endpoint of the socket.
  5996. [heading Exceptions]
  5997. [variablelist
  5998. [[boost::system::system_error][Thrown on failure.]]
  5999. ]
  6000. [heading Example]
  6001. boost::asio::ip::tcp::socket socket(my_context);
  6002. ...
  6003. boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint();
  6004. [endsect]
  6005. [section:overload2 basic_datagram_socket::remote_endpoint (2 of 2 overloads)]
  6006. ['Inherited from basic_socket.]
  6007. Get the remote endpoint of the socket.
  6008. endpoint_type remote_endpoint(
  6009. boost::system::error_code & ec) const;
  6010. This function is used to obtain the remote endpoint of the socket.
  6011. [heading Parameters]
  6012. [variablelist
  6013. [[ec][Set to indicate what error occurred, if any.]]
  6014. ]
  6015. [heading Return Value]
  6016. An object that represents the remote endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
  6017. [heading Example]
  6018. boost::asio::ip::tcp::socket socket(my_context);
  6019. ...
  6020. boost::system::error_code ec;
  6021. boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(ec);
  6022. if (ec)
  6023. {
  6024. // An error occurred.
  6025. }
  6026. [endsect]
  6027. [endsect]
  6028. [section:reuse_address basic_datagram_socket::reuse_address]
  6029. ['Inherited from socket_base.]
  6030. [indexterm2 boost_asio.indexterm.basic_datagram_socket.reuse_address..reuse_address..basic_datagram_socket]
  6031. Socket option to allow the socket to be bound to an address that is already in use.
  6032. typedef implementation_defined reuse_address;
  6033. Implements the SOL\_SOCKET/SO\_REUSEADDR socket option.
  6034. [heading Examples]
  6035. Setting the option:
  6036. boost::asio::ip::tcp::acceptor acceptor(my_context);
  6037. ...
  6038. boost::asio::socket_base::reuse_address option(true);
  6039. acceptor.set_option(option);
  6040. Getting the current option value:
  6041. boost::asio::ip::tcp::acceptor acceptor(my_context);
  6042. ...
  6043. boost::asio::socket_base::reuse_address option;
  6044. acceptor.get_option(option);
  6045. bool is_set = option.value();
  6046. [heading Requirements]
  6047. ['Header: ][^boost/asio/basic_datagram_socket.hpp]
  6048. ['Convenience header: ][^boost/asio.hpp]
  6049. [endsect]
  6050. [section:send basic_datagram_socket::send]
  6051. [indexterm2 boost_asio.indexterm.basic_datagram_socket.send..send..basic_datagram_socket]
  6052. Send some data on a connected socket.
  6053. template<
  6054. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  6055. std::size_t ``[link boost_asio.reference.basic_datagram_socket.send.overload1 send]``(
  6056. const ConstBufferSequence & buffers);
  6057. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.send.overload1 more...]]``
  6058. template<
  6059. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  6060. std::size_t ``[link boost_asio.reference.basic_datagram_socket.send.overload2 send]``(
  6061. const ConstBufferSequence & buffers,
  6062. socket_base::message_flags flags);
  6063. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.send.overload2 more...]]``
  6064. template<
  6065. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  6066. std::size_t ``[link boost_asio.reference.basic_datagram_socket.send.overload3 send]``(
  6067. const ConstBufferSequence & buffers,
  6068. socket_base::message_flags flags,
  6069. boost::system::error_code & ec);
  6070. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.send.overload3 more...]]``
  6071. [section:overload1 basic_datagram_socket::send (1 of 3 overloads)]
  6072. Send some data on a connected socket.
  6073. template<
  6074. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  6075. std::size_t send(
  6076. const ConstBufferSequence & buffers);
  6077. This function is used to send data on the datagram socket. The function call will block until the data has been sent successfully or an error occurs.
  6078. [heading Parameters]
  6079. [variablelist
  6080. [[buffers][One ore more data buffers to be sent on the socket.]]
  6081. ]
  6082. [heading Return Value]
  6083. The number of bytes sent.
  6084. [heading Exceptions]
  6085. [variablelist
  6086. [[boost::system::system_error][Thrown on failure.]]
  6087. ]
  6088. [heading Remarks]
  6089. The send operation can only be used with a connected socket. Use the send\_to function to send data on an unconnected datagram socket.
  6090. [heading Example]
  6091. To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  6092. socket.send(boost::asio::buffer(data, size));
  6093. See the [link boost_asio.reference.buffer `buffer`] documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  6094. [endsect]
  6095. [section:overload2 basic_datagram_socket::send (2 of 3 overloads)]
  6096. Send some data on a connected socket.
  6097. template<
  6098. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  6099. std::size_t send(
  6100. const ConstBufferSequence & buffers,
  6101. socket_base::message_flags flags);
  6102. This function is used to send data on the datagram socket. The function call will block until the data has been sent successfully or an error occurs.
  6103. [heading Parameters]
  6104. [variablelist
  6105. [[buffers][One ore more data buffers to be sent on the socket.]]
  6106. [[flags][Flags specifying how the send call is to be made.]]
  6107. ]
  6108. [heading Return Value]
  6109. The number of bytes sent.
  6110. [heading Exceptions]
  6111. [variablelist
  6112. [[boost::system::system_error][Thrown on failure.]]
  6113. ]
  6114. [heading Remarks]
  6115. The send operation can only be used with a connected socket. Use the send\_to function to send data on an unconnected datagram socket.
  6116. [endsect]
  6117. [section:overload3 basic_datagram_socket::send (3 of 3 overloads)]
  6118. Send some data on a connected socket.
  6119. template<
  6120. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  6121. std::size_t send(
  6122. const ConstBufferSequence & buffers,
  6123. socket_base::message_flags flags,
  6124. boost::system::error_code & ec);
  6125. This function is used to send data on the datagram socket. The function call will block until the data has been sent successfully or an error occurs.
  6126. [heading Parameters]
  6127. [variablelist
  6128. [[buffers][One or more data buffers to be sent on the socket.]]
  6129. [[flags][Flags specifying how the send call is to be made.]]
  6130. [[ec][Set to indicate what error occurred, if any.]]
  6131. ]
  6132. [heading Return Value]
  6133. The number of bytes sent.
  6134. [heading Remarks]
  6135. The send operation can only be used with a connected socket. Use the send\_to function to send data on an unconnected datagram socket.
  6136. [endsect]
  6137. [endsect]
  6138. [section:send_buffer_size basic_datagram_socket::send_buffer_size]
  6139. ['Inherited from socket_base.]
  6140. [indexterm2 boost_asio.indexterm.basic_datagram_socket.send_buffer_size..send_buffer_size..basic_datagram_socket]
  6141. Socket option for the send buffer size of a socket.
  6142. typedef implementation_defined send_buffer_size;
  6143. Implements the SOL\_SOCKET/SO\_SNDBUF socket option.
  6144. [heading Examples]
  6145. Setting the option:
  6146. boost::asio::ip::tcp::socket socket(my_context);
  6147. ...
  6148. boost::asio::socket_base::send_buffer_size option(8192);
  6149. socket.set_option(option);
  6150. Getting the current option value:
  6151. boost::asio::ip::tcp::socket socket(my_context);
  6152. ...
  6153. boost::asio::socket_base::send_buffer_size option;
  6154. socket.get_option(option);
  6155. int size = option.value();
  6156. [heading Requirements]
  6157. ['Header: ][^boost/asio/basic_datagram_socket.hpp]
  6158. ['Convenience header: ][^boost/asio.hpp]
  6159. [endsect]
  6160. [section:send_low_watermark basic_datagram_socket::send_low_watermark]
  6161. ['Inherited from socket_base.]
  6162. [indexterm2 boost_asio.indexterm.basic_datagram_socket.send_low_watermark..send_low_watermark..basic_datagram_socket]
  6163. Socket option for the send low watermark.
  6164. typedef implementation_defined send_low_watermark;
  6165. Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option.
  6166. [heading Examples]
  6167. Setting the option:
  6168. boost::asio::ip::tcp::socket socket(my_context);
  6169. ...
  6170. boost::asio::socket_base::send_low_watermark option(1024);
  6171. socket.set_option(option);
  6172. Getting the current option value:
  6173. boost::asio::ip::tcp::socket socket(my_context);
  6174. ...
  6175. boost::asio::socket_base::send_low_watermark option;
  6176. socket.get_option(option);
  6177. int size = option.value();
  6178. [heading Requirements]
  6179. ['Header: ][^boost/asio/basic_datagram_socket.hpp]
  6180. ['Convenience header: ][^boost/asio.hpp]
  6181. [endsect]
  6182. [section:send_to basic_datagram_socket::send_to]
  6183. [indexterm2 boost_asio.indexterm.basic_datagram_socket.send_to..send_to..basic_datagram_socket]
  6184. Send a datagram to the specified endpoint.
  6185. template<
  6186. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  6187. std::size_t ``[link boost_asio.reference.basic_datagram_socket.send_to.overload1 send_to]``(
  6188. const ConstBufferSequence & buffers,
  6189. const endpoint_type & destination);
  6190. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.send_to.overload1 more...]]``
  6191. template<
  6192. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  6193. std::size_t ``[link boost_asio.reference.basic_datagram_socket.send_to.overload2 send_to]``(
  6194. const ConstBufferSequence & buffers,
  6195. const endpoint_type & destination,
  6196. socket_base::message_flags flags);
  6197. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.send_to.overload2 more...]]``
  6198. template<
  6199. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  6200. std::size_t ``[link boost_asio.reference.basic_datagram_socket.send_to.overload3 send_to]``(
  6201. const ConstBufferSequence & buffers,
  6202. const endpoint_type & destination,
  6203. socket_base::message_flags flags,
  6204. boost::system::error_code & ec);
  6205. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.send_to.overload3 more...]]``
  6206. [section:overload1 basic_datagram_socket::send_to (1 of 3 overloads)]
  6207. Send a datagram to the specified endpoint.
  6208. template<
  6209. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  6210. std::size_t send_to(
  6211. const ConstBufferSequence & buffers,
  6212. const endpoint_type & destination);
  6213. This function is used to send a datagram to the specified remote endpoint. The function call will block until the data has been sent successfully or an error occurs.
  6214. [heading Parameters]
  6215. [variablelist
  6216. [[buffers][One or more data buffers to be sent to the remote endpoint.]]
  6217. [[destination][The remote endpoint to which the data will be sent.]]
  6218. ]
  6219. [heading Return Value]
  6220. The number of bytes sent.
  6221. [heading Exceptions]
  6222. [variablelist
  6223. [[boost::system::system_error][Thrown on failure.]]
  6224. ]
  6225. [heading Example]
  6226. To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  6227. boost::asio::ip::udp::endpoint destination(
  6228. boost::asio::ip::address::from_string("1.2.3.4"), 12345);
  6229. socket.send_to(boost::asio::buffer(data, size), destination);
  6230. See the [link boost_asio.reference.buffer `buffer`] documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  6231. [endsect]
  6232. [section:overload2 basic_datagram_socket::send_to (2 of 3 overloads)]
  6233. Send a datagram to the specified endpoint.
  6234. template<
  6235. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  6236. std::size_t send_to(
  6237. const ConstBufferSequence & buffers,
  6238. const endpoint_type & destination,
  6239. socket_base::message_flags flags);
  6240. This function is used to send a datagram to the specified remote endpoint. The function call will block until the data has been sent successfully or an error occurs.
  6241. [heading Parameters]
  6242. [variablelist
  6243. [[buffers][One or more data buffers to be sent to the remote endpoint.]]
  6244. [[destination][The remote endpoint to which the data will be sent.]]
  6245. [[flags][Flags specifying how the send call is to be made.]]
  6246. ]
  6247. [heading Return Value]
  6248. The number of bytes sent.
  6249. [heading Exceptions]
  6250. [variablelist
  6251. [[boost::system::system_error][Thrown on failure. ]]
  6252. ]
  6253. [endsect]
  6254. [section:overload3 basic_datagram_socket::send_to (3 of 3 overloads)]
  6255. Send a datagram to the specified endpoint.
  6256. template<
  6257. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  6258. std::size_t send_to(
  6259. const ConstBufferSequence & buffers,
  6260. const endpoint_type & destination,
  6261. socket_base::message_flags flags,
  6262. boost::system::error_code & ec);
  6263. This function is used to send a datagram to the specified remote endpoint. The function call will block until the data has been sent successfully or an error occurs.
  6264. [heading Parameters]
  6265. [variablelist
  6266. [[buffers][One or more data buffers to be sent to the remote endpoint.]]
  6267. [[destination][The remote endpoint to which the data will be sent.]]
  6268. [[flags][Flags specifying how the send call is to be made.]]
  6269. [[ec][Set to indicate what error occurred, if any.]]
  6270. ]
  6271. [heading Return Value]
  6272. The number of bytes sent.
  6273. [endsect]
  6274. [endsect]
  6275. [section:set_option basic_datagram_socket::set_option]
  6276. [indexterm2 boost_asio.indexterm.basic_datagram_socket.set_option..set_option..basic_datagram_socket]
  6277. Set an option on the socket.
  6278. template<
  6279. typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
  6280. void ``[link boost_asio.reference.basic_datagram_socket.set_option.overload1 set_option]``(
  6281. const SettableSocketOption & option);
  6282. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.set_option.overload1 more...]]``
  6283. template<
  6284. typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
  6285. void ``[link boost_asio.reference.basic_datagram_socket.set_option.overload2 set_option]``(
  6286. const SettableSocketOption & option,
  6287. boost::system::error_code & ec);
  6288. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.set_option.overload2 more...]]``
  6289. [section:overload1 basic_datagram_socket::set_option (1 of 2 overloads)]
  6290. ['Inherited from basic_socket.]
  6291. Set an option on the socket.
  6292. template<
  6293. typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
  6294. void set_option(
  6295. const SettableSocketOption & option);
  6296. This function is used to set an option on the socket.
  6297. [heading Parameters]
  6298. [variablelist
  6299. [[option][The new option value to be set on the socket.]]
  6300. ]
  6301. [heading Exceptions]
  6302. [variablelist
  6303. [[boost::system::system_error][Thrown on failure.]]
  6304. ]
  6305. [heading Example]
  6306. Setting the IPPROTO\_TCP/TCP\_NODELAY option:
  6307. boost::asio::ip::tcp::socket socket(my_context);
  6308. ...
  6309. boost::asio::ip::tcp::no_delay option(true);
  6310. socket.set_option(option);
  6311. [endsect]
  6312. [section:overload2 basic_datagram_socket::set_option (2 of 2 overloads)]
  6313. ['Inherited from basic_socket.]
  6314. Set an option on the socket.
  6315. template<
  6316. typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
  6317. void set_option(
  6318. const SettableSocketOption & option,
  6319. boost::system::error_code & ec);
  6320. This function is used to set an option on the socket.
  6321. [heading Parameters]
  6322. [variablelist
  6323. [[option][The new option value to be set on the socket.]]
  6324. [[ec][Set to indicate what error occurred, if any.]]
  6325. ]
  6326. [heading Example]
  6327. Setting the IPPROTO\_TCP/TCP\_NODELAY option:
  6328. boost::asio::ip::tcp::socket socket(my_context);
  6329. ...
  6330. boost::asio::ip::tcp::no_delay option(true);
  6331. boost::system::error_code ec;
  6332. socket.set_option(option, ec);
  6333. if (ec)
  6334. {
  6335. // An error occurred.
  6336. }
  6337. [endsect]
  6338. [endsect]
  6339. [section:shutdown basic_datagram_socket::shutdown]
  6340. [indexterm2 boost_asio.indexterm.basic_datagram_socket.shutdown..shutdown..basic_datagram_socket]
  6341. Disable sends or receives on the socket.
  6342. void ``[link boost_asio.reference.basic_datagram_socket.shutdown.overload1 shutdown]``(
  6343. shutdown_type what);
  6344. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.shutdown.overload1 more...]]``
  6345. void ``[link boost_asio.reference.basic_datagram_socket.shutdown.overload2 shutdown]``(
  6346. shutdown_type what,
  6347. boost::system::error_code & ec);
  6348. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.shutdown.overload2 more...]]``
  6349. [section:overload1 basic_datagram_socket::shutdown (1 of 2 overloads)]
  6350. ['Inherited from basic_socket.]
  6351. Disable sends or receives on the socket.
  6352. void shutdown(
  6353. shutdown_type what);
  6354. This function is used to disable send operations, receive operations, or both.
  6355. [heading Parameters]
  6356. [variablelist
  6357. [[what][Determines what types of operation will no longer be allowed.]]
  6358. ]
  6359. [heading Exceptions]
  6360. [variablelist
  6361. [[boost::system::system_error][Thrown on failure.]]
  6362. ]
  6363. [heading Example]
  6364. Shutting down the send side of the socket:
  6365. boost::asio::ip::tcp::socket socket(my_context);
  6366. ...
  6367. socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send);
  6368. [endsect]
  6369. [section:overload2 basic_datagram_socket::shutdown (2 of 2 overloads)]
  6370. ['Inherited from basic_socket.]
  6371. Disable sends or receives on the socket.
  6372. void shutdown(
  6373. shutdown_type what,
  6374. boost::system::error_code & ec);
  6375. This function is used to disable send operations, receive operations, or both.
  6376. [heading Parameters]
  6377. [variablelist
  6378. [[what][Determines what types of operation will no longer be allowed.]]
  6379. [[ec][Set to indicate what error occurred, if any.]]
  6380. ]
  6381. [heading Example]
  6382. Shutting down the send side of the socket:
  6383. boost::asio::ip::tcp::socket socket(my_context);
  6384. ...
  6385. boost::system::error_code ec;
  6386. socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ec);
  6387. if (ec)
  6388. {
  6389. // An error occurred.
  6390. }
  6391. [endsect]
  6392. [endsect]
  6393. [section:shutdown_type basic_datagram_socket::shutdown_type]
  6394. ['Inherited from socket_base.]
  6395. [indexterm2 boost_asio.indexterm.basic_datagram_socket.shutdown_type..shutdown_type..basic_datagram_socket]
  6396. Different ways a socket may be shutdown.
  6397. enum shutdown_type
  6398. [indexterm2 boost_asio.indexterm.basic_datagram_socket.shutdown_type.shutdown_receive..shutdown_receive..basic_datagram_socket]
  6399. [indexterm2 boost_asio.indexterm.basic_datagram_socket.shutdown_type.shutdown_send..shutdown_send..basic_datagram_socket]
  6400. [indexterm2 boost_asio.indexterm.basic_datagram_socket.shutdown_type.shutdown_both..shutdown_both..basic_datagram_socket]
  6401. [heading Values]
  6402. [variablelist
  6403. [
  6404. [shutdown_receive]
  6405. [Shutdown the receive side of the socket. ]
  6406. ]
  6407. [
  6408. [shutdown_send]
  6409. [Shutdown the send side of the socket. ]
  6410. ]
  6411. [
  6412. [shutdown_both]
  6413. [Shutdown both send and receive on the socket. ]
  6414. ]
  6415. ]
  6416. [endsect]
  6417. [section:wait basic_datagram_socket::wait]
  6418. [indexterm2 boost_asio.indexterm.basic_datagram_socket.wait..wait..basic_datagram_socket]
  6419. Wait for the socket to become ready to read, ready to write, or to have pending error conditions.
  6420. void ``[link boost_asio.reference.basic_datagram_socket.wait.overload1 wait]``(
  6421. wait_type w);
  6422. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.wait.overload1 more...]]``
  6423. void ``[link boost_asio.reference.basic_datagram_socket.wait.overload2 wait]``(
  6424. wait_type w,
  6425. boost::system::error_code & ec);
  6426. `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.wait.overload2 more...]]``
  6427. [section:overload1 basic_datagram_socket::wait (1 of 2 overloads)]
  6428. ['Inherited from basic_socket.]
  6429. Wait for the socket to become ready to read, ready to write, or to have pending error conditions.
  6430. void wait(
  6431. wait_type w);
  6432. This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state.
  6433. [heading Parameters]
  6434. [variablelist
  6435. [[w][Specifies the desired socket state.]]
  6436. ]
  6437. [heading Example]
  6438. Waiting for a socket to become readable.
  6439. boost::asio::ip::tcp::socket socket(my_context);
  6440. ...
  6441. socket.wait(boost::asio::ip::tcp::socket::wait_read);
  6442. [endsect]
  6443. [section:overload2 basic_datagram_socket::wait (2 of 2 overloads)]
  6444. ['Inherited from basic_socket.]
  6445. Wait for the socket to become ready to read, ready to write, or to have pending error conditions.
  6446. void wait(
  6447. wait_type w,
  6448. boost::system::error_code & ec);
  6449. This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state.
  6450. [heading Parameters]
  6451. [variablelist
  6452. [[w][Specifies the desired socket state.]]
  6453. [[ec][Set to indicate what error occurred, if any.]]
  6454. ]
  6455. [heading Example]
  6456. Waiting for a socket to become readable.
  6457. boost::asio::ip::tcp::socket socket(my_context);
  6458. ...
  6459. boost::system::error_code ec;
  6460. socket.wait(boost::asio::ip::tcp::socket::wait_read, ec);
  6461. [endsect]
  6462. [endsect]
  6463. [section:wait_type basic_datagram_socket::wait_type]
  6464. ['Inherited from socket_base.]
  6465. [indexterm2 boost_asio.indexterm.basic_datagram_socket.wait_type..wait_type..basic_datagram_socket]
  6466. Wait types.
  6467. enum wait_type
  6468. [indexterm2 boost_asio.indexterm.basic_datagram_socket.wait_type.wait_read..wait_read..basic_datagram_socket]
  6469. [indexterm2 boost_asio.indexterm.basic_datagram_socket.wait_type.wait_write..wait_write..basic_datagram_socket]
  6470. [indexterm2 boost_asio.indexterm.basic_datagram_socket.wait_type.wait_error..wait_error..basic_datagram_socket]
  6471. [heading Values]
  6472. [variablelist
  6473. [
  6474. [wait_read]
  6475. [Wait for a socket to become ready to read. ]
  6476. ]
  6477. [
  6478. [wait_write]
  6479. [Wait for a socket to become ready to write. ]
  6480. ]
  6481. [
  6482. [wait_error]
  6483. [Wait for a socket to have error conditions pending. ]
  6484. ]
  6485. ]
  6486. For use with `basic_socket::wait()` and `basic_socket::async_wait()`.
  6487. [endsect]
  6488. [section:_basic_datagram_socket basic_datagram_socket::~basic_datagram_socket]
  6489. [indexterm2 boost_asio.indexterm.basic_datagram_socket._basic_datagram_socket..~basic_datagram_socket..basic_datagram_socket]
  6490. Destroys the socket.
  6491. ~basic_datagram_socket();
  6492. This function destroys the socket, cancelling any outstanding asynchronous operations associated with the socket as if by calling `cancel`.
  6493. [endsect]
  6494. [endsect]
  6495. [section:basic_datagram_socket__rebind_executor basic_datagram_socket::rebind_executor]
  6496. Rebinds the socket type to another executor.
  6497. template<
  6498. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  6499. struct rebind_executor
  6500. [heading Types]
  6501. [table
  6502. [[Name][Description]]
  6503. [
  6504. [[link boost_asio.reference.basic_datagram_socket__rebind_executor.other [*other]]]
  6505. [The socket type when rebound to the specified executor. ]
  6506. ]
  6507. ]
  6508. [heading Requirements]
  6509. ['Header: ][^boost/asio/basic_datagram_socket.hpp]
  6510. ['Convenience header: ][^boost/asio.hpp]
  6511. [section:other basic_datagram_socket::rebind_executor::other]
  6512. [indexterm2 boost_asio.indexterm.basic_datagram_socket__rebind_executor.other..other..basic_datagram_socket::rebind_executor]
  6513. The socket type when rebound to the specified executor.
  6514. typedef basic_datagram_socket< Protocol, Executor1 > other;
  6515. [heading Types]
  6516. [table
  6517. [[Name][Description]]
  6518. [
  6519. [[link boost_asio.reference.basic_datagram_socket__rebind_executor [*rebind_executor]]]
  6520. [Rebinds the socket type to another executor. ]
  6521. ]
  6522. [
  6523. [[link boost_asio.reference.basic_datagram_socket.broadcast [*broadcast]]]
  6524. [Socket option to permit sending of broadcast messages. ]
  6525. ]
  6526. [
  6527. [[link boost_asio.reference.basic_datagram_socket.bytes_readable [*bytes_readable]]]
  6528. [IO control command to get the amount of data that can be read without blocking. ]
  6529. ]
  6530. [
  6531. [[link boost_asio.reference.basic_datagram_socket.debug [*debug]]]
  6532. [Socket option to enable socket-level debugging. ]
  6533. ]
  6534. [
  6535. [[link boost_asio.reference.basic_datagram_socket.do_not_route [*do_not_route]]]
  6536. [Socket option to prevent routing, use local interfaces only. ]
  6537. ]
  6538. [
  6539. [[link boost_asio.reference.basic_datagram_socket.enable_connection_aborted [*enable_connection_aborted]]]
  6540. [Socket option to report aborted connections on accept. ]
  6541. ]
  6542. [
  6543. [[link boost_asio.reference.basic_datagram_socket.endpoint_type [*endpoint_type]]]
  6544. [The endpoint type. ]
  6545. ]
  6546. [
  6547. [[link boost_asio.reference.basic_datagram_socket.executor_type [*executor_type]]]
  6548. [The type of the executor associated with the object. ]
  6549. ]
  6550. [
  6551. [[link boost_asio.reference.basic_datagram_socket.keep_alive [*keep_alive]]]
  6552. [Socket option to send keep-alives. ]
  6553. ]
  6554. [
  6555. [[link boost_asio.reference.basic_datagram_socket.linger [*linger]]]
  6556. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  6557. ]
  6558. [
  6559. [[link boost_asio.reference.basic_datagram_socket.lowest_layer_type [*lowest_layer_type]]]
  6560. [A basic_socket is always the lowest layer. ]
  6561. ]
  6562. [
  6563. [[link boost_asio.reference.basic_datagram_socket.message_flags [*message_flags]]]
  6564. [Bitmask type for flags that can be passed to send and receive operations. ]
  6565. ]
  6566. [
  6567. [[link boost_asio.reference.basic_datagram_socket.native_handle_type [*native_handle_type]]]
  6568. [The native representation of a socket. ]
  6569. ]
  6570. [
  6571. [[link boost_asio.reference.basic_datagram_socket.out_of_band_inline [*out_of_band_inline]]]
  6572. [Socket option for putting received out-of-band data inline. ]
  6573. ]
  6574. [
  6575. [[link boost_asio.reference.basic_datagram_socket.protocol_type [*protocol_type]]]
  6576. [The protocol type. ]
  6577. ]
  6578. [
  6579. [[link boost_asio.reference.basic_datagram_socket.receive_buffer_size [*receive_buffer_size]]]
  6580. [Socket option for the receive buffer size of a socket. ]
  6581. ]
  6582. [
  6583. [[link boost_asio.reference.basic_datagram_socket.receive_low_watermark [*receive_low_watermark]]]
  6584. [Socket option for the receive low watermark. ]
  6585. ]
  6586. [
  6587. [[link boost_asio.reference.basic_datagram_socket.reuse_address [*reuse_address]]]
  6588. [Socket option to allow the socket to be bound to an address that is already in use. ]
  6589. ]
  6590. [
  6591. [[link boost_asio.reference.basic_datagram_socket.send_buffer_size [*send_buffer_size]]]
  6592. [Socket option for the send buffer size of a socket. ]
  6593. ]
  6594. [
  6595. [[link boost_asio.reference.basic_datagram_socket.send_low_watermark [*send_low_watermark]]]
  6596. [Socket option for the send low watermark. ]
  6597. ]
  6598. [
  6599. [[link boost_asio.reference.basic_datagram_socket.shutdown_type [*shutdown_type]]]
  6600. [Different ways a socket may be shutdown. ]
  6601. ]
  6602. [
  6603. [[link boost_asio.reference.basic_datagram_socket.wait_type [*wait_type]]]
  6604. [Wait types. ]
  6605. ]
  6606. ]
  6607. [heading Member Functions]
  6608. [table
  6609. [[Name][Description]]
  6610. [
  6611. [[link boost_asio.reference.basic_datagram_socket.assign [*assign]]]
  6612. [Assign an existing native socket to the socket. ]
  6613. ]
  6614. [
  6615. [[link boost_asio.reference.basic_datagram_socket.async_connect [*async_connect]]]
  6616. [Start an asynchronous connect. ]
  6617. ]
  6618. [
  6619. [[link boost_asio.reference.basic_datagram_socket.async_receive [*async_receive]]]
  6620. [Start an asynchronous receive on a connected socket. ]
  6621. ]
  6622. [
  6623. [[link boost_asio.reference.basic_datagram_socket.async_receive_from [*async_receive_from]]]
  6624. [Start an asynchronous receive. ]
  6625. ]
  6626. [
  6627. [[link boost_asio.reference.basic_datagram_socket.async_send [*async_send]]]
  6628. [Start an asynchronous send on a connected socket. ]
  6629. ]
  6630. [
  6631. [[link boost_asio.reference.basic_datagram_socket.async_send_to [*async_send_to]]]
  6632. [Start an asynchronous send. ]
  6633. ]
  6634. [
  6635. [[link boost_asio.reference.basic_datagram_socket.async_wait [*async_wait]]]
  6636. [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  6637. ]
  6638. [
  6639. [[link boost_asio.reference.basic_datagram_socket.at_mark [*at_mark]]]
  6640. [Determine whether the socket is at the out-of-band data mark. ]
  6641. ]
  6642. [
  6643. [[link boost_asio.reference.basic_datagram_socket.available [*available]]]
  6644. [Determine the number of bytes available for reading. ]
  6645. ]
  6646. [
  6647. [[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket [*basic_datagram_socket]]]
  6648. [Construct a basic_datagram_socket without opening it.
  6649. [hr]
  6650. Construct and open a basic_datagram_socket.
  6651. [hr]
  6652. Construct a basic_datagram_socket, opening it and binding it to the given local endpoint.
  6653. [hr]
  6654. Construct a basic_datagram_socket on an existing native socket.
  6655. [hr]
  6656. Move-construct a basic_datagram_socket from another.
  6657. [hr]
  6658. Move-construct a basic_datagram_socket from a socket of another protocol type. ]
  6659. ]
  6660. [
  6661. [[link boost_asio.reference.basic_datagram_socket.bind [*bind]]]
  6662. [Bind the socket to the given local endpoint. ]
  6663. ]
  6664. [
  6665. [[link boost_asio.reference.basic_datagram_socket.cancel [*cancel]]]
  6666. [Cancel all asynchronous operations associated with the socket. ]
  6667. ]
  6668. [
  6669. [[link boost_asio.reference.basic_datagram_socket.close [*close]]]
  6670. [Close the socket. ]
  6671. ]
  6672. [
  6673. [[link boost_asio.reference.basic_datagram_socket.connect [*connect]]]
  6674. [Connect the socket to the specified endpoint. ]
  6675. ]
  6676. [
  6677. [[link boost_asio.reference.basic_datagram_socket.get_executor [*get_executor]]]
  6678. [Get the executor associated with the object. ]
  6679. ]
  6680. [
  6681. [[link boost_asio.reference.basic_datagram_socket.get_option [*get_option]]]
  6682. [Get an option from the socket. ]
  6683. ]
  6684. [
  6685. [[link boost_asio.reference.basic_datagram_socket.io_control [*io_control]]]
  6686. [Perform an IO control command on the socket. ]
  6687. ]
  6688. [
  6689. [[link boost_asio.reference.basic_datagram_socket.is_open [*is_open]]]
  6690. [Determine whether the socket is open. ]
  6691. ]
  6692. [
  6693. [[link boost_asio.reference.basic_datagram_socket.local_endpoint [*local_endpoint]]]
  6694. [Get the local endpoint of the socket. ]
  6695. ]
  6696. [
  6697. [[link boost_asio.reference.basic_datagram_socket.lowest_layer [*lowest_layer]]]
  6698. [Get a reference to the lowest layer.
  6699. [hr]
  6700. Get a const reference to the lowest layer. ]
  6701. ]
  6702. [
  6703. [[link boost_asio.reference.basic_datagram_socket.native_handle [*native_handle]]]
  6704. [Get the native socket representation. ]
  6705. ]
  6706. [
  6707. [[link boost_asio.reference.basic_datagram_socket.native_non_blocking [*native_non_blocking]]]
  6708. [Gets the non-blocking mode of the native socket implementation.
  6709. [hr]
  6710. Sets the non-blocking mode of the native socket implementation. ]
  6711. ]
  6712. [
  6713. [[link boost_asio.reference.basic_datagram_socket.non_blocking [*non_blocking]]]
  6714. [Gets the non-blocking mode of the socket.
  6715. [hr]
  6716. Sets the non-blocking mode of the socket. ]
  6717. ]
  6718. [
  6719. [[link boost_asio.reference.basic_datagram_socket.open [*open]]]
  6720. [Open the socket using the specified protocol. ]
  6721. ]
  6722. [
  6723. [[link boost_asio.reference.basic_datagram_socket.operator_eq_ [*operator=]]]
  6724. [Move-assign a basic_datagram_socket from another.
  6725. [hr]
  6726. Move-assign a basic_datagram_socket from a socket of another protocol type. ]
  6727. ]
  6728. [
  6729. [[link boost_asio.reference.basic_datagram_socket.receive [*receive]]]
  6730. [Receive some data on a connected socket. ]
  6731. ]
  6732. [
  6733. [[link boost_asio.reference.basic_datagram_socket.receive_from [*receive_from]]]
  6734. [Receive a datagram with the endpoint of the sender. ]
  6735. ]
  6736. [
  6737. [[link boost_asio.reference.basic_datagram_socket.release [*release]]]
  6738. [Release ownership of the underlying native socket. ]
  6739. ]
  6740. [
  6741. [[link boost_asio.reference.basic_datagram_socket.remote_endpoint [*remote_endpoint]]]
  6742. [Get the remote endpoint of the socket. ]
  6743. ]
  6744. [
  6745. [[link boost_asio.reference.basic_datagram_socket.send [*send]]]
  6746. [Send some data on a connected socket. ]
  6747. ]
  6748. [
  6749. [[link boost_asio.reference.basic_datagram_socket.send_to [*send_to]]]
  6750. [Send a datagram to the specified endpoint. ]
  6751. ]
  6752. [
  6753. [[link boost_asio.reference.basic_datagram_socket.set_option [*set_option]]]
  6754. [Set an option on the socket. ]
  6755. ]
  6756. [
  6757. [[link boost_asio.reference.basic_datagram_socket.shutdown [*shutdown]]]
  6758. [Disable sends or receives on the socket. ]
  6759. ]
  6760. [
  6761. [[link boost_asio.reference.basic_datagram_socket.wait [*wait]]]
  6762. [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  6763. ]
  6764. [
  6765. [[link boost_asio.reference.basic_datagram_socket._basic_datagram_socket [*~basic_datagram_socket]]]
  6766. [Destroys the socket. ]
  6767. ]
  6768. ]
  6769. [heading Data Members]
  6770. [table
  6771. [[Name][Description]]
  6772. [
  6773. [[link boost_asio.reference.basic_datagram_socket.max_connections [*max_connections]]]
  6774. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  6775. ]
  6776. [
  6777. [[link boost_asio.reference.basic_datagram_socket.max_listen_connections [*max_listen_connections]]]
  6778. [The maximum length of the queue of pending incoming connections. ]
  6779. ]
  6780. [
  6781. [[link boost_asio.reference.basic_datagram_socket.message_do_not_route [*message_do_not_route]]]
  6782. [Specify that the data should not be subject to routing. ]
  6783. ]
  6784. [
  6785. [[link boost_asio.reference.basic_datagram_socket.message_end_of_record [*message_end_of_record]]]
  6786. [Specifies that the data marks the end of a record. ]
  6787. ]
  6788. [
  6789. [[link boost_asio.reference.basic_datagram_socket.message_out_of_band [*message_out_of_band]]]
  6790. [Process out-of-band data. ]
  6791. ]
  6792. [
  6793. [[link boost_asio.reference.basic_datagram_socket.message_peek [*message_peek]]]
  6794. [Peek at incoming data without removing it from the input queue. ]
  6795. ]
  6796. ]
  6797. [heading Protected Data Members]
  6798. [table
  6799. [[Name][Description]]
  6800. [
  6801. [[link boost_asio.reference.basic_datagram_socket.impl_ [*impl_]]]
  6802. []
  6803. ]
  6804. ]
  6805. The [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] class template provides asynchronous and blocking datagram-oriented socket functionality.
  6806. [heading Thread Safety]
  6807. ['Distinct] ['objects:] Safe.
  6808. ['Shared] ['objects:] Unsafe.
  6809. [heading Requirements]
  6810. ['Header: ][^boost/asio/basic_datagram_socket.hpp]
  6811. ['Convenience header: ][^boost/asio.hpp]
  6812. [endsect]
  6813. [endsect]
  6814. [section:basic_deadline_timer basic_deadline_timer]
  6815. Provides waitable timer functionality.
  6816. template<
  6817. typename Time,
  6818. typename ``[link boost_asio.reference.TimeTraits TimeTraits]`` = boost::asio::time_traits<Time>,
  6819. typename ``[link boost_asio.reference.Executor1 Executor]`` = executor>
  6820. class basic_deadline_timer
  6821. [heading Types]
  6822. [table
  6823. [[Name][Description]]
  6824. [
  6825. [[link boost_asio.reference.basic_deadline_timer__rebind_executor [*rebind_executor]]]
  6826. [Rebinds the timer type to another executor. ]
  6827. ]
  6828. [
  6829. [[link boost_asio.reference.basic_deadline_timer.duration_type [*duration_type]]]
  6830. [The duration type. ]
  6831. ]
  6832. [
  6833. [[link boost_asio.reference.basic_deadline_timer.executor_type [*executor_type]]]
  6834. [The type of the executor associated with the object. ]
  6835. ]
  6836. [
  6837. [[link boost_asio.reference.basic_deadline_timer.time_type [*time_type]]]
  6838. [The time type. ]
  6839. ]
  6840. [
  6841. [[link boost_asio.reference.basic_deadline_timer.traits_type [*traits_type]]]
  6842. [The time traits type. ]
  6843. ]
  6844. ]
  6845. [heading Member Functions]
  6846. [table
  6847. [[Name][Description]]
  6848. [
  6849. [[link boost_asio.reference.basic_deadline_timer.async_wait [*async_wait]]]
  6850. [Start an asynchronous wait on the timer. ]
  6851. ]
  6852. [
  6853. [[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer [*basic_deadline_timer]]]
  6854. [Constructor.
  6855. [hr]
  6856. Constructor to set a particular expiry time as an absolute time.
  6857. [hr]
  6858. Constructor to set a particular expiry time relative to now.
  6859. [hr]
  6860. Move-construct a basic_deadline_timer from another. ]
  6861. ]
  6862. [
  6863. [[link boost_asio.reference.basic_deadline_timer.cancel [*cancel]]]
  6864. [Cancel any asynchronous operations that are waiting on the timer. ]
  6865. ]
  6866. [
  6867. [[link boost_asio.reference.basic_deadline_timer.cancel_one [*cancel_one]]]
  6868. [Cancels one asynchronous operation that is waiting on the timer. ]
  6869. ]
  6870. [
  6871. [[link boost_asio.reference.basic_deadline_timer.expires_at [*expires_at]]]
  6872. [Get the timer's expiry time as an absolute time.
  6873. [hr]
  6874. Set the timer's expiry time as an absolute time. ]
  6875. ]
  6876. [
  6877. [[link boost_asio.reference.basic_deadline_timer.expires_from_now [*expires_from_now]]]
  6878. [Get the timer's expiry time relative to now.
  6879. [hr]
  6880. Set the timer's expiry time relative to now. ]
  6881. ]
  6882. [
  6883. [[link boost_asio.reference.basic_deadline_timer.get_executor [*get_executor]]]
  6884. [Get the executor associated with the object. ]
  6885. ]
  6886. [
  6887. [[link boost_asio.reference.basic_deadline_timer.operator_eq_ [*operator=]]]
  6888. [Move-assign a basic_deadline_timer from another. ]
  6889. ]
  6890. [
  6891. [[link boost_asio.reference.basic_deadline_timer.wait [*wait]]]
  6892. [Perform a blocking wait on the timer. ]
  6893. ]
  6894. [
  6895. [[link boost_asio.reference.basic_deadline_timer._basic_deadline_timer [*~basic_deadline_timer]]]
  6896. [Destroys the timer. ]
  6897. ]
  6898. ]
  6899. The [link boost_asio.reference.basic_deadline_timer `basic_deadline_timer`] class template provides the ability to perform a blocking or asynchronous wait for a timer to expire.
  6900. A deadline timer is always in one of two states: "expired" or "not expired". If the `wait()` or `async_wait()` function is called on an expired timer, the wait operation will complete immediately.
  6901. Most applications will use the [link boost_asio.reference.deadline_timer `deadline_timer`] typedef.
  6902. [heading Thread Safety]
  6903. ['Distinct] ['objects:] Safe.
  6904. ['Shared] ['objects:] Unsafe.
  6905. [heading Examples]
  6906. Performing a blocking wait:
  6907. // Construct a timer without setting an expiry time.
  6908. boost::asio::deadline_timer timer(my_context);
  6909. // Set an expiry time relative to now.
  6910. timer.expires_from_now(boost::posix_time::seconds(5));
  6911. // Wait for the timer to expire.
  6912. timer.wait();
  6913. Performing an asynchronous wait:
  6914. void handler(const boost::system::error_code& error)
  6915. {
  6916. if (!error)
  6917. {
  6918. // Timer expired.
  6919. }
  6920. }
  6921. ...
  6922. // Construct a timer with an absolute expiry time.
  6923. boost::asio::deadline_timer timer(my_context,
  6924. boost::posix_time::time_from_string("2005-12-07 23:59:59.000"));
  6925. // Start an asynchronous wait.
  6926. timer.async_wait(handler);
  6927. [heading Changing an active deadline_timer's expiry time]
  6928. Changing the expiry time of a timer while there are pending asynchronous waits causes those wait operations to be cancelled. To ensure that the action associated with the timer is performed only once, use something like this: used:
  6929. void on_some_event()
  6930. {
  6931. if (my_timer.expires_from_now(seconds(5)) > 0)
  6932. {
  6933. // We managed to cancel the timer. Start new asynchronous wait.
  6934. my_timer.async_wait(on_timeout);
  6935. }
  6936. else
  6937. {
  6938. // Too late, timer has already expired!
  6939. }
  6940. }
  6941. void on_timeout(const boost::system::error_code& e)
  6942. {
  6943. if (e != boost::asio::error::operation_aborted)
  6944. {
  6945. // Timer was not cancelled, take necessary action.
  6946. }
  6947. }
  6948. * 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.
  6949. * If a wait handler is cancelled, the boost::system::error\_code passed to it contains the value `boost::asio::error::operation_aborted`.
  6950. [heading Requirements]
  6951. ['Header: ][^boost/asio/basic_deadline_timer.hpp]
  6952. ['Convenience header: ][^boost/asio.hpp]
  6953. [section:async_wait basic_deadline_timer::async_wait]
  6954. [indexterm2 boost_asio.indexterm.basic_deadline_timer.async_wait..async_wait..basic_deadline_timer]
  6955. Start an asynchronous wait on the timer.
  6956. template<
  6957. typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  6958. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait(
  6959. WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  6960. This function may be used to initiate an asynchronous wait against the timer. It always returns immediately.
  6961. For each call to `async_wait()`, the supplied handler will be called exactly once. The handler will be called when:
  6962. * The timer has expired.
  6963. * The timer was cancelled, in which case the handler is passed the error code `boost::asio::error::operation_aborted`.
  6964. [heading Parameters]
  6965. [variablelist
  6966. [[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:
  6967. ``
  6968. void handler(
  6969. const boost::system::error_code& error // Result of operation.
  6970. );
  6971. ``
  6972. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
  6973. ]
  6974. [endsect]
  6975. [section:basic_deadline_timer basic_deadline_timer::basic_deadline_timer]
  6976. [indexterm2 boost_asio.indexterm.basic_deadline_timer.basic_deadline_timer..basic_deadline_timer..basic_deadline_timer]
  6977. Constructor.
  6978. explicit ``[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload1 basic_deadline_timer]``(
  6979. const executor_type & ex);
  6980. `` [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload1 more...]]``
  6981. template<
  6982. typename ExecutionContext>
  6983. explicit ``[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload2 basic_deadline_timer]``(
  6984. ExecutionContext & context,
  6985. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  6986. `` [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload2 more...]]``
  6987. Constructor to set a particular expiry time as an absolute time.
  6988. ``[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload3 basic_deadline_timer]``(
  6989. const executor_type & ex,
  6990. const time_type & expiry_time);
  6991. `` [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload3 more...]]``
  6992. template<
  6993. typename ExecutionContext>
  6994. ``[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload4 basic_deadline_timer]``(
  6995. ExecutionContext & context,
  6996. const time_type & expiry_time,
  6997. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  6998. `` [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload4 more...]]``
  6999. Constructor to set a particular expiry time relative to now.
  7000. ``[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload5 basic_deadline_timer]``(
  7001. const executor_type & ex,
  7002. const duration_type & expiry_time);
  7003. `` [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload5 more...]]``
  7004. template<
  7005. typename ExecutionContext>
  7006. ``[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload6 basic_deadline_timer]``(
  7007. ExecutionContext & context,
  7008. const duration_type & expiry_time,
  7009. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  7010. `` [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload6 more...]]``
  7011. Move-construct a [link boost_asio.reference.basic_deadline_timer `basic_deadline_timer`] from another.
  7012. ``[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload7 basic_deadline_timer]``(
  7013. basic_deadline_timer && other);
  7014. `` [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload7 more...]]``
  7015. [section:overload1 basic_deadline_timer::basic_deadline_timer (1 of 7 overloads)]
  7016. Constructor.
  7017. basic_deadline_timer(
  7018. const executor_type & ex);
  7019. This constructor creates a timer without setting an expiry time. The `expires_at()` or `expires_from_now()` functions must be called to set an expiry time before the timer can be waited on.
  7020. [heading Parameters]
  7021. [variablelist
  7022. [[ex][The I/O executor that the timer will use, by default, to dispatch handlers for any asynchronous operations performed on the timer. ]]
  7023. ]
  7024. [endsect]
  7025. [section:overload2 basic_deadline_timer::basic_deadline_timer (2 of 7 overloads)]
  7026. Constructor.
  7027. template<
  7028. typename ExecutionContext>
  7029. basic_deadline_timer(
  7030. ExecutionContext & context,
  7031. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  7032. This constructor creates a timer without setting an expiry time. The `expires_at()` or `expires_from_now()` functions must be called to set an expiry time before the timer can be waited on.
  7033. [heading Parameters]
  7034. [variablelist
  7035. [[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. ]]
  7036. ]
  7037. [endsect]
  7038. [section:overload3 basic_deadline_timer::basic_deadline_timer (3 of 7 overloads)]
  7039. Constructor to set a particular expiry time as an absolute time.
  7040. basic_deadline_timer(
  7041. const executor_type & ex,
  7042. const time_type & expiry_time);
  7043. This constructor creates a timer and sets the expiry time.
  7044. [heading Parameters]
  7045. [variablelist
  7046. [[ex][The I/O executor that the timer will use, by default, to dispatch handlers for any asynchronous operations performed on the timer.]]
  7047. [[expiry_time][The expiry time to be used for the timer, expressed as an absolute time. ]]
  7048. ]
  7049. [endsect]
  7050. [section:overload4 basic_deadline_timer::basic_deadline_timer (4 of 7 overloads)]
  7051. Constructor to set a particular expiry time as an absolute time.
  7052. template<
  7053. typename ExecutionContext>
  7054. basic_deadline_timer(
  7055. ExecutionContext & context,
  7056. const time_type & expiry_time,
  7057. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  7058. This constructor creates a timer and sets the expiry time.
  7059. [heading Parameters]
  7060. [variablelist
  7061. [[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.]]
  7062. [[expiry_time][The expiry time to be used for the timer, expressed as an absolute time. ]]
  7063. ]
  7064. [endsect]
  7065. [section:overload5 basic_deadline_timer::basic_deadline_timer (5 of 7 overloads)]
  7066. Constructor to set a particular expiry time relative to now.
  7067. basic_deadline_timer(
  7068. const executor_type & ex,
  7069. const duration_type & expiry_time);
  7070. This constructor creates a timer and sets the expiry time.
  7071. [heading Parameters]
  7072. [variablelist
  7073. [[ex][The I/O executor that the timer will use, by default, to dispatch handlers for any asynchronous operations performed on the timer.]]
  7074. [[expiry_time][The expiry time to be used for the timer, relative to now. ]]
  7075. ]
  7076. [endsect]
  7077. [section:overload6 basic_deadline_timer::basic_deadline_timer (6 of 7 overloads)]
  7078. Constructor to set a particular expiry time relative to now.
  7079. template<
  7080. typename ExecutionContext>
  7081. basic_deadline_timer(
  7082. ExecutionContext & context,
  7083. const duration_type & expiry_time,
  7084. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  7085. This constructor creates a timer and sets the expiry time.
  7086. [heading Parameters]
  7087. [variablelist
  7088. [[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.]]
  7089. [[expiry_time][The expiry time to be used for the timer, relative to now. ]]
  7090. ]
  7091. [endsect]
  7092. [section:overload7 basic_deadline_timer::basic_deadline_timer (7 of 7 overloads)]
  7093. Move-construct a [link boost_asio.reference.basic_deadline_timer `basic_deadline_timer`] from another.
  7094. basic_deadline_timer(
  7095. basic_deadline_timer && other);
  7096. This constructor moves a timer from one object to another.
  7097. [heading Parameters]
  7098. [variablelist
  7099. [[other][The other [link boost_asio.reference.basic_deadline_timer `basic_deadline_timer`] object from which the move will occur.]]
  7100. ]
  7101. [heading Remarks]
  7102. Following the move, the moved-from object is in the same state as if constructed using the `basic_deadline_timer(const executor_type&)` constructor.
  7103. [endsect]
  7104. [endsect]
  7105. [section:cancel basic_deadline_timer::cancel]
  7106. [indexterm2 boost_asio.indexterm.basic_deadline_timer.cancel..cancel..basic_deadline_timer]
  7107. Cancel any asynchronous operations that are waiting on the timer.
  7108. std::size_t ``[link boost_asio.reference.basic_deadline_timer.cancel.overload1 cancel]``();
  7109. `` [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.cancel.overload1 more...]]``
  7110. std::size_t ``[link boost_asio.reference.basic_deadline_timer.cancel.overload2 cancel]``(
  7111. boost::system::error_code & ec);
  7112. `` [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.cancel.overload2 more...]]``
  7113. [section:overload1 basic_deadline_timer::cancel (1 of 2 overloads)]
  7114. Cancel any asynchronous operations that are waiting on the timer.
  7115. std::size_t cancel();
  7116. This function forces the completion of any pending asynchronous wait operations against the timer. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
  7117. Cancelling the timer does not change the expiry time.
  7118. [heading Return Value]
  7119. The number of asynchronous operations that were cancelled.
  7120. [heading Exceptions]
  7121. [variablelist
  7122. [[boost::system::system_error][Thrown on failure.]]
  7123. ]
  7124. [heading Remarks]
  7125. If the timer has already expired when `cancel()` is called, then the handlers for asynchronous wait operations will:
  7126. * have already been invoked; or
  7127. * have been queued for invocation in the near future.
  7128. These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation.
  7129. [endsect]
  7130. [section:overload2 basic_deadline_timer::cancel (2 of 2 overloads)]
  7131. Cancel any asynchronous operations that are waiting on the timer.
  7132. std::size_t cancel(
  7133. boost::system::error_code & ec);
  7134. This function forces the completion of any pending asynchronous wait operations against the timer. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
  7135. Cancelling the timer does not change the expiry time.
  7136. [heading Parameters]
  7137. [variablelist
  7138. [[ec][Set to indicate what error occurred, if any.]]
  7139. ]
  7140. [heading Return Value]
  7141. The number of asynchronous operations that were cancelled.
  7142. [heading Remarks]
  7143. If the timer has already expired when `cancel()` is called, then the handlers for asynchronous wait operations will:
  7144. * have already been invoked; or
  7145. * have been queued for invocation in the near future.
  7146. These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation.
  7147. [endsect]
  7148. [endsect]
  7149. [section:cancel_one basic_deadline_timer::cancel_one]
  7150. [indexterm2 boost_asio.indexterm.basic_deadline_timer.cancel_one..cancel_one..basic_deadline_timer]
  7151. Cancels one asynchronous operation that is waiting on the timer.
  7152. std::size_t ``[link boost_asio.reference.basic_deadline_timer.cancel_one.overload1 cancel_one]``();
  7153. `` [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.cancel_one.overload1 more...]]``
  7154. std::size_t ``[link boost_asio.reference.basic_deadline_timer.cancel_one.overload2 cancel_one]``(
  7155. boost::system::error_code & ec);
  7156. `` [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.cancel_one.overload2 more...]]``
  7157. [section:overload1 basic_deadline_timer::cancel_one (1 of 2 overloads)]
  7158. Cancels one asynchronous operation that is waiting on the timer.
  7159. std::size_t cancel_one();
  7160. This function forces the completion of one pending asynchronous wait operation against the timer. Handlers are cancelled in FIFO order. The handler for the cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
  7161. Cancelling the timer does not change the expiry time.
  7162. [heading Return Value]
  7163. The number of asynchronous operations that were cancelled. That is, either 0 or 1.
  7164. [heading Exceptions]
  7165. [variablelist
  7166. [[boost::system::system_error][Thrown on failure.]]
  7167. ]
  7168. [heading Remarks]
  7169. If the timer has already expired when `cancel_one()` is called, then the handlers for asynchronous wait operations will:
  7170. * have already been invoked; or
  7171. * have been queued for invocation in the near future.
  7172. These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation.
  7173. [endsect]
  7174. [section:overload2 basic_deadline_timer::cancel_one (2 of 2 overloads)]
  7175. Cancels one asynchronous operation that is waiting on the timer.
  7176. std::size_t cancel_one(
  7177. boost::system::error_code & ec);
  7178. This function forces the completion of one pending asynchronous wait operation against the timer. Handlers are cancelled in FIFO order. The handler for the cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
  7179. Cancelling the timer does not change the expiry time.
  7180. [heading Parameters]
  7181. [variablelist
  7182. [[ec][Set to indicate what error occurred, if any.]]
  7183. ]
  7184. [heading Return Value]
  7185. The number of asynchronous operations that were cancelled. That is, either 0 or 1.
  7186. [heading Remarks]
  7187. If the timer has already expired when `cancel_one()` is called, then the handlers for asynchronous wait operations will:
  7188. * have already been invoked; or
  7189. * have been queued for invocation in the near future.
  7190. These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation.
  7191. [endsect]
  7192. [endsect]
  7193. [section:duration_type basic_deadline_timer::duration_type]
  7194. [indexterm2 boost_asio.indexterm.basic_deadline_timer.duration_type..duration_type..basic_deadline_timer]
  7195. The duration type.
  7196. typedef traits_type::duration_type duration_type;
  7197. [heading Requirements]
  7198. ['Header: ][^boost/asio/basic_deadline_timer.hpp]
  7199. ['Convenience header: ][^boost/asio.hpp]
  7200. [endsect]
  7201. [section:executor_type basic_deadline_timer::executor_type]
  7202. [indexterm2 boost_asio.indexterm.basic_deadline_timer.executor_type..executor_type..basic_deadline_timer]
  7203. The type of the executor associated with the object.
  7204. typedef Executor executor_type;
  7205. [heading Requirements]
  7206. ['Header: ][^boost/asio/basic_deadline_timer.hpp]
  7207. ['Convenience header: ][^boost/asio.hpp]
  7208. [endsect]
  7209. [section:expires_at basic_deadline_timer::expires_at]
  7210. [indexterm2 boost_asio.indexterm.basic_deadline_timer.expires_at..expires_at..basic_deadline_timer]
  7211. Get the timer's expiry time as an absolute time.
  7212. time_type ``[link boost_asio.reference.basic_deadline_timer.expires_at.overload1 expires_at]``() const;
  7213. `` [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.expires_at.overload1 more...]]``
  7214. Set the timer's expiry time as an absolute time.
  7215. std::size_t ``[link boost_asio.reference.basic_deadline_timer.expires_at.overload2 expires_at]``(
  7216. const time_type & expiry_time);
  7217. `` [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.expires_at.overload2 more...]]``
  7218. std::size_t ``[link boost_asio.reference.basic_deadline_timer.expires_at.overload3 expires_at]``(
  7219. const time_type & expiry_time,
  7220. boost::system::error_code & ec);
  7221. `` [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.expires_at.overload3 more...]]``
  7222. [section:overload1 basic_deadline_timer::expires_at (1 of 3 overloads)]
  7223. Get the timer's expiry time as an absolute time.
  7224. time_type expires_at() const;
  7225. This function may be used to obtain the timer's current expiry time. Whether the timer has expired or not does not affect this value.
  7226. [endsect]
  7227. [section:overload2 basic_deadline_timer::expires_at (2 of 3 overloads)]
  7228. Set the timer's expiry time as an absolute time.
  7229. std::size_t expires_at(
  7230. const time_type & expiry_time);
  7231. This function sets the expiry time. Any pending asynchronous wait operations will be cancelled. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
  7232. [heading Parameters]
  7233. [variablelist
  7234. [[expiry_time][The expiry time to be used for the timer.]]
  7235. ]
  7236. [heading Return Value]
  7237. The number of asynchronous operations that were cancelled.
  7238. [heading Exceptions]
  7239. [variablelist
  7240. [[boost::system::system_error][Thrown on failure.]]
  7241. ]
  7242. [heading Remarks]
  7243. If the timer has already expired when `expires_at()` is called, then the handlers for asynchronous wait operations will:
  7244. * have already been invoked; or
  7245. * have been queued for invocation in the near future.
  7246. These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation.
  7247. [endsect]
  7248. [section:overload3 basic_deadline_timer::expires_at (3 of 3 overloads)]
  7249. Set the timer's expiry time as an absolute time.
  7250. std::size_t expires_at(
  7251. const time_type & expiry_time,
  7252. boost::system::error_code & ec);
  7253. This function sets the expiry time. Any pending asynchronous wait operations will be cancelled. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
  7254. [heading Parameters]
  7255. [variablelist
  7256. [[expiry_time][The expiry time to be used for the timer.]]
  7257. [[ec][Set to indicate what error occurred, if any.]]
  7258. ]
  7259. [heading Return Value]
  7260. The number of asynchronous operations that were cancelled.
  7261. [heading Remarks]
  7262. If the timer has already expired when `expires_at()` is called, then the handlers for asynchronous wait operations will:
  7263. * have already been invoked; or
  7264. * have been queued for invocation in the near future.
  7265. These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation.
  7266. [endsect]
  7267. [endsect]
  7268. [section:expires_from_now basic_deadline_timer::expires_from_now]
  7269. [indexterm2 boost_asio.indexterm.basic_deadline_timer.expires_from_now..expires_from_now..basic_deadline_timer]
  7270. Get the timer's expiry time relative to now.
  7271. duration_type ``[link boost_asio.reference.basic_deadline_timer.expires_from_now.overload1 expires_from_now]``() const;
  7272. `` [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.expires_from_now.overload1 more...]]``
  7273. Set the timer's expiry time relative to now.
  7274. std::size_t ``[link boost_asio.reference.basic_deadline_timer.expires_from_now.overload2 expires_from_now]``(
  7275. const duration_type & expiry_time);
  7276. `` [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.expires_from_now.overload2 more...]]``
  7277. std::size_t ``[link boost_asio.reference.basic_deadline_timer.expires_from_now.overload3 expires_from_now]``(
  7278. const duration_type & expiry_time,
  7279. boost::system::error_code & ec);
  7280. `` [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.expires_from_now.overload3 more...]]``
  7281. [section:overload1 basic_deadline_timer::expires_from_now (1 of 3 overloads)]
  7282. Get the timer's expiry time relative to now.
  7283. duration_type expires_from_now() const;
  7284. This function may be used to obtain the timer's current expiry time. Whether the timer has expired or not does not affect this value.
  7285. [endsect]
  7286. [section:overload2 basic_deadline_timer::expires_from_now (2 of 3 overloads)]
  7287. Set the timer's expiry time relative to now.
  7288. std::size_t expires_from_now(
  7289. const duration_type & expiry_time);
  7290. This function sets the expiry time. Any pending asynchronous wait operations will be cancelled. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
  7291. [heading Parameters]
  7292. [variablelist
  7293. [[expiry_time][The expiry time to be used for the timer.]]
  7294. ]
  7295. [heading Return Value]
  7296. The number of asynchronous operations that were cancelled.
  7297. [heading Exceptions]
  7298. [variablelist
  7299. [[boost::system::system_error][Thrown on failure.]]
  7300. ]
  7301. [heading Remarks]
  7302. If the timer has already expired when `expires_from_now()` is called, then the handlers for asynchronous wait operations will:
  7303. * have already been invoked; or
  7304. * have been queued for invocation in the near future.
  7305. These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation.
  7306. [endsect]
  7307. [section:overload3 basic_deadline_timer::expires_from_now (3 of 3 overloads)]
  7308. Set the timer's expiry time relative to now.
  7309. std::size_t expires_from_now(
  7310. const duration_type & expiry_time,
  7311. boost::system::error_code & ec);
  7312. This function sets the expiry time. Any pending asynchronous wait operations will be cancelled. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
  7313. [heading Parameters]
  7314. [variablelist
  7315. [[expiry_time][The expiry time to be used for the timer.]]
  7316. [[ec][Set to indicate what error occurred, if any.]]
  7317. ]
  7318. [heading Return Value]
  7319. The number of asynchronous operations that were cancelled.
  7320. [heading Remarks]
  7321. If the timer has already expired when `expires_from_now()` is called, then the handlers for asynchronous wait operations will:
  7322. * have already been invoked; or
  7323. * have been queued for invocation in the near future.
  7324. These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation.
  7325. [endsect]
  7326. [endsect]
  7327. [section:get_executor basic_deadline_timer::get_executor]
  7328. [indexterm2 boost_asio.indexterm.basic_deadline_timer.get_executor..get_executor..basic_deadline_timer]
  7329. Get the executor associated with the object.
  7330. executor_type get_executor();
  7331. [endsect]
  7332. [section:operator_eq_ basic_deadline_timer::operator=]
  7333. [indexterm2 boost_asio.indexterm.basic_deadline_timer.operator_eq_..operator=..basic_deadline_timer]
  7334. Move-assign a [link boost_asio.reference.basic_deadline_timer `basic_deadline_timer`] from another.
  7335. basic_deadline_timer & operator=(
  7336. basic_deadline_timer && other);
  7337. This assignment operator moves a timer from one object to another. Cancels any outstanding asynchronous operations associated with the target object.
  7338. [heading Parameters]
  7339. [variablelist
  7340. [[other][The other [link boost_asio.reference.basic_deadline_timer `basic_deadline_timer`] object from which the move will occur.]]
  7341. ]
  7342. [heading Remarks]
  7343. Following the move, the moved-from object is in the same state as if constructed using the `basic_deadline_timer(const executor_type&)` constructor.
  7344. [endsect]
  7345. [section:time_type basic_deadline_timer::time_type]
  7346. [indexterm2 boost_asio.indexterm.basic_deadline_timer.time_type..time_type..basic_deadline_timer]
  7347. The time type.
  7348. typedef traits_type::time_type time_type;
  7349. [heading Requirements]
  7350. ['Header: ][^boost/asio/basic_deadline_timer.hpp]
  7351. ['Convenience header: ][^boost/asio.hpp]
  7352. [endsect]
  7353. [section:traits_type basic_deadline_timer::traits_type]
  7354. [indexterm2 boost_asio.indexterm.basic_deadline_timer.traits_type..traits_type..basic_deadline_timer]
  7355. The time traits type.
  7356. typedef TimeTraits traits_type;
  7357. [heading Requirements]
  7358. ['Header: ][^boost/asio/basic_deadline_timer.hpp]
  7359. ['Convenience header: ][^boost/asio.hpp]
  7360. [endsect]
  7361. [section:wait basic_deadline_timer::wait]
  7362. [indexterm2 boost_asio.indexterm.basic_deadline_timer.wait..wait..basic_deadline_timer]
  7363. Perform a blocking wait on the timer.
  7364. void ``[link boost_asio.reference.basic_deadline_timer.wait.overload1 wait]``();
  7365. `` [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.wait.overload1 more...]]``
  7366. void ``[link boost_asio.reference.basic_deadline_timer.wait.overload2 wait]``(
  7367. boost::system::error_code & ec);
  7368. `` [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.wait.overload2 more...]]``
  7369. [section:overload1 basic_deadline_timer::wait (1 of 2 overloads)]
  7370. Perform a blocking wait on the timer.
  7371. void wait();
  7372. This function is used to wait for the timer to expire. This function blocks and does not return until the timer has expired.
  7373. [heading Exceptions]
  7374. [variablelist
  7375. [[boost::system::system_error][Thrown on failure. ]]
  7376. ]
  7377. [endsect]
  7378. [section:overload2 basic_deadline_timer::wait (2 of 2 overloads)]
  7379. Perform a blocking wait on the timer.
  7380. void wait(
  7381. boost::system::error_code & ec);
  7382. This function is used to wait for the timer to expire. This function blocks and does not return until the timer has expired.
  7383. [heading Parameters]
  7384. [variablelist
  7385. [[ec][Set to indicate what error occurred, if any. ]]
  7386. ]
  7387. [endsect]
  7388. [endsect]
  7389. [section:_basic_deadline_timer basic_deadline_timer::~basic_deadline_timer]
  7390. [indexterm2 boost_asio.indexterm.basic_deadline_timer._basic_deadline_timer..~basic_deadline_timer..basic_deadline_timer]
  7391. Destroys the timer.
  7392. ~basic_deadline_timer();
  7393. This function destroys the timer, cancelling any outstanding asynchronous wait operations associated with the timer as if by calling `cancel`.
  7394. [endsect]
  7395. [endsect]
  7396. [section:basic_deadline_timer__rebind_executor basic_deadline_timer::rebind_executor]
  7397. Rebinds the timer type to another executor.
  7398. template<
  7399. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  7400. struct rebind_executor
  7401. [heading Types]
  7402. [table
  7403. [[Name][Description]]
  7404. [
  7405. [[link boost_asio.reference.basic_deadline_timer__rebind_executor.other [*other]]]
  7406. [The timer type when rebound to the specified executor. ]
  7407. ]
  7408. ]
  7409. [heading Requirements]
  7410. ['Header: ][^boost/asio/basic_deadline_timer.hpp]
  7411. ['Convenience header: ][^boost/asio.hpp]
  7412. [section:other basic_deadline_timer::rebind_executor::other]
  7413. [indexterm2 boost_asio.indexterm.basic_deadline_timer__rebind_executor.other..other..basic_deadline_timer::rebind_executor]
  7414. The timer type when rebound to the specified executor.
  7415. typedef basic_deadline_timer< Time, TimeTraits, Executor1 > other;
  7416. [heading Types]
  7417. [table
  7418. [[Name][Description]]
  7419. [
  7420. [[link boost_asio.reference.basic_deadline_timer__rebind_executor [*rebind_executor]]]
  7421. [Rebinds the timer type to another executor. ]
  7422. ]
  7423. [
  7424. [[link boost_asio.reference.basic_deadline_timer.duration_type [*duration_type]]]
  7425. [The duration type. ]
  7426. ]
  7427. [
  7428. [[link boost_asio.reference.basic_deadline_timer.executor_type [*executor_type]]]
  7429. [The type of the executor associated with the object. ]
  7430. ]
  7431. [
  7432. [[link boost_asio.reference.basic_deadline_timer.time_type [*time_type]]]
  7433. [The time type. ]
  7434. ]
  7435. [
  7436. [[link boost_asio.reference.basic_deadline_timer.traits_type [*traits_type]]]
  7437. [The time traits type. ]
  7438. ]
  7439. ]
  7440. [heading Member Functions]
  7441. [table
  7442. [[Name][Description]]
  7443. [
  7444. [[link boost_asio.reference.basic_deadline_timer.async_wait [*async_wait]]]
  7445. [Start an asynchronous wait on the timer. ]
  7446. ]
  7447. [
  7448. [[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer [*basic_deadline_timer]]]
  7449. [Constructor.
  7450. [hr]
  7451. Constructor to set a particular expiry time as an absolute time.
  7452. [hr]
  7453. Constructor to set a particular expiry time relative to now.
  7454. [hr]
  7455. Move-construct a basic_deadline_timer from another. ]
  7456. ]
  7457. [
  7458. [[link boost_asio.reference.basic_deadline_timer.cancel [*cancel]]]
  7459. [Cancel any asynchronous operations that are waiting on the timer. ]
  7460. ]
  7461. [
  7462. [[link boost_asio.reference.basic_deadline_timer.cancel_one [*cancel_one]]]
  7463. [Cancels one asynchronous operation that is waiting on the timer. ]
  7464. ]
  7465. [
  7466. [[link boost_asio.reference.basic_deadline_timer.expires_at [*expires_at]]]
  7467. [Get the timer's expiry time as an absolute time.
  7468. [hr]
  7469. Set the timer's expiry time as an absolute time. ]
  7470. ]
  7471. [
  7472. [[link boost_asio.reference.basic_deadline_timer.expires_from_now [*expires_from_now]]]
  7473. [Get the timer's expiry time relative to now.
  7474. [hr]
  7475. Set the timer's expiry time relative to now. ]
  7476. ]
  7477. [
  7478. [[link boost_asio.reference.basic_deadline_timer.get_executor [*get_executor]]]
  7479. [Get the executor associated with the object. ]
  7480. ]
  7481. [
  7482. [[link boost_asio.reference.basic_deadline_timer.operator_eq_ [*operator=]]]
  7483. [Move-assign a basic_deadline_timer from another. ]
  7484. ]
  7485. [
  7486. [[link boost_asio.reference.basic_deadline_timer.wait [*wait]]]
  7487. [Perform a blocking wait on the timer. ]
  7488. ]
  7489. [
  7490. [[link boost_asio.reference.basic_deadline_timer._basic_deadline_timer [*~basic_deadline_timer]]]
  7491. [Destroys the timer. ]
  7492. ]
  7493. ]
  7494. The [link boost_asio.reference.basic_deadline_timer `basic_deadline_timer`] class template provides the ability to perform a blocking or asynchronous wait for a timer to expire.
  7495. A deadline timer is always in one of two states: "expired" or "not expired". If the `wait()` or `async_wait()` function is called on an expired timer, the wait operation will complete immediately.
  7496. Most applications will use the [link boost_asio.reference.deadline_timer `deadline_timer`] typedef.
  7497. [heading Thread Safety]
  7498. ['Distinct] ['objects:] Safe.
  7499. ['Shared] ['objects:] Unsafe.
  7500. [heading Examples]
  7501. Performing a blocking wait:
  7502. // Construct a timer without setting an expiry time.
  7503. boost::asio::deadline_timer timer(my_context);
  7504. // Set an expiry time relative to now.
  7505. timer.expires_from_now(boost::posix_time::seconds(5));
  7506. // Wait for the timer to expire.
  7507. timer.wait();
  7508. Performing an asynchronous wait:
  7509. void handler(const boost::system::error_code& error)
  7510. {
  7511. if (!error)
  7512. {
  7513. // Timer expired.
  7514. }
  7515. }
  7516. ...
  7517. // Construct a timer with an absolute expiry time.
  7518. boost::asio::deadline_timer timer(my_context,
  7519. boost::posix_time::time_from_string("2005-12-07 23:59:59.000"));
  7520. // Start an asynchronous wait.
  7521. timer.async_wait(handler);
  7522. [heading Changing an active deadline_timer's expiry time]
  7523. Changing the expiry time of a timer while there are pending asynchronous waits causes those wait operations to be cancelled. To ensure that the action associated with the timer is performed only once, use something like this: used:
  7524. void on_some_event()
  7525. {
  7526. if (my_timer.expires_from_now(seconds(5)) > 0)
  7527. {
  7528. // We managed to cancel the timer. Start new asynchronous wait.
  7529. my_timer.async_wait(on_timeout);
  7530. }
  7531. else
  7532. {
  7533. // Too late, timer has already expired!
  7534. }
  7535. }
  7536. void on_timeout(const boost::system::error_code& e)
  7537. {
  7538. if (e != boost::asio::error::operation_aborted)
  7539. {
  7540. // Timer was not cancelled, take necessary action.
  7541. }
  7542. }
  7543. * 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.
  7544. * If a wait handler is cancelled, the boost::system::error\_code passed to it contains the value `boost::asio::error::operation_aborted`.
  7545. [heading Requirements]
  7546. ['Header: ][^boost/asio/basic_deadline_timer.hpp]
  7547. ['Convenience header: ][^boost/asio.hpp]
  7548. [endsect]
  7549. [endsect]
  7550. [section:basic_io_object basic_io_object]
  7551. Base class for all I/O objects.
  7552. template<
  7553. typename ``[link boost_asio.reference.IoObjectService IoObjectService]``>
  7554. class basic_io_object
  7555. [heading Types]
  7556. [table
  7557. [[Name][Description]]
  7558. [
  7559. [[link boost_asio.reference.basic_io_object.executor_type [*executor_type]]]
  7560. [The type of the executor associated with the object. ]
  7561. ]
  7562. [
  7563. [[link boost_asio.reference.basic_io_object.implementation_type [*implementation_type]]]
  7564. [The underlying implementation type of I/O object. ]
  7565. ]
  7566. [
  7567. [[link boost_asio.reference.basic_io_object.service_type [*service_type]]]
  7568. [The type of the service that will be used to provide I/O operations. ]
  7569. ]
  7570. ]
  7571. [heading Member Functions]
  7572. [table
  7573. [[Name][Description]]
  7574. [
  7575. [[link boost_asio.reference.basic_io_object.get_executor [*get_executor]]]
  7576. [Get the executor associated with the object. ]
  7577. ]
  7578. [
  7579. [[link boost_asio.reference.basic_io_object.get_io_context [*get_io_context]]]
  7580. [(Deprecated: Use get_executor().) Get the io_context associated with the object. ]
  7581. ]
  7582. [
  7583. [[link boost_asio.reference.basic_io_object.get_io_service [*get_io_service]]]
  7584. [(Deprecated: Use get_executor().) Get the io_context associated with the object. ]
  7585. ]
  7586. ]
  7587. [heading Protected Member Functions]
  7588. [table
  7589. [[Name][Description]]
  7590. [
  7591. [[link boost_asio.reference.basic_io_object.basic_io_object [*basic_io_object]]]
  7592. [Construct a basic_io_object.
  7593. [hr]
  7594. Move-construct a basic_io_object.
  7595. [hr]
  7596. Perform a converting move-construction of a basic_io_object. ]
  7597. ]
  7598. [
  7599. [[link boost_asio.reference.basic_io_object.get_implementation [*get_implementation]]]
  7600. [Get the underlying implementation of the I/O object. ]
  7601. ]
  7602. [
  7603. [[link boost_asio.reference.basic_io_object.get_service [*get_service]]]
  7604. [Get the service associated with the I/O object. ]
  7605. ]
  7606. [
  7607. [[link boost_asio.reference.basic_io_object.operator_eq_ [*operator=]]]
  7608. [Move-assign a basic_io_object. ]
  7609. ]
  7610. [
  7611. [[link boost_asio.reference.basic_io_object._basic_io_object [*~basic_io_object]]]
  7612. [Protected destructor to prevent deletion through this type. ]
  7613. ]
  7614. ]
  7615. [heading Remarks]
  7616. All I/O objects are non-copyable. However, when using C++0x, certain I/O objects do support move construction and move assignment.
  7617. [heading Requirements]
  7618. ['Header: ][^boost/asio/basic_io_object.hpp]
  7619. ['Convenience header: ][^boost/asio.hpp]
  7620. [section:basic_io_object basic_io_object::basic_io_object]
  7621. [indexterm2 boost_asio.indexterm.basic_io_object.basic_io_object..basic_io_object..basic_io_object]
  7622. Construct a [link boost_asio.reference.basic_io_object `basic_io_object`].
  7623. explicit ``[link boost_asio.reference.basic_io_object.basic_io_object.overload1 basic_io_object]``(
  7624. boost::asio::io_context & io_context);
  7625. `` [''''&raquo;''' [link boost_asio.reference.basic_io_object.basic_io_object.overload1 more...]]``
  7626. Move-construct a [link boost_asio.reference.basic_io_object `basic_io_object`].
  7627. ``[link boost_asio.reference.basic_io_object.basic_io_object.overload2 basic_io_object]``(
  7628. basic_io_object && other);
  7629. `` [''''&raquo;''' [link boost_asio.reference.basic_io_object.basic_io_object.overload2 more...]]``
  7630. Perform a converting move-construction of a [link boost_asio.reference.basic_io_object `basic_io_object`].
  7631. template<
  7632. typename ``[link boost_asio.reference.IoObjectService IoObjectService1]``>
  7633. ``[link boost_asio.reference.basic_io_object.basic_io_object.overload3 basic_io_object]``(
  7634. IoObjectService1 & other_service,
  7635. typename IoObjectService1::implementation_type & other_implementation);
  7636. `` [''''&raquo;''' [link boost_asio.reference.basic_io_object.basic_io_object.overload3 more...]]``
  7637. [section:overload1 basic_io_object::basic_io_object (1 of 3 overloads)]
  7638. Construct a [link boost_asio.reference.basic_io_object `basic_io_object`].
  7639. basic_io_object(
  7640. boost::asio::io_context & io_context);
  7641. Performs:
  7642. get_service().construct(get_implementation());
  7643. [endsect]
  7644. [section:overload2 basic_io_object::basic_io_object (2 of 3 overloads)]
  7645. Move-construct a [link boost_asio.reference.basic_io_object `basic_io_object`].
  7646. basic_io_object(
  7647. basic_io_object && other);
  7648. Performs:
  7649. get_service().move_construct(
  7650. get_implementation(), other.get_implementation());
  7651. [heading Remarks]
  7652. Available only for services that support movability,
  7653. [endsect]
  7654. [section:overload3 basic_io_object::basic_io_object (3 of 3 overloads)]
  7655. Perform a converting move-construction of a [link boost_asio.reference.basic_io_object `basic_io_object`].
  7656. template<
  7657. typename ``[link boost_asio.reference.IoObjectService IoObjectService1]``>
  7658. basic_io_object(
  7659. IoObjectService1 & other_service,
  7660. typename IoObjectService1::implementation_type & other_implementation);
  7661. [endsect]
  7662. [endsect]
  7663. [section:executor_type basic_io_object::executor_type]
  7664. [indexterm2 boost_asio.indexterm.basic_io_object.executor_type..executor_type..basic_io_object]
  7665. The type of the executor associated with the object.
  7666. typedef boost::asio::io_context::executor_type executor_type;
  7667. [heading Member Functions]
  7668. [table
  7669. [[Name][Description]]
  7670. [
  7671. [[link boost_asio.reference.io_context__executor_type.context [*context]]]
  7672. [Obtain the underlying execution context. ]
  7673. ]
  7674. [
  7675. [[link boost_asio.reference.io_context__executor_type.defer [*defer]]]
  7676. [Request the io_context to invoke the given function object. ]
  7677. ]
  7678. [
  7679. [[link boost_asio.reference.io_context__executor_type.dispatch [*dispatch]]]
  7680. [Request the io_context to invoke the given function object. ]
  7681. ]
  7682. [
  7683. [[link boost_asio.reference.io_context__executor_type.on_work_finished [*on_work_finished]]]
  7684. [Inform the io_context that some work is no longer outstanding. ]
  7685. ]
  7686. [
  7687. [[link boost_asio.reference.io_context__executor_type.on_work_started [*on_work_started]]]
  7688. [Inform the io_context that it has some outstanding work to do. ]
  7689. ]
  7690. [
  7691. [[link boost_asio.reference.io_context__executor_type.post [*post]]]
  7692. [Request the io_context to invoke the given function object. ]
  7693. ]
  7694. [
  7695. [[link boost_asio.reference.io_context__executor_type.running_in_this_thread [*running_in_this_thread]]]
  7696. [Determine whether the io_context is running in the current thread. ]
  7697. ]
  7698. ]
  7699. [heading Friends]
  7700. [table
  7701. [[Name][Description]]
  7702. [
  7703. [[link boost_asio.reference.io_context__executor_type.operator_not__eq_ [*operator!=]]]
  7704. [Compare two executors for inequality. ]
  7705. ]
  7706. [
  7707. [[link boost_asio.reference.io_context__executor_type.operator_eq__eq_ [*operator==]]]
  7708. [Compare two executors for equality. ]
  7709. ]
  7710. ]
  7711. [heading Requirements]
  7712. ['Header: ][^boost/asio/basic_io_object.hpp]
  7713. ['Convenience header: ][^boost/asio.hpp]
  7714. [endsect]
  7715. [section:get_executor basic_io_object::get_executor]
  7716. [indexterm2 boost_asio.indexterm.basic_io_object.get_executor..get_executor..basic_io_object]
  7717. Get the executor associated with the object.
  7718. executor_type get_executor();
  7719. [endsect]
  7720. [section:get_implementation basic_io_object::get_implementation]
  7721. [indexterm2 boost_asio.indexterm.basic_io_object.get_implementation..get_implementation..basic_io_object]
  7722. Get the underlying implementation of the I/O object.
  7723. implementation_type & ``[link boost_asio.reference.basic_io_object.get_implementation.overload1 get_implementation]``();
  7724. `` [''''&raquo;''' [link boost_asio.reference.basic_io_object.get_implementation.overload1 more...]]``
  7725. const implementation_type & ``[link boost_asio.reference.basic_io_object.get_implementation.overload2 get_implementation]``() const;
  7726. `` [''''&raquo;''' [link boost_asio.reference.basic_io_object.get_implementation.overload2 more...]]``
  7727. [section:overload1 basic_io_object::get_implementation (1 of 2 overloads)]
  7728. Get the underlying implementation of the I/O object.
  7729. implementation_type & get_implementation();
  7730. [endsect]
  7731. [section:overload2 basic_io_object::get_implementation (2 of 2 overloads)]
  7732. Get the underlying implementation of the I/O object.
  7733. const implementation_type & get_implementation() const;
  7734. [endsect]
  7735. [endsect]
  7736. [section:get_io_context basic_io_object::get_io_context]
  7737. [indexterm2 boost_asio.indexterm.basic_io_object.get_io_context..get_io_context..basic_io_object]
  7738. (Deprecated: Use `get_executor()`.) Get the [link boost_asio.reference.io_context `io_context`] associated with the object.
  7739. boost::asio::io_context & get_io_context();
  7740. This function may be used to obtain the [link boost_asio.reference.io_context `io_context`] object that the I/O object uses to dispatch handlers for asynchronous operations.
  7741. [heading Return Value]
  7742. A reference to the [link boost_asio.reference.io_context `io_context`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
  7743. [endsect]
  7744. [section:get_io_service basic_io_object::get_io_service]
  7745. [indexterm2 boost_asio.indexterm.basic_io_object.get_io_service..get_io_service..basic_io_object]
  7746. (Deprecated: Use `get_executor()`.) Get the [link boost_asio.reference.io_context `io_context`] associated with the object.
  7747. boost::asio::io_context & get_io_service();
  7748. This function may be used to obtain the [link boost_asio.reference.io_context `io_context`] object that the I/O object uses to dispatch handlers for asynchronous operations.
  7749. [heading Return Value]
  7750. A reference to the [link boost_asio.reference.io_context `io_context`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
  7751. [endsect]
  7752. [section:get_service basic_io_object::get_service]
  7753. [indexterm2 boost_asio.indexterm.basic_io_object.get_service..get_service..basic_io_object]
  7754. Get the service associated with the I/O object.
  7755. service_type & ``[link boost_asio.reference.basic_io_object.get_service.overload1 get_service]``();
  7756. `` [''''&raquo;''' [link boost_asio.reference.basic_io_object.get_service.overload1 more...]]``
  7757. const service_type & ``[link boost_asio.reference.basic_io_object.get_service.overload2 get_service]``() const;
  7758. `` [''''&raquo;''' [link boost_asio.reference.basic_io_object.get_service.overload2 more...]]``
  7759. [section:overload1 basic_io_object::get_service (1 of 2 overloads)]
  7760. Get the service associated with the I/O object.
  7761. service_type & get_service();
  7762. [endsect]
  7763. [section:overload2 basic_io_object::get_service (2 of 2 overloads)]
  7764. Get the service associated with the I/O object.
  7765. const service_type & get_service() const;
  7766. [endsect]
  7767. [endsect]
  7768. [section:implementation_type basic_io_object::implementation_type]
  7769. [indexterm2 boost_asio.indexterm.basic_io_object.implementation_type..implementation_type..basic_io_object]
  7770. The underlying implementation type of I/O object.
  7771. typedef service_type::implementation_type implementation_type;
  7772. [heading Requirements]
  7773. ['Header: ][^boost/asio/basic_io_object.hpp]
  7774. ['Convenience header: ][^boost/asio.hpp]
  7775. [endsect]
  7776. [section:operator_eq_ basic_io_object::operator=]
  7777. [indexterm2 boost_asio.indexterm.basic_io_object.operator_eq_..operator=..basic_io_object]
  7778. Move-assign a [link boost_asio.reference.basic_io_object `basic_io_object`].
  7779. basic_io_object & operator=(
  7780. basic_io_object && other);
  7781. Performs:
  7782. get_service().move_assign(get_implementation(),
  7783. other.get_service(), other.get_implementation());
  7784. [heading Remarks]
  7785. Available only for services that support movability,
  7786. [endsect]
  7787. [section:service_type basic_io_object::service_type]
  7788. [indexterm2 boost_asio.indexterm.basic_io_object.service_type..service_type..basic_io_object]
  7789. The type of the service that will be used to provide I/O operations.
  7790. typedef IoObjectService service_type;
  7791. [heading Requirements]
  7792. ['Header: ][^boost/asio/basic_io_object.hpp]
  7793. ['Convenience header: ][^boost/asio.hpp]
  7794. [endsect]
  7795. [section:_basic_io_object basic_io_object::~basic_io_object]
  7796. [indexterm2 boost_asio.indexterm.basic_io_object._basic_io_object..~basic_io_object..basic_io_object]
  7797. Protected destructor to prevent deletion through this type.
  7798. ~basic_io_object();
  7799. Performs:
  7800. get_service().destroy(get_implementation());
  7801. [endsect]
  7802. [endsect]
  7803. [section:basic_raw_socket basic_raw_socket]
  7804. Provides raw-oriented socket functionality.
  7805. template<
  7806. typename ``[link boost_asio.reference.Protocol Protocol]``,
  7807. typename ``[link boost_asio.reference.Executor1 Executor]``>
  7808. class basic_raw_socket :
  7809. public basic_socket< Protocol, Executor >
  7810. [heading Types]
  7811. [table
  7812. [[Name][Description]]
  7813. [
  7814. [[link boost_asio.reference.basic_raw_socket__rebind_executor [*rebind_executor]]]
  7815. [Rebinds the socket type to another executor. ]
  7816. ]
  7817. [
  7818. [[link boost_asio.reference.basic_raw_socket.broadcast [*broadcast]]]
  7819. [Socket option to permit sending of broadcast messages. ]
  7820. ]
  7821. [
  7822. [[link boost_asio.reference.basic_raw_socket.bytes_readable [*bytes_readable]]]
  7823. [IO control command to get the amount of data that can be read without blocking. ]
  7824. ]
  7825. [
  7826. [[link boost_asio.reference.basic_raw_socket.debug [*debug]]]
  7827. [Socket option to enable socket-level debugging. ]
  7828. ]
  7829. [
  7830. [[link boost_asio.reference.basic_raw_socket.do_not_route [*do_not_route]]]
  7831. [Socket option to prevent routing, use local interfaces only. ]
  7832. ]
  7833. [
  7834. [[link boost_asio.reference.basic_raw_socket.enable_connection_aborted [*enable_connection_aborted]]]
  7835. [Socket option to report aborted connections on accept. ]
  7836. ]
  7837. [
  7838. [[link boost_asio.reference.basic_raw_socket.endpoint_type [*endpoint_type]]]
  7839. [The endpoint type. ]
  7840. ]
  7841. [
  7842. [[link boost_asio.reference.basic_raw_socket.executor_type [*executor_type]]]
  7843. [The type of the executor associated with the object. ]
  7844. ]
  7845. [
  7846. [[link boost_asio.reference.basic_raw_socket.keep_alive [*keep_alive]]]
  7847. [Socket option to send keep-alives. ]
  7848. ]
  7849. [
  7850. [[link boost_asio.reference.basic_raw_socket.linger [*linger]]]
  7851. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  7852. ]
  7853. [
  7854. [[link boost_asio.reference.basic_raw_socket.lowest_layer_type [*lowest_layer_type]]]
  7855. [A basic_socket is always the lowest layer. ]
  7856. ]
  7857. [
  7858. [[link boost_asio.reference.basic_raw_socket.message_flags [*message_flags]]]
  7859. [Bitmask type for flags that can be passed to send and receive operations. ]
  7860. ]
  7861. [
  7862. [[link boost_asio.reference.basic_raw_socket.native_handle_type [*native_handle_type]]]
  7863. [The native representation of a socket. ]
  7864. ]
  7865. [
  7866. [[link boost_asio.reference.basic_raw_socket.out_of_band_inline [*out_of_band_inline]]]
  7867. [Socket option for putting received out-of-band data inline. ]
  7868. ]
  7869. [
  7870. [[link boost_asio.reference.basic_raw_socket.protocol_type [*protocol_type]]]
  7871. [The protocol type. ]
  7872. ]
  7873. [
  7874. [[link boost_asio.reference.basic_raw_socket.receive_buffer_size [*receive_buffer_size]]]
  7875. [Socket option for the receive buffer size of a socket. ]
  7876. ]
  7877. [
  7878. [[link boost_asio.reference.basic_raw_socket.receive_low_watermark [*receive_low_watermark]]]
  7879. [Socket option for the receive low watermark. ]
  7880. ]
  7881. [
  7882. [[link boost_asio.reference.basic_raw_socket.reuse_address [*reuse_address]]]
  7883. [Socket option to allow the socket to be bound to an address that is already in use. ]
  7884. ]
  7885. [
  7886. [[link boost_asio.reference.basic_raw_socket.send_buffer_size [*send_buffer_size]]]
  7887. [Socket option for the send buffer size of a socket. ]
  7888. ]
  7889. [
  7890. [[link boost_asio.reference.basic_raw_socket.send_low_watermark [*send_low_watermark]]]
  7891. [Socket option for the send low watermark. ]
  7892. ]
  7893. [
  7894. [[link boost_asio.reference.basic_raw_socket.shutdown_type [*shutdown_type]]]
  7895. [Different ways a socket may be shutdown. ]
  7896. ]
  7897. [
  7898. [[link boost_asio.reference.basic_raw_socket.wait_type [*wait_type]]]
  7899. [Wait types. ]
  7900. ]
  7901. ]
  7902. [heading Member Functions]
  7903. [table
  7904. [[Name][Description]]
  7905. [
  7906. [[link boost_asio.reference.basic_raw_socket.assign [*assign]]]
  7907. [Assign an existing native socket to the socket. ]
  7908. ]
  7909. [
  7910. [[link boost_asio.reference.basic_raw_socket.async_connect [*async_connect]]]
  7911. [Start an asynchronous connect. ]
  7912. ]
  7913. [
  7914. [[link boost_asio.reference.basic_raw_socket.async_receive [*async_receive]]]
  7915. [Start an asynchronous receive on a connected socket. ]
  7916. ]
  7917. [
  7918. [[link boost_asio.reference.basic_raw_socket.async_receive_from [*async_receive_from]]]
  7919. [Start an asynchronous receive. ]
  7920. ]
  7921. [
  7922. [[link boost_asio.reference.basic_raw_socket.async_send [*async_send]]]
  7923. [Start an asynchronous send on a connected socket. ]
  7924. ]
  7925. [
  7926. [[link boost_asio.reference.basic_raw_socket.async_send_to [*async_send_to]]]
  7927. [Start an asynchronous send. ]
  7928. ]
  7929. [
  7930. [[link boost_asio.reference.basic_raw_socket.async_wait [*async_wait]]]
  7931. [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  7932. ]
  7933. [
  7934. [[link boost_asio.reference.basic_raw_socket.at_mark [*at_mark]]]
  7935. [Determine whether the socket is at the out-of-band data mark. ]
  7936. ]
  7937. [
  7938. [[link boost_asio.reference.basic_raw_socket.available [*available]]]
  7939. [Determine the number of bytes available for reading. ]
  7940. ]
  7941. [
  7942. [[link boost_asio.reference.basic_raw_socket.basic_raw_socket [*basic_raw_socket]]]
  7943. [Construct a basic_raw_socket without opening it.
  7944. [hr]
  7945. Construct and open a basic_raw_socket.
  7946. [hr]
  7947. Construct a basic_raw_socket, opening it and binding it to the given local endpoint.
  7948. [hr]
  7949. Construct a basic_raw_socket on an existing native socket.
  7950. [hr]
  7951. Move-construct a basic_raw_socket from another.
  7952. [hr]
  7953. Move-construct a basic_raw_socket from a socket of another protocol type. ]
  7954. ]
  7955. [
  7956. [[link boost_asio.reference.basic_raw_socket.bind [*bind]]]
  7957. [Bind the socket to the given local endpoint. ]
  7958. ]
  7959. [
  7960. [[link boost_asio.reference.basic_raw_socket.cancel [*cancel]]]
  7961. [Cancel all asynchronous operations associated with the socket. ]
  7962. ]
  7963. [
  7964. [[link boost_asio.reference.basic_raw_socket.close [*close]]]
  7965. [Close the socket. ]
  7966. ]
  7967. [
  7968. [[link boost_asio.reference.basic_raw_socket.connect [*connect]]]
  7969. [Connect the socket to the specified endpoint. ]
  7970. ]
  7971. [
  7972. [[link boost_asio.reference.basic_raw_socket.get_executor [*get_executor]]]
  7973. [Get the executor associated with the object. ]
  7974. ]
  7975. [
  7976. [[link boost_asio.reference.basic_raw_socket.get_option [*get_option]]]
  7977. [Get an option from the socket. ]
  7978. ]
  7979. [
  7980. [[link boost_asio.reference.basic_raw_socket.io_control [*io_control]]]
  7981. [Perform an IO control command on the socket. ]
  7982. ]
  7983. [
  7984. [[link boost_asio.reference.basic_raw_socket.is_open [*is_open]]]
  7985. [Determine whether the socket is open. ]
  7986. ]
  7987. [
  7988. [[link boost_asio.reference.basic_raw_socket.local_endpoint [*local_endpoint]]]
  7989. [Get the local endpoint of the socket. ]
  7990. ]
  7991. [
  7992. [[link boost_asio.reference.basic_raw_socket.lowest_layer [*lowest_layer]]]
  7993. [Get a reference to the lowest layer.
  7994. [hr]
  7995. Get a const reference to the lowest layer. ]
  7996. ]
  7997. [
  7998. [[link boost_asio.reference.basic_raw_socket.native_handle [*native_handle]]]
  7999. [Get the native socket representation. ]
  8000. ]
  8001. [
  8002. [[link boost_asio.reference.basic_raw_socket.native_non_blocking [*native_non_blocking]]]
  8003. [Gets the non-blocking mode of the native socket implementation.
  8004. [hr]
  8005. Sets the non-blocking mode of the native socket implementation. ]
  8006. ]
  8007. [
  8008. [[link boost_asio.reference.basic_raw_socket.non_blocking [*non_blocking]]]
  8009. [Gets the non-blocking mode of the socket.
  8010. [hr]
  8011. Sets the non-blocking mode of the socket. ]
  8012. ]
  8013. [
  8014. [[link boost_asio.reference.basic_raw_socket.open [*open]]]
  8015. [Open the socket using the specified protocol. ]
  8016. ]
  8017. [
  8018. [[link boost_asio.reference.basic_raw_socket.operator_eq_ [*operator=]]]
  8019. [Move-assign a basic_raw_socket from another.
  8020. [hr]
  8021. Move-assign a basic_raw_socket from a socket of another protocol type. ]
  8022. ]
  8023. [
  8024. [[link boost_asio.reference.basic_raw_socket.receive [*receive]]]
  8025. [Receive some data on a connected socket. ]
  8026. ]
  8027. [
  8028. [[link boost_asio.reference.basic_raw_socket.receive_from [*receive_from]]]
  8029. [Receive raw data with the endpoint of the sender. ]
  8030. ]
  8031. [
  8032. [[link boost_asio.reference.basic_raw_socket.release [*release]]]
  8033. [Release ownership of the underlying native socket. ]
  8034. ]
  8035. [
  8036. [[link boost_asio.reference.basic_raw_socket.remote_endpoint [*remote_endpoint]]]
  8037. [Get the remote endpoint of the socket. ]
  8038. ]
  8039. [
  8040. [[link boost_asio.reference.basic_raw_socket.send [*send]]]
  8041. [Send some data on a connected socket. ]
  8042. ]
  8043. [
  8044. [[link boost_asio.reference.basic_raw_socket.send_to [*send_to]]]
  8045. [Send raw data to the specified endpoint. ]
  8046. ]
  8047. [
  8048. [[link boost_asio.reference.basic_raw_socket.set_option [*set_option]]]
  8049. [Set an option on the socket. ]
  8050. ]
  8051. [
  8052. [[link boost_asio.reference.basic_raw_socket.shutdown [*shutdown]]]
  8053. [Disable sends or receives on the socket. ]
  8054. ]
  8055. [
  8056. [[link boost_asio.reference.basic_raw_socket.wait [*wait]]]
  8057. [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  8058. ]
  8059. [
  8060. [[link boost_asio.reference.basic_raw_socket._basic_raw_socket [*~basic_raw_socket]]]
  8061. [Destroys the socket. ]
  8062. ]
  8063. ]
  8064. [heading Data Members]
  8065. [table
  8066. [[Name][Description]]
  8067. [
  8068. [[link boost_asio.reference.basic_raw_socket.max_connections [*max_connections]]]
  8069. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  8070. ]
  8071. [
  8072. [[link boost_asio.reference.basic_raw_socket.max_listen_connections [*max_listen_connections]]]
  8073. [The maximum length of the queue of pending incoming connections. ]
  8074. ]
  8075. [
  8076. [[link boost_asio.reference.basic_raw_socket.message_do_not_route [*message_do_not_route]]]
  8077. [Specify that the data should not be subject to routing. ]
  8078. ]
  8079. [
  8080. [[link boost_asio.reference.basic_raw_socket.message_end_of_record [*message_end_of_record]]]
  8081. [Specifies that the data marks the end of a record. ]
  8082. ]
  8083. [
  8084. [[link boost_asio.reference.basic_raw_socket.message_out_of_band [*message_out_of_band]]]
  8085. [Process out-of-band data. ]
  8086. ]
  8087. [
  8088. [[link boost_asio.reference.basic_raw_socket.message_peek [*message_peek]]]
  8089. [Peek at incoming data without removing it from the input queue. ]
  8090. ]
  8091. ]
  8092. [heading Protected Data Members]
  8093. [table
  8094. [[Name][Description]]
  8095. [
  8096. [[link boost_asio.reference.basic_raw_socket.impl_ [*impl_]]]
  8097. []
  8098. ]
  8099. ]
  8100. The [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] class template provides asynchronous and blocking raw-oriented socket functionality.
  8101. [heading Thread Safety]
  8102. ['Distinct] ['objects:] Safe.
  8103. ['Shared] ['objects:] Unsafe.
  8104. [heading Requirements]
  8105. ['Header: ][^boost/asio/basic_raw_socket.hpp]
  8106. ['Convenience header: ][^boost/asio.hpp]
  8107. [section:assign basic_raw_socket::assign]
  8108. [indexterm2 boost_asio.indexterm.basic_raw_socket.assign..assign..basic_raw_socket]
  8109. Assign an existing native socket to the socket.
  8110. void ``[link boost_asio.reference.basic_raw_socket.assign.overload1 assign]``(
  8111. const protocol_type & protocol,
  8112. const native_handle_type & native_socket);
  8113. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.assign.overload1 more...]]``
  8114. void ``[link boost_asio.reference.basic_raw_socket.assign.overload2 assign]``(
  8115. const protocol_type & protocol,
  8116. const native_handle_type & native_socket,
  8117. boost::system::error_code & ec);
  8118. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.assign.overload2 more...]]``
  8119. [section:overload1 basic_raw_socket::assign (1 of 2 overloads)]
  8120. ['Inherited from basic_socket.]
  8121. Assign an existing native socket to the socket.
  8122. void assign(
  8123. const protocol_type & protocol,
  8124. const native_handle_type & native_socket);
  8125. [endsect]
  8126. [section:overload2 basic_raw_socket::assign (2 of 2 overloads)]
  8127. ['Inherited from basic_socket.]
  8128. Assign an existing native socket to the socket.
  8129. void assign(
  8130. const protocol_type & protocol,
  8131. const native_handle_type & native_socket,
  8132. boost::system::error_code & ec);
  8133. [endsect]
  8134. [endsect]
  8135. [section:async_connect basic_raw_socket::async_connect]
  8136. ['Inherited from basic_socket.]
  8137. [indexterm2 boost_asio.indexterm.basic_raw_socket.async_connect..async_connect..basic_raw_socket]
  8138. Start an asynchronous connect.
  8139. template<
  8140. typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  8141. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect(
  8142. const endpoint_type & peer_endpoint,
  8143. ConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  8144. This function is used to asynchronously connect a socket to the specified remote endpoint. The function call always returns immediately.
  8145. The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
  8146. [heading Parameters]
  8147. [variablelist
  8148. [[peer_endpoint][The remote endpoint to which the socket will be connected. Copies will be made of the endpoint object as required.]]
  8149. [[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:
  8150. ``
  8151. void handler(
  8152. const boost::system::error_code& error // Result of operation
  8153. );
  8154. ``
  8155. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  8156. ]
  8157. [heading Example]
  8158. void connect_handler(const boost::system::error_code& error)
  8159. {
  8160. if (!error)
  8161. {
  8162. // Connect succeeded.
  8163. }
  8164. }
  8165. ...
  8166. boost::asio::ip::tcp::socket socket(my_context);
  8167. boost::asio::ip::tcp::endpoint endpoint(
  8168. boost::asio::ip::address::from_string("1.2.3.4"), 12345);
  8169. socket.async_connect(endpoint, connect_handler);
  8170. [endsect]
  8171. [section:async_receive basic_raw_socket::async_receive]
  8172. [indexterm2 boost_asio.indexterm.basic_raw_socket.async_receive..async_receive..basic_raw_socket]
  8173. Start an asynchronous receive on a connected socket.
  8174. template<
  8175. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  8176. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  8177. ``[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]``(
  8178. const MutableBufferSequence & buffers,
  8179. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  8180. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.async_receive.overload1 more...]]``
  8181. template<
  8182. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  8183. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  8184. ``[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]``(
  8185. const MutableBufferSequence & buffers,
  8186. socket_base::message_flags flags,
  8187. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  8188. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.async_receive.overload2 more...]]``
  8189. [section:overload1 basic_raw_socket::async_receive (1 of 2 overloads)]
  8190. Start an asynchronous receive on a connected socket.
  8191. template<
  8192. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  8193. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  8194. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive(
  8195. const MutableBufferSequence & buffers,
  8196. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  8197. This function is used to asynchronously receive data from the raw socket. The function call always returns immediately.
  8198. [heading Parameters]
  8199. [variablelist
  8200. [[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.]]
  8201. [[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:
  8202. ``
  8203. void handler(
  8204. const boost::system::error_code& error, // Result of operation.
  8205. std::size_t bytes_transferred // Number of bytes received.
  8206. );
  8207. ``
  8208. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  8209. ]
  8210. [heading Remarks]
  8211. The async\_receive operation can only be used with a connected socket. Use the async\_receive\_from function to receive data on an unconnected raw socket.
  8212. [heading Example]
  8213. To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  8214. socket.async_receive(boost::asio::buffer(data, size), handler);
  8215. See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  8216. [endsect]
  8217. [section:overload2 basic_raw_socket::async_receive (2 of 2 overloads)]
  8218. Start an asynchronous receive on a connected socket.
  8219. template<
  8220. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  8221. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  8222. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive(
  8223. const MutableBufferSequence & buffers,
  8224. socket_base::message_flags flags,
  8225. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  8226. This function is used to asynchronously receive data from the raw socket. The function call always returns immediately.
  8227. [heading Parameters]
  8228. [variablelist
  8229. [[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.]]
  8230. [[flags][Flags specifying how the receive call is to be made.]]
  8231. [[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:
  8232. ``
  8233. void handler(
  8234. const boost::system::error_code& error, // Result of operation.
  8235. std::size_t bytes_transferred // Number of bytes received.
  8236. );
  8237. ``
  8238. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  8239. ]
  8240. [heading Remarks]
  8241. The async\_receive operation can only be used with a connected socket. Use the async\_receive\_from function to receive data on an unconnected raw socket.
  8242. [endsect]
  8243. [endsect]
  8244. [section:async_receive_from basic_raw_socket::async_receive_from]
  8245. [indexterm2 boost_asio.indexterm.basic_raw_socket.async_receive_from..async_receive_from..basic_raw_socket]
  8246. Start an asynchronous receive.
  8247. template<
  8248. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  8249. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  8250. ``[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]``(
  8251. const MutableBufferSequence & buffers,
  8252. endpoint_type & sender_endpoint,
  8253. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  8254. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.async_receive_from.overload1 more...]]``
  8255. template<
  8256. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  8257. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  8258. ``[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]``(
  8259. const MutableBufferSequence & buffers,
  8260. endpoint_type & sender_endpoint,
  8261. socket_base::message_flags flags,
  8262. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  8263. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.async_receive_from.overload2 more...]]``
  8264. [section:overload1 basic_raw_socket::async_receive_from (1 of 2 overloads)]
  8265. Start an asynchronous receive.
  8266. template<
  8267. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  8268. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  8269. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive_from(
  8270. const MutableBufferSequence & buffers,
  8271. endpoint_type & sender_endpoint,
  8272. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  8273. This function is used to asynchronously receive raw data. The function call always returns immediately.
  8274. [heading Parameters]
  8275. [variablelist
  8276. [[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.]]
  8277. [[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.]]
  8278. [[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:
  8279. ``
  8280. void handler(
  8281. const boost::system::error_code& error, // Result of operation.
  8282. std::size_t bytes_transferred // Number of bytes received.
  8283. );
  8284. ``
  8285. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  8286. ]
  8287. [heading Example]
  8288. To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  8289. socket.async_receive_from(
  8290. boost::asio::buffer(data, size), 0, sender_endpoint, handler);
  8291. See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  8292. [endsect]
  8293. [section:overload2 basic_raw_socket::async_receive_from (2 of 2 overloads)]
  8294. Start an asynchronous receive.
  8295. template<
  8296. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  8297. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  8298. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive_from(
  8299. const MutableBufferSequence & buffers,
  8300. endpoint_type & sender_endpoint,
  8301. socket_base::message_flags flags,
  8302. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  8303. This function is used to asynchronously receive raw data. The function call always returns immediately.
  8304. [heading Parameters]
  8305. [variablelist
  8306. [[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.]]
  8307. [[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.]]
  8308. [[flags][Flags specifying how the receive call is to be made.]]
  8309. [[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:
  8310. ``
  8311. void handler(
  8312. const boost::system::error_code& error, // Result of operation.
  8313. std::size_t bytes_transferred // Number of bytes received.
  8314. );
  8315. ``
  8316. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
  8317. ]
  8318. [endsect]
  8319. [endsect]
  8320. [section:async_send basic_raw_socket::async_send]
  8321. [indexterm2 boost_asio.indexterm.basic_raw_socket.async_send..async_send..basic_raw_socket]
  8322. Start an asynchronous send on a connected socket.
  8323. template<
  8324. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  8325. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  8326. ``[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]``(
  8327. const ConstBufferSequence & buffers,
  8328. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  8329. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.async_send.overload1 more...]]``
  8330. template<
  8331. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  8332. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  8333. ``[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]``(
  8334. const ConstBufferSequence & buffers,
  8335. socket_base::message_flags flags,
  8336. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  8337. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.async_send.overload2 more...]]``
  8338. [section:overload1 basic_raw_socket::async_send (1 of 2 overloads)]
  8339. Start an asynchronous send on a connected socket.
  8340. template<
  8341. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  8342. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  8343. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send(
  8344. const ConstBufferSequence & buffers,
  8345. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  8346. This function is used to send data on the raw socket. The function call will block until the data has been sent successfully or an error occurs.
  8347. [heading Parameters]
  8348. [variablelist
  8349. [[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.]]
  8350. [[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:
  8351. ``
  8352. void handler(
  8353. const boost::system::error_code& error, // Result of operation.
  8354. std::size_t bytes_transferred // Number of bytes sent.
  8355. );
  8356. ``
  8357. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  8358. ]
  8359. [heading Remarks]
  8360. The async\_send operation can only be used with a connected socket. Use the async\_send\_to function to send data on an unconnected raw socket.
  8361. [heading Example]
  8362. To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  8363. socket.async_send(boost::asio::buffer(data, size), handler);
  8364. See the [link boost_asio.reference.buffer `buffer`] documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  8365. [endsect]
  8366. [section:overload2 basic_raw_socket::async_send (2 of 2 overloads)]
  8367. Start an asynchronous send on a connected socket.
  8368. template<
  8369. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  8370. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  8371. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send(
  8372. const ConstBufferSequence & buffers,
  8373. socket_base::message_flags flags,
  8374. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  8375. This function is used to send data on the raw socket. The function call will block until the data has been sent successfully or an error occurs.
  8376. [heading Parameters]
  8377. [variablelist
  8378. [[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.]]
  8379. [[flags][Flags specifying how the send call is to be made.]]
  8380. [[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:
  8381. ``
  8382. void handler(
  8383. const boost::system::error_code& error, // Result of operation.
  8384. std::size_t bytes_transferred // Number of bytes sent.
  8385. );
  8386. ``
  8387. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  8388. ]
  8389. [heading Remarks]
  8390. The async\_send operation can only be used with a connected socket. Use the async\_send\_to function to send data on an unconnected raw socket.
  8391. [endsect]
  8392. [endsect]
  8393. [section:async_send_to basic_raw_socket::async_send_to]
  8394. [indexterm2 boost_asio.indexterm.basic_raw_socket.async_send_to..async_send_to..basic_raw_socket]
  8395. Start an asynchronous send.
  8396. template<
  8397. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  8398. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  8399. ``[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]``(
  8400. const ConstBufferSequence & buffers,
  8401. const endpoint_type & destination,
  8402. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  8403. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.async_send_to.overload1 more...]]``
  8404. template<
  8405. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  8406. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  8407. ``[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]``(
  8408. const ConstBufferSequence & buffers,
  8409. const endpoint_type & destination,
  8410. socket_base::message_flags flags,
  8411. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  8412. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.async_send_to.overload2 more...]]``
  8413. [section:overload1 basic_raw_socket::async_send_to (1 of 2 overloads)]
  8414. Start an asynchronous send.
  8415. template<
  8416. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  8417. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  8418. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send_to(
  8419. const ConstBufferSequence & buffers,
  8420. const endpoint_type & destination,
  8421. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  8422. This function is used to asynchronously send raw data to the specified remote endpoint. The function call always returns immediately.
  8423. [heading Parameters]
  8424. [variablelist
  8425. [[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.]]
  8426. [[destination][The remote endpoint to which the data will be sent. Copies will be made of the endpoint as required.]]
  8427. [[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:
  8428. ``
  8429. void handler(
  8430. const boost::system::error_code& error, // Result of operation.
  8431. std::size_t bytes_transferred // Number of bytes sent.
  8432. );
  8433. ``
  8434. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  8435. ]
  8436. [heading Example]
  8437. To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  8438. boost::asio::ip::udp::endpoint destination(
  8439. boost::asio::ip::address::from_string("1.2.3.4"), 12345);
  8440. socket.async_send_to(
  8441. boost::asio::buffer(data, size), destination, handler);
  8442. See the [link boost_asio.reference.buffer `buffer`] documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  8443. [endsect]
  8444. [section:overload2 basic_raw_socket::async_send_to (2 of 2 overloads)]
  8445. Start an asynchronous send.
  8446. template<
  8447. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  8448. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  8449. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send_to(
  8450. const ConstBufferSequence & buffers,
  8451. const endpoint_type & destination,
  8452. socket_base::message_flags flags,
  8453. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  8454. This function is used to asynchronously send raw data to the specified remote endpoint. The function call always returns immediately.
  8455. [heading Parameters]
  8456. [variablelist
  8457. [[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.]]
  8458. [[flags][Flags specifying how the send call is to be made.]]
  8459. [[destination][The remote endpoint to which the data will be sent. Copies will be made of the endpoint as required.]]
  8460. [[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:
  8461. ``
  8462. void handler(
  8463. const boost::system::error_code& error, // Result of operation.
  8464. std::size_t bytes_transferred // Number of bytes sent.
  8465. );
  8466. ``
  8467. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
  8468. ]
  8469. [endsect]
  8470. [endsect]
  8471. [section:async_wait basic_raw_socket::async_wait]
  8472. ['Inherited from basic_socket.]
  8473. [indexterm2 boost_asio.indexterm.basic_raw_socket.async_wait..async_wait..basic_raw_socket]
  8474. Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions.
  8475. template<
  8476. typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  8477. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait(
  8478. wait_type w,
  8479. WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  8480. This function is used to perform an asynchronous wait for a socket to enter a ready to read, write or error condition state.
  8481. [heading Parameters]
  8482. [variablelist
  8483. [[w][Specifies the desired socket state.]]
  8484. [[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:
  8485. ``
  8486. void handler(
  8487. const boost::system::error_code& error // Result of operation
  8488. );
  8489. ``
  8490. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  8491. ]
  8492. [heading Example]
  8493. void wait_handler(const boost::system::error_code& error)
  8494. {
  8495. if (!error)
  8496. {
  8497. // Wait succeeded.
  8498. }
  8499. }
  8500. ...
  8501. boost::asio::ip::tcp::socket socket(my_context);
  8502. ...
  8503. socket.async_wait(boost::asio::ip::tcp::socket::wait_read, wait_handler);
  8504. [endsect]
  8505. [section:at_mark basic_raw_socket::at_mark]
  8506. [indexterm2 boost_asio.indexterm.basic_raw_socket.at_mark..at_mark..basic_raw_socket]
  8507. Determine whether the socket is at the out-of-band data mark.
  8508. bool ``[link boost_asio.reference.basic_raw_socket.at_mark.overload1 at_mark]``() const;
  8509. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.at_mark.overload1 more...]]``
  8510. bool ``[link boost_asio.reference.basic_raw_socket.at_mark.overload2 at_mark]``(
  8511. boost::system::error_code & ec) const;
  8512. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.at_mark.overload2 more...]]``
  8513. [section:overload1 basic_raw_socket::at_mark (1 of 2 overloads)]
  8514. ['Inherited from basic_socket.]
  8515. Determine whether the socket is at the out-of-band data mark.
  8516. bool at_mark() const;
  8517. This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
  8518. [heading Return Value]
  8519. A bool indicating whether the socket is at the out-of-band data mark.
  8520. [heading Exceptions]
  8521. [variablelist
  8522. [[boost::system::system_error][Thrown on failure. ]]
  8523. ]
  8524. [endsect]
  8525. [section:overload2 basic_raw_socket::at_mark (2 of 2 overloads)]
  8526. ['Inherited from basic_socket.]
  8527. Determine whether the socket is at the out-of-band data mark.
  8528. bool at_mark(
  8529. boost::system::error_code & ec) const;
  8530. This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
  8531. [heading Parameters]
  8532. [variablelist
  8533. [[ec][Set to indicate what error occurred, if any.]]
  8534. ]
  8535. [heading Return Value]
  8536. A bool indicating whether the socket is at the out-of-band data mark.
  8537. [endsect]
  8538. [endsect]
  8539. [section:available basic_raw_socket::available]
  8540. [indexterm2 boost_asio.indexterm.basic_raw_socket.available..available..basic_raw_socket]
  8541. Determine the number of bytes available for reading.
  8542. std::size_t ``[link boost_asio.reference.basic_raw_socket.available.overload1 available]``() const;
  8543. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.available.overload1 more...]]``
  8544. std::size_t ``[link boost_asio.reference.basic_raw_socket.available.overload2 available]``(
  8545. boost::system::error_code & ec) const;
  8546. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.available.overload2 more...]]``
  8547. [section:overload1 basic_raw_socket::available (1 of 2 overloads)]
  8548. ['Inherited from basic_socket.]
  8549. Determine the number of bytes available for reading.
  8550. std::size_t available() const;
  8551. This function is used to determine the number of bytes that may be read without blocking.
  8552. [heading Return Value]
  8553. The number of bytes that may be read without blocking, or 0 if an error occurs.
  8554. [heading Exceptions]
  8555. [variablelist
  8556. [[boost::system::system_error][Thrown on failure. ]]
  8557. ]
  8558. [endsect]
  8559. [section:overload2 basic_raw_socket::available (2 of 2 overloads)]
  8560. ['Inherited from basic_socket.]
  8561. Determine the number of bytes available for reading.
  8562. std::size_t available(
  8563. boost::system::error_code & ec) const;
  8564. This function is used to determine the number of bytes that may be read without blocking.
  8565. [heading Parameters]
  8566. [variablelist
  8567. [[ec][Set to indicate what error occurred, if any.]]
  8568. ]
  8569. [heading Return Value]
  8570. The number of bytes that may be read without blocking, or 0 if an error occurs.
  8571. [endsect]
  8572. [endsect]
  8573. [section:basic_raw_socket basic_raw_socket::basic_raw_socket]
  8574. [indexterm2 boost_asio.indexterm.basic_raw_socket.basic_raw_socket..basic_raw_socket..basic_raw_socket]
  8575. Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] without opening it.
  8576. explicit ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload1 basic_raw_socket]``(
  8577. const executor_type & ex);
  8578. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload1 more...]]``
  8579. template<
  8580. typename ExecutionContext>
  8581. explicit ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload2 basic_raw_socket]``(
  8582. ExecutionContext & context,
  8583. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  8584. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload2 more...]]``
  8585. Construct and open a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`].
  8586. ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload3 basic_raw_socket]``(
  8587. const executor_type & ex,
  8588. const protocol_type & protocol);
  8589. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload3 more...]]``
  8590. template<
  8591. typename ExecutionContext>
  8592. ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload4 basic_raw_socket]``(
  8593. ExecutionContext & context,
  8594. const protocol_type & protocol,
  8595. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  8596. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload4 more...]]``
  8597. Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`], opening it and binding it to the given local endpoint.
  8598. ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload5 basic_raw_socket]``(
  8599. const executor_type & ex,
  8600. const endpoint_type & endpoint);
  8601. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload5 more...]]``
  8602. template<
  8603. typename ExecutionContext>
  8604. ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload6 basic_raw_socket]``(
  8605. ExecutionContext & context,
  8606. const endpoint_type & endpoint,
  8607. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  8608. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload6 more...]]``
  8609. Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] on an existing native socket.
  8610. ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload7 basic_raw_socket]``(
  8611. const executor_type & ex,
  8612. const protocol_type & protocol,
  8613. const native_handle_type & native_socket);
  8614. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload7 more...]]``
  8615. template<
  8616. typename ExecutionContext>
  8617. ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload8 basic_raw_socket]``(
  8618. ExecutionContext & context,
  8619. const protocol_type & protocol,
  8620. const native_handle_type & native_socket,
  8621. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  8622. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload8 more...]]``
  8623. Move-construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] from another.
  8624. ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload9 basic_raw_socket]``(
  8625. basic_raw_socket && other);
  8626. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload9 more...]]``
  8627. Move-construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] from a socket of another protocol type.
  8628. template<
  8629. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  8630. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  8631. ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload10 basic_raw_socket]``(
  8632. basic_raw_socket< Protocol1, Executor1 > && other,
  8633. typename enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type * = 0);
  8634. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload10 more...]]``
  8635. [section:overload1 basic_raw_socket::basic_raw_socket (1 of 10 overloads)]
  8636. Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] without opening it.
  8637. basic_raw_socket(
  8638. const executor_type & ex);
  8639. This constructor creates a raw socket without opening it. The `open()` function must be called before data can be sent or received on the socket.
  8640. [heading Parameters]
  8641. [variablelist
  8642. [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket. ]]
  8643. ]
  8644. [endsect]
  8645. [section:overload2 basic_raw_socket::basic_raw_socket (2 of 10 overloads)]
  8646. Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] without opening it.
  8647. template<
  8648. typename ExecutionContext>
  8649. basic_raw_socket(
  8650. ExecutionContext & context,
  8651. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  8652. This constructor creates a raw socket without opening it. The `open()` function must be called before data can be sent or received on the socket.
  8653. [heading Parameters]
  8654. [variablelist
  8655. [[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. ]]
  8656. ]
  8657. [endsect]
  8658. [section:overload3 basic_raw_socket::basic_raw_socket (3 of 10 overloads)]
  8659. Construct and open a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`].
  8660. basic_raw_socket(
  8661. const executor_type & ex,
  8662. const protocol_type & protocol);
  8663. This constructor creates and opens a raw socket.
  8664. [heading Parameters]
  8665. [variablelist
  8666. [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
  8667. [[protocol][An object specifying protocol parameters to be used.]]
  8668. ]
  8669. [heading Exceptions]
  8670. [variablelist
  8671. [[boost::system::system_error][Thrown on failure. ]]
  8672. ]
  8673. [endsect]
  8674. [section:overload4 basic_raw_socket::basic_raw_socket (4 of 10 overloads)]
  8675. Construct and open a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`].
  8676. template<
  8677. typename ExecutionContext>
  8678. basic_raw_socket(
  8679. ExecutionContext & context,
  8680. const protocol_type & protocol,
  8681. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  8682. This constructor creates and opens a raw socket.
  8683. [heading Parameters]
  8684. [variablelist
  8685. [[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.]]
  8686. [[protocol][An object specifying protocol parameters to be used.]]
  8687. ]
  8688. [heading Exceptions]
  8689. [variablelist
  8690. [[boost::system::system_error][Thrown on failure. ]]
  8691. ]
  8692. [endsect]
  8693. [section:overload5 basic_raw_socket::basic_raw_socket (5 of 10 overloads)]
  8694. Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`], opening it and binding it to the given local endpoint.
  8695. basic_raw_socket(
  8696. const executor_type & ex,
  8697. const endpoint_type & endpoint);
  8698. This constructor creates a raw socket and automatically opens it bound to the specified endpoint on the local machine. The protocol used is the protocol associated with the given endpoint.
  8699. [heading Parameters]
  8700. [variablelist
  8701. [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
  8702. [[endpoint][An endpoint on the local machine to which the raw socket will be bound.]]
  8703. ]
  8704. [heading Exceptions]
  8705. [variablelist
  8706. [[boost::system::system_error][Thrown on failure. ]]
  8707. ]
  8708. [endsect]
  8709. [section:overload6 basic_raw_socket::basic_raw_socket (6 of 10 overloads)]
  8710. Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`], opening it and binding it to the given local endpoint.
  8711. template<
  8712. typename ExecutionContext>
  8713. basic_raw_socket(
  8714. ExecutionContext & context,
  8715. const endpoint_type & endpoint,
  8716. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  8717. This constructor creates a raw socket and automatically opens it bound to the specified endpoint on the local machine. The protocol used is the protocol associated with the given endpoint.
  8718. [heading Parameters]
  8719. [variablelist
  8720. [[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.]]
  8721. [[endpoint][An endpoint on the local machine to which the raw socket will be bound.]]
  8722. ]
  8723. [heading Exceptions]
  8724. [variablelist
  8725. [[boost::system::system_error][Thrown on failure. ]]
  8726. ]
  8727. [endsect]
  8728. [section:overload7 basic_raw_socket::basic_raw_socket (7 of 10 overloads)]
  8729. Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] on an existing native socket.
  8730. basic_raw_socket(
  8731. const executor_type & ex,
  8732. const protocol_type & protocol,
  8733. const native_handle_type & native_socket);
  8734. This constructor creates a raw socket object to hold an existing native socket.
  8735. [heading Parameters]
  8736. [variablelist
  8737. [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
  8738. [[protocol][An object specifying protocol parameters to be used.]]
  8739. [[native_socket][The new underlying socket implementation.]]
  8740. ]
  8741. [heading Exceptions]
  8742. [variablelist
  8743. [[boost::system::system_error][Thrown on failure. ]]
  8744. ]
  8745. [endsect]
  8746. [section:overload8 basic_raw_socket::basic_raw_socket (8 of 10 overloads)]
  8747. Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] on an existing native socket.
  8748. template<
  8749. typename ExecutionContext>
  8750. basic_raw_socket(
  8751. ExecutionContext & context,
  8752. const protocol_type & protocol,
  8753. const native_handle_type & native_socket,
  8754. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  8755. This constructor creates a raw socket object to hold an existing native socket.
  8756. [heading Parameters]
  8757. [variablelist
  8758. [[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.]]
  8759. [[protocol][An object specifying protocol parameters to be used.]]
  8760. [[native_socket][The new underlying socket implementation.]]
  8761. ]
  8762. [heading Exceptions]
  8763. [variablelist
  8764. [[boost::system::system_error][Thrown on failure. ]]
  8765. ]
  8766. [endsect]
  8767. [section:overload9 basic_raw_socket::basic_raw_socket (9 of 10 overloads)]
  8768. Move-construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] from another.
  8769. basic_raw_socket(
  8770. basic_raw_socket && other);
  8771. This constructor moves a raw socket from one object to another.
  8772. [heading Parameters]
  8773. [variablelist
  8774. [[other][The other [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] object from which the move will occur.]]
  8775. ]
  8776. [heading Remarks]
  8777. Following the move, the moved-from object is in the same state as if constructed using the `basic_raw_socket(const executor_type&)` constructor.
  8778. [endsect]
  8779. [section:overload10 basic_raw_socket::basic_raw_socket (10 of 10 overloads)]
  8780. Move-construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] from a socket of another protocol type.
  8781. template<
  8782. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  8783. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  8784. basic_raw_socket(
  8785. basic_raw_socket< Protocol1, Executor1 > && other,
  8786. typename enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type * = 0);
  8787. This constructor moves a raw socket from one object to another.
  8788. [heading Parameters]
  8789. [variablelist
  8790. [[other][The other [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] object from which the move will occur.]]
  8791. ]
  8792. [heading Remarks]
  8793. Following the move, the moved-from object is in the same state as if constructed using the `basic_raw_socket(const executor_type&)` constructor.
  8794. [endsect]
  8795. [endsect]
  8796. [section:bind basic_raw_socket::bind]
  8797. [indexterm2 boost_asio.indexterm.basic_raw_socket.bind..bind..basic_raw_socket]
  8798. Bind the socket to the given local endpoint.
  8799. void ``[link boost_asio.reference.basic_raw_socket.bind.overload1 bind]``(
  8800. const endpoint_type & endpoint);
  8801. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.bind.overload1 more...]]``
  8802. void ``[link boost_asio.reference.basic_raw_socket.bind.overload2 bind]``(
  8803. const endpoint_type & endpoint,
  8804. boost::system::error_code & ec);
  8805. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.bind.overload2 more...]]``
  8806. [section:overload1 basic_raw_socket::bind (1 of 2 overloads)]
  8807. ['Inherited from basic_socket.]
  8808. Bind the socket to the given local endpoint.
  8809. void bind(
  8810. const endpoint_type & endpoint);
  8811. This function binds the socket to the specified endpoint on the local machine.
  8812. [heading Parameters]
  8813. [variablelist
  8814. [[endpoint][An endpoint on the local machine to which the socket will be bound.]]
  8815. ]
  8816. [heading Exceptions]
  8817. [variablelist
  8818. [[boost::system::system_error][Thrown on failure.]]
  8819. ]
  8820. [heading Example]
  8821. boost::asio::ip::tcp::socket socket(my_context);
  8822. socket.open(boost::asio::ip::tcp::v4());
  8823. socket.bind(boost::asio::ip::tcp::endpoint(
  8824. boost::asio::ip::tcp::v4(), 12345));
  8825. [endsect]
  8826. [section:overload2 basic_raw_socket::bind (2 of 2 overloads)]
  8827. ['Inherited from basic_socket.]
  8828. Bind the socket to the given local endpoint.
  8829. void bind(
  8830. const endpoint_type & endpoint,
  8831. boost::system::error_code & ec);
  8832. This function binds the socket to the specified endpoint on the local machine.
  8833. [heading Parameters]
  8834. [variablelist
  8835. [[endpoint][An endpoint on the local machine to which the socket will be bound.]]
  8836. [[ec][Set to indicate what error occurred, if any.]]
  8837. ]
  8838. [heading Example]
  8839. boost::asio::ip::tcp::socket socket(my_context);
  8840. socket.open(boost::asio::ip::tcp::v4());
  8841. boost::system::error_code ec;
  8842. socket.bind(boost::asio::ip::tcp::endpoint(
  8843. boost::asio::ip::tcp::v4(), 12345), ec);
  8844. if (ec)
  8845. {
  8846. // An error occurred.
  8847. }
  8848. [endsect]
  8849. [endsect]
  8850. [section:broadcast basic_raw_socket::broadcast]
  8851. ['Inherited from socket_base.]
  8852. [indexterm2 boost_asio.indexterm.basic_raw_socket.broadcast..broadcast..basic_raw_socket]
  8853. Socket option to permit sending of broadcast messages.
  8854. typedef implementation_defined broadcast;
  8855. Implements the SOL\_SOCKET/SO\_BROADCAST socket option.
  8856. [heading Examples]
  8857. Setting the option:
  8858. boost::asio::ip::udp::socket socket(my_context);
  8859. ...
  8860. boost::asio::socket_base::broadcast option(true);
  8861. socket.set_option(option);
  8862. Getting the current option value:
  8863. boost::asio::ip::udp::socket socket(my_context);
  8864. ...
  8865. boost::asio::socket_base::broadcast option;
  8866. socket.get_option(option);
  8867. bool is_set = option.value();
  8868. [heading Requirements]
  8869. ['Header: ][^boost/asio/basic_raw_socket.hpp]
  8870. ['Convenience header: ][^boost/asio.hpp]
  8871. [endsect]
  8872. [section:bytes_readable basic_raw_socket::bytes_readable]
  8873. ['Inherited from socket_base.]
  8874. [indexterm2 boost_asio.indexterm.basic_raw_socket.bytes_readable..bytes_readable..basic_raw_socket]
  8875. IO control command to get the amount of data that can be read without blocking.
  8876. typedef implementation_defined bytes_readable;
  8877. Implements the FIONREAD IO control command.
  8878. [heading Example]
  8879. boost::asio::ip::tcp::socket socket(my_context);
  8880. ...
  8881. boost::asio::socket_base::bytes_readable command(true);
  8882. socket.io_control(command);
  8883. std::size_t bytes_readable = command.get();
  8884. [heading Requirements]
  8885. ['Header: ][^boost/asio/basic_raw_socket.hpp]
  8886. ['Convenience header: ][^boost/asio.hpp]
  8887. [endsect]
  8888. [section:cancel basic_raw_socket::cancel]
  8889. [indexterm2 boost_asio.indexterm.basic_raw_socket.cancel..cancel..basic_raw_socket]
  8890. Cancel all asynchronous operations associated with the socket.
  8891. void ``[link boost_asio.reference.basic_raw_socket.cancel.overload1 cancel]``();
  8892. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.cancel.overload1 more...]]``
  8893. void ``[link boost_asio.reference.basic_raw_socket.cancel.overload2 cancel]``(
  8894. boost::system::error_code & ec);
  8895. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.cancel.overload2 more...]]``
  8896. [section:overload1 basic_raw_socket::cancel (1 of 2 overloads)]
  8897. ['Inherited from basic_socket.]
  8898. Cancel all asynchronous operations associated with the socket.
  8899. void cancel();
  8900. This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
  8901. [heading Exceptions]
  8902. [variablelist
  8903. [[boost::system::system_error][Thrown on failure.]]
  8904. ]
  8905. [heading Remarks]
  8906. Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
  8907. * It will only cancel asynchronous operations that were initiated in the current thread.
  8908. * 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.
  8909. For portable cancellation, consider using one of the following alternatives:
  8910. * Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
  8911. * Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
  8912. When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above.
  8913. [endsect]
  8914. [section:overload2 basic_raw_socket::cancel (2 of 2 overloads)]
  8915. ['Inherited from basic_socket.]
  8916. Cancel all asynchronous operations associated with the socket.
  8917. void cancel(
  8918. boost::system::error_code & ec);
  8919. This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
  8920. [heading Parameters]
  8921. [variablelist
  8922. [[ec][Set to indicate what error occurred, if any.]]
  8923. ]
  8924. [heading Remarks]
  8925. Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
  8926. * It will only cancel asynchronous operations that were initiated in the current thread.
  8927. * 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.
  8928. For portable cancellation, consider using one of the following alternatives:
  8929. * Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
  8930. * Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
  8931. When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above.
  8932. [endsect]
  8933. [endsect]
  8934. [section:close basic_raw_socket::close]
  8935. [indexterm2 boost_asio.indexterm.basic_raw_socket.close..close..basic_raw_socket]
  8936. Close the socket.
  8937. void ``[link boost_asio.reference.basic_raw_socket.close.overload1 close]``();
  8938. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.close.overload1 more...]]``
  8939. void ``[link boost_asio.reference.basic_raw_socket.close.overload2 close]``(
  8940. boost::system::error_code & ec);
  8941. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.close.overload2 more...]]``
  8942. [section:overload1 basic_raw_socket::close (1 of 2 overloads)]
  8943. ['Inherited from basic_socket.]
  8944. Close the socket.
  8945. void close();
  8946. This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
  8947. [heading Exceptions]
  8948. [variablelist
  8949. [[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
  8950. ]
  8951. [heading Remarks]
  8952. For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket.
  8953. [endsect]
  8954. [section:overload2 basic_raw_socket::close (2 of 2 overloads)]
  8955. ['Inherited from basic_socket.]
  8956. Close the socket.
  8957. void close(
  8958. boost::system::error_code & ec);
  8959. This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
  8960. [heading Parameters]
  8961. [variablelist
  8962. [[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
  8963. ]
  8964. [heading Example]
  8965. boost::asio::ip::tcp::socket socket(my_context);
  8966. ...
  8967. boost::system::error_code ec;
  8968. socket.close(ec);
  8969. if (ec)
  8970. {
  8971. // An error occurred.
  8972. }
  8973. [heading Remarks]
  8974. For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket.
  8975. [endsect]
  8976. [endsect]
  8977. [section:connect basic_raw_socket::connect]
  8978. [indexterm2 boost_asio.indexterm.basic_raw_socket.connect..connect..basic_raw_socket]
  8979. Connect the socket to the specified endpoint.
  8980. void ``[link boost_asio.reference.basic_raw_socket.connect.overload1 connect]``(
  8981. const endpoint_type & peer_endpoint);
  8982. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.connect.overload1 more...]]``
  8983. void ``[link boost_asio.reference.basic_raw_socket.connect.overload2 connect]``(
  8984. const endpoint_type & peer_endpoint,
  8985. boost::system::error_code & ec);
  8986. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.connect.overload2 more...]]``
  8987. [section:overload1 basic_raw_socket::connect (1 of 2 overloads)]
  8988. ['Inherited from basic_socket.]
  8989. Connect the socket to the specified endpoint.
  8990. void connect(
  8991. const endpoint_type & peer_endpoint);
  8992. This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
  8993. The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
  8994. [heading Parameters]
  8995. [variablelist
  8996. [[peer_endpoint][The remote endpoint to which the socket will be connected.]]
  8997. ]
  8998. [heading Exceptions]
  8999. [variablelist
  9000. [[boost::system::system_error][Thrown on failure.]]
  9001. ]
  9002. [heading Example]
  9003. boost::asio::ip::tcp::socket socket(my_context);
  9004. boost::asio::ip::tcp::endpoint endpoint(
  9005. boost::asio::ip::address::from_string("1.2.3.4"), 12345);
  9006. socket.connect(endpoint);
  9007. [endsect]
  9008. [section:overload2 basic_raw_socket::connect (2 of 2 overloads)]
  9009. ['Inherited from basic_socket.]
  9010. Connect the socket to the specified endpoint.
  9011. void connect(
  9012. const endpoint_type & peer_endpoint,
  9013. boost::system::error_code & ec);
  9014. This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
  9015. The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
  9016. [heading Parameters]
  9017. [variablelist
  9018. [[peer_endpoint][The remote endpoint to which the socket will be connected.]]
  9019. [[ec][Set to indicate what error occurred, if any.]]
  9020. ]
  9021. [heading Example]
  9022. boost::asio::ip::tcp::socket socket(my_context);
  9023. boost::asio::ip::tcp::endpoint endpoint(
  9024. boost::asio::ip::address::from_string("1.2.3.4"), 12345);
  9025. boost::system::error_code ec;
  9026. socket.connect(endpoint, ec);
  9027. if (ec)
  9028. {
  9029. // An error occurred.
  9030. }
  9031. [endsect]
  9032. [endsect]
  9033. [section:debug basic_raw_socket::debug]
  9034. ['Inherited from socket_base.]
  9035. [indexterm2 boost_asio.indexterm.basic_raw_socket.debug..debug..basic_raw_socket]
  9036. Socket option to enable socket-level debugging.
  9037. typedef implementation_defined debug;
  9038. Implements the SOL\_SOCKET/SO\_DEBUG socket option.
  9039. [heading Examples]
  9040. Setting the option:
  9041. boost::asio::ip::tcp::socket socket(my_context);
  9042. ...
  9043. boost::asio::socket_base::debug option(true);
  9044. socket.set_option(option);
  9045. Getting the current option value:
  9046. boost::asio::ip::tcp::socket socket(my_context);
  9047. ...
  9048. boost::asio::socket_base::debug option;
  9049. socket.get_option(option);
  9050. bool is_set = option.value();
  9051. [heading Requirements]
  9052. ['Header: ][^boost/asio/basic_raw_socket.hpp]
  9053. ['Convenience header: ][^boost/asio.hpp]
  9054. [endsect]
  9055. [section:do_not_route basic_raw_socket::do_not_route]
  9056. ['Inherited from socket_base.]
  9057. [indexterm2 boost_asio.indexterm.basic_raw_socket.do_not_route..do_not_route..basic_raw_socket]
  9058. Socket option to prevent routing, use local interfaces only.
  9059. typedef implementation_defined do_not_route;
  9060. Implements the SOL\_SOCKET/SO\_DONTROUTE socket option.
  9061. [heading Examples]
  9062. Setting the option:
  9063. boost::asio::ip::udp::socket socket(my_context);
  9064. ...
  9065. boost::asio::socket_base::do_not_route option(true);
  9066. socket.set_option(option);
  9067. Getting the current option value:
  9068. boost::asio::ip::udp::socket socket(my_context);
  9069. ...
  9070. boost::asio::socket_base::do_not_route option;
  9071. socket.get_option(option);
  9072. bool is_set = option.value();
  9073. [heading Requirements]
  9074. ['Header: ][^boost/asio/basic_raw_socket.hpp]
  9075. ['Convenience header: ][^boost/asio.hpp]
  9076. [endsect]
  9077. [section:enable_connection_aborted basic_raw_socket::enable_connection_aborted]
  9078. ['Inherited from socket_base.]
  9079. [indexterm2 boost_asio.indexterm.basic_raw_socket.enable_connection_aborted..enable_connection_aborted..basic_raw_socket]
  9080. Socket option to report aborted connections on accept.
  9081. typedef implementation_defined enable_connection_aborted;
  9082. Implements a custom socket option that determines whether or not an accept operation is permitted to fail with `boost::asio::error::connection_aborted`. By default the option is false.
  9083. [heading Examples]
  9084. Setting the option:
  9085. boost::asio::ip::tcp::acceptor acceptor(my_context);
  9086. ...
  9087. boost::asio::socket_base::enable_connection_aborted option(true);
  9088. acceptor.set_option(option);
  9089. Getting the current option value:
  9090. boost::asio::ip::tcp::acceptor acceptor(my_context);
  9091. ...
  9092. boost::asio::socket_base::enable_connection_aborted option;
  9093. acceptor.get_option(option);
  9094. bool is_set = option.value();
  9095. [heading Requirements]
  9096. ['Header: ][^boost/asio/basic_raw_socket.hpp]
  9097. ['Convenience header: ][^boost/asio.hpp]
  9098. [endsect]
  9099. [section:endpoint_type basic_raw_socket::endpoint_type]
  9100. [indexterm2 boost_asio.indexterm.basic_raw_socket.endpoint_type..endpoint_type..basic_raw_socket]
  9101. The endpoint type.
  9102. typedef Protocol::endpoint endpoint_type;
  9103. [heading Requirements]
  9104. ['Header: ][^boost/asio/basic_raw_socket.hpp]
  9105. ['Convenience header: ][^boost/asio.hpp]
  9106. [endsect]
  9107. [section:executor_type basic_raw_socket::executor_type]
  9108. [indexterm2 boost_asio.indexterm.basic_raw_socket.executor_type..executor_type..basic_raw_socket]
  9109. The type of the executor associated with the object.
  9110. typedef Executor executor_type;
  9111. [heading Requirements]
  9112. ['Header: ][^boost/asio/basic_raw_socket.hpp]
  9113. ['Convenience header: ][^boost/asio.hpp]
  9114. [endsect]
  9115. [section:get_executor basic_raw_socket::get_executor]
  9116. ['Inherited from basic_socket.]
  9117. [indexterm2 boost_asio.indexterm.basic_raw_socket.get_executor..get_executor..basic_raw_socket]
  9118. Get the executor associated with the object.
  9119. executor_type get_executor();
  9120. [endsect]
  9121. [section:get_option basic_raw_socket::get_option]
  9122. [indexterm2 boost_asio.indexterm.basic_raw_socket.get_option..get_option..basic_raw_socket]
  9123. Get an option from the socket.
  9124. template<
  9125. typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
  9126. void ``[link boost_asio.reference.basic_raw_socket.get_option.overload1 get_option]``(
  9127. GettableSocketOption & option) const;
  9128. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.get_option.overload1 more...]]``
  9129. template<
  9130. typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
  9131. void ``[link boost_asio.reference.basic_raw_socket.get_option.overload2 get_option]``(
  9132. GettableSocketOption & option,
  9133. boost::system::error_code & ec) const;
  9134. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.get_option.overload2 more...]]``
  9135. [section:overload1 basic_raw_socket::get_option (1 of 2 overloads)]
  9136. ['Inherited from basic_socket.]
  9137. Get an option from the socket.
  9138. template<
  9139. typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
  9140. void get_option(
  9141. GettableSocketOption & option) const;
  9142. This function is used to get the current value of an option on the socket.
  9143. [heading Parameters]
  9144. [variablelist
  9145. [[option][The option value to be obtained from the socket.]]
  9146. ]
  9147. [heading Exceptions]
  9148. [variablelist
  9149. [[boost::system::system_error][Thrown on failure.]]
  9150. ]
  9151. [heading Example]
  9152. Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option:
  9153. boost::asio::ip::tcp::socket socket(my_context);
  9154. ...
  9155. boost::asio::ip::tcp::socket::keep_alive option;
  9156. socket.get_option(option);
  9157. bool is_set = option.value();
  9158. [endsect]
  9159. [section:overload2 basic_raw_socket::get_option (2 of 2 overloads)]
  9160. ['Inherited from basic_socket.]
  9161. Get an option from the socket.
  9162. template<
  9163. typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
  9164. void get_option(
  9165. GettableSocketOption & option,
  9166. boost::system::error_code & ec) const;
  9167. This function is used to get the current value of an option on the socket.
  9168. [heading Parameters]
  9169. [variablelist
  9170. [[option][The option value to be obtained from the socket.]]
  9171. [[ec][Set to indicate what error occurred, if any.]]
  9172. ]
  9173. [heading Example]
  9174. Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option:
  9175. boost::asio::ip::tcp::socket socket(my_context);
  9176. ...
  9177. boost::asio::ip::tcp::socket::keep_alive option;
  9178. boost::system::error_code ec;
  9179. socket.get_option(option, ec);
  9180. if (ec)
  9181. {
  9182. // An error occurred.
  9183. }
  9184. bool is_set = option.value();
  9185. [endsect]
  9186. [endsect]
  9187. [section:impl_ basic_raw_socket::impl_]
  9188. ['Inherited from basic_socket.]
  9189. [indexterm2 boost_asio.indexterm.basic_raw_socket.impl_..impl_..basic_raw_socket]
  9190. detail::io_object_impl< detail::reactive_socket_service< Protocol >, Executor > impl_;
  9191. [endsect]
  9192. [section:io_control basic_raw_socket::io_control]
  9193. [indexterm2 boost_asio.indexterm.basic_raw_socket.io_control..io_control..basic_raw_socket]
  9194. Perform an IO control command on the socket.
  9195. template<
  9196. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  9197. void ``[link boost_asio.reference.basic_raw_socket.io_control.overload1 io_control]``(
  9198. IoControlCommand & command);
  9199. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.io_control.overload1 more...]]``
  9200. template<
  9201. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  9202. void ``[link boost_asio.reference.basic_raw_socket.io_control.overload2 io_control]``(
  9203. IoControlCommand & command,
  9204. boost::system::error_code & ec);
  9205. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.io_control.overload2 more...]]``
  9206. [section:overload1 basic_raw_socket::io_control (1 of 2 overloads)]
  9207. ['Inherited from basic_socket.]
  9208. Perform an IO control command on the socket.
  9209. template<
  9210. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  9211. void io_control(
  9212. IoControlCommand & command);
  9213. This function is used to execute an IO control command on the socket.
  9214. [heading Parameters]
  9215. [variablelist
  9216. [[command][The IO control command to be performed on the socket.]]
  9217. ]
  9218. [heading Exceptions]
  9219. [variablelist
  9220. [[boost::system::system_error][Thrown on failure.]]
  9221. ]
  9222. [heading Example]
  9223. Getting the number of bytes ready to read:
  9224. boost::asio::ip::tcp::socket socket(my_context);
  9225. ...
  9226. boost::asio::ip::tcp::socket::bytes_readable command;
  9227. socket.io_control(command);
  9228. std::size_t bytes_readable = command.get();
  9229. [endsect]
  9230. [section:overload2 basic_raw_socket::io_control (2 of 2 overloads)]
  9231. ['Inherited from basic_socket.]
  9232. Perform an IO control command on the socket.
  9233. template<
  9234. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  9235. void io_control(
  9236. IoControlCommand & command,
  9237. boost::system::error_code & ec);
  9238. This function is used to execute an IO control command on the socket.
  9239. [heading Parameters]
  9240. [variablelist
  9241. [[command][The IO control command to be performed on the socket.]]
  9242. [[ec][Set to indicate what error occurred, if any.]]
  9243. ]
  9244. [heading Example]
  9245. Getting the number of bytes ready to read:
  9246. boost::asio::ip::tcp::socket socket(my_context);
  9247. ...
  9248. boost::asio::ip::tcp::socket::bytes_readable command;
  9249. boost::system::error_code ec;
  9250. socket.io_control(command, ec);
  9251. if (ec)
  9252. {
  9253. // An error occurred.
  9254. }
  9255. std::size_t bytes_readable = command.get();
  9256. [endsect]
  9257. [endsect]
  9258. [section:is_open basic_raw_socket::is_open]
  9259. ['Inherited from basic_socket.]
  9260. [indexterm2 boost_asio.indexterm.basic_raw_socket.is_open..is_open..basic_raw_socket]
  9261. Determine whether the socket is open.
  9262. bool is_open() const;
  9263. [endsect]
  9264. [section:keep_alive basic_raw_socket::keep_alive]
  9265. ['Inherited from socket_base.]
  9266. [indexterm2 boost_asio.indexterm.basic_raw_socket.keep_alive..keep_alive..basic_raw_socket]
  9267. Socket option to send keep-alives.
  9268. typedef implementation_defined keep_alive;
  9269. Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option.
  9270. [heading Examples]
  9271. Setting the option:
  9272. boost::asio::ip::tcp::socket socket(my_context);
  9273. ...
  9274. boost::asio::socket_base::keep_alive option(true);
  9275. socket.set_option(option);
  9276. Getting the current option value:
  9277. boost::asio::ip::tcp::socket socket(my_context);
  9278. ...
  9279. boost::asio::socket_base::keep_alive option;
  9280. socket.get_option(option);
  9281. bool is_set = option.value();
  9282. [heading Requirements]
  9283. ['Header: ][^boost/asio/basic_raw_socket.hpp]
  9284. ['Convenience header: ][^boost/asio.hpp]
  9285. [endsect]
  9286. [section:linger basic_raw_socket::linger]
  9287. ['Inherited from socket_base.]
  9288. [indexterm2 boost_asio.indexterm.basic_raw_socket.linger..linger..basic_raw_socket]
  9289. Socket option to specify whether the socket lingers on close if unsent data is present.
  9290. typedef implementation_defined linger;
  9291. Implements the SOL\_SOCKET/SO\_LINGER socket option.
  9292. [heading Examples]
  9293. Setting the option:
  9294. boost::asio::ip::tcp::socket socket(my_context);
  9295. ...
  9296. boost::asio::socket_base::linger option(true, 30);
  9297. socket.set_option(option);
  9298. Getting the current option value:
  9299. boost::asio::ip::tcp::socket socket(my_context);
  9300. ...
  9301. boost::asio::socket_base::linger option;
  9302. socket.get_option(option);
  9303. bool is_set = option.enabled();
  9304. unsigned short timeout = option.timeout();
  9305. [heading Requirements]
  9306. ['Header: ][^boost/asio/basic_raw_socket.hpp]
  9307. ['Convenience header: ][^boost/asio.hpp]
  9308. [endsect]
  9309. [section:local_endpoint basic_raw_socket::local_endpoint]
  9310. [indexterm2 boost_asio.indexterm.basic_raw_socket.local_endpoint..local_endpoint..basic_raw_socket]
  9311. Get the local endpoint of the socket.
  9312. endpoint_type ``[link boost_asio.reference.basic_raw_socket.local_endpoint.overload1 local_endpoint]``() const;
  9313. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.local_endpoint.overload1 more...]]``
  9314. endpoint_type ``[link boost_asio.reference.basic_raw_socket.local_endpoint.overload2 local_endpoint]``(
  9315. boost::system::error_code & ec) const;
  9316. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.local_endpoint.overload2 more...]]``
  9317. [section:overload1 basic_raw_socket::local_endpoint (1 of 2 overloads)]
  9318. ['Inherited from basic_socket.]
  9319. Get the local endpoint of the socket.
  9320. endpoint_type local_endpoint() const;
  9321. This function is used to obtain the locally bound endpoint of the socket.
  9322. [heading Return Value]
  9323. An object that represents the local endpoint of the socket.
  9324. [heading Exceptions]
  9325. [variablelist
  9326. [[boost::system::system_error][Thrown on failure.]]
  9327. ]
  9328. [heading Example]
  9329. boost::asio::ip::tcp::socket socket(my_context);
  9330. ...
  9331. boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint();
  9332. [endsect]
  9333. [section:overload2 basic_raw_socket::local_endpoint (2 of 2 overloads)]
  9334. ['Inherited from basic_socket.]
  9335. Get the local endpoint of the socket.
  9336. endpoint_type local_endpoint(
  9337. boost::system::error_code & ec) const;
  9338. This function is used to obtain the locally bound endpoint of the socket.
  9339. [heading Parameters]
  9340. [variablelist
  9341. [[ec][Set to indicate what error occurred, if any.]]
  9342. ]
  9343. [heading Return Value]
  9344. An object that represents the local endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
  9345. [heading Example]
  9346. boost::asio::ip::tcp::socket socket(my_context);
  9347. ...
  9348. boost::system::error_code ec;
  9349. boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(ec);
  9350. if (ec)
  9351. {
  9352. // An error occurred.
  9353. }
  9354. [endsect]
  9355. [endsect]
  9356. [section:lowest_layer basic_raw_socket::lowest_layer]
  9357. [indexterm2 boost_asio.indexterm.basic_raw_socket.lowest_layer..lowest_layer..basic_raw_socket]
  9358. Get a reference to the lowest layer.
  9359. lowest_layer_type & ``[link boost_asio.reference.basic_raw_socket.lowest_layer.overload1 lowest_layer]``();
  9360. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.lowest_layer.overload1 more...]]``
  9361. Get a const reference to the lowest layer.
  9362. const lowest_layer_type & ``[link boost_asio.reference.basic_raw_socket.lowest_layer.overload2 lowest_layer]``() const;
  9363. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.lowest_layer.overload2 more...]]``
  9364. [section:overload1 basic_raw_socket::lowest_layer (1 of 2 overloads)]
  9365. ['Inherited from basic_socket.]
  9366. Get a reference to the lowest layer.
  9367. lowest_layer_type & lowest_layer();
  9368. This function returns a reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
  9369. [heading Return Value]
  9370. A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
  9371. [endsect]
  9372. [section:overload2 basic_raw_socket::lowest_layer (2 of 2 overloads)]
  9373. ['Inherited from basic_socket.]
  9374. Get a const reference to the lowest layer.
  9375. const lowest_layer_type & lowest_layer() const;
  9376. This function returns a const reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
  9377. [heading Return Value]
  9378. A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
  9379. [endsect]
  9380. [endsect]
  9381. [section:lowest_layer_type basic_raw_socket::lowest_layer_type]
  9382. ['Inherited from basic_socket.]
  9383. [indexterm2 boost_asio.indexterm.basic_raw_socket.lowest_layer_type..lowest_layer_type..basic_raw_socket]
  9384. A [link boost_asio.reference.basic_socket `basic_socket`] is always the lowest layer.
  9385. typedef basic_socket< Protocol, Executor > lowest_layer_type;
  9386. [heading Types]
  9387. [table
  9388. [[Name][Description]]
  9389. [
  9390. [[link boost_asio.reference.basic_socket__rebind_executor [*rebind_executor]]]
  9391. [Rebinds the socket type to another executor. ]
  9392. ]
  9393. [
  9394. [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]]
  9395. [Socket option to permit sending of broadcast messages. ]
  9396. ]
  9397. [
  9398. [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]]
  9399. [IO control command to get the amount of data that can be read without blocking. ]
  9400. ]
  9401. [
  9402. [[link boost_asio.reference.basic_socket.debug [*debug]]]
  9403. [Socket option to enable socket-level debugging. ]
  9404. ]
  9405. [
  9406. [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]]
  9407. [Socket option to prevent routing, use local interfaces only. ]
  9408. ]
  9409. [
  9410. [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]]
  9411. [Socket option to report aborted connections on accept. ]
  9412. ]
  9413. [
  9414. [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]]
  9415. [The endpoint type. ]
  9416. ]
  9417. [
  9418. [[link boost_asio.reference.basic_socket.executor_type [*executor_type]]]
  9419. [The type of the executor associated with the object. ]
  9420. ]
  9421. [
  9422. [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]]
  9423. [Socket option to send keep-alives. ]
  9424. ]
  9425. [
  9426. [[link boost_asio.reference.basic_socket.linger [*linger]]]
  9427. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  9428. ]
  9429. [
  9430. [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]]
  9431. [A basic_socket is always the lowest layer. ]
  9432. ]
  9433. [
  9434. [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]]
  9435. [Bitmask type for flags that can be passed to send and receive operations. ]
  9436. ]
  9437. [
  9438. [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]]
  9439. [The native representation of a socket. ]
  9440. ]
  9441. [
  9442. [[link boost_asio.reference.basic_socket.out_of_band_inline [*out_of_band_inline]]]
  9443. [Socket option for putting received out-of-band data inline. ]
  9444. ]
  9445. [
  9446. [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]]
  9447. [The protocol type. ]
  9448. ]
  9449. [
  9450. [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]]
  9451. [Socket option for the receive buffer size of a socket. ]
  9452. ]
  9453. [
  9454. [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]]
  9455. [Socket option for the receive low watermark. ]
  9456. ]
  9457. [
  9458. [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]]
  9459. [Socket option to allow the socket to be bound to an address that is already in use. ]
  9460. ]
  9461. [
  9462. [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]]
  9463. [Socket option for the send buffer size of a socket. ]
  9464. ]
  9465. [
  9466. [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]]
  9467. [Socket option for the send low watermark. ]
  9468. ]
  9469. [
  9470. [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]]
  9471. [Different ways a socket may be shutdown. ]
  9472. ]
  9473. [
  9474. [[link boost_asio.reference.basic_socket.wait_type [*wait_type]]]
  9475. [Wait types. ]
  9476. ]
  9477. ]
  9478. [heading Member Functions]
  9479. [table
  9480. [[Name][Description]]
  9481. [
  9482. [[link boost_asio.reference.basic_socket.assign [*assign]]]
  9483. [Assign an existing native socket to the socket. ]
  9484. ]
  9485. [
  9486. [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]]
  9487. [Start an asynchronous connect. ]
  9488. ]
  9489. [
  9490. [[link boost_asio.reference.basic_socket.async_wait [*async_wait]]]
  9491. [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  9492. ]
  9493. [
  9494. [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]]
  9495. [Determine whether the socket is at the out-of-band data mark. ]
  9496. ]
  9497. [
  9498. [[link boost_asio.reference.basic_socket.available [*available]]]
  9499. [Determine the number of bytes available for reading. ]
  9500. ]
  9501. [
  9502. [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]]]
  9503. [Construct a basic_socket without opening it.
  9504. [hr]
  9505. Construct and open a basic_socket.
  9506. [hr]
  9507. Construct a basic_socket, opening it and binding it to the given local endpoint.
  9508. [hr]
  9509. Construct a basic_socket on an existing native socket.
  9510. [hr]
  9511. Move-construct a basic_socket from another.
  9512. [hr]
  9513. Move-construct a basic_socket from a socket of another protocol type. ]
  9514. ]
  9515. [
  9516. [[link boost_asio.reference.basic_socket.bind [*bind]]]
  9517. [Bind the socket to the given local endpoint. ]
  9518. ]
  9519. [
  9520. [[link boost_asio.reference.basic_socket.cancel [*cancel]]]
  9521. [Cancel all asynchronous operations associated with the socket. ]
  9522. ]
  9523. [
  9524. [[link boost_asio.reference.basic_socket.close [*close]]]
  9525. [Close the socket. ]
  9526. ]
  9527. [
  9528. [[link boost_asio.reference.basic_socket.connect [*connect]]]
  9529. [Connect the socket to the specified endpoint. ]
  9530. ]
  9531. [
  9532. [[link boost_asio.reference.basic_socket.get_executor [*get_executor]]]
  9533. [Get the executor associated with the object. ]
  9534. ]
  9535. [
  9536. [[link boost_asio.reference.basic_socket.get_option [*get_option]]]
  9537. [Get an option from the socket. ]
  9538. ]
  9539. [
  9540. [[link boost_asio.reference.basic_socket.io_control [*io_control]]]
  9541. [Perform an IO control command on the socket. ]
  9542. ]
  9543. [
  9544. [[link boost_asio.reference.basic_socket.is_open [*is_open]]]
  9545. [Determine whether the socket is open. ]
  9546. ]
  9547. [
  9548. [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]]
  9549. [Get the local endpoint of the socket. ]
  9550. ]
  9551. [
  9552. [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]]
  9553. [Get a reference to the lowest layer.
  9554. [hr]
  9555. Get a const reference to the lowest layer. ]
  9556. ]
  9557. [
  9558. [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]]
  9559. [Get the native socket representation. ]
  9560. ]
  9561. [
  9562. [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]]
  9563. [Gets the non-blocking mode of the native socket implementation.
  9564. [hr]
  9565. Sets the non-blocking mode of the native socket implementation. ]
  9566. ]
  9567. [
  9568. [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]]
  9569. [Gets the non-blocking mode of the socket.
  9570. [hr]
  9571. Sets the non-blocking mode of the socket. ]
  9572. ]
  9573. [
  9574. [[link boost_asio.reference.basic_socket.open [*open]]]
  9575. [Open the socket using the specified protocol. ]
  9576. ]
  9577. [
  9578. [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]]
  9579. [Move-assign a basic_socket from another.
  9580. [hr]
  9581. Move-assign a basic_socket from a socket of another protocol type. ]
  9582. ]
  9583. [
  9584. [[link boost_asio.reference.basic_socket.release [*release]]]
  9585. [Release ownership of the underlying native socket. ]
  9586. ]
  9587. [
  9588. [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]]
  9589. [Get the remote endpoint of the socket. ]
  9590. ]
  9591. [
  9592. [[link boost_asio.reference.basic_socket.set_option [*set_option]]]
  9593. [Set an option on the socket. ]
  9594. ]
  9595. [
  9596. [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]]
  9597. [Disable sends or receives on the socket. ]
  9598. ]
  9599. [
  9600. [[link boost_asio.reference.basic_socket.wait [*wait]]]
  9601. [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  9602. ]
  9603. ]
  9604. [heading Protected Member Functions]
  9605. [table
  9606. [[Name][Description]]
  9607. [
  9608. [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]]]
  9609. [Protected destructor to prevent deletion through this type. ]
  9610. ]
  9611. ]
  9612. [heading Data Members]
  9613. [table
  9614. [[Name][Description]]
  9615. [
  9616. [[link boost_asio.reference.basic_socket.max_connections [*max_connections]]]
  9617. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  9618. ]
  9619. [
  9620. [[link boost_asio.reference.basic_socket.max_listen_connections [*max_listen_connections]]]
  9621. [The maximum length of the queue of pending incoming connections. ]
  9622. ]
  9623. [
  9624. [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]]]
  9625. [Specify that the data should not be subject to routing. ]
  9626. ]
  9627. [
  9628. [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]]]
  9629. [Specifies that the data marks the end of a record. ]
  9630. ]
  9631. [
  9632. [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]]]
  9633. [Process out-of-band data. ]
  9634. ]
  9635. [
  9636. [[link boost_asio.reference.basic_socket.message_peek [*message_peek]]]
  9637. [Peek at incoming data without removing it from the input queue. ]
  9638. ]
  9639. ]
  9640. [heading Protected Data Members]
  9641. [table
  9642. [[Name][Description]]
  9643. [
  9644. [[link boost_asio.reference.basic_socket.impl_ [*impl_]]]
  9645. []
  9646. ]
  9647. ]
  9648. The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
  9649. [heading Thread Safety]
  9650. ['Distinct] ['objects:] Safe.
  9651. ['Shared] ['objects:] Unsafe.
  9652. [heading Requirements]
  9653. ['Header: ][^boost/asio/basic_raw_socket.hpp]
  9654. ['Convenience header: ][^boost/asio.hpp]
  9655. [endsect]
  9656. [section:max_connections basic_raw_socket::max_connections]
  9657. ['Inherited from socket_base.]
  9658. [indexterm2 boost_asio.indexterm.basic_raw_socket.max_connections..max_connections..basic_raw_socket]
  9659. (Deprecated: Use max\_listen\_connections.) The maximum length of the queue of pending incoming connections.
  9660. static const int max_connections = implementation_defined;
  9661. [endsect]
  9662. [section:max_listen_connections basic_raw_socket::max_listen_connections]
  9663. ['Inherited from socket_base.]
  9664. [indexterm2 boost_asio.indexterm.basic_raw_socket.max_listen_connections..max_listen_connections..basic_raw_socket]
  9665. The maximum length of the queue of pending incoming connections.
  9666. static const int max_listen_connections = implementation_defined;
  9667. [endsect]
  9668. [section:message_do_not_route basic_raw_socket::message_do_not_route]
  9669. ['Inherited from socket_base.]
  9670. [indexterm2 boost_asio.indexterm.basic_raw_socket.message_do_not_route..message_do_not_route..basic_raw_socket]
  9671. Specify that the data should not be subject to routing.
  9672. static const int message_do_not_route = implementation_defined;
  9673. [endsect]
  9674. [section:message_end_of_record basic_raw_socket::message_end_of_record]
  9675. ['Inherited from socket_base.]
  9676. [indexterm2 boost_asio.indexterm.basic_raw_socket.message_end_of_record..message_end_of_record..basic_raw_socket]
  9677. Specifies that the data marks the end of a record.
  9678. static const int message_end_of_record = implementation_defined;
  9679. [endsect]
  9680. [section:message_flags basic_raw_socket::message_flags]
  9681. ['Inherited from socket_base.]
  9682. [indexterm2 boost_asio.indexterm.basic_raw_socket.message_flags..message_flags..basic_raw_socket]
  9683. Bitmask type for flags that can be passed to send and receive operations.
  9684. typedef int message_flags;
  9685. [heading Requirements]
  9686. ['Header: ][^boost/asio/basic_raw_socket.hpp]
  9687. ['Convenience header: ][^boost/asio.hpp]
  9688. [endsect]
  9689. [section:message_out_of_band basic_raw_socket::message_out_of_band]
  9690. ['Inherited from socket_base.]
  9691. [indexterm2 boost_asio.indexterm.basic_raw_socket.message_out_of_band..message_out_of_band..basic_raw_socket]
  9692. Process out-of-band data.
  9693. static const int message_out_of_band = implementation_defined;
  9694. [endsect]
  9695. [section:message_peek basic_raw_socket::message_peek]
  9696. ['Inherited from socket_base.]
  9697. [indexterm2 boost_asio.indexterm.basic_raw_socket.message_peek..message_peek..basic_raw_socket]
  9698. Peek at incoming data without removing it from the input queue.
  9699. static const int message_peek = implementation_defined;
  9700. [endsect]
  9701. [section:native_handle basic_raw_socket::native_handle]
  9702. ['Inherited from basic_socket.]
  9703. [indexterm2 boost_asio.indexterm.basic_raw_socket.native_handle..native_handle..basic_raw_socket]
  9704. Get the native socket representation.
  9705. native_handle_type native_handle();
  9706. This function may be used to obtain the underlying representation of the socket. This is intended to allow access to native socket functionality that is not otherwise provided.
  9707. [endsect]
  9708. [section:native_handle_type basic_raw_socket::native_handle_type]
  9709. [indexterm2 boost_asio.indexterm.basic_raw_socket.native_handle_type..native_handle_type..basic_raw_socket]
  9710. The native representation of a socket.
  9711. typedef implementation_defined native_handle_type;
  9712. [heading Requirements]
  9713. ['Header: ][^boost/asio/basic_raw_socket.hpp]
  9714. ['Convenience header: ][^boost/asio.hpp]
  9715. [endsect]
  9716. [section:native_non_blocking basic_raw_socket::native_non_blocking]
  9717. [indexterm2 boost_asio.indexterm.basic_raw_socket.native_non_blocking..native_non_blocking..basic_raw_socket]
  9718. Gets the non-blocking mode of the native socket implementation.
  9719. bool ``[link boost_asio.reference.basic_raw_socket.native_non_blocking.overload1 native_non_blocking]``() const;
  9720. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.native_non_blocking.overload1 more...]]``
  9721. Sets the non-blocking mode of the native socket implementation.
  9722. void ``[link boost_asio.reference.basic_raw_socket.native_non_blocking.overload2 native_non_blocking]``(
  9723. bool mode);
  9724. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.native_non_blocking.overload2 more...]]``
  9725. void ``[link boost_asio.reference.basic_raw_socket.native_non_blocking.overload3 native_non_blocking]``(
  9726. bool mode,
  9727. boost::system::error_code & ec);
  9728. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.native_non_blocking.overload3 more...]]``
  9729. [section:overload1 basic_raw_socket::native_non_blocking (1 of 3 overloads)]
  9730. ['Inherited from basic_socket.]
  9731. Gets the non-blocking mode of the native socket implementation.
  9732. bool native_non_blocking() const;
  9733. This function is used to retrieve the non-blocking mode of the underlying native socket. This mode has no effect on the behaviour of the socket object's synchronous operations.
  9734. [heading Return Value]
  9735. `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).
  9736. [heading Remarks]
  9737. The current non-blocking mode is cached by the socket object. Consequently, the return value may be incorrect if the non-blocking mode was set directly on the native socket.
  9738. [heading Example]
  9739. This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
  9740. template <typename Handler>
  9741. struct sendfile_op
  9742. {
  9743. tcp::socket& sock_;
  9744. int fd_;
  9745. Handler handler_;
  9746. off_t offset_;
  9747. std::size_t total_bytes_transferred_;
  9748. // Function call operator meeting WriteHandler requirements.
  9749. // Used as the handler for the async_write_some operation.
  9750. void operator()(boost::system::error_code ec, std::size_t)
  9751. {
  9752. // Put the underlying socket into non-blocking mode.
  9753. if (!ec)
  9754. if (!sock_.native_non_blocking())
  9755. sock_.native_non_blocking(true, ec);
  9756. if (!ec)
  9757. {
  9758. for (;;)
  9759. {
  9760. // Try the system call.
  9761. errno = 0;
  9762. int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
  9763. ec = boost::system::error_code(n < 0 ? errno : 0,
  9764. boost::asio::error::get_system_category());
  9765. total_bytes_transferred_ += ec ? 0 : n;
  9766. // Retry operation immediately if interrupted by signal.
  9767. if (ec == boost::asio::error::interrupted)
  9768. continue;
  9769. // Check if we need to run the operation again.
  9770. if (ec == boost::asio::error::would_block
  9771. || ec == boost::asio::error::try_again)
  9772. {
  9773. // We have to wait for the socket to become ready again.
  9774. sock_.async_wait(tcp::socket::wait_write, *this);
  9775. return;
  9776. }
  9777. if (ec || n == 0)
  9778. {
  9779. // An error occurred, or we have reached the end of the file.
  9780. // Either way we must exit the loop so we can call the handler.
  9781. break;
  9782. }
  9783. // Loop around to try calling sendfile again.
  9784. }
  9785. }
  9786. // Pass result back to user's handler.
  9787. handler_(ec, total_bytes_transferred_);
  9788. }
  9789. };
  9790. template <typename Handler>
  9791. void async_sendfile(tcp::socket& sock, int fd, Handler h)
  9792. {
  9793. sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
  9794. sock.async_wait(tcp::socket::wait_write, op);
  9795. }
  9796. [endsect]
  9797. [section:overload2 basic_raw_socket::native_non_blocking (2 of 3 overloads)]
  9798. ['Inherited from basic_socket.]
  9799. Sets the non-blocking mode of the native socket implementation.
  9800. void native_non_blocking(
  9801. bool mode);
  9802. This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
  9803. [heading Parameters]
  9804. [variablelist
  9805. [[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).]]
  9806. ]
  9807. [heading Exceptions]
  9808. [variablelist
  9809. [[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.]]
  9810. ]
  9811. [heading Example]
  9812. This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
  9813. template <typename Handler>
  9814. struct sendfile_op
  9815. {
  9816. tcp::socket& sock_;
  9817. int fd_;
  9818. Handler handler_;
  9819. off_t offset_;
  9820. std::size_t total_bytes_transferred_;
  9821. // Function call operator meeting WriteHandler requirements.
  9822. // Used as the handler for the async_write_some operation.
  9823. void operator()(boost::system::error_code ec, std::size_t)
  9824. {
  9825. // Put the underlying socket into non-blocking mode.
  9826. if (!ec)
  9827. if (!sock_.native_non_blocking())
  9828. sock_.native_non_blocking(true, ec);
  9829. if (!ec)
  9830. {
  9831. for (;;)
  9832. {
  9833. // Try the system call.
  9834. errno = 0;
  9835. int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
  9836. ec = boost::system::error_code(n < 0 ? errno : 0,
  9837. boost::asio::error::get_system_category());
  9838. total_bytes_transferred_ += ec ? 0 : n;
  9839. // Retry operation immediately if interrupted by signal.
  9840. if (ec == boost::asio::error::interrupted)
  9841. continue;
  9842. // Check if we need to run the operation again.
  9843. if (ec == boost::asio::error::would_block
  9844. || ec == boost::asio::error::try_again)
  9845. {
  9846. // We have to wait for the socket to become ready again.
  9847. sock_.async_wait(tcp::socket::wait_write, *this);
  9848. return;
  9849. }
  9850. if (ec || n == 0)
  9851. {
  9852. // An error occurred, or we have reached the end of the file.
  9853. // Either way we must exit the loop so we can call the handler.
  9854. break;
  9855. }
  9856. // Loop around to try calling sendfile again.
  9857. }
  9858. }
  9859. // Pass result back to user's handler.
  9860. handler_(ec, total_bytes_transferred_);
  9861. }
  9862. };
  9863. template <typename Handler>
  9864. void async_sendfile(tcp::socket& sock, int fd, Handler h)
  9865. {
  9866. sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
  9867. sock.async_wait(tcp::socket::wait_write, op);
  9868. }
  9869. [endsect]
  9870. [section:overload3 basic_raw_socket::native_non_blocking (3 of 3 overloads)]
  9871. ['Inherited from basic_socket.]
  9872. Sets the non-blocking mode of the native socket implementation.
  9873. void native_non_blocking(
  9874. bool mode,
  9875. boost::system::error_code & ec);
  9876. This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
  9877. [heading Parameters]
  9878. [variablelist
  9879. [[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).]]
  9880. [[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.]]
  9881. ]
  9882. [heading Example]
  9883. This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
  9884. template <typename Handler>
  9885. struct sendfile_op
  9886. {
  9887. tcp::socket& sock_;
  9888. int fd_;
  9889. Handler handler_;
  9890. off_t offset_;
  9891. std::size_t total_bytes_transferred_;
  9892. // Function call operator meeting WriteHandler requirements.
  9893. // Used as the handler for the async_write_some operation.
  9894. void operator()(boost::system::error_code ec, std::size_t)
  9895. {
  9896. // Put the underlying socket into non-blocking mode.
  9897. if (!ec)
  9898. if (!sock_.native_non_blocking())
  9899. sock_.native_non_blocking(true, ec);
  9900. if (!ec)
  9901. {
  9902. for (;;)
  9903. {
  9904. // Try the system call.
  9905. errno = 0;
  9906. int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
  9907. ec = boost::system::error_code(n < 0 ? errno : 0,
  9908. boost::asio::error::get_system_category());
  9909. total_bytes_transferred_ += ec ? 0 : n;
  9910. // Retry operation immediately if interrupted by signal.
  9911. if (ec == boost::asio::error::interrupted)
  9912. continue;
  9913. // Check if we need to run the operation again.
  9914. if (ec == boost::asio::error::would_block
  9915. || ec == boost::asio::error::try_again)
  9916. {
  9917. // We have to wait for the socket to become ready again.
  9918. sock_.async_wait(tcp::socket::wait_write, *this);
  9919. return;
  9920. }
  9921. if (ec || n == 0)
  9922. {
  9923. // An error occurred, or we have reached the end of the file.
  9924. // Either way we must exit the loop so we can call the handler.
  9925. break;
  9926. }
  9927. // Loop around to try calling sendfile again.
  9928. }
  9929. }
  9930. // Pass result back to user's handler.
  9931. handler_(ec, total_bytes_transferred_);
  9932. }
  9933. };
  9934. template <typename Handler>
  9935. void async_sendfile(tcp::socket& sock, int fd, Handler h)
  9936. {
  9937. sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
  9938. sock.async_wait(tcp::socket::wait_write, op);
  9939. }
  9940. [endsect]
  9941. [endsect]
  9942. [section:non_blocking basic_raw_socket::non_blocking]
  9943. [indexterm2 boost_asio.indexterm.basic_raw_socket.non_blocking..non_blocking..basic_raw_socket]
  9944. Gets the non-blocking mode of the socket.
  9945. bool ``[link boost_asio.reference.basic_raw_socket.non_blocking.overload1 non_blocking]``() const;
  9946. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.non_blocking.overload1 more...]]``
  9947. Sets the non-blocking mode of the socket.
  9948. void ``[link boost_asio.reference.basic_raw_socket.non_blocking.overload2 non_blocking]``(
  9949. bool mode);
  9950. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.non_blocking.overload2 more...]]``
  9951. void ``[link boost_asio.reference.basic_raw_socket.non_blocking.overload3 non_blocking]``(
  9952. bool mode,
  9953. boost::system::error_code & ec);
  9954. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.non_blocking.overload3 more...]]``
  9955. [section:overload1 basic_raw_socket::non_blocking (1 of 3 overloads)]
  9956. ['Inherited from basic_socket.]
  9957. Gets the non-blocking mode of the socket.
  9958. bool non_blocking() const;
  9959. [heading Return Value]
  9960. `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.
  9961. [heading Remarks]
  9962. The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
  9963. [endsect]
  9964. [section:overload2 basic_raw_socket::non_blocking (2 of 3 overloads)]
  9965. ['Inherited from basic_socket.]
  9966. Sets the non-blocking mode of the socket.
  9967. void non_blocking(
  9968. bool mode);
  9969. [heading Parameters]
  9970. [variablelist
  9971. [[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.]]
  9972. ]
  9973. [heading Exceptions]
  9974. [variablelist
  9975. [[boost::system::system_error][Thrown on failure.]]
  9976. ]
  9977. [heading Remarks]
  9978. The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
  9979. [endsect]
  9980. [section:overload3 basic_raw_socket::non_blocking (3 of 3 overloads)]
  9981. ['Inherited from basic_socket.]
  9982. Sets the non-blocking mode of the socket.
  9983. void non_blocking(
  9984. bool mode,
  9985. boost::system::error_code & ec);
  9986. [heading Parameters]
  9987. [variablelist
  9988. [[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.]]
  9989. [[ec][Set to indicate what error occurred, if any.]]
  9990. ]
  9991. [heading Remarks]
  9992. The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
  9993. [endsect]
  9994. [endsect]
  9995. [section:open basic_raw_socket::open]
  9996. [indexterm2 boost_asio.indexterm.basic_raw_socket.open..open..basic_raw_socket]
  9997. Open the socket using the specified protocol.
  9998. void ``[link boost_asio.reference.basic_raw_socket.open.overload1 open]``(
  9999. const protocol_type & protocol = protocol_type());
  10000. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.open.overload1 more...]]``
  10001. void ``[link boost_asio.reference.basic_raw_socket.open.overload2 open]``(
  10002. const protocol_type & protocol,
  10003. boost::system::error_code & ec);
  10004. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.open.overload2 more...]]``
  10005. [section:overload1 basic_raw_socket::open (1 of 2 overloads)]
  10006. ['Inherited from basic_socket.]
  10007. Open the socket using the specified protocol.
  10008. void open(
  10009. const protocol_type & protocol = protocol_type());
  10010. This function opens the socket so that it will use the specified protocol.
  10011. [heading Parameters]
  10012. [variablelist
  10013. [[protocol][An object specifying protocol parameters to be used.]]
  10014. ]
  10015. [heading Exceptions]
  10016. [variablelist
  10017. [[boost::system::system_error][Thrown on failure.]]
  10018. ]
  10019. [heading Example]
  10020. boost::asio::ip::tcp::socket socket(my_context);
  10021. socket.open(boost::asio::ip::tcp::v4());
  10022. [endsect]
  10023. [section:overload2 basic_raw_socket::open (2 of 2 overloads)]
  10024. ['Inherited from basic_socket.]
  10025. Open the socket using the specified protocol.
  10026. void open(
  10027. const protocol_type & protocol,
  10028. boost::system::error_code & ec);
  10029. This function opens the socket so that it will use the specified protocol.
  10030. [heading Parameters]
  10031. [variablelist
  10032. [[protocol][An object specifying which protocol is to be used.]]
  10033. [[ec][Set to indicate what error occurred, if any.]]
  10034. ]
  10035. [heading Example]
  10036. boost::asio::ip::tcp::socket socket(my_context);
  10037. boost::system::error_code ec;
  10038. socket.open(boost::asio::ip::tcp::v4(), ec);
  10039. if (ec)
  10040. {
  10041. // An error occurred.
  10042. }
  10043. [endsect]
  10044. [endsect]
  10045. [section:operator_eq_ basic_raw_socket::operator=]
  10046. [indexterm2 boost_asio.indexterm.basic_raw_socket.operator_eq_..operator=..basic_raw_socket]
  10047. Move-assign a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] from another.
  10048. basic_raw_socket & ``[link boost_asio.reference.basic_raw_socket.operator_eq_.overload1 operator=]``(
  10049. basic_raw_socket && other);
  10050. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.operator_eq_.overload1 more...]]``
  10051. Move-assign a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] from a socket of another protocol type.
  10052. template<
  10053. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  10054. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  10055. enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_raw_socket & >::type ``[link boost_asio.reference.basic_raw_socket.operator_eq_.overload2 operator=]``(
  10056. basic_raw_socket< Protocol1, Executor1 > && other);
  10057. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.operator_eq_.overload2 more...]]``
  10058. [section:overload1 basic_raw_socket::operator= (1 of 2 overloads)]
  10059. Move-assign a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] from another.
  10060. basic_raw_socket & operator=(
  10061. basic_raw_socket && other);
  10062. This assignment operator moves a raw socket from one object to another.
  10063. [heading Parameters]
  10064. [variablelist
  10065. [[other][The other [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] object from which the move will occur.]]
  10066. ]
  10067. [heading Remarks]
  10068. Following the move, the moved-from object is in the same state as if constructed using the `basic_raw_socket(const executor_type&)` constructor.
  10069. [endsect]
  10070. [section:overload2 basic_raw_socket::operator= (2 of 2 overloads)]
  10071. Move-assign a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] from a socket of another protocol type.
  10072. template<
  10073. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  10074. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  10075. enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_raw_socket & >::type operator=(
  10076. basic_raw_socket< Protocol1, Executor1 > && other);
  10077. This assignment operator moves a raw socket from one object to another.
  10078. [heading Parameters]
  10079. [variablelist
  10080. [[other][The other [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] object from which the move will occur.]]
  10081. ]
  10082. [heading Remarks]
  10083. Following the move, the moved-from object is in the same state as if constructed using the `basic_raw_socket(const executor_type&)` constructor.
  10084. [endsect]
  10085. [endsect]
  10086. [section:out_of_band_inline basic_raw_socket::out_of_band_inline]
  10087. ['Inherited from socket_base.]
  10088. [indexterm2 boost_asio.indexterm.basic_raw_socket.out_of_band_inline..out_of_band_inline..basic_raw_socket]
  10089. Socket option for putting received out-of-band data inline.
  10090. typedef implementation_defined out_of_band_inline;
  10091. Implements the SOL\_SOCKET/SO\_OOBINLINE socket option.
  10092. [heading Examples]
  10093. Setting the option:
  10094. boost::asio::ip::tcp::socket socket(my_context);
  10095. ...
  10096. boost::asio::socket_base::out_of_band_inline option(true);
  10097. socket.set_option(option);
  10098. Getting the current option value:
  10099. boost::asio::ip::tcp::socket socket(my_context);
  10100. ...
  10101. boost::asio::socket_base::out_of_band_inline option;
  10102. socket.get_option(option);
  10103. bool value = option.value();
  10104. [heading Requirements]
  10105. ['Header: ][^boost/asio/basic_raw_socket.hpp]
  10106. ['Convenience header: ][^boost/asio.hpp]
  10107. [endsect]
  10108. [section:protocol_type basic_raw_socket::protocol_type]
  10109. [indexterm2 boost_asio.indexterm.basic_raw_socket.protocol_type..protocol_type..basic_raw_socket]
  10110. The protocol type.
  10111. typedef Protocol protocol_type;
  10112. [heading Requirements]
  10113. ['Header: ][^boost/asio/basic_raw_socket.hpp]
  10114. ['Convenience header: ][^boost/asio.hpp]
  10115. [endsect]
  10116. [section:receive basic_raw_socket::receive]
  10117. [indexterm2 boost_asio.indexterm.basic_raw_socket.receive..receive..basic_raw_socket]
  10118. Receive some data on a connected socket.
  10119. template<
  10120. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  10121. std::size_t ``[link boost_asio.reference.basic_raw_socket.receive.overload1 receive]``(
  10122. const MutableBufferSequence & buffers);
  10123. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.receive.overload1 more...]]``
  10124. template<
  10125. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  10126. std::size_t ``[link boost_asio.reference.basic_raw_socket.receive.overload2 receive]``(
  10127. const MutableBufferSequence & buffers,
  10128. socket_base::message_flags flags);
  10129. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.receive.overload2 more...]]``
  10130. template<
  10131. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  10132. std::size_t ``[link boost_asio.reference.basic_raw_socket.receive.overload3 receive]``(
  10133. const MutableBufferSequence & buffers,
  10134. socket_base::message_flags flags,
  10135. boost::system::error_code & ec);
  10136. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.receive.overload3 more...]]``
  10137. [section:overload1 basic_raw_socket::receive (1 of 3 overloads)]
  10138. Receive some data on a connected socket.
  10139. template<
  10140. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  10141. std::size_t receive(
  10142. const MutableBufferSequence & buffers);
  10143. This function is used to receive data on the raw socket. The function call will block until data has been received successfully or an error occurs.
  10144. [heading Parameters]
  10145. [variablelist
  10146. [[buffers][One or more buffers into which the data will be received.]]
  10147. ]
  10148. [heading Return Value]
  10149. The number of bytes received.
  10150. [heading Exceptions]
  10151. [variablelist
  10152. [[boost::system::system_error][Thrown on failure.]]
  10153. ]
  10154. [heading Remarks]
  10155. The receive operation can only be used with a connected socket. Use the receive\_from function to receive data on an unconnected raw socket.
  10156. [heading Example]
  10157. To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  10158. socket.receive(boost::asio::buffer(data, size));
  10159. See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  10160. [endsect]
  10161. [section:overload2 basic_raw_socket::receive (2 of 3 overloads)]
  10162. Receive some data on a connected socket.
  10163. template<
  10164. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  10165. std::size_t receive(
  10166. const MutableBufferSequence & buffers,
  10167. socket_base::message_flags flags);
  10168. This function is used to receive data on the raw socket. The function call will block until data has been received successfully or an error occurs.
  10169. [heading Parameters]
  10170. [variablelist
  10171. [[buffers][One or more buffers into which the data will be received.]]
  10172. [[flags][Flags specifying how the receive call is to be made.]]
  10173. ]
  10174. [heading Return Value]
  10175. The number of bytes received.
  10176. [heading Exceptions]
  10177. [variablelist
  10178. [[boost::system::system_error][Thrown on failure.]]
  10179. ]
  10180. [heading Remarks]
  10181. The receive operation can only be used with a connected socket. Use the receive\_from function to receive data on an unconnected raw socket.
  10182. [endsect]
  10183. [section:overload3 basic_raw_socket::receive (3 of 3 overloads)]
  10184. Receive some data on a connected socket.
  10185. template<
  10186. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  10187. std::size_t receive(
  10188. const MutableBufferSequence & buffers,
  10189. socket_base::message_flags flags,
  10190. boost::system::error_code & ec);
  10191. This function is used to receive data on the raw socket. The function call will block until data has been received successfully or an error occurs.
  10192. [heading Parameters]
  10193. [variablelist
  10194. [[buffers][One or more buffers into which the data will be received.]]
  10195. [[flags][Flags specifying how the receive call is to be made.]]
  10196. [[ec][Set to indicate what error occurred, if any.]]
  10197. ]
  10198. [heading Return Value]
  10199. The number of bytes received.
  10200. [heading Remarks]
  10201. The receive operation can only be used with a connected socket. Use the receive\_from function to receive data on an unconnected raw socket.
  10202. [endsect]
  10203. [endsect]
  10204. [section:receive_buffer_size basic_raw_socket::receive_buffer_size]
  10205. ['Inherited from socket_base.]
  10206. [indexterm2 boost_asio.indexterm.basic_raw_socket.receive_buffer_size..receive_buffer_size..basic_raw_socket]
  10207. Socket option for the receive buffer size of a socket.
  10208. typedef implementation_defined receive_buffer_size;
  10209. Implements the SOL\_SOCKET/SO\_RCVBUF socket option.
  10210. [heading Examples]
  10211. Setting the option:
  10212. boost::asio::ip::tcp::socket socket(my_context);
  10213. ...
  10214. boost::asio::socket_base::receive_buffer_size option(8192);
  10215. socket.set_option(option);
  10216. Getting the current option value:
  10217. boost::asio::ip::tcp::socket socket(my_context);
  10218. ...
  10219. boost::asio::socket_base::receive_buffer_size option;
  10220. socket.get_option(option);
  10221. int size = option.value();
  10222. [heading Requirements]
  10223. ['Header: ][^boost/asio/basic_raw_socket.hpp]
  10224. ['Convenience header: ][^boost/asio.hpp]
  10225. [endsect]
  10226. [section:receive_from basic_raw_socket::receive_from]
  10227. [indexterm2 boost_asio.indexterm.basic_raw_socket.receive_from..receive_from..basic_raw_socket]
  10228. Receive raw data with the endpoint of the sender.
  10229. template<
  10230. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  10231. std::size_t ``[link boost_asio.reference.basic_raw_socket.receive_from.overload1 receive_from]``(
  10232. const MutableBufferSequence & buffers,
  10233. endpoint_type & sender_endpoint);
  10234. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.receive_from.overload1 more...]]``
  10235. template<
  10236. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  10237. std::size_t ``[link boost_asio.reference.basic_raw_socket.receive_from.overload2 receive_from]``(
  10238. const MutableBufferSequence & buffers,
  10239. endpoint_type & sender_endpoint,
  10240. socket_base::message_flags flags);
  10241. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.receive_from.overload2 more...]]``
  10242. template<
  10243. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  10244. std::size_t ``[link boost_asio.reference.basic_raw_socket.receive_from.overload3 receive_from]``(
  10245. const MutableBufferSequence & buffers,
  10246. endpoint_type & sender_endpoint,
  10247. socket_base::message_flags flags,
  10248. boost::system::error_code & ec);
  10249. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.receive_from.overload3 more...]]``
  10250. [section:overload1 basic_raw_socket::receive_from (1 of 3 overloads)]
  10251. Receive raw data with the endpoint of the sender.
  10252. template<
  10253. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  10254. std::size_t receive_from(
  10255. const MutableBufferSequence & buffers,
  10256. endpoint_type & sender_endpoint);
  10257. This function is used to receive raw data. The function call will block until data has been received successfully or an error occurs.
  10258. [heading Parameters]
  10259. [variablelist
  10260. [[buffers][One or more buffers into which the data will be received.]]
  10261. [[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the data.]]
  10262. ]
  10263. [heading Return Value]
  10264. The number of bytes received.
  10265. [heading Exceptions]
  10266. [variablelist
  10267. [[boost::system::system_error][Thrown on failure.]]
  10268. ]
  10269. [heading Example]
  10270. To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  10271. boost::asio::ip::udp::endpoint sender_endpoint;
  10272. socket.receive_from(
  10273. boost::asio::buffer(data, size), sender_endpoint);
  10274. See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  10275. [endsect]
  10276. [section:overload2 basic_raw_socket::receive_from (2 of 3 overloads)]
  10277. Receive raw data with the endpoint of the sender.
  10278. template<
  10279. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  10280. std::size_t receive_from(
  10281. const MutableBufferSequence & buffers,
  10282. endpoint_type & sender_endpoint,
  10283. socket_base::message_flags flags);
  10284. This function is used to receive raw data. The function call will block until data has been received successfully or an error occurs.
  10285. [heading Parameters]
  10286. [variablelist
  10287. [[buffers][One or more buffers into which the data will be received.]]
  10288. [[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the data.]]
  10289. [[flags][Flags specifying how the receive call is to be made.]]
  10290. ]
  10291. [heading Return Value]
  10292. The number of bytes received.
  10293. [heading Exceptions]
  10294. [variablelist
  10295. [[boost::system::system_error][Thrown on failure. ]]
  10296. ]
  10297. [endsect]
  10298. [section:overload3 basic_raw_socket::receive_from (3 of 3 overloads)]
  10299. Receive raw data with the endpoint of the sender.
  10300. template<
  10301. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  10302. std::size_t receive_from(
  10303. const MutableBufferSequence & buffers,
  10304. endpoint_type & sender_endpoint,
  10305. socket_base::message_flags flags,
  10306. boost::system::error_code & ec);
  10307. This function is used to receive raw data. The function call will block until data has been received successfully or an error occurs.
  10308. [heading Parameters]
  10309. [variablelist
  10310. [[buffers][One or more buffers into which the data will be received.]]
  10311. [[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the data.]]
  10312. [[flags][Flags specifying how the receive call is to be made.]]
  10313. [[ec][Set to indicate what error occurred, if any.]]
  10314. ]
  10315. [heading Return Value]
  10316. The number of bytes received.
  10317. [endsect]
  10318. [endsect]
  10319. [section:receive_low_watermark basic_raw_socket::receive_low_watermark]
  10320. ['Inherited from socket_base.]
  10321. [indexterm2 boost_asio.indexterm.basic_raw_socket.receive_low_watermark..receive_low_watermark..basic_raw_socket]
  10322. Socket option for the receive low watermark.
  10323. typedef implementation_defined receive_low_watermark;
  10324. Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option.
  10325. [heading Examples]
  10326. Setting the option:
  10327. boost::asio::ip::tcp::socket socket(my_context);
  10328. ...
  10329. boost::asio::socket_base::receive_low_watermark option(1024);
  10330. socket.set_option(option);
  10331. Getting the current option value:
  10332. boost::asio::ip::tcp::socket socket(my_context);
  10333. ...
  10334. boost::asio::socket_base::receive_low_watermark option;
  10335. socket.get_option(option);
  10336. int size = option.value();
  10337. [heading Requirements]
  10338. ['Header: ][^boost/asio/basic_raw_socket.hpp]
  10339. ['Convenience header: ][^boost/asio.hpp]
  10340. [endsect]
  10341. [section:release basic_raw_socket::release]
  10342. [indexterm2 boost_asio.indexterm.basic_raw_socket.release..release..basic_raw_socket]
  10343. Release ownership of the underlying native socket.
  10344. native_handle_type ``[link boost_asio.reference.basic_raw_socket.release.overload1 release]``();
  10345. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.release.overload1 more...]]``
  10346. native_handle_type ``[link boost_asio.reference.basic_raw_socket.release.overload2 release]``(
  10347. boost::system::error_code & ec);
  10348. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.release.overload2 more...]]``
  10349. [section:overload1 basic_raw_socket::release (1 of 2 overloads)]
  10350. ['Inherited from basic_socket.]
  10351. Release ownership of the underlying native socket.
  10352. native_handle_type release();
  10353. This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. Ownership of the native socket is then transferred to the caller.
  10354. [heading Exceptions]
  10355. [variablelist
  10356. [[boost::system::system_error][Thrown on failure.]]
  10357. ]
  10358. [heading Remarks]
  10359. This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms.
  10360. [endsect]
  10361. [section:overload2 basic_raw_socket::release (2 of 2 overloads)]
  10362. ['Inherited from basic_socket.]
  10363. Release ownership of the underlying native socket.
  10364. native_handle_type release(
  10365. boost::system::error_code & ec);
  10366. This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. Ownership of the native socket is then transferred to the caller.
  10367. [heading Parameters]
  10368. [variablelist
  10369. [[ec][Set to indicate what error occurred, if any.]]
  10370. ]
  10371. [heading Remarks]
  10372. This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms.
  10373. [endsect]
  10374. [endsect]
  10375. [section:remote_endpoint basic_raw_socket::remote_endpoint]
  10376. [indexterm2 boost_asio.indexterm.basic_raw_socket.remote_endpoint..remote_endpoint..basic_raw_socket]
  10377. Get the remote endpoint of the socket.
  10378. endpoint_type ``[link boost_asio.reference.basic_raw_socket.remote_endpoint.overload1 remote_endpoint]``() const;
  10379. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.remote_endpoint.overload1 more...]]``
  10380. endpoint_type ``[link boost_asio.reference.basic_raw_socket.remote_endpoint.overload2 remote_endpoint]``(
  10381. boost::system::error_code & ec) const;
  10382. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.remote_endpoint.overload2 more...]]``
  10383. [section:overload1 basic_raw_socket::remote_endpoint (1 of 2 overloads)]
  10384. ['Inherited from basic_socket.]
  10385. Get the remote endpoint of the socket.
  10386. endpoint_type remote_endpoint() const;
  10387. This function is used to obtain the remote endpoint of the socket.
  10388. [heading Return Value]
  10389. An object that represents the remote endpoint of the socket.
  10390. [heading Exceptions]
  10391. [variablelist
  10392. [[boost::system::system_error][Thrown on failure.]]
  10393. ]
  10394. [heading Example]
  10395. boost::asio::ip::tcp::socket socket(my_context);
  10396. ...
  10397. boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint();
  10398. [endsect]
  10399. [section:overload2 basic_raw_socket::remote_endpoint (2 of 2 overloads)]
  10400. ['Inherited from basic_socket.]
  10401. Get the remote endpoint of the socket.
  10402. endpoint_type remote_endpoint(
  10403. boost::system::error_code & ec) const;
  10404. This function is used to obtain the remote endpoint of the socket.
  10405. [heading Parameters]
  10406. [variablelist
  10407. [[ec][Set to indicate what error occurred, if any.]]
  10408. ]
  10409. [heading Return Value]
  10410. An object that represents the remote endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
  10411. [heading Example]
  10412. boost::asio::ip::tcp::socket socket(my_context);
  10413. ...
  10414. boost::system::error_code ec;
  10415. boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(ec);
  10416. if (ec)
  10417. {
  10418. // An error occurred.
  10419. }
  10420. [endsect]
  10421. [endsect]
  10422. [section:reuse_address basic_raw_socket::reuse_address]
  10423. ['Inherited from socket_base.]
  10424. [indexterm2 boost_asio.indexterm.basic_raw_socket.reuse_address..reuse_address..basic_raw_socket]
  10425. Socket option to allow the socket to be bound to an address that is already in use.
  10426. typedef implementation_defined reuse_address;
  10427. Implements the SOL\_SOCKET/SO\_REUSEADDR socket option.
  10428. [heading Examples]
  10429. Setting the option:
  10430. boost::asio::ip::tcp::acceptor acceptor(my_context);
  10431. ...
  10432. boost::asio::socket_base::reuse_address option(true);
  10433. acceptor.set_option(option);
  10434. Getting the current option value:
  10435. boost::asio::ip::tcp::acceptor acceptor(my_context);
  10436. ...
  10437. boost::asio::socket_base::reuse_address option;
  10438. acceptor.get_option(option);
  10439. bool is_set = option.value();
  10440. [heading Requirements]
  10441. ['Header: ][^boost/asio/basic_raw_socket.hpp]
  10442. ['Convenience header: ][^boost/asio.hpp]
  10443. [endsect]
  10444. [section:send basic_raw_socket::send]
  10445. [indexterm2 boost_asio.indexterm.basic_raw_socket.send..send..basic_raw_socket]
  10446. Send some data on a connected socket.
  10447. template<
  10448. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  10449. std::size_t ``[link boost_asio.reference.basic_raw_socket.send.overload1 send]``(
  10450. const ConstBufferSequence & buffers);
  10451. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.send.overload1 more...]]``
  10452. template<
  10453. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  10454. std::size_t ``[link boost_asio.reference.basic_raw_socket.send.overload2 send]``(
  10455. const ConstBufferSequence & buffers,
  10456. socket_base::message_flags flags);
  10457. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.send.overload2 more...]]``
  10458. template<
  10459. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  10460. std::size_t ``[link boost_asio.reference.basic_raw_socket.send.overload3 send]``(
  10461. const ConstBufferSequence & buffers,
  10462. socket_base::message_flags flags,
  10463. boost::system::error_code & ec);
  10464. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.send.overload3 more...]]``
  10465. [section:overload1 basic_raw_socket::send (1 of 3 overloads)]
  10466. Send some data on a connected socket.
  10467. template<
  10468. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  10469. std::size_t send(
  10470. const ConstBufferSequence & buffers);
  10471. This function is used to send data on the raw socket. The function call will block until the data has been sent successfully or an error occurs.
  10472. [heading Parameters]
  10473. [variablelist
  10474. [[buffers][One ore more data buffers to be sent on the socket.]]
  10475. ]
  10476. [heading Return Value]
  10477. The number of bytes sent.
  10478. [heading Exceptions]
  10479. [variablelist
  10480. [[boost::system::system_error][Thrown on failure.]]
  10481. ]
  10482. [heading Remarks]
  10483. The send operation can only be used with a connected socket. Use the send\_to function to send data on an unconnected raw socket.
  10484. [heading Example]
  10485. To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  10486. socket.send(boost::asio::buffer(data, size));
  10487. See the [link boost_asio.reference.buffer `buffer`] documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  10488. [endsect]
  10489. [section:overload2 basic_raw_socket::send (2 of 3 overloads)]
  10490. Send some data on a connected socket.
  10491. template<
  10492. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  10493. std::size_t send(
  10494. const ConstBufferSequence & buffers,
  10495. socket_base::message_flags flags);
  10496. This function is used to send data on the raw socket. The function call will block until the data has been sent successfully or an error occurs.
  10497. [heading Parameters]
  10498. [variablelist
  10499. [[buffers][One ore more data buffers to be sent on the socket.]]
  10500. [[flags][Flags specifying how the send call is to be made.]]
  10501. ]
  10502. [heading Return Value]
  10503. The number of bytes sent.
  10504. [heading Exceptions]
  10505. [variablelist
  10506. [[boost::system::system_error][Thrown on failure.]]
  10507. ]
  10508. [heading Remarks]
  10509. The send operation can only be used with a connected socket. Use the send\_to function to send data on an unconnected raw socket.
  10510. [endsect]
  10511. [section:overload3 basic_raw_socket::send (3 of 3 overloads)]
  10512. Send some data on a connected socket.
  10513. template<
  10514. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  10515. std::size_t send(
  10516. const ConstBufferSequence & buffers,
  10517. socket_base::message_flags flags,
  10518. boost::system::error_code & ec);
  10519. This function is used to send data on the raw socket. The function call will block until the data has been sent successfully or an error occurs.
  10520. [heading Parameters]
  10521. [variablelist
  10522. [[buffers][One or more data buffers to be sent on the socket.]]
  10523. [[flags][Flags specifying how the send call is to be made.]]
  10524. [[ec][Set to indicate what error occurred, if any.]]
  10525. ]
  10526. [heading Return Value]
  10527. The number of bytes sent.
  10528. [heading Remarks]
  10529. The send operation can only be used with a connected socket. Use the send\_to function to send data on an unconnected raw socket.
  10530. [endsect]
  10531. [endsect]
  10532. [section:send_buffer_size basic_raw_socket::send_buffer_size]
  10533. ['Inherited from socket_base.]
  10534. [indexterm2 boost_asio.indexterm.basic_raw_socket.send_buffer_size..send_buffer_size..basic_raw_socket]
  10535. Socket option for the send buffer size of a socket.
  10536. typedef implementation_defined send_buffer_size;
  10537. Implements the SOL\_SOCKET/SO\_SNDBUF socket option.
  10538. [heading Examples]
  10539. Setting the option:
  10540. boost::asio::ip::tcp::socket socket(my_context);
  10541. ...
  10542. boost::asio::socket_base::send_buffer_size option(8192);
  10543. socket.set_option(option);
  10544. Getting the current option value:
  10545. boost::asio::ip::tcp::socket socket(my_context);
  10546. ...
  10547. boost::asio::socket_base::send_buffer_size option;
  10548. socket.get_option(option);
  10549. int size = option.value();
  10550. [heading Requirements]
  10551. ['Header: ][^boost/asio/basic_raw_socket.hpp]
  10552. ['Convenience header: ][^boost/asio.hpp]
  10553. [endsect]
  10554. [section:send_low_watermark basic_raw_socket::send_low_watermark]
  10555. ['Inherited from socket_base.]
  10556. [indexterm2 boost_asio.indexterm.basic_raw_socket.send_low_watermark..send_low_watermark..basic_raw_socket]
  10557. Socket option for the send low watermark.
  10558. typedef implementation_defined send_low_watermark;
  10559. Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option.
  10560. [heading Examples]
  10561. Setting the option:
  10562. boost::asio::ip::tcp::socket socket(my_context);
  10563. ...
  10564. boost::asio::socket_base::send_low_watermark option(1024);
  10565. socket.set_option(option);
  10566. Getting the current option value:
  10567. boost::asio::ip::tcp::socket socket(my_context);
  10568. ...
  10569. boost::asio::socket_base::send_low_watermark option;
  10570. socket.get_option(option);
  10571. int size = option.value();
  10572. [heading Requirements]
  10573. ['Header: ][^boost/asio/basic_raw_socket.hpp]
  10574. ['Convenience header: ][^boost/asio.hpp]
  10575. [endsect]
  10576. [section:send_to basic_raw_socket::send_to]
  10577. [indexterm2 boost_asio.indexterm.basic_raw_socket.send_to..send_to..basic_raw_socket]
  10578. Send raw data to the specified endpoint.
  10579. template<
  10580. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  10581. std::size_t ``[link boost_asio.reference.basic_raw_socket.send_to.overload1 send_to]``(
  10582. const ConstBufferSequence & buffers,
  10583. const endpoint_type & destination);
  10584. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.send_to.overload1 more...]]``
  10585. template<
  10586. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  10587. std::size_t ``[link boost_asio.reference.basic_raw_socket.send_to.overload2 send_to]``(
  10588. const ConstBufferSequence & buffers,
  10589. const endpoint_type & destination,
  10590. socket_base::message_flags flags);
  10591. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.send_to.overload2 more...]]``
  10592. template<
  10593. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  10594. std::size_t ``[link boost_asio.reference.basic_raw_socket.send_to.overload3 send_to]``(
  10595. const ConstBufferSequence & buffers,
  10596. const endpoint_type & destination,
  10597. socket_base::message_flags flags,
  10598. boost::system::error_code & ec);
  10599. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.send_to.overload3 more...]]``
  10600. [section:overload1 basic_raw_socket::send_to (1 of 3 overloads)]
  10601. Send raw data to the specified endpoint.
  10602. template<
  10603. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  10604. std::size_t send_to(
  10605. const ConstBufferSequence & buffers,
  10606. const endpoint_type & destination);
  10607. This function is used to send raw data to the specified remote endpoint. The function call will block until the data has been sent successfully or an error occurs.
  10608. [heading Parameters]
  10609. [variablelist
  10610. [[buffers][One or more data buffers to be sent to the remote endpoint.]]
  10611. [[destination][The remote endpoint to which the data will be sent.]]
  10612. ]
  10613. [heading Return Value]
  10614. The number of bytes sent.
  10615. [heading Exceptions]
  10616. [variablelist
  10617. [[boost::system::system_error][Thrown on failure.]]
  10618. ]
  10619. [heading Example]
  10620. To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  10621. boost::asio::ip::udp::endpoint destination(
  10622. boost::asio::ip::address::from_string("1.2.3.4"), 12345);
  10623. socket.send_to(boost::asio::buffer(data, size), destination);
  10624. See the [link boost_asio.reference.buffer `buffer`] documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  10625. [endsect]
  10626. [section:overload2 basic_raw_socket::send_to (2 of 3 overloads)]
  10627. Send raw data to the specified endpoint.
  10628. template<
  10629. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  10630. std::size_t send_to(
  10631. const ConstBufferSequence & buffers,
  10632. const endpoint_type & destination,
  10633. socket_base::message_flags flags);
  10634. This function is used to send raw data to the specified remote endpoint. The function call will block until the data has been sent successfully or an error occurs.
  10635. [heading Parameters]
  10636. [variablelist
  10637. [[buffers][One or more data buffers to be sent to the remote endpoint.]]
  10638. [[destination][The remote endpoint to which the data will be sent.]]
  10639. [[flags][Flags specifying how the send call is to be made.]]
  10640. ]
  10641. [heading Return Value]
  10642. The number of bytes sent.
  10643. [heading Exceptions]
  10644. [variablelist
  10645. [[boost::system::system_error][Thrown on failure. ]]
  10646. ]
  10647. [endsect]
  10648. [section:overload3 basic_raw_socket::send_to (3 of 3 overloads)]
  10649. Send raw data to the specified endpoint.
  10650. template<
  10651. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  10652. std::size_t send_to(
  10653. const ConstBufferSequence & buffers,
  10654. const endpoint_type & destination,
  10655. socket_base::message_flags flags,
  10656. boost::system::error_code & ec);
  10657. This function is used to send raw data to the specified remote endpoint. The function call will block until the data has been sent successfully or an error occurs.
  10658. [heading Parameters]
  10659. [variablelist
  10660. [[buffers][One or more data buffers to be sent to the remote endpoint.]]
  10661. [[destination][The remote endpoint to which the data will be sent.]]
  10662. [[flags][Flags specifying how the send call is to be made.]]
  10663. [[ec][Set to indicate what error occurred, if any.]]
  10664. ]
  10665. [heading Return Value]
  10666. The number of bytes sent.
  10667. [endsect]
  10668. [endsect]
  10669. [section:set_option basic_raw_socket::set_option]
  10670. [indexterm2 boost_asio.indexterm.basic_raw_socket.set_option..set_option..basic_raw_socket]
  10671. Set an option on the socket.
  10672. template<
  10673. typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
  10674. void ``[link boost_asio.reference.basic_raw_socket.set_option.overload1 set_option]``(
  10675. const SettableSocketOption & option);
  10676. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.set_option.overload1 more...]]``
  10677. template<
  10678. typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
  10679. void ``[link boost_asio.reference.basic_raw_socket.set_option.overload2 set_option]``(
  10680. const SettableSocketOption & option,
  10681. boost::system::error_code & ec);
  10682. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.set_option.overload2 more...]]``
  10683. [section:overload1 basic_raw_socket::set_option (1 of 2 overloads)]
  10684. ['Inherited from basic_socket.]
  10685. Set an option on the socket.
  10686. template<
  10687. typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
  10688. void set_option(
  10689. const SettableSocketOption & option);
  10690. This function is used to set an option on the socket.
  10691. [heading Parameters]
  10692. [variablelist
  10693. [[option][The new option value to be set on the socket.]]
  10694. ]
  10695. [heading Exceptions]
  10696. [variablelist
  10697. [[boost::system::system_error][Thrown on failure.]]
  10698. ]
  10699. [heading Example]
  10700. Setting the IPPROTO\_TCP/TCP\_NODELAY option:
  10701. boost::asio::ip::tcp::socket socket(my_context);
  10702. ...
  10703. boost::asio::ip::tcp::no_delay option(true);
  10704. socket.set_option(option);
  10705. [endsect]
  10706. [section:overload2 basic_raw_socket::set_option (2 of 2 overloads)]
  10707. ['Inherited from basic_socket.]
  10708. Set an option on the socket.
  10709. template<
  10710. typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
  10711. void set_option(
  10712. const SettableSocketOption & option,
  10713. boost::system::error_code & ec);
  10714. This function is used to set an option on the socket.
  10715. [heading Parameters]
  10716. [variablelist
  10717. [[option][The new option value to be set on the socket.]]
  10718. [[ec][Set to indicate what error occurred, if any.]]
  10719. ]
  10720. [heading Example]
  10721. Setting the IPPROTO\_TCP/TCP\_NODELAY option:
  10722. boost::asio::ip::tcp::socket socket(my_context);
  10723. ...
  10724. boost::asio::ip::tcp::no_delay option(true);
  10725. boost::system::error_code ec;
  10726. socket.set_option(option, ec);
  10727. if (ec)
  10728. {
  10729. // An error occurred.
  10730. }
  10731. [endsect]
  10732. [endsect]
  10733. [section:shutdown basic_raw_socket::shutdown]
  10734. [indexterm2 boost_asio.indexterm.basic_raw_socket.shutdown..shutdown..basic_raw_socket]
  10735. Disable sends or receives on the socket.
  10736. void ``[link boost_asio.reference.basic_raw_socket.shutdown.overload1 shutdown]``(
  10737. shutdown_type what);
  10738. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.shutdown.overload1 more...]]``
  10739. void ``[link boost_asio.reference.basic_raw_socket.shutdown.overload2 shutdown]``(
  10740. shutdown_type what,
  10741. boost::system::error_code & ec);
  10742. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.shutdown.overload2 more...]]``
  10743. [section:overload1 basic_raw_socket::shutdown (1 of 2 overloads)]
  10744. ['Inherited from basic_socket.]
  10745. Disable sends or receives on the socket.
  10746. void shutdown(
  10747. shutdown_type what);
  10748. This function is used to disable send operations, receive operations, or both.
  10749. [heading Parameters]
  10750. [variablelist
  10751. [[what][Determines what types of operation will no longer be allowed.]]
  10752. ]
  10753. [heading Exceptions]
  10754. [variablelist
  10755. [[boost::system::system_error][Thrown on failure.]]
  10756. ]
  10757. [heading Example]
  10758. Shutting down the send side of the socket:
  10759. boost::asio::ip::tcp::socket socket(my_context);
  10760. ...
  10761. socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send);
  10762. [endsect]
  10763. [section:overload2 basic_raw_socket::shutdown (2 of 2 overloads)]
  10764. ['Inherited from basic_socket.]
  10765. Disable sends or receives on the socket.
  10766. void shutdown(
  10767. shutdown_type what,
  10768. boost::system::error_code & ec);
  10769. This function is used to disable send operations, receive operations, or both.
  10770. [heading Parameters]
  10771. [variablelist
  10772. [[what][Determines what types of operation will no longer be allowed.]]
  10773. [[ec][Set to indicate what error occurred, if any.]]
  10774. ]
  10775. [heading Example]
  10776. Shutting down the send side of the socket:
  10777. boost::asio::ip::tcp::socket socket(my_context);
  10778. ...
  10779. boost::system::error_code ec;
  10780. socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ec);
  10781. if (ec)
  10782. {
  10783. // An error occurred.
  10784. }
  10785. [endsect]
  10786. [endsect]
  10787. [section:shutdown_type basic_raw_socket::shutdown_type]
  10788. ['Inherited from socket_base.]
  10789. [indexterm2 boost_asio.indexterm.basic_raw_socket.shutdown_type..shutdown_type..basic_raw_socket]
  10790. Different ways a socket may be shutdown.
  10791. enum shutdown_type
  10792. [indexterm2 boost_asio.indexterm.basic_raw_socket.shutdown_type.shutdown_receive..shutdown_receive..basic_raw_socket]
  10793. [indexterm2 boost_asio.indexterm.basic_raw_socket.shutdown_type.shutdown_send..shutdown_send..basic_raw_socket]
  10794. [indexterm2 boost_asio.indexterm.basic_raw_socket.shutdown_type.shutdown_both..shutdown_both..basic_raw_socket]
  10795. [heading Values]
  10796. [variablelist
  10797. [
  10798. [shutdown_receive]
  10799. [Shutdown the receive side of the socket. ]
  10800. ]
  10801. [
  10802. [shutdown_send]
  10803. [Shutdown the send side of the socket. ]
  10804. ]
  10805. [
  10806. [shutdown_both]
  10807. [Shutdown both send and receive on the socket. ]
  10808. ]
  10809. ]
  10810. [endsect]
  10811. [section:wait basic_raw_socket::wait]
  10812. [indexterm2 boost_asio.indexterm.basic_raw_socket.wait..wait..basic_raw_socket]
  10813. Wait for the socket to become ready to read, ready to write, or to have pending error conditions.
  10814. void ``[link boost_asio.reference.basic_raw_socket.wait.overload1 wait]``(
  10815. wait_type w);
  10816. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.wait.overload1 more...]]``
  10817. void ``[link boost_asio.reference.basic_raw_socket.wait.overload2 wait]``(
  10818. wait_type w,
  10819. boost::system::error_code & ec);
  10820. `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.wait.overload2 more...]]``
  10821. [section:overload1 basic_raw_socket::wait (1 of 2 overloads)]
  10822. ['Inherited from basic_socket.]
  10823. Wait for the socket to become ready to read, ready to write, or to have pending error conditions.
  10824. void wait(
  10825. wait_type w);
  10826. This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state.
  10827. [heading Parameters]
  10828. [variablelist
  10829. [[w][Specifies the desired socket state.]]
  10830. ]
  10831. [heading Example]
  10832. Waiting for a socket to become readable.
  10833. boost::asio::ip::tcp::socket socket(my_context);
  10834. ...
  10835. socket.wait(boost::asio::ip::tcp::socket::wait_read);
  10836. [endsect]
  10837. [section:overload2 basic_raw_socket::wait (2 of 2 overloads)]
  10838. ['Inherited from basic_socket.]
  10839. Wait for the socket to become ready to read, ready to write, or to have pending error conditions.
  10840. void wait(
  10841. wait_type w,
  10842. boost::system::error_code & ec);
  10843. This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state.
  10844. [heading Parameters]
  10845. [variablelist
  10846. [[w][Specifies the desired socket state.]]
  10847. [[ec][Set to indicate what error occurred, if any.]]
  10848. ]
  10849. [heading Example]
  10850. Waiting for a socket to become readable.
  10851. boost::asio::ip::tcp::socket socket(my_context);
  10852. ...
  10853. boost::system::error_code ec;
  10854. socket.wait(boost::asio::ip::tcp::socket::wait_read, ec);
  10855. [endsect]
  10856. [endsect]
  10857. [section:wait_type basic_raw_socket::wait_type]
  10858. ['Inherited from socket_base.]
  10859. [indexterm2 boost_asio.indexterm.basic_raw_socket.wait_type..wait_type..basic_raw_socket]
  10860. Wait types.
  10861. enum wait_type
  10862. [indexterm2 boost_asio.indexterm.basic_raw_socket.wait_type.wait_read..wait_read..basic_raw_socket]
  10863. [indexterm2 boost_asio.indexterm.basic_raw_socket.wait_type.wait_write..wait_write..basic_raw_socket]
  10864. [indexterm2 boost_asio.indexterm.basic_raw_socket.wait_type.wait_error..wait_error..basic_raw_socket]
  10865. [heading Values]
  10866. [variablelist
  10867. [
  10868. [wait_read]
  10869. [Wait for a socket to become ready to read. ]
  10870. ]
  10871. [
  10872. [wait_write]
  10873. [Wait for a socket to become ready to write. ]
  10874. ]
  10875. [
  10876. [wait_error]
  10877. [Wait for a socket to have error conditions pending. ]
  10878. ]
  10879. ]
  10880. For use with `basic_socket::wait()` and `basic_socket::async_wait()`.
  10881. [endsect]
  10882. [section:_basic_raw_socket basic_raw_socket::~basic_raw_socket]
  10883. [indexterm2 boost_asio.indexterm.basic_raw_socket._basic_raw_socket..~basic_raw_socket..basic_raw_socket]
  10884. Destroys the socket.
  10885. ~basic_raw_socket();
  10886. This function destroys the socket, cancelling any outstanding asynchronous operations associated with the socket as if by calling `cancel`.
  10887. [endsect]
  10888. [endsect]
  10889. [section:basic_raw_socket__rebind_executor basic_raw_socket::rebind_executor]
  10890. Rebinds the socket type to another executor.
  10891. template<
  10892. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  10893. struct rebind_executor
  10894. [heading Types]
  10895. [table
  10896. [[Name][Description]]
  10897. [
  10898. [[link boost_asio.reference.basic_raw_socket__rebind_executor.other [*other]]]
  10899. [The socket type when rebound to the specified executor. ]
  10900. ]
  10901. ]
  10902. [heading Requirements]
  10903. ['Header: ][^boost/asio/basic_raw_socket.hpp]
  10904. ['Convenience header: ][^boost/asio.hpp]
  10905. [section:other basic_raw_socket::rebind_executor::other]
  10906. [indexterm2 boost_asio.indexterm.basic_raw_socket__rebind_executor.other..other..basic_raw_socket::rebind_executor]
  10907. The socket type when rebound to the specified executor.
  10908. typedef basic_raw_socket< Protocol, Executor1 > other;
  10909. [heading Types]
  10910. [table
  10911. [[Name][Description]]
  10912. [
  10913. [[link boost_asio.reference.basic_raw_socket__rebind_executor [*rebind_executor]]]
  10914. [Rebinds the socket type to another executor. ]
  10915. ]
  10916. [
  10917. [[link boost_asio.reference.basic_raw_socket.broadcast [*broadcast]]]
  10918. [Socket option to permit sending of broadcast messages. ]
  10919. ]
  10920. [
  10921. [[link boost_asio.reference.basic_raw_socket.bytes_readable [*bytes_readable]]]
  10922. [IO control command to get the amount of data that can be read without blocking. ]
  10923. ]
  10924. [
  10925. [[link boost_asio.reference.basic_raw_socket.debug [*debug]]]
  10926. [Socket option to enable socket-level debugging. ]
  10927. ]
  10928. [
  10929. [[link boost_asio.reference.basic_raw_socket.do_not_route [*do_not_route]]]
  10930. [Socket option to prevent routing, use local interfaces only. ]
  10931. ]
  10932. [
  10933. [[link boost_asio.reference.basic_raw_socket.enable_connection_aborted [*enable_connection_aborted]]]
  10934. [Socket option to report aborted connections on accept. ]
  10935. ]
  10936. [
  10937. [[link boost_asio.reference.basic_raw_socket.endpoint_type [*endpoint_type]]]
  10938. [The endpoint type. ]
  10939. ]
  10940. [
  10941. [[link boost_asio.reference.basic_raw_socket.executor_type [*executor_type]]]
  10942. [The type of the executor associated with the object. ]
  10943. ]
  10944. [
  10945. [[link boost_asio.reference.basic_raw_socket.keep_alive [*keep_alive]]]
  10946. [Socket option to send keep-alives. ]
  10947. ]
  10948. [
  10949. [[link boost_asio.reference.basic_raw_socket.linger [*linger]]]
  10950. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  10951. ]
  10952. [
  10953. [[link boost_asio.reference.basic_raw_socket.lowest_layer_type [*lowest_layer_type]]]
  10954. [A basic_socket is always the lowest layer. ]
  10955. ]
  10956. [
  10957. [[link boost_asio.reference.basic_raw_socket.message_flags [*message_flags]]]
  10958. [Bitmask type for flags that can be passed to send and receive operations. ]
  10959. ]
  10960. [
  10961. [[link boost_asio.reference.basic_raw_socket.native_handle_type [*native_handle_type]]]
  10962. [The native representation of a socket. ]
  10963. ]
  10964. [
  10965. [[link boost_asio.reference.basic_raw_socket.out_of_band_inline [*out_of_band_inline]]]
  10966. [Socket option for putting received out-of-band data inline. ]
  10967. ]
  10968. [
  10969. [[link boost_asio.reference.basic_raw_socket.protocol_type [*protocol_type]]]
  10970. [The protocol type. ]
  10971. ]
  10972. [
  10973. [[link boost_asio.reference.basic_raw_socket.receive_buffer_size [*receive_buffer_size]]]
  10974. [Socket option for the receive buffer size of a socket. ]
  10975. ]
  10976. [
  10977. [[link boost_asio.reference.basic_raw_socket.receive_low_watermark [*receive_low_watermark]]]
  10978. [Socket option for the receive low watermark. ]
  10979. ]
  10980. [
  10981. [[link boost_asio.reference.basic_raw_socket.reuse_address [*reuse_address]]]
  10982. [Socket option to allow the socket to be bound to an address that is already in use. ]
  10983. ]
  10984. [
  10985. [[link boost_asio.reference.basic_raw_socket.send_buffer_size [*send_buffer_size]]]
  10986. [Socket option for the send buffer size of a socket. ]
  10987. ]
  10988. [
  10989. [[link boost_asio.reference.basic_raw_socket.send_low_watermark [*send_low_watermark]]]
  10990. [Socket option for the send low watermark. ]
  10991. ]
  10992. [
  10993. [[link boost_asio.reference.basic_raw_socket.shutdown_type [*shutdown_type]]]
  10994. [Different ways a socket may be shutdown. ]
  10995. ]
  10996. [
  10997. [[link boost_asio.reference.basic_raw_socket.wait_type [*wait_type]]]
  10998. [Wait types. ]
  10999. ]
  11000. ]
  11001. [heading Member Functions]
  11002. [table
  11003. [[Name][Description]]
  11004. [
  11005. [[link boost_asio.reference.basic_raw_socket.assign [*assign]]]
  11006. [Assign an existing native socket to the socket. ]
  11007. ]
  11008. [
  11009. [[link boost_asio.reference.basic_raw_socket.async_connect [*async_connect]]]
  11010. [Start an asynchronous connect. ]
  11011. ]
  11012. [
  11013. [[link boost_asio.reference.basic_raw_socket.async_receive [*async_receive]]]
  11014. [Start an asynchronous receive on a connected socket. ]
  11015. ]
  11016. [
  11017. [[link boost_asio.reference.basic_raw_socket.async_receive_from [*async_receive_from]]]
  11018. [Start an asynchronous receive. ]
  11019. ]
  11020. [
  11021. [[link boost_asio.reference.basic_raw_socket.async_send [*async_send]]]
  11022. [Start an asynchronous send on a connected socket. ]
  11023. ]
  11024. [
  11025. [[link boost_asio.reference.basic_raw_socket.async_send_to [*async_send_to]]]
  11026. [Start an asynchronous send. ]
  11027. ]
  11028. [
  11029. [[link boost_asio.reference.basic_raw_socket.async_wait [*async_wait]]]
  11030. [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  11031. ]
  11032. [
  11033. [[link boost_asio.reference.basic_raw_socket.at_mark [*at_mark]]]
  11034. [Determine whether the socket is at the out-of-band data mark. ]
  11035. ]
  11036. [
  11037. [[link boost_asio.reference.basic_raw_socket.available [*available]]]
  11038. [Determine the number of bytes available for reading. ]
  11039. ]
  11040. [
  11041. [[link boost_asio.reference.basic_raw_socket.basic_raw_socket [*basic_raw_socket]]]
  11042. [Construct a basic_raw_socket without opening it.
  11043. [hr]
  11044. Construct and open a basic_raw_socket.
  11045. [hr]
  11046. Construct a basic_raw_socket, opening it and binding it to the given local endpoint.
  11047. [hr]
  11048. Construct a basic_raw_socket on an existing native socket.
  11049. [hr]
  11050. Move-construct a basic_raw_socket from another.
  11051. [hr]
  11052. Move-construct a basic_raw_socket from a socket of another protocol type. ]
  11053. ]
  11054. [
  11055. [[link boost_asio.reference.basic_raw_socket.bind [*bind]]]
  11056. [Bind the socket to the given local endpoint. ]
  11057. ]
  11058. [
  11059. [[link boost_asio.reference.basic_raw_socket.cancel [*cancel]]]
  11060. [Cancel all asynchronous operations associated with the socket. ]
  11061. ]
  11062. [
  11063. [[link boost_asio.reference.basic_raw_socket.close [*close]]]
  11064. [Close the socket. ]
  11065. ]
  11066. [
  11067. [[link boost_asio.reference.basic_raw_socket.connect [*connect]]]
  11068. [Connect the socket to the specified endpoint. ]
  11069. ]
  11070. [
  11071. [[link boost_asio.reference.basic_raw_socket.get_executor [*get_executor]]]
  11072. [Get the executor associated with the object. ]
  11073. ]
  11074. [
  11075. [[link boost_asio.reference.basic_raw_socket.get_option [*get_option]]]
  11076. [Get an option from the socket. ]
  11077. ]
  11078. [
  11079. [[link boost_asio.reference.basic_raw_socket.io_control [*io_control]]]
  11080. [Perform an IO control command on the socket. ]
  11081. ]
  11082. [
  11083. [[link boost_asio.reference.basic_raw_socket.is_open [*is_open]]]
  11084. [Determine whether the socket is open. ]
  11085. ]
  11086. [
  11087. [[link boost_asio.reference.basic_raw_socket.local_endpoint [*local_endpoint]]]
  11088. [Get the local endpoint of the socket. ]
  11089. ]
  11090. [
  11091. [[link boost_asio.reference.basic_raw_socket.lowest_layer [*lowest_layer]]]
  11092. [Get a reference to the lowest layer.
  11093. [hr]
  11094. Get a const reference to the lowest layer. ]
  11095. ]
  11096. [
  11097. [[link boost_asio.reference.basic_raw_socket.native_handle [*native_handle]]]
  11098. [Get the native socket representation. ]
  11099. ]
  11100. [
  11101. [[link boost_asio.reference.basic_raw_socket.native_non_blocking [*native_non_blocking]]]
  11102. [Gets the non-blocking mode of the native socket implementation.
  11103. [hr]
  11104. Sets the non-blocking mode of the native socket implementation. ]
  11105. ]
  11106. [
  11107. [[link boost_asio.reference.basic_raw_socket.non_blocking [*non_blocking]]]
  11108. [Gets the non-blocking mode of the socket.
  11109. [hr]
  11110. Sets the non-blocking mode of the socket. ]
  11111. ]
  11112. [
  11113. [[link boost_asio.reference.basic_raw_socket.open [*open]]]
  11114. [Open the socket using the specified protocol. ]
  11115. ]
  11116. [
  11117. [[link boost_asio.reference.basic_raw_socket.operator_eq_ [*operator=]]]
  11118. [Move-assign a basic_raw_socket from another.
  11119. [hr]
  11120. Move-assign a basic_raw_socket from a socket of another protocol type. ]
  11121. ]
  11122. [
  11123. [[link boost_asio.reference.basic_raw_socket.receive [*receive]]]
  11124. [Receive some data on a connected socket. ]
  11125. ]
  11126. [
  11127. [[link boost_asio.reference.basic_raw_socket.receive_from [*receive_from]]]
  11128. [Receive raw data with the endpoint of the sender. ]
  11129. ]
  11130. [
  11131. [[link boost_asio.reference.basic_raw_socket.release [*release]]]
  11132. [Release ownership of the underlying native socket. ]
  11133. ]
  11134. [
  11135. [[link boost_asio.reference.basic_raw_socket.remote_endpoint [*remote_endpoint]]]
  11136. [Get the remote endpoint of the socket. ]
  11137. ]
  11138. [
  11139. [[link boost_asio.reference.basic_raw_socket.send [*send]]]
  11140. [Send some data on a connected socket. ]
  11141. ]
  11142. [
  11143. [[link boost_asio.reference.basic_raw_socket.send_to [*send_to]]]
  11144. [Send raw data to the specified endpoint. ]
  11145. ]
  11146. [
  11147. [[link boost_asio.reference.basic_raw_socket.set_option [*set_option]]]
  11148. [Set an option on the socket. ]
  11149. ]
  11150. [
  11151. [[link boost_asio.reference.basic_raw_socket.shutdown [*shutdown]]]
  11152. [Disable sends or receives on the socket. ]
  11153. ]
  11154. [
  11155. [[link boost_asio.reference.basic_raw_socket.wait [*wait]]]
  11156. [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  11157. ]
  11158. [
  11159. [[link boost_asio.reference.basic_raw_socket._basic_raw_socket [*~basic_raw_socket]]]
  11160. [Destroys the socket. ]
  11161. ]
  11162. ]
  11163. [heading Data Members]
  11164. [table
  11165. [[Name][Description]]
  11166. [
  11167. [[link boost_asio.reference.basic_raw_socket.max_connections [*max_connections]]]
  11168. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  11169. ]
  11170. [
  11171. [[link boost_asio.reference.basic_raw_socket.max_listen_connections [*max_listen_connections]]]
  11172. [The maximum length of the queue of pending incoming connections. ]
  11173. ]
  11174. [
  11175. [[link boost_asio.reference.basic_raw_socket.message_do_not_route [*message_do_not_route]]]
  11176. [Specify that the data should not be subject to routing. ]
  11177. ]
  11178. [
  11179. [[link boost_asio.reference.basic_raw_socket.message_end_of_record [*message_end_of_record]]]
  11180. [Specifies that the data marks the end of a record. ]
  11181. ]
  11182. [
  11183. [[link boost_asio.reference.basic_raw_socket.message_out_of_band [*message_out_of_band]]]
  11184. [Process out-of-band data. ]
  11185. ]
  11186. [
  11187. [[link boost_asio.reference.basic_raw_socket.message_peek [*message_peek]]]
  11188. [Peek at incoming data without removing it from the input queue. ]
  11189. ]
  11190. ]
  11191. [heading Protected Data Members]
  11192. [table
  11193. [[Name][Description]]
  11194. [
  11195. [[link boost_asio.reference.basic_raw_socket.impl_ [*impl_]]]
  11196. []
  11197. ]
  11198. ]
  11199. The [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] class template provides asynchronous and blocking raw-oriented socket functionality.
  11200. [heading Thread Safety]
  11201. ['Distinct] ['objects:] Safe.
  11202. ['Shared] ['objects:] Unsafe.
  11203. [heading Requirements]
  11204. ['Header: ][^boost/asio/basic_raw_socket.hpp]
  11205. ['Convenience header: ][^boost/asio.hpp]
  11206. [endsect]
  11207. [endsect]
  11208. [section:basic_seq_packet_socket basic_seq_packet_socket]
  11209. Provides sequenced packet socket functionality.
  11210. template<
  11211. typename ``[link boost_asio.reference.Protocol Protocol]``,
  11212. typename ``[link boost_asio.reference.Executor1 Executor]``>
  11213. class basic_seq_packet_socket :
  11214. public basic_socket< Protocol, Executor >
  11215. [heading Types]
  11216. [table
  11217. [[Name][Description]]
  11218. [
  11219. [[link boost_asio.reference.basic_seq_packet_socket__rebind_executor [*rebind_executor]]]
  11220. [Rebinds the socket type to another executor. ]
  11221. ]
  11222. [
  11223. [[link boost_asio.reference.basic_seq_packet_socket.broadcast [*broadcast]]]
  11224. [Socket option to permit sending of broadcast messages. ]
  11225. ]
  11226. [
  11227. [[link boost_asio.reference.basic_seq_packet_socket.bytes_readable [*bytes_readable]]]
  11228. [IO control command to get the amount of data that can be read without blocking. ]
  11229. ]
  11230. [
  11231. [[link boost_asio.reference.basic_seq_packet_socket.debug [*debug]]]
  11232. [Socket option to enable socket-level debugging. ]
  11233. ]
  11234. [
  11235. [[link boost_asio.reference.basic_seq_packet_socket.do_not_route [*do_not_route]]]
  11236. [Socket option to prevent routing, use local interfaces only. ]
  11237. ]
  11238. [
  11239. [[link boost_asio.reference.basic_seq_packet_socket.enable_connection_aborted [*enable_connection_aborted]]]
  11240. [Socket option to report aborted connections on accept. ]
  11241. ]
  11242. [
  11243. [[link boost_asio.reference.basic_seq_packet_socket.endpoint_type [*endpoint_type]]]
  11244. [The endpoint type. ]
  11245. ]
  11246. [
  11247. [[link boost_asio.reference.basic_seq_packet_socket.executor_type [*executor_type]]]
  11248. [The type of the executor associated with the object. ]
  11249. ]
  11250. [
  11251. [[link boost_asio.reference.basic_seq_packet_socket.keep_alive [*keep_alive]]]
  11252. [Socket option to send keep-alives. ]
  11253. ]
  11254. [
  11255. [[link boost_asio.reference.basic_seq_packet_socket.linger [*linger]]]
  11256. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  11257. ]
  11258. [
  11259. [[link boost_asio.reference.basic_seq_packet_socket.lowest_layer_type [*lowest_layer_type]]]
  11260. [A basic_socket is always the lowest layer. ]
  11261. ]
  11262. [
  11263. [[link boost_asio.reference.basic_seq_packet_socket.message_flags [*message_flags]]]
  11264. [Bitmask type for flags that can be passed to send and receive operations. ]
  11265. ]
  11266. [
  11267. [[link boost_asio.reference.basic_seq_packet_socket.native_handle_type [*native_handle_type]]]
  11268. [The native representation of a socket. ]
  11269. ]
  11270. [
  11271. [[link boost_asio.reference.basic_seq_packet_socket.out_of_band_inline [*out_of_band_inline]]]
  11272. [Socket option for putting received out-of-band data inline. ]
  11273. ]
  11274. [
  11275. [[link boost_asio.reference.basic_seq_packet_socket.protocol_type [*protocol_type]]]
  11276. [The protocol type. ]
  11277. ]
  11278. [
  11279. [[link boost_asio.reference.basic_seq_packet_socket.receive_buffer_size [*receive_buffer_size]]]
  11280. [Socket option for the receive buffer size of a socket. ]
  11281. ]
  11282. [
  11283. [[link boost_asio.reference.basic_seq_packet_socket.receive_low_watermark [*receive_low_watermark]]]
  11284. [Socket option for the receive low watermark. ]
  11285. ]
  11286. [
  11287. [[link boost_asio.reference.basic_seq_packet_socket.reuse_address [*reuse_address]]]
  11288. [Socket option to allow the socket to be bound to an address that is already in use. ]
  11289. ]
  11290. [
  11291. [[link boost_asio.reference.basic_seq_packet_socket.send_buffer_size [*send_buffer_size]]]
  11292. [Socket option for the send buffer size of a socket. ]
  11293. ]
  11294. [
  11295. [[link boost_asio.reference.basic_seq_packet_socket.send_low_watermark [*send_low_watermark]]]
  11296. [Socket option for the send low watermark. ]
  11297. ]
  11298. [
  11299. [[link boost_asio.reference.basic_seq_packet_socket.shutdown_type [*shutdown_type]]]
  11300. [Different ways a socket may be shutdown. ]
  11301. ]
  11302. [
  11303. [[link boost_asio.reference.basic_seq_packet_socket.wait_type [*wait_type]]]
  11304. [Wait types. ]
  11305. ]
  11306. ]
  11307. [heading Member Functions]
  11308. [table
  11309. [[Name][Description]]
  11310. [
  11311. [[link boost_asio.reference.basic_seq_packet_socket.assign [*assign]]]
  11312. [Assign an existing native socket to the socket. ]
  11313. ]
  11314. [
  11315. [[link boost_asio.reference.basic_seq_packet_socket.async_connect [*async_connect]]]
  11316. [Start an asynchronous connect. ]
  11317. ]
  11318. [
  11319. [[link boost_asio.reference.basic_seq_packet_socket.async_receive [*async_receive]]]
  11320. [Start an asynchronous receive. ]
  11321. ]
  11322. [
  11323. [[link boost_asio.reference.basic_seq_packet_socket.async_send [*async_send]]]
  11324. [Start an asynchronous send. ]
  11325. ]
  11326. [
  11327. [[link boost_asio.reference.basic_seq_packet_socket.async_wait [*async_wait]]]
  11328. [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  11329. ]
  11330. [
  11331. [[link boost_asio.reference.basic_seq_packet_socket.at_mark [*at_mark]]]
  11332. [Determine whether the socket is at the out-of-band data mark. ]
  11333. ]
  11334. [
  11335. [[link boost_asio.reference.basic_seq_packet_socket.available [*available]]]
  11336. [Determine the number of bytes available for reading. ]
  11337. ]
  11338. [
  11339. [[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket [*basic_seq_packet_socket]]]
  11340. [Construct a basic_seq_packet_socket without opening it.
  11341. [hr]
  11342. Construct and open a basic_seq_packet_socket.
  11343. [hr]
  11344. Construct a basic_seq_packet_socket, opening it and binding it to the given local endpoint.
  11345. [hr]
  11346. Construct a basic_seq_packet_socket on an existing native socket.
  11347. [hr]
  11348. Move-construct a basic_seq_packet_socket from another.
  11349. [hr]
  11350. Move-construct a basic_seq_packet_socket from a socket of another protocol type. ]
  11351. ]
  11352. [
  11353. [[link boost_asio.reference.basic_seq_packet_socket.bind [*bind]]]
  11354. [Bind the socket to the given local endpoint. ]
  11355. ]
  11356. [
  11357. [[link boost_asio.reference.basic_seq_packet_socket.cancel [*cancel]]]
  11358. [Cancel all asynchronous operations associated with the socket. ]
  11359. ]
  11360. [
  11361. [[link boost_asio.reference.basic_seq_packet_socket.close [*close]]]
  11362. [Close the socket. ]
  11363. ]
  11364. [
  11365. [[link boost_asio.reference.basic_seq_packet_socket.connect [*connect]]]
  11366. [Connect the socket to the specified endpoint. ]
  11367. ]
  11368. [
  11369. [[link boost_asio.reference.basic_seq_packet_socket.get_executor [*get_executor]]]
  11370. [Get the executor associated with the object. ]
  11371. ]
  11372. [
  11373. [[link boost_asio.reference.basic_seq_packet_socket.get_option [*get_option]]]
  11374. [Get an option from the socket. ]
  11375. ]
  11376. [
  11377. [[link boost_asio.reference.basic_seq_packet_socket.io_control [*io_control]]]
  11378. [Perform an IO control command on the socket. ]
  11379. ]
  11380. [
  11381. [[link boost_asio.reference.basic_seq_packet_socket.is_open [*is_open]]]
  11382. [Determine whether the socket is open. ]
  11383. ]
  11384. [
  11385. [[link boost_asio.reference.basic_seq_packet_socket.local_endpoint [*local_endpoint]]]
  11386. [Get the local endpoint of the socket. ]
  11387. ]
  11388. [
  11389. [[link boost_asio.reference.basic_seq_packet_socket.lowest_layer [*lowest_layer]]]
  11390. [Get a reference to the lowest layer.
  11391. [hr]
  11392. Get a const reference to the lowest layer. ]
  11393. ]
  11394. [
  11395. [[link boost_asio.reference.basic_seq_packet_socket.native_handle [*native_handle]]]
  11396. [Get the native socket representation. ]
  11397. ]
  11398. [
  11399. [[link boost_asio.reference.basic_seq_packet_socket.native_non_blocking [*native_non_blocking]]]
  11400. [Gets the non-blocking mode of the native socket implementation.
  11401. [hr]
  11402. Sets the non-blocking mode of the native socket implementation. ]
  11403. ]
  11404. [
  11405. [[link boost_asio.reference.basic_seq_packet_socket.non_blocking [*non_blocking]]]
  11406. [Gets the non-blocking mode of the socket.
  11407. [hr]
  11408. Sets the non-blocking mode of the socket. ]
  11409. ]
  11410. [
  11411. [[link boost_asio.reference.basic_seq_packet_socket.open [*open]]]
  11412. [Open the socket using the specified protocol. ]
  11413. ]
  11414. [
  11415. [[link boost_asio.reference.basic_seq_packet_socket.operator_eq_ [*operator=]]]
  11416. [Move-assign a basic_seq_packet_socket from another.
  11417. [hr]
  11418. Move-assign a basic_seq_packet_socket from a socket of another protocol type. ]
  11419. ]
  11420. [
  11421. [[link boost_asio.reference.basic_seq_packet_socket.receive [*receive]]]
  11422. [Receive some data on the socket.
  11423. [hr]
  11424. Receive some data on a connected socket. ]
  11425. ]
  11426. [
  11427. [[link boost_asio.reference.basic_seq_packet_socket.release [*release]]]
  11428. [Release ownership of the underlying native socket. ]
  11429. ]
  11430. [
  11431. [[link boost_asio.reference.basic_seq_packet_socket.remote_endpoint [*remote_endpoint]]]
  11432. [Get the remote endpoint of the socket. ]
  11433. ]
  11434. [
  11435. [[link boost_asio.reference.basic_seq_packet_socket.send [*send]]]
  11436. [Send some data on the socket. ]
  11437. ]
  11438. [
  11439. [[link boost_asio.reference.basic_seq_packet_socket.set_option [*set_option]]]
  11440. [Set an option on the socket. ]
  11441. ]
  11442. [
  11443. [[link boost_asio.reference.basic_seq_packet_socket.shutdown [*shutdown]]]
  11444. [Disable sends or receives on the socket. ]
  11445. ]
  11446. [
  11447. [[link boost_asio.reference.basic_seq_packet_socket.wait [*wait]]]
  11448. [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  11449. ]
  11450. [
  11451. [[link boost_asio.reference.basic_seq_packet_socket._basic_seq_packet_socket [*~basic_seq_packet_socket]]]
  11452. [Destroys the socket. ]
  11453. ]
  11454. ]
  11455. [heading Data Members]
  11456. [table
  11457. [[Name][Description]]
  11458. [
  11459. [[link boost_asio.reference.basic_seq_packet_socket.max_connections [*max_connections]]]
  11460. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  11461. ]
  11462. [
  11463. [[link boost_asio.reference.basic_seq_packet_socket.max_listen_connections [*max_listen_connections]]]
  11464. [The maximum length of the queue of pending incoming connections. ]
  11465. ]
  11466. [
  11467. [[link boost_asio.reference.basic_seq_packet_socket.message_do_not_route [*message_do_not_route]]]
  11468. [Specify that the data should not be subject to routing. ]
  11469. ]
  11470. [
  11471. [[link boost_asio.reference.basic_seq_packet_socket.message_end_of_record [*message_end_of_record]]]
  11472. [Specifies that the data marks the end of a record. ]
  11473. ]
  11474. [
  11475. [[link boost_asio.reference.basic_seq_packet_socket.message_out_of_band [*message_out_of_band]]]
  11476. [Process out-of-band data. ]
  11477. ]
  11478. [
  11479. [[link boost_asio.reference.basic_seq_packet_socket.message_peek [*message_peek]]]
  11480. [Peek at incoming data without removing it from the input queue. ]
  11481. ]
  11482. ]
  11483. [heading Protected Data Members]
  11484. [table
  11485. [[Name][Description]]
  11486. [
  11487. [[link boost_asio.reference.basic_seq_packet_socket.impl_ [*impl_]]]
  11488. []
  11489. ]
  11490. ]
  11491. The [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] class template provides asynchronous and blocking sequenced packet socket functionality.
  11492. [heading Thread Safety]
  11493. ['Distinct] ['objects:] Safe.
  11494. ['Shared] ['objects:] Unsafe.
  11495. [heading Requirements]
  11496. ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
  11497. ['Convenience header: ][^boost/asio.hpp]
  11498. [section:assign basic_seq_packet_socket::assign]
  11499. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.assign..assign..basic_seq_packet_socket]
  11500. Assign an existing native socket to the socket.
  11501. void ``[link boost_asio.reference.basic_seq_packet_socket.assign.overload1 assign]``(
  11502. const protocol_type & protocol,
  11503. const native_handle_type & native_socket);
  11504. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.assign.overload1 more...]]``
  11505. void ``[link boost_asio.reference.basic_seq_packet_socket.assign.overload2 assign]``(
  11506. const protocol_type & protocol,
  11507. const native_handle_type & native_socket,
  11508. boost::system::error_code & ec);
  11509. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.assign.overload2 more...]]``
  11510. [section:overload1 basic_seq_packet_socket::assign (1 of 2 overloads)]
  11511. ['Inherited from basic_socket.]
  11512. Assign an existing native socket to the socket.
  11513. void assign(
  11514. const protocol_type & protocol,
  11515. const native_handle_type & native_socket);
  11516. [endsect]
  11517. [section:overload2 basic_seq_packet_socket::assign (2 of 2 overloads)]
  11518. ['Inherited from basic_socket.]
  11519. Assign an existing native socket to the socket.
  11520. void assign(
  11521. const protocol_type & protocol,
  11522. const native_handle_type & native_socket,
  11523. boost::system::error_code & ec);
  11524. [endsect]
  11525. [endsect]
  11526. [section:async_connect basic_seq_packet_socket::async_connect]
  11527. ['Inherited from basic_socket.]
  11528. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.async_connect..async_connect..basic_seq_packet_socket]
  11529. Start an asynchronous connect.
  11530. template<
  11531. typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  11532. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect(
  11533. const endpoint_type & peer_endpoint,
  11534. ConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  11535. This function is used to asynchronously connect a socket to the specified remote endpoint. The function call always returns immediately.
  11536. The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
  11537. [heading Parameters]
  11538. [variablelist
  11539. [[peer_endpoint][The remote endpoint to which the socket will be connected. Copies will be made of the endpoint object as required.]]
  11540. [[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:
  11541. ``
  11542. void handler(
  11543. const boost::system::error_code& error // Result of operation
  11544. );
  11545. ``
  11546. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  11547. ]
  11548. [heading Example]
  11549. void connect_handler(const boost::system::error_code& error)
  11550. {
  11551. if (!error)
  11552. {
  11553. // Connect succeeded.
  11554. }
  11555. }
  11556. ...
  11557. boost::asio::ip::tcp::socket socket(my_context);
  11558. boost::asio::ip::tcp::endpoint endpoint(
  11559. boost::asio::ip::address::from_string("1.2.3.4"), 12345);
  11560. socket.async_connect(endpoint, connect_handler);
  11561. [endsect]
  11562. [section:async_receive basic_seq_packet_socket::async_receive]
  11563. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.async_receive..async_receive..basic_seq_packet_socket]
  11564. Start an asynchronous receive.
  11565. template<
  11566. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  11567. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  11568. ``[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]``(
  11569. const MutableBufferSequence & buffers,
  11570. socket_base::message_flags & out_flags,
  11571. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  11572. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.async_receive.overload1 more...]]``
  11573. template<
  11574. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  11575. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  11576. ``[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]``(
  11577. const MutableBufferSequence & buffers,
  11578. socket_base::message_flags in_flags,
  11579. socket_base::message_flags & out_flags,
  11580. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  11581. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.async_receive.overload2 more...]]``
  11582. [section:overload1 basic_seq_packet_socket::async_receive (1 of 2 overloads)]
  11583. Start an asynchronous receive.
  11584. template<
  11585. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  11586. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  11587. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive(
  11588. const MutableBufferSequence & buffers,
  11589. socket_base::message_flags & out_flags,
  11590. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  11591. This function is used to asynchronously receive data from the sequenced packet socket. The function call always returns immediately.
  11592. [heading Parameters]
  11593. [variablelist
  11594. [[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.]]
  11595. [[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.]]
  11596. [[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:
  11597. ``
  11598. void handler(
  11599. const boost::system::error_code& error, // Result of operation.
  11600. std::size_t bytes_transferred // Number of bytes received.
  11601. );
  11602. ``
  11603. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  11604. ]
  11605. [heading Example]
  11606. To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  11607. socket.async_receive(boost::asio::buffer(data, size), out_flags, handler);
  11608. See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  11609. [endsect]
  11610. [section:overload2 basic_seq_packet_socket::async_receive (2 of 2 overloads)]
  11611. Start an asynchronous receive.
  11612. template<
  11613. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  11614. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  11615. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive(
  11616. const MutableBufferSequence & buffers,
  11617. socket_base::message_flags in_flags,
  11618. socket_base::message_flags & out_flags,
  11619. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  11620. This function is used to asynchronously receive data from the sequenced data socket. The function call always returns immediately.
  11621. [heading Parameters]
  11622. [variablelist
  11623. [[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.]]
  11624. [[in_flags][Flags specifying how the receive call is to be made.]]
  11625. [[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.]]
  11626. [[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:
  11627. ``
  11628. void handler(
  11629. const boost::system::error_code& error, // Result of operation.
  11630. std::size_t bytes_transferred // Number of bytes received.
  11631. );
  11632. ``
  11633. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  11634. ]
  11635. [heading Example]
  11636. To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  11637. socket.async_receive(
  11638. boost::asio::buffer(data, size),
  11639. 0, out_flags, handler);
  11640. See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  11641. [endsect]
  11642. [endsect]
  11643. [section:async_send basic_seq_packet_socket::async_send]
  11644. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.async_send..async_send..basic_seq_packet_socket]
  11645. Start an asynchronous send.
  11646. template<
  11647. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  11648. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  11649. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send(
  11650. const ConstBufferSequence & buffers,
  11651. socket_base::message_flags flags,
  11652. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  11653. This function is used to asynchronously send data on the sequenced packet socket. The function call always returns immediately.
  11654. [heading Parameters]
  11655. [variablelist
  11656. [[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.]]
  11657. [[flags][Flags specifying how the send call is to be made.]]
  11658. [[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:
  11659. ``
  11660. void handler(
  11661. const boost::system::error_code& error, // Result of operation.
  11662. std::size_t bytes_transferred // Number of bytes sent.
  11663. );
  11664. ``
  11665. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  11666. ]
  11667. [heading Example]
  11668. To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  11669. socket.async_send(boost::asio::buffer(data, size), 0, handler);
  11670. See the [link boost_asio.reference.buffer `buffer`] documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  11671. [endsect]
  11672. [section:async_wait basic_seq_packet_socket::async_wait]
  11673. ['Inherited from basic_socket.]
  11674. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.async_wait..async_wait..basic_seq_packet_socket]
  11675. Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions.
  11676. template<
  11677. typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  11678. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait(
  11679. wait_type w,
  11680. WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  11681. This function is used to perform an asynchronous wait for a socket to enter a ready to read, write or error condition state.
  11682. [heading Parameters]
  11683. [variablelist
  11684. [[w][Specifies the desired socket state.]]
  11685. [[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:
  11686. ``
  11687. void handler(
  11688. const boost::system::error_code& error // Result of operation
  11689. );
  11690. ``
  11691. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  11692. ]
  11693. [heading Example]
  11694. void wait_handler(const boost::system::error_code& error)
  11695. {
  11696. if (!error)
  11697. {
  11698. // Wait succeeded.
  11699. }
  11700. }
  11701. ...
  11702. boost::asio::ip::tcp::socket socket(my_context);
  11703. ...
  11704. socket.async_wait(boost::asio::ip::tcp::socket::wait_read, wait_handler);
  11705. [endsect]
  11706. [section:at_mark basic_seq_packet_socket::at_mark]
  11707. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.at_mark..at_mark..basic_seq_packet_socket]
  11708. Determine whether the socket is at the out-of-band data mark.
  11709. bool ``[link boost_asio.reference.basic_seq_packet_socket.at_mark.overload1 at_mark]``() const;
  11710. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.at_mark.overload1 more...]]``
  11711. bool ``[link boost_asio.reference.basic_seq_packet_socket.at_mark.overload2 at_mark]``(
  11712. boost::system::error_code & ec) const;
  11713. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.at_mark.overload2 more...]]``
  11714. [section:overload1 basic_seq_packet_socket::at_mark (1 of 2 overloads)]
  11715. ['Inherited from basic_socket.]
  11716. Determine whether the socket is at the out-of-band data mark.
  11717. bool at_mark() const;
  11718. This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
  11719. [heading Return Value]
  11720. A bool indicating whether the socket is at the out-of-band data mark.
  11721. [heading Exceptions]
  11722. [variablelist
  11723. [[boost::system::system_error][Thrown on failure. ]]
  11724. ]
  11725. [endsect]
  11726. [section:overload2 basic_seq_packet_socket::at_mark (2 of 2 overloads)]
  11727. ['Inherited from basic_socket.]
  11728. Determine whether the socket is at the out-of-band data mark.
  11729. bool at_mark(
  11730. boost::system::error_code & ec) const;
  11731. This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
  11732. [heading Parameters]
  11733. [variablelist
  11734. [[ec][Set to indicate what error occurred, if any.]]
  11735. ]
  11736. [heading Return Value]
  11737. A bool indicating whether the socket is at the out-of-band data mark.
  11738. [endsect]
  11739. [endsect]
  11740. [section:available basic_seq_packet_socket::available]
  11741. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.available..available..basic_seq_packet_socket]
  11742. Determine the number of bytes available for reading.
  11743. std::size_t ``[link boost_asio.reference.basic_seq_packet_socket.available.overload1 available]``() const;
  11744. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.available.overload1 more...]]``
  11745. std::size_t ``[link boost_asio.reference.basic_seq_packet_socket.available.overload2 available]``(
  11746. boost::system::error_code & ec) const;
  11747. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.available.overload2 more...]]``
  11748. [section:overload1 basic_seq_packet_socket::available (1 of 2 overloads)]
  11749. ['Inherited from basic_socket.]
  11750. Determine the number of bytes available for reading.
  11751. std::size_t available() const;
  11752. This function is used to determine the number of bytes that may be read without blocking.
  11753. [heading Return Value]
  11754. The number of bytes that may be read without blocking, or 0 if an error occurs.
  11755. [heading Exceptions]
  11756. [variablelist
  11757. [[boost::system::system_error][Thrown on failure. ]]
  11758. ]
  11759. [endsect]
  11760. [section:overload2 basic_seq_packet_socket::available (2 of 2 overloads)]
  11761. ['Inherited from basic_socket.]
  11762. Determine the number of bytes available for reading.
  11763. std::size_t available(
  11764. boost::system::error_code & ec) const;
  11765. This function is used to determine the number of bytes that may be read without blocking.
  11766. [heading Parameters]
  11767. [variablelist
  11768. [[ec][Set to indicate what error occurred, if any.]]
  11769. ]
  11770. [heading Return Value]
  11771. The number of bytes that may be read without blocking, or 0 if an error occurs.
  11772. [endsect]
  11773. [endsect]
  11774. [section:basic_seq_packet_socket basic_seq_packet_socket::basic_seq_packet_socket]
  11775. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.basic_seq_packet_socket..basic_seq_packet_socket..basic_seq_packet_socket]
  11776. Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] without opening it.
  11777. explicit ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload1 basic_seq_packet_socket]``(
  11778. const executor_type & ex);
  11779. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload1 more...]]``
  11780. template<
  11781. typename ExecutionContext>
  11782. explicit ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload2 basic_seq_packet_socket]``(
  11783. ExecutionContext & context,
  11784. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  11785. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload2 more...]]``
  11786. Construct and open a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`].
  11787. ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload3 basic_seq_packet_socket]``(
  11788. const executor_type & ex,
  11789. const protocol_type & protocol);
  11790. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload3 more...]]``
  11791. template<
  11792. typename ExecutionContext>
  11793. ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload4 basic_seq_packet_socket]``(
  11794. ExecutionContext & context,
  11795. const protocol_type & protocol,
  11796. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  11797. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload4 more...]]``
  11798. Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`], opening it and binding it to the given local endpoint.
  11799. ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload5 basic_seq_packet_socket]``(
  11800. const executor_type & ex,
  11801. const endpoint_type & endpoint);
  11802. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload5 more...]]``
  11803. template<
  11804. typename ExecutionContext>
  11805. ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload6 basic_seq_packet_socket]``(
  11806. ExecutionContext & context,
  11807. const endpoint_type & endpoint,
  11808. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  11809. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload6 more...]]``
  11810. Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] on an existing native socket.
  11811. ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload7 basic_seq_packet_socket]``(
  11812. const executor_type & ex,
  11813. const protocol_type & protocol,
  11814. const native_handle_type & native_socket);
  11815. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload7 more...]]``
  11816. template<
  11817. typename ExecutionContext>
  11818. ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload8 basic_seq_packet_socket]``(
  11819. ExecutionContext & context,
  11820. const protocol_type & protocol,
  11821. const native_handle_type & native_socket,
  11822. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  11823. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload8 more...]]``
  11824. Move-construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] from another.
  11825. ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload9 basic_seq_packet_socket]``(
  11826. basic_seq_packet_socket && other);
  11827. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload9 more...]]``
  11828. Move-construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] from a socket of another protocol type.
  11829. template<
  11830. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  11831. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  11832. ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload10 basic_seq_packet_socket]``(
  11833. basic_seq_packet_socket< Protocol1, Executor1 > && other,
  11834. typename enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type * = 0);
  11835. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload10 more...]]``
  11836. [section:overload1 basic_seq_packet_socket::basic_seq_packet_socket (1 of 10 overloads)]
  11837. Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] without opening it.
  11838. basic_seq_packet_socket(
  11839. const executor_type & ex);
  11840. This constructor creates a sequenced packet socket without opening it. The socket needs to be opened and then connected or accepted before data can be sent or received on it.
  11841. [heading Parameters]
  11842. [variablelist
  11843. [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket. ]]
  11844. ]
  11845. [endsect]
  11846. [section:overload2 basic_seq_packet_socket::basic_seq_packet_socket (2 of 10 overloads)]
  11847. Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] without opening it.
  11848. template<
  11849. typename ExecutionContext>
  11850. basic_seq_packet_socket(
  11851. ExecutionContext & context,
  11852. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  11853. This constructor creates a sequenced packet socket without opening it. The socket needs to be opened and then connected or accepted before data can be sent or received on it.
  11854. [heading Parameters]
  11855. [variablelist
  11856. [[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. ]]
  11857. ]
  11858. [endsect]
  11859. [section:overload3 basic_seq_packet_socket::basic_seq_packet_socket (3 of 10 overloads)]
  11860. Construct and open a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`].
  11861. basic_seq_packet_socket(
  11862. const executor_type & ex,
  11863. const protocol_type & protocol);
  11864. This constructor creates and opens a sequenced\_packet socket. The socket needs to be connected or accepted before data can be sent or received on it.
  11865. [heading Parameters]
  11866. [variablelist
  11867. [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
  11868. [[protocol][An object specifying protocol parameters to be used.]]
  11869. ]
  11870. [heading Exceptions]
  11871. [variablelist
  11872. [[boost::system::system_error][Thrown on failure. ]]
  11873. ]
  11874. [endsect]
  11875. [section:overload4 basic_seq_packet_socket::basic_seq_packet_socket (4 of 10 overloads)]
  11876. Construct and open a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`].
  11877. template<
  11878. typename ExecutionContext>
  11879. basic_seq_packet_socket(
  11880. ExecutionContext & context,
  11881. const protocol_type & protocol,
  11882. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  11883. This constructor creates and opens a sequenced\_packet socket. The socket needs to be connected or accepted before data can be sent or received on it.
  11884. [heading Parameters]
  11885. [variablelist
  11886. [[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.]]
  11887. [[protocol][An object specifying protocol parameters to be used.]]
  11888. ]
  11889. [heading Exceptions]
  11890. [variablelist
  11891. [[boost::system::system_error][Thrown on failure. ]]
  11892. ]
  11893. [endsect]
  11894. [section:overload5 basic_seq_packet_socket::basic_seq_packet_socket (5 of 10 overloads)]
  11895. Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`], opening it and binding it to the given local endpoint.
  11896. basic_seq_packet_socket(
  11897. const executor_type & ex,
  11898. const endpoint_type & endpoint);
  11899. This constructor creates a sequenced packet socket and automatically opens it bound to the specified endpoint on the local machine. The protocol used is the protocol associated with the given endpoint.
  11900. [heading Parameters]
  11901. [variablelist
  11902. [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
  11903. [[endpoint][An endpoint on the local machine to which the sequenced packet socket will be bound.]]
  11904. ]
  11905. [heading Exceptions]
  11906. [variablelist
  11907. [[boost::system::system_error][Thrown on failure. ]]
  11908. ]
  11909. [endsect]
  11910. [section:overload6 basic_seq_packet_socket::basic_seq_packet_socket (6 of 10 overloads)]
  11911. Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`], opening it and binding it to the given local endpoint.
  11912. template<
  11913. typename ExecutionContext>
  11914. basic_seq_packet_socket(
  11915. ExecutionContext & context,
  11916. const endpoint_type & endpoint,
  11917. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  11918. This constructor creates a sequenced packet socket and automatically opens it bound to the specified endpoint on the local machine. The protocol used is the protocol associated with the given endpoint.
  11919. [heading Parameters]
  11920. [variablelist
  11921. [[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.]]
  11922. [[endpoint][An endpoint on the local machine to which the sequenced packet socket will be bound.]]
  11923. ]
  11924. [heading Exceptions]
  11925. [variablelist
  11926. [[boost::system::system_error][Thrown on failure. ]]
  11927. ]
  11928. [endsect]
  11929. [section:overload7 basic_seq_packet_socket::basic_seq_packet_socket (7 of 10 overloads)]
  11930. Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] on an existing native socket.
  11931. basic_seq_packet_socket(
  11932. const executor_type & ex,
  11933. const protocol_type & protocol,
  11934. const native_handle_type & native_socket);
  11935. This constructor creates a sequenced packet socket object to hold an existing native socket.
  11936. [heading Parameters]
  11937. [variablelist
  11938. [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
  11939. [[protocol][An object specifying protocol parameters to be used.]]
  11940. [[native_socket][The new underlying socket implementation.]]
  11941. ]
  11942. [heading Exceptions]
  11943. [variablelist
  11944. [[boost::system::system_error][Thrown on failure. ]]
  11945. ]
  11946. [endsect]
  11947. [section:overload8 basic_seq_packet_socket::basic_seq_packet_socket (8 of 10 overloads)]
  11948. Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] on an existing native socket.
  11949. template<
  11950. typename ExecutionContext>
  11951. basic_seq_packet_socket(
  11952. ExecutionContext & context,
  11953. const protocol_type & protocol,
  11954. const native_handle_type & native_socket,
  11955. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  11956. This constructor creates a sequenced packet socket object to hold an existing native socket.
  11957. [heading Parameters]
  11958. [variablelist
  11959. [[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.]]
  11960. [[protocol][An object specifying protocol parameters to be used.]]
  11961. [[native_socket][The new underlying socket implementation.]]
  11962. ]
  11963. [heading Exceptions]
  11964. [variablelist
  11965. [[boost::system::system_error][Thrown on failure. ]]
  11966. ]
  11967. [endsect]
  11968. [section:overload9 basic_seq_packet_socket::basic_seq_packet_socket (9 of 10 overloads)]
  11969. Move-construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] from another.
  11970. basic_seq_packet_socket(
  11971. basic_seq_packet_socket && other);
  11972. This constructor moves a sequenced packet socket from one object to another.
  11973. [heading Parameters]
  11974. [variablelist
  11975. [[other][The other [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] object from which the move will occur.]]
  11976. ]
  11977. [heading Remarks]
  11978. Following the move, the moved-from object is in the same state as if constructed using the `basic_seq_packet_socket(const executor_type&)` constructor.
  11979. [endsect]
  11980. [section:overload10 basic_seq_packet_socket::basic_seq_packet_socket (10 of 10 overloads)]
  11981. Move-construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] from a socket of another protocol type.
  11982. template<
  11983. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  11984. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  11985. basic_seq_packet_socket(
  11986. basic_seq_packet_socket< Protocol1, Executor1 > && other,
  11987. typename enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type * = 0);
  11988. This constructor moves a sequenced packet socket from one object to another.
  11989. [heading Parameters]
  11990. [variablelist
  11991. [[other][The other [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] object from which the move will occur.]]
  11992. ]
  11993. [heading Remarks]
  11994. Following the move, the moved-from object is in the same state as if constructed using the `basic_seq_packet_socket(const executor_type&)` constructor.
  11995. [endsect]
  11996. [endsect]
  11997. [section:bind basic_seq_packet_socket::bind]
  11998. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.bind..bind..basic_seq_packet_socket]
  11999. Bind the socket to the given local endpoint.
  12000. void ``[link boost_asio.reference.basic_seq_packet_socket.bind.overload1 bind]``(
  12001. const endpoint_type & endpoint);
  12002. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.bind.overload1 more...]]``
  12003. void ``[link boost_asio.reference.basic_seq_packet_socket.bind.overload2 bind]``(
  12004. const endpoint_type & endpoint,
  12005. boost::system::error_code & ec);
  12006. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.bind.overload2 more...]]``
  12007. [section:overload1 basic_seq_packet_socket::bind (1 of 2 overloads)]
  12008. ['Inherited from basic_socket.]
  12009. Bind the socket to the given local endpoint.
  12010. void bind(
  12011. const endpoint_type & endpoint);
  12012. This function binds the socket to the specified endpoint on the local machine.
  12013. [heading Parameters]
  12014. [variablelist
  12015. [[endpoint][An endpoint on the local machine to which the socket will be bound.]]
  12016. ]
  12017. [heading Exceptions]
  12018. [variablelist
  12019. [[boost::system::system_error][Thrown on failure.]]
  12020. ]
  12021. [heading Example]
  12022. boost::asio::ip::tcp::socket socket(my_context);
  12023. socket.open(boost::asio::ip::tcp::v4());
  12024. socket.bind(boost::asio::ip::tcp::endpoint(
  12025. boost::asio::ip::tcp::v4(), 12345));
  12026. [endsect]
  12027. [section:overload2 basic_seq_packet_socket::bind (2 of 2 overloads)]
  12028. ['Inherited from basic_socket.]
  12029. Bind the socket to the given local endpoint.
  12030. void bind(
  12031. const endpoint_type & endpoint,
  12032. boost::system::error_code & ec);
  12033. This function binds the socket to the specified endpoint on the local machine.
  12034. [heading Parameters]
  12035. [variablelist
  12036. [[endpoint][An endpoint on the local machine to which the socket will be bound.]]
  12037. [[ec][Set to indicate what error occurred, if any.]]
  12038. ]
  12039. [heading Example]
  12040. boost::asio::ip::tcp::socket socket(my_context);
  12041. socket.open(boost::asio::ip::tcp::v4());
  12042. boost::system::error_code ec;
  12043. socket.bind(boost::asio::ip::tcp::endpoint(
  12044. boost::asio::ip::tcp::v4(), 12345), ec);
  12045. if (ec)
  12046. {
  12047. // An error occurred.
  12048. }
  12049. [endsect]
  12050. [endsect]
  12051. [section:broadcast basic_seq_packet_socket::broadcast]
  12052. ['Inherited from socket_base.]
  12053. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.broadcast..broadcast..basic_seq_packet_socket]
  12054. Socket option to permit sending of broadcast messages.
  12055. typedef implementation_defined broadcast;
  12056. Implements the SOL\_SOCKET/SO\_BROADCAST socket option.
  12057. [heading Examples]
  12058. Setting the option:
  12059. boost::asio::ip::udp::socket socket(my_context);
  12060. ...
  12061. boost::asio::socket_base::broadcast option(true);
  12062. socket.set_option(option);
  12063. Getting the current option value:
  12064. boost::asio::ip::udp::socket socket(my_context);
  12065. ...
  12066. boost::asio::socket_base::broadcast option;
  12067. socket.get_option(option);
  12068. bool is_set = option.value();
  12069. [heading Requirements]
  12070. ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
  12071. ['Convenience header: ][^boost/asio.hpp]
  12072. [endsect]
  12073. [section:bytes_readable basic_seq_packet_socket::bytes_readable]
  12074. ['Inherited from socket_base.]
  12075. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.bytes_readable..bytes_readable..basic_seq_packet_socket]
  12076. IO control command to get the amount of data that can be read without blocking.
  12077. typedef implementation_defined bytes_readable;
  12078. Implements the FIONREAD IO control command.
  12079. [heading Example]
  12080. boost::asio::ip::tcp::socket socket(my_context);
  12081. ...
  12082. boost::asio::socket_base::bytes_readable command(true);
  12083. socket.io_control(command);
  12084. std::size_t bytes_readable = command.get();
  12085. [heading Requirements]
  12086. ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
  12087. ['Convenience header: ][^boost/asio.hpp]
  12088. [endsect]
  12089. [section:cancel basic_seq_packet_socket::cancel]
  12090. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.cancel..cancel..basic_seq_packet_socket]
  12091. Cancel all asynchronous operations associated with the socket.
  12092. void ``[link boost_asio.reference.basic_seq_packet_socket.cancel.overload1 cancel]``();
  12093. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.cancel.overload1 more...]]``
  12094. void ``[link boost_asio.reference.basic_seq_packet_socket.cancel.overload2 cancel]``(
  12095. boost::system::error_code & ec);
  12096. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.cancel.overload2 more...]]``
  12097. [section:overload1 basic_seq_packet_socket::cancel (1 of 2 overloads)]
  12098. ['Inherited from basic_socket.]
  12099. Cancel all asynchronous operations associated with the socket.
  12100. void cancel();
  12101. This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
  12102. [heading Exceptions]
  12103. [variablelist
  12104. [[boost::system::system_error][Thrown on failure.]]
  12105. ]
  12106. [heading Remarks]
  12107. Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
  12108. * It will only cancel asynchronous operations that were initiated in the current thread.
  12109. * 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.
  12110. For portable cancellation, consider using one of the following alternatives:
  12111. * Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
  12112. * Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
  12113. When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above.
  12114. [endsect]
  12115. [section:overload2 basic_seq_packet_socket::cancel (2 of 2 overloads)]
  12116. ['Inherited from basic_socket.]
  12117. Cancel all asynchronous operations associated with the socket.
  12118. void cancel(
  12119. boost::system::error_code & ec);
  12120. This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
  12121. [heading Parameters]
  12122. [variablelist
  12123. [[ec][Set to indicate what error occurred, if any.]]
  12124. ]
  12125. [heading Remarks]
  12126. Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
  12127. * It will only cancel asynchronous operations that were initiated in the current thread.
  12128. * 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.
  12129. For portable cancellation, consider using one of the following alternatives:
  12130. * Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
  12131. * Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
  12132. When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above.
  12133. [endsect]
  12134. [endsect]
  12135. [section:close basic_seq_packet_socket::close]
  12136. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.close..close..basic_seq_packet_socket]
  12137. Close the socket.
  12138. void ``[link boost_asio.reference.basic_seq_packet_socket.close.overload1 close]``();
  12139. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.close.overload1 more...]]``
  12140. void ``[link boost_asio.reference.basic_seq_packet_socket.close.overload2 close]``(
  12141. boost::system::error_code & ec);
  12142. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.close.overload2 more...]]``
  12143. [section:overload1 basic_seq_packet_socket::close (1 of 2 overloads)]
  12144. ['Inherited from basic_socket.]
  12145. Close the socket.
  12146. void close();
  12147. This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
  12148. [heading Exceptions]
  12149. [variablelist
  12150. [[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
  12151. ]
  12152. [heading Remarks]
  12153. For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket.
  12154. [endsect]
  12155. [section:overload2 basic_seq_packet_socket::close (2 of 2 overloads)]
  12156. ['Inherited from basic_socket.]
  12157. Close the socket.
  12158. void close(
  12159. boost::system::error_code & ec);
  12160. This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
  12161. [heading Parameters]
  12162. [variablelist
  12163. [[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
  12164. ]
  12165. [heading Example]
  12166. boost::asio::ip::tcp::socket socket(my_context);
  12167. ...
  12168. boost::system::error_code ec;
  12169. socket.close(ec);
  12170. if (ec)
  12171. {
  12172. // An error occurred.
  12173. }
  12174. [heading Remarks]
  12175. For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket.
  12176. [endsect]
  12177. [endsect]
  12178. [section:connect basic_seq_packet_socket::connect]
  12179. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.connect..connect..basic_seq_packet_socket]
  12180. Connect the socket to the specified endpoint.
  12181. void ``[link boost_asio.reference.basic_seq_packet_socket.connect.overload1 connect]``(
  12182. const endpoint_type & peer_endpoint);
  12183. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.connect.overload1 more...]]``
  12184. void ``[link boost_asio.reference.basic_seq_packet_socket.connect.overload2 connect]``(
  12185. const endpoint_type & peer_endpoint,
  12186. boost::system::error_code & ec);
  12187. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.connect.overload2 more...]]``
  12188. [section:overload1 basic_seq_packet_socket::connect (1 of 2 overloads)]
  12189. ['Inherited from basic_socket.]
  12190. Connect the socket to the specified endpoint.
  12191. void connect(
  12192. const endpoint_type & peer_endpoint);
  12193. This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
  12194. The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
  12195. [heading Parameters]
  12196. [variablelist
  12197. [[peer_endpoint][The remote endpoint to which the socket will be connected.]]
  12198. ]
  12199. [heading Exceptions]
  12200. [variablelist
  12201. [[boost::system::system_error][Thrown on failure.]]
  12202. ]
  12203. [heading Example]
  12204. boost::asio::ip::tcp::socket socket(my_context);
  12205. boost::asio::ip::tcp::endpoint endpoint(
  12206. boost::asio::ip::address::from_string("1.2.3.4"), 12345);
  12207. socket.connect(endpoint);
  12208. [endsect]
  12209. [section:overload2 basic_seq_packet_socket::connect (2 of 2 overloads)]
  12210. ['Inherited from basic_socket.]
  12211. Connect the socket to the specified endpoint.
  12212. void connect(
  12213. const endpoint_type & peer_endpoint,
  12214. boost::system::error_code & ec);
  12215. This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
  12216. The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
  12217. [heading Parameters]
  12218. [variablelist
  12219. [[peer_endpoint][The remote endpoint to which the socket will be connected.]]
  12220. [[ec][Set to indicate what error occurred, if any.]]
  12221. ]
  12222. [heading Example]
  12223. boost::asio::ip::tcp::socket socket(my_context);
  12224. boost::asio::ip::tcp::endpoint endpoint(
  12225. boost::asio::ip::address::from_string("1.2.3.4"), 12345);
  12226. boost::system::error_code ec;
  12227. socket.connect(endpoint, ec);
  12228. if (ec)
  12229. {
  12230. // An error occurred.
  12231. }
  12232. [endsect]
  12233. [endsect]
  12234. [section:debug basic_seq_packet_socket::debug]
  12235. ['Inherited from socket_base.]
  12236. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.debug..debug..basic_seq_packet_socket]
  12237. Socket option to enable socket-level debugging.
  12238. typedef implementation_defined debug;
  12239. Implements the SOL\_SOCKET/SO\_DEBUG socket option.
  12240. [heading Examples]
  12241. Setting the option:
  12242. boost::asio::ip::tcp::socket socket(my_context);
  12243. ...
  12244. boost::asio::socket_base::debug option(true);
  12245. socket.set_option(option);
  12246. Getting the current option value:
  12247. boost::asio::ip::tcp::socket socket(my_context);
  12248. ...
  12249. boost::asio::socket_base::debug option;
  12250. socket.get_option(option);
  12251. bool is_set = option.value();
  12252. [heading Requirements]
  12253. ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
  12254. ['Convenience header: ][^boost/asio.hpp]
  12255. [endsect]
  12256. [section:do_not_route basic_seq_packet_socket::do_not_route]
  12257. ['Inherited from socket_base.]
  12258. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.do_not_route..do_not_route..basic_seq_packet_socket]
  12259. Socket option to prevent routing, use local interfaces only.
  12260. typedef implementation_defined do_not_route;
  12261. Implements the SOL\_SOCKET/SO\_DONTROUTE socket option.
  12262. [heading Examples]
  12263. Setting the option:
  12264. boost::asio::ip::udp::socket socket(my_context);
  12265. ...
  12266. boost::asio::socket_base::do_not_route option(true);
  12267. socket.set_option(option);
  12268. Getting the current option value:
  12269. boost::asio::ip::udp::socket socket(my_context);
  12270. ...
  12271. boost::asio::socket_base::do_not_route option;
  12272. socket.get_option(option);
  12273. bool is_set = option.value();
  12274. [heading Requirements]
  12275. ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
  12276. ['Convenience header: ][^boost/asio.hpp]
  12277. [endsect]
  12278. [section:enable_connection_aborted basic_seq_packet_socket::enable_connection_aborted]
  12279. ['Inherited from socket_base.]
  12280. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.enable_connection_aborted..enable_connection_aborted..basic_seq_packet_socket]
  12281. Socket option to report aborted connections on accept.
  12282. typedef implementation_defined enable_connection_aborted;
  12283. Implements a custom socket option that determines whether or not an accept operation is permitted to fail with `boost::asio::error::connection_aborted`. By default the option is false.
  12284. [heading Examples]
  12285. Setting the option:
  12286. boost::asio::ip::tcp::acceptor acceptor(my_context);
  12287. ...
  12288. boost::asio::socket_base::enable_connection_aborted option(true);
  12289. acceptor.set_option(option);
  12290. Getting the current option value:
  12291. boost::asio::ip::tcp::acceptor acceptor(my_context);
  12292. ...
  12293. boost::asio::socket_base::enable_connection_aborted option;
  12294. acceptor.get_option(option);
  12295. bool is_set = option.value();
  12296. [heading Requirements]
  12297. ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
  12298. ['Convenience header: ][^boost/asio.hpp]
  12299. [endsect]
  12300. [section:endpoint_type basic_seq_packet_socket::endpoint_type]
  12301. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.endpoint_type..endpoint_type..basic_seq_packet_socket]
  12302. The endpoint type.
  12303. typedef Protocol::endpoint endpoint_type;
  12304. [heading Requirements]
  12305. ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
  12306. ['Convenience header: ][^boost/asio.hpp]
  12307. [endsect]
  12308. [section:executor_type basic_seq_packet_socket::executor_type]
  12309. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.executor_type..executor_type..basic_seq_packet_socket]
  12310. The type of the executor associated with the object.
  12311. typedef Executor executor_type;
  12312. [heading Requirements]
  12313. ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
  12314. ['Convenience header: ][^boost/asio.hpp]
  12315. [endsect]
  12316. [section:get_executor basic_seq_packet_socket::get_executor]
  12317. ['Inherited from basic_socket.]
  12318. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.get_executor..get_executor..basic_seq_packet_socket]
  12319. Get the executor associated with the object.
  12320. executor_type get_executor();
  12321. [endsect]
  12322. [section:get_option basic_seq_packet_socket::get_option]
  12323. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.get_option..get_option..basic_seq_packet_socket]
  12324. Get an option from the socket.
  12325. template<
  12326. typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
  12327. void ``[link boost_asio.reference.basic_seq_packet_socket.get_option.overload1 get_option]``(
  12328. GettableSocketOption & option) const;
  12329. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.get_option.overload1 more...]]``
  12330. template<
  12331. typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
  12332. void ``[link boost_asio.reference.basic_seq_packet_socket.get_option.overload2 get_option]``(
  12333. GettableSocketOption & option,
  12334. boost::system::error_code & ec) const;
  12335. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.get_option.overload2 more...]]``
  12336. [section:overload1 basic_seq_packet_socket::get_option (1 of 2 overloads)]
  12337. ['Inherited from basic_socket.]
  12338. Get an option from the socket.
  12339. template<
  12340. typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
  12341. void get_option(
  12342. GettableSocketOption & option) const;
  12343. This function is used to get the current value of an option on the socket.
  12344. [heading Parameters]
  12345. [variablelist
  12346. [[option][The option value to be obtained from the socket.]]
  12347. ]
  12348. [heading Exceptions]
  12349. [variablelist
  12350. [[boost::system::system_error][Thrown on failure.]]
  12351. ]
  12352. [heading Example]
  12353. Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option:
  12354. boost::asio::ip::tcp::socket socket(my_context);
  12355. ...
  12356. boost::asio::ip::tcp::socket::keep_alive option;
  12357. socket.get_option(option);
  12358. bool is_set = option.value();
  12359. [endsect]
  12360. [section:overload2 basic_seq_packet_socket::get_option (2 of 2 overloads)]
  12361. ['Inherited from basic_socket.]
  12362. Get an option from the socket.
  12363. template<
  12364. typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
  12365. void get_option(
  12366. GettableSocketOption & option,
  12367. boost::system::error_code & ec) const;
  12368. This function is used to get the current value of an option on the socket.
  12369. [heading Parameters]
  12370. [variablelist
  12371. [[option][The option value to be obtained from the socket.]]
  12372. [[ec][Set to indicate what error occurred, if any.]]
  12373. ]
  12374. [heading Example]
  12375. Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option:
  12376. boost::asio::ip::tcp::socket socket(my_context);
  12377. ...
  12378. boost::asio::ip::tcp::socket::keep_alive option;
  12379. boost::system::error_code ec;
  12380. socket.get_option(option, ec);
  12381. if (ec)
  12382. {
  12383. // An error occurred.
  12384. }
  12385. bool is_set = option.value();
  12386. [endsect]
  12387. [endsect]
  12388. [section:impl_ basic_seq_packet_socket::impl_]
  12389. ['Inherited from basic_socket.]
  12390. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.impl_..impl_..basic_seq_packet_socket]
  12391. detail::io_object_impl< detail::reactive_socket_service< Protocol >, Executor > impl_;
  12392. [endsect]
  12393. [section:io_control basic_seq_packet_socket::io_control]
  12394. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.io_control..io_control..basic_seq_packet_socket]
  12395. Perform an IO control command on the socket.
  12396. template<
  12397. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  12398. void ``[link boost_asio.reference.basic_seq_packet_socket.io_control.overload1 io_control]``(
  12399. IoControlCommand & command);
  12400. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.io_control.overload1 more...]]``
  12401. template<
  12402. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  12403. void ``[link boost_asio.reference.basic_seq_packet_socket.io_control.overload2 io_control]``(
  12404. IoControlCommand & command,
  12405. boost::system::error_code & ec);
  12406. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.io_control.overload2 more...]]``
  12407. [section:overload1 basic_seq_packet_socket::io_control (1 of 2 overloads)]
  12408. ['Inherited from basic_socket.]
  12409. Perform an IO control command on the socket.
  12410. template<
  12411. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  12412. void io_control(
  12413. IoControlCommand & command);
  12414. This function is used to execute an IO control command on the socket.
  12415. [heading Parameters]
  12416. [variablelist
  12417. [[command][The IO control command to be performed on the socket.]]
  12418. ]
  12419. [heading Exceptions]
  12420. [variablelist
  12421. [[boost::system::system_error][Thrown on failure.]]
  12422. ]
  12423. [heading Example]
  12424. Getting the number of bytes ready to read:
  12425. boost::asio::ip::tcp::socket socket(my_context);
  12426. ...
  12427. boost::asio::ip::tcp::socket::bytes_readable command;
  12428. socket.io_control(command);
  12429. std::size_t bytes_readable = command.get();
  12430. [endsect]
  12431. [section:overload2 basic_seq_packet_socket::io_control (2 of 2 overloads)]
  12432. ['Inherited from basic_socket.]
  12433. Perform an IO control command on the socket.
  12434. template<
  12435. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  12436. void io_control(
  12437. IoControlCommand & command,
  12438. boost::system::error_code & ec);
  12439. This function is used to execute an IO control command on the socket.
  12440. [heading Parameters]
  12441. [variablelist
  12442. [[command][The IO control command to be performed on the socket.]]
  12443. [[ec][Set to indicate what error occurred, if any.]]
  12444. ]
  12445. [heading Example]
  12446. Getting the number of bytes ready to read:
  12447. boost::asio::ip::tcp::socket socket(my_context);
  12448. ...
  12449. boost::asio::ip::tcp::socket::bytes_readable command;
  12450. boost::system::error_code ec;
  12451. socket.io_control(command, ec);
  12452. if (ec)
  12453. {
  12454. // An error occurred.
  12455. }
  12456. std::size_t bytes_readable = command.get();
  12457. [endsect]
  12458. [endsect]
  12459. [section:is_open basic_seq_packet_socket::is_open]
  12460. ['Inherited from basic_socket.]
  12461. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.is_open..is_open..basic_seq_packet_socket]
  12462. Determine whether the socket is open.
  12463. bool is_open() const;
  12464. [endsect]
  12465. [section:keep_alive basic_seq_packet_socket::keep_alive]
  12466. ['Inherited from socket_base.]
  12467. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.keep_alive..keep_alive..basic_seq_packet_socket]
  12468. Socket option to send keep-alives.
  12469. typedef implementation_defined keep_alive;
  12470. Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option.
  12471. [heading Examples]
  12472. Setting the option:
  12473. boost::asio::ip::tcp::socket socket(my_context);
  12474. ...
  12475. boost::asio::socket_base::keep_alive option(true);
  12476. socket.set_option(option);
  12477. Getting the current option value:
  12478. boost::asio::ip::tcp::socket socket(my_context);
  12479. ...
  12480. boost::asio::socket_base::keep_alive option;
  12481. socket.get_option(option);
  12482. bool is_set = option.value();
  12483. [heading Requirements]
  12484. ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
  12485. ['Convenience header: ][^boost/asio.hpp]
  12486. [endsect]
  12487. [section:linger basic_seq_packet_socket::linger]
  12488. ['Inherited from socket_base.]
  12489. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.linger..linger..basic_seq_packet_socket]
  12490. Socket option to specify whether the socket lingers on close if unsent data is present.
  12491. typedef implementation_defined linger;
  12492. Implements the SOL\_SOCKET/SO\_LINGER socket option.
  12493. [heading Examples]
  12494. Setting the option:
  12495. boost::asio::ip::tcp::socket socket(my_context);
  12496. ...
  12497. boost::asio::socket_base::linger option(true, 30);
  12498. socket.set_option(option);
  12499. Getting the current option value:
  12500. boost::asio::ip::tcp::socket socket(my_context);
  12501. ...
  12502. boost::asio::socket_base::linger option;
  12503. socket.get_option(option);
  12504. bool is_set = option.enabled();
  12505. unsigned short timeout = option.timeout();
  12506. [heading Requirements]
  12507. ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
  12508. ['Convenience header: ][^boost/asio.hpp]
  12509. [endsect]
  12510. [section:local_endpoint basic_seq_packet_socket::local_endpoint]
  12511. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.local_endpoint..local_endpoint..basic_seq_packet_socket]
  12512. Get the local endpoint of the socket.
  12513. endpoint_type ``[link boost_asio.reference.basic_seq_packet_socket.local_endpoint.overload1 local_endpoint]``() const;
  12514. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.local_endpoint.overload1 more...]]``
  12515. endpoint_type ``[link boost_asio.reference.basic_seq_packet_socket.local_endpoint.overload2 local_endpoint]``(
  12516. boost::system::error_code & ec) const;
  12517. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.local_endpoint.overload2 more...]]``
  12518. [section:overload1 basic_seq_packet_socket::local_endpoint (1 of 2 overloads)]
  12519. ['Inherited from basic_socket.]
  12520. Get the local endpoint of the socket.
  12521. endpoint_type local_endpoint() const;
  12522. This function is used to obtain the locally bound endpoint of the socket.
  12523. [heading Return Value]
  12524. An object that represents the local endpoint of the socket.
  12525. [heading Exceptions]
  12526. [variablelist
  12527. [[boost::system::system_error][Thrown on failure.]]
  12528. ]
  12529. [heading Example]
  12530. boost::asio::ip::tcp::socket socket(my_context);
  12531. ...
  12532. boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint();
  12533. [endsect]
  12534. [section:overload2 basic_seq_packet_socket::local_endpoint (2 of 2 overloads)]
  12535. ['Inherited from basic_socket.]
  12536. Get the local endpoint of the socket.
  12537. endpoint_type local_endpoint(
  12538. boost::system::error_code & ec) const;
  12539. This function is used to obtain the locally bound endpoint of the socket.
  12540. [heading Parameters]
  12541. [variablelist
  12542. [[ec][Set to indicate what error occurred, if any.]]
  12543. ]
  12544. [heading Return Value]
  12545. An object that represents the local endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
  12546. [heading Example]
  12547. boost::asio::ip::tcp::socket socket(my_context);
  12548. ...
  12549. boost::system::error_code ec;
  12550. boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(ec);
  12551. if (ec)
  12552. {
  12553. // An error occurred.
  12554. }
  12555. [endsect]
  12556. [endsect]
  12557. [section:lowest_layer basic_seq_packet_socket::lowest_layer]
  12558. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.lowest_layer..lowest_layer..basic_seq_packet_socket]
  12559. Get a reference to the lowest layer.
  12560. lowest_layer_type & ``[link boost_asio.reference.basic_seq_packet_socket.lowest_layer.overload1 lowest_layer]``();
  12561. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.lowest_layer.overload1 more...]]``
  12562. Get a const reference to the lowest layer.
  12563. const lowest_layer_type & ``[link boost_asio.reference.basic_seq_packet_socket.lowest_layer.overload2 lowest_layer]``() const;
  12564. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.lowest_layer.overload2 more...]]``
  12565. [section:overload1 basic_seq_packet_socket::lowest_layer (1 of 2 overloads)]
  12566. ['Inherited from basic_socket.]
  12567. Get a reference to the lowest layer.
  12568. lowest_layer_type & lowest_layer();
  12569. This function returns a reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
  12570. [heading Return Value]
  12571. A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
  12572. [endsect]
  12573. [section:overload2 basic_seq_packet_socket::lowest_layer (2 of 2 overloads)]
  12574. ['Inherited from basic_socket.]
  12575. Get a const reference to the lowest layer.
  12576. const lowest_layer_type & lowest_layer() const;
  12577. This function returns a const reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
  12578. [heading Return Value]
  12579. A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
  12580. [endsect]
  12581. [endsect]
  12582. [section:lowest_layer_type basic_seq_packet_socket::lowest_layer_type]
  12583. ['Inherited from basic_socket.]
  12584. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.lowest_layer_type..lowest_layer_type..basic_seq_packet_socket]
  12585. A [link boost_asio.reference.basic_socket `basic_socket`] is always the lowest layer.
  12586. typedef basic_socket< Protocol, Executor > lowest_layer_type;
  12587. [heading Types]
  12588. [table
  12589. [[Name][Description]]
  12590. [
  12591. [[link boost_asio.reference.basic_socket__rebind_executor [*rebind_executor]]]
  12592. [Rebinds the socket type to another executor. ]
  12593. ]
  12594. [
  12595. [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]]
  12596. [Socket option to permit sending of broadcast messages. ]
  12597. ]
  12598. [
  12599. [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]]
  12600. [IO control command to get the amount of data that can be read without blocking. ]
  12601. ]
  12602. [
  12603. [[link boost_asio.reference.basic_socket.debug [*debug]]]
  12604. [Socket option to enable socket-level debugging. ]
  12605. ]
  12606. [
  12607. [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]]
  12608. [Socket option to prevent routing, use local interfaces only. ]
  12609. ]
  12610. [
  12611. [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]]
  12612. [Socket option to report aborted connections on accept. ]
  12613. ]
  12614. [
  12615. [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]]
  12616. [The endpoint type. ]
  12617. ]
  12618. [
  12619. [[link boost_asio.reference.basic_socket.executor_type [*executor_type]]]
  12620. [The type of the executor associated with the object. ]
  12621. ]
  12622. [
  12623. [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]]
  12624. [Socket option to send keep-alives. ]
  12625. ]
  12626. [
  12627. [[link boost_asio.reference.basic_socket.linger [*linger]]]
  12628. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  12629. ]
  12630. [
  12631. [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]]
  12632. [A basic_socket is always the lowest layer. ]
  12633. ]
  12634. [
  12635. [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]]
  12636. [Bitmask type for flags that can be passed to send and receive operations. ]
  12637. ]
  12638. [
  12639. [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]]
  12640. [The native representation of a socket. ]
  12641. ]
  12642. [
  12643. [[link boost_asio.reference.basic_socket.out_of_band_inline [*out_of_band_inline]]]
  12644. [Socket option for putting received out-of-band data inline. ]
  12645. ]
  12646. [
  12647. [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]]
  12648. [The protocol type. ]
  12649. ]
  12650. [
  12651. [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]]
  12652. [Socket option for the receive buffer size of a socket. ]
  12653. ]
  12654. [
  12655. [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]]
  12656. [Socket option for the receive low watermark. ]
  12657. ]
  12658. [
  12659. [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]]
  12660. [Socket option to allow the socket to be bound to an address that is already in use. ]
  12661. ]
  12662. [
  12663. [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]]
  12664. [Socket option for the send buffer size of a socket. ]
  12665. ]
  12666. [
  12667. [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]]
  12668. [Socket option for the send low watermark. ]
  12669. ]
  12670. [
  12671. [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]]
  12672. [Different ways a socket may be shutdown. ]
  12673. ]
  12674. [
  12675. [[link boost_asio.reference.basic_socket.wait_type [*wait_type]]]
  12676. [Wait types. ]
  12677. ]
  12678. ]
  12679. [heading Member Functions]
  12680. [table
  12681. [[Name][Description]]
  12682. [
  12683. [[link boost_asio.reference.basic_socket.assign [*assign]]]
  12684. [Assign an existing native socket to the socket. ]
  12685. ]
  12686. [
  12687. [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]]
  12688. [Start an asynchronous connect. ]
  12689. ]
  12690. [
  12691. [[link boost_asio.reference.basic_socket.async_wait [*async_wait]]]
  12692. [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  12693. ]
  12694. [
  12695. [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]]
  12696. [Determine whether the socket is at the out-of-band data mark. ]
  12697. ]
  12698. [
  12699. [[link boost_asio.reference.basic_socket.available [*available]]]
  12700. [Determine the number of bytes available for reading. ]
  12701. ]
  12702. [
  12703. [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]]]
  12704. [Construct a basic_socket without opening it.
  12705. [hr]
  12706. Construct and open a basic_socket.
  12707. [hr]
  12708. Construct a basic_socket, opening it and binding it to the given local endpoint.
  12709. [hr]
  12710. Construct a basic_socket on an existing native socket.
  12711. [hr]
  12712. Move-construct a basic_socket from another.
  12713. [hr]
  12714. Move-construct a basic_socket from a socket of another protocol type. ]
  12715. ]
  12716. [
  12717. [[link boost_asio.reference.basic_socket.bind [*bind]]]
  12718. [Bind the socket to the given local endpoint. ]
  12719. ]
  12720. [
  12721. [[link boost_asio.reference.basic_socket.cancel [*cancel]]]
  12722. [Cancel all asynchronous operations associated with the socket. ]
  12723. ]
  12724. [
  12725. [[link boost_asio.reference.basic_socket.close [*close]]]
  12726. [Close the socket. ]
  12727. ]
  12728. [
  12729. [[link boost_asio.reference.basic_socket.connect [*connect]]]
  12730. [Connect the socket to the specified endpoint. ]
  12731. ]
  12732. [
  12733. [[link boost_asio.reference.basic_socket.get_executor [*get_executor]]]
  12734. [Get the executor associated with the object. ]
  12735. ]
  12736. [
  12737. [[link boost_asio.reference.basic_socket.get_option [*get_option]]]
  12738. [Get an option from the socket. ]
  12739. ]
  12740. [
  12741. [[link boost_asio.reference.basic_socket.io_control [*io_control]]]
  12742. [Perform an IO control command on the socket. ]
  12743. ]
  12744. [
  12745. [[link boost_asio.reference.basic_socket.is_open [*is_open]]]
  12746. [Determine whether the socket is open. ]
  12747. ]
  12748. [
  12749. [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]]
  12750. [Get the local endpoint of the socket. ]
  12751. ]
  12752. [
  12753. [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]]
  12754. [Get a reference to the lowest layer.
  12755. [hr]
  12756. Get a const reference to the lowest layer. ]
  12757. ]
  12758. [
  12759. [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]]
  12760. [Get the native socket representation. ]
  12761. ]
  12762. [
  12763. [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]]
  12764. [Gets the non-blocking mode of the native socket implementation.
  12765. [hr]
  12766. Sets the non-blocking mode of the native socket implementation. ]
  12767. ]
  12768. [
  12769. [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]]
  12770. [Gets the non-blocking mode of the socket.
  12771. [hr]
  12772. Sets the non-blocking mode of the socket. ]
  12773. ]
  12774. [
  12775. [[link boost_asio.reference.basic_socket.open [*open]]]
  12776. [Open the socket using the specified protocol. ]
  12777. ]
  12778. [
  12779. [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]]
  12780. [Move-assign a basic_socket from another.
  12781. [hr]
  12782. Move-assign a basic_socket from a socket of another protocol type. ]
  12783. ]
  12784. [
  12785. [[link boost_asio.reference.basic_socket.release [*release]]]
  12786. [Release ownership of the underlying native socket. ]
  12787. ]
  12788. [
  12789. [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]]
  12790. [Get the remote endpoint of the socket. ]
  12791. ]
  12792. [
  12793. [[link boost_asio.reference.basic_socket.set_option [*set_option]]]
  12794. [Set an option on the socket. ]
  12795. ]
  12796. [
  12797. [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]]
  12798. [Disable sends or receives on the socket. ]
  12799. ]
  12800. [
  12801. [[link boost_asio.reference.basic_socket.wait [*wait]]]
  12802. [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  12803. ]
  12804. ]
  12805. [heading Protected Member Functions]
  12806. [table
  12807. [[Name][Description]]
  12808. [
  12809. [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]]]
  12810. [Protected destructor to prevent deletion through this type. ]
  12811. ]
  12812. ]
  12813. [heading Data Members]
  12814. [table
  12815. [[Name][Description]]
  12816. [
  12817. [[link boost_asio.reference.basic_socket.max_connections [*max_connections]]]
  12818. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  12819. ]
  12820. [
  12821. [[link boost_asio.reference.basic_socket.max_listen_connections [*max_listen_connections]]]
  12822. [The maximum length of the queue of pending incoming connections. ]
  12823. ]
  12824. [
  12825. [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]]]
  12826. [Specify that the data should not be subject to routing. ]
  12827. ]
  12828. [
  12829. [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]]]
  12830. [Specifies that the data marks the end of a record. ]
  12831. ]
  12832. [
  12833. [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]]]
  12834. [Process out-of-band data. ]
  12835. ]
  12836. [
  12837. [[link boost_asio.reference.basic_socket.message_peek [*message_peek]]]
  12838. [Peek at incoming data without removing it from the input queue. ]
  12839. ]
  12840. ]
  12841. [heading Protected Data Members]
  12842. [table
  12843. [[Name][Description]]
  12844. [
  12845. [[link boost_asio.reference.basic_socket.impl_ [*impl_]]]
  12846. []
  12847. ]
  12848. ]
  12849. The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
  12850. [heading Thread Safety]
  12851. ['Distinct] ['objects:] Safe.
  12852. ['Shared] ['objects:] Unsafe.
  12853. [heading Requirements]
  12854. ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
  12855. ['Convenience header: ][^boost/asio.hpp]
  12856. [endsect]
  12857. [section:max_connections basic_seq_packet_socket::max_connections]
  12858. ['Inherited from socket_base.]
  12859. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.max_connections..max_connections..basic_seq_packet_socket]
  12860. (Deprecated: Use max\_listen\_connections.) The maximum length of the queue of pending incoming connections.
  12861. static const int max_connections = implementation_defined;
  12862. [endsect]
  12863. [section:max_listen_connections basic_seq_packet_socket::max_listen_connections]
  12864. ['Inherited from socket_base.]
  12865. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.max_listen_connections..max_listen_connections..basic_seq_packet_socket]
  12866. The maximum length of the queue of pending incoming connections.
  12867. static const int max_listen_connections = implementation_defined;
  12868. [endsect]
  12869. [section:message_do_not_route basic_seq_packet_socket::message_do_not_route]
  12870. ['Inherited from socket_base.]
  12871. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.message_do_not_route..message_do_not_route..basic_seq_packet_socket]
  12872. Specify that the data should not be subject to routing.
  12873. static const int message_do_not_route = implementation_defined;
  12874. [endsect]
  12875. [section:message_end_of_record basic_seq_packet_socket::message_end_of_record]
  12876. ['Inherited from socket_base.]
  12877. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.message_end_of_record..message_end_of_record..basic_seq_packet_socket]
  12878. Specifies that the data marks the end of a record.
  12879. static const int message_end_of_record = implementation_defined;
  12880. [endsect]
  12881. [section:message_flags basic_seq_packet_socket::message_flags]
  12882. ['Inherited from socket_base.]
  12883. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.message_flags..message_flags..basic_seq_packet_socket]
  12884. Bitmask type for flags that can be passed to send and receive operations.
  12885. typedef int message_flags;
  12886. [heading Requirements]
  12887. ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
  12888. ['Convenience header: ][^boost/asio.hpp]
  12889. [endsect]
  12890. [section:message_out_of_band basic_seq_packet_socket::message_out_of_band]
  12891. ['Inherited from socket_base.]
  12892. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.message_out_of_band..message_out_of_band..basic_seq_packet_socket]
  12893. Process out-of-band data.
  12894. static const int message_out_of_band = implementation_defined;
  12895. [endsect]
  12896. [section:message_peek basic_seq_packet_socket::message_peek]
  12897. ['Inherited from socket_base.]
  12898. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.message_peek..message_peek..basic_seq_packet_socket]
  12899. Peek at incoming data without removing it from the input queue.
  12900. static const int message_peek = implementation_defined;
  12901. [endsect]
  12902. [section:native_handle basic_seq_packet_socket::native_handle]
  12903. ['Inherited from basic_socket.]
  12904. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.native_handle..native_handle..basic_seq_packet_socket]
  12905. Get the native socket representation.
  12906. native_handle_type native_handle();
  12907. This function may be used to obtain the underlying representation of the socket. This is intended to allow access to native socket functionality that is not otherwise provided.
  12908. [endsect]
  12909. [section:native_handle_type basic_seq_packet_socket::native_handle_type]
  12910. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.native_handle_type..native_handle_type..basic_seq_packet_socket]
  12911. The native representation of a socket.
  12912. typedef implementation_defined native_handle_type;
  12913. [heading Requirements]
  12914. ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
  12915. ['Convenience header: ][^boost/asio.hpp]
  12916. [endsect]
  12917. [section:native_non_blocking basic_seq_packet_socket::native_non_blocking]
  12918. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.native_non_blocking..native_non_blocking..basic_seq_packet_socket]
  12919. Gets the non-blocking mode of the native socket implementation.
  12920. bool ``[link boost_asio.reference.basic_seq_packet_socket.native_non_blocking.overload1 native_non_blocking]``() const;
  12921. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.native_non_blocking.overload1 more...]]``
  12922. Sets the non-blocking mode of the native socket implementation.
  12923. void ``[link boost_asio.reference.basic_seq_packet_socket.native_non_blocking.overload2 native_non_blocking]``(
  12924. bool mode);
  12925. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.native_non_blocking.overload2 more...]]``
  12926. void ``[link boost_asio.reference.basic_seq_packet_socket.native_non_blocking.overload3 native_non_blocking]``(
  12927. bool mode,
  12928. boost::system::error_code & ec);
  12929. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.native_non_blocking.overload3 more...]]``
  12930. [section:overload1 basic_seq_packet_socket::native_non_blocking (1 of 3 overloads)]
  12931. ['Inherited from basic_socket.]
  12932. Gets the non-blocking mode of the native socket implementation.
  12933. bool native_non_blocking() const;
  12934. This function is used to retrieve the non-blocking mode of the underlying native socket. This mode has no effect on the behaviour of the socket object's synchronous operations.
  12935. [heading Return Value]
  12936. `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).
  12937. [heading Remarks]
  12938. The current non-blocking mode is cached by the socket object. Consequently, the return value may be incorrect if the non-blocking mode was set directly on the native socket.
  12939. [heading Example]
  12940. This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
  12941. template <typename Handler>
  12942. struct sendfile_op
  12943. {
  12944. tcp::socket& sock_;
  12945. int fd_;
  12946. Handler handler_;
  12947. off_t offset_;
  12948. std::size_t total_bytes_transferred_;
  12949. // Function call operator meeting WriteHandler requirements.
  12950. // Used as the handler for the async_write_some operation.
  12951. void operator()(boost::system::error_code ec, std::size_t)
  12952. {
  12953. // Put the underlying socket into non-blocking mode.
  12954. if (!ec)
  12955. if (!sock_.native_non_blocking())
  12956. sock_.native_non_blocking(true, ec);
  12957. if (!ec)
  12958. {
  12959. for (;;)
  12960. {
  12961. // Try the system call.
  12962. errno = 0;
  12963. int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
  12964. ec = boost::system::error_code(n < 0 ? errno : 0,
  12965. boost::asio::error::get_system_category());
  12966. total_bytes_transferred_ += ec ? 0 : n;
  12967. // Retry operation immediately if interrupted by signal.
  12968. if (ec == boost::asio::error::interrupted)
  12969. continue;
  12970. // Check if we need to run the operation again.
  12971. if (ec == boost::asio::error::would_block
  12972. || ec == boost::asio::error::try_again)
  12973. {
  12974. // We have to wait for the socket to become ready again.
  12975. sock_.async_wait(tcp::socket::wait_write, *this);
  12976. return;
  12977. }
  12978. if (ec || n == 0)
  12979. {
  12980. // An error occurred, or we have reached the end of the file.
  12981. // Either way we must exit the loop so we can call the handler.
  12982. break;
  12983. }
  12984. // Loop around to try calling sendfile again.
  12985. }
  12986. }
  12987. // Pass result back to user's handler.
  12988. handler_(ec, total_bytes_transferred_);
  12989. }
  12990. };
  12991. template <typename Handler>
  12992. void async_sendfile(tcp::socket& sock, int fd, Handler h)
  12993. {
  12994. sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
  12995. sock.async_wait(tcp::socket::wait_write, op);
  12996. }
  12997. [endsect]
  12998. [section:overload2 basic_seq_packet_socket::native_non_blocking (2 of 3 overloads)]
  12999. ['Inherited from basic_socket.]
  13000. Sets the non-blocking mode of the native socket implementation.
  13001. void native_non_blocking(
  13002. bool mode);
  13003. This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
  13004. [heading Parameters]
  13005. [variablelist
  13006. [[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).]]
  13007. ]
  13008. [heading Exceptions]
  13009. [variablelist
  13010. [[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.]]
  13011. ]
  13012. [heading Example]
  13013. This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
  13014. template <typename Handler>
  13015. struct sendfile_op
  13016. {
  13017. tcp::socket& sock_;
  13018. int fd_;
  13019. Handler handler_;
  13020. off_t offset_;
  13021. std::size_t total_bytes_transferred_;
  13022. // Function call operator meeting WriteHandler requirements.
  13023. // Used as the handler for the async_write_some operation.
  13024. void operator()(boost::system::error_code ec, std::size_t)
  13025. {
  13026. // Put the underlying socket into non-blocking mode.
  13027. if (!ec)
  13028. if (!sock_.native_non_blocking())
  13029. sock_.native_non_blocking(true, ec);
  13030. if (!ec)
  13031. {
  13032. for (;;)
  13033. {
  13034. // Try the system call.
  13035. errno = 0;
  13036. int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
  13037. ec = boost::system::error_code(n < 0 ? errno : 0,
  13038. boost::asio::error::get_system_category());
  13039. total_bytes_transferred_ += ec ? 0 : n;
  13040. // Retry operation immediately if interrupted by signal.
  13041. if (ec == boost::asio::error::interrupted)
  13042. continue;
  13043. // Check if we need to run the operation again.
  13044. if (ec == boost::asio::error::would_block
  13045. || ec == boost::asio::error::try_again)
  13046. {
  13047. // We have to wait for the socket to become ready again.
  13048. sock_.async_wait(tcp::socket::wait_write, *this);
  13049. return;
  13050. }
  13051. if (ec || n == 0)
  13052. {
  13053. // An error occurred, or we have reached the end of the file.
  13054. // Either way we must exit the loop so we can call the handler.
  13055. break;
  13056. }
  13057. // Loop around to try calling sendfile again.
  13058. }
  13059. }
  13060. // Pass result back to user's handler.
  13061. handler_(ec, total_bytes_transferred_);
  13062. }
  13063. };
  13064. template <typename Handler>
  13065. void async_sendfile(tcp::socket& sock, int fd, Handler h)
  13066. {
  13067. sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
  13068. sock.async_wait(tcp::socket::wait_write, op);
  13069. }
  13070. [endsect]
  13071. [section:overload3 basic_seq_packet_socket::native_non_blocking (3 of 3 overloads)]
  13072. ['Inherited from basic_socket.]
  13073. Sets the non-blocking mode of the native socket implementation.
  13074. void native_non_blocking(
  13075. bool mode,
  13076. boost::system::error_code & ec);
  13077. This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
  13078. [heading Parameters]
  13079. [variablelist
  13080. [[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).]]
  13081. [[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.]]
  13082. ]
  13083. [heading Example]
  13084. This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
  13085. template <typename Handler>
  13086. struct sendfile_op
  13087. {
  13088. tcp::socket& sock_;
  13089. int fd_;
  13090. Handler handler_;
  13091. off_t offset_;
  13092. std::size_t total_bytes_transferred_;
  13093. // Function call operator meeting WriteHandler requirements.
  13094. // Used as the handler for the async_write_some operation.
  13095. void operator()(boost::system::error_code ec, std::size_t)
  13096. {
  13097. // Put the underlying socket into non-blocking mode.
  13098. if (!ec)
  13099. if (!sock_.native_non_blocking())
  13100. sock_.native_non_blocking(true, ec);
  13101. if (!ec)
  13102. {
  13103. for (;;)
  13104. {
  13105. // Try the system call.
  13106. errno = 0;
  13107. int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
  13108. ec = boost::system::error_code(n < 0 ? errno : 0,
  13109. boost::asio::error::get_system_category());
  13110. total_bytes_transferred_ += ec ? 0 : n;
  13111. // Retry operation immediately if interrupted by signal.
  13112. if (ec == boost::asio::error::interrupted)
  13113. continue;
  13114. // Check if we need to run the operation again.
  13115. if (ec == boost::asio::error::would_block
  13116. || ec == boost::asio::error::try_again)
  13117. {
  13118. // We have to wait for the socket to become ready again.
  13119. sock_.async_wait(tcp::socket::wait_write, *this);
  13120. return;
  13121. }
  13122. if (ec || n == 0)
  13123. {
  13124. // An error occurred, or we have reached the end of the file.
  13125. // Either way we must exit the loop so we can call the handler.
  13126. break;
  13127. }
  13128. // Loop around to try calling sendfile again.
  13129. }
  13130. }
  13131. // Pass result back to user's handler.
  13132. handler_(ec, total_bytes_transferred_);
  13133. }
  13134. };
  13135. template <typename Handler>
  13136. void async_sendfile(tcp::socket& sock, int fd, Handler h)
  13137. {
  13138. sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
  13139. sock.async_wait(tcp::socket::wait_write, op);
  13140. }
  13141. [endsect]
  13142. [endsect]
  13143. [section:non_blocking basic_seq_packet_socket::non_blocking]
  13144. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.non_blocking..non_blocking..basic_seq_packet_socket]
  13145. Gets the non-blocking mode of the socket.
  13146. bool ``[link boost_asio.reference.basic_seq_packet_socket.non_blocking.overload1 non_blocking]``() const;
  13147. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.non_blocking.overload1 more...]]``
  13148. Sets the non-blocking mode of the socket.
  13149. void ``[link boost_asio.reference.basic_seq_packet_socket.non_blocking.overload2 non_blocking]``(
  13150. bool mode);
  13151. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.non_blocking.overload2 more...]]``
  13152. void ``[link boost_asio.reference.basic_seq_packet_socket.non_blocking.overload3 non_blocking]``(
  13153. bool mode,
  13154. boost::system::error_code & ec);
  13155. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.non_blocking.overload3 more...]]``
  13156. [section:overload1 basic_seq_packet_socket::non_blocking (1 of 3 overloads)]
  13157. ['Inherited from basic_socket.]
  13158. Gets the non-blocking mode of the socket.
  13159. bool non_blocking() const;
  13160. [heading Return Value]
  13161. `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.
  13162. [heading Remarks]
  13163. The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
  13164. [endsect]
  13165. [section:overload2 basic_seq_packet_socket::non_blocking (2 of 3 overloads)]
  13166. ['Inherited from basic_socket.]
  13167. Sets the non-blocking mode of the socket.
  13168. void non_blocking(
  13169. bool mode);
  13170. [heading Parameters]
  13171. [variablelist
  13172. [[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.]]
  13173. ]
  13174. [heading Exceptions]
  13175. [variablelist
  13176. [[boost::system::system_error][Thrown on failure.]]
  13177. ]
  13178. [heading Remarks]
  13179. The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
  13180. [endsect]
  13181. [section:overload3 basic_seq_packet_socket::non_blocking (3 of 3 overloads)]
  13182. ['Inherited from basic_socket.]
  13183. Sets the non-blocking mode of the socket.
  13184. void non_blocking(
  13185. bool mode,
  13186. boost::system::error_code & ec);
  13187. [heading Parameters]
  13188. [variablelist
  13189. [[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.]]
  13190. [[ec][Set to indicate what error occurred, if any.]]
  13191. ]
  13192. [heading Remarks]
  13193. The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
  13194. [endsect]
  13195. [endsect]
  13196. [section:open basic_seq_packet_socket::open]
  13197. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.open..open..basic_seq_packet_socket]
  13198. Open the socket using the specified protocol.
  13199. void ``[link boost_asio.reference.basic_seq_packet_socket.open.overload1 open]``(
  13200. const protocol_type & protocol = protocol_type());
  13201. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.open.overload1 more...]]``
  13202. void ``[link boost_asio.reference.basic_seq_packet_socket.open.overload2 open]``(
  13203. const protocol_type & protocol,
  13204. boost::system::error_code & ec);
  13205. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.open.overload2 more...]]``
  13206. [section:overload1 basic_seq_packet_socket::open (1 of 2 overloads)]
  13207. ['Inherited from basic_socket.]
  13208. Open the socket using the specified protocol.
  13209. void open(
  13210. const protocol_type & protocol = protocol_type());
  13211. This function opens the socket so that it will use the specified protocol.
  13212. [heading Parameters]
  13213. [variablelist
  13214. [[protocol][An object specifying protocol parameters to be used.]]
  13215. ]
  13216. [heading Exceptions]
  13217. [variablelist
  13218. [[boost::system::system_error][Thrown on failure.]]
  13219. ]
  13220. [heading Example]
  13221. boost::asio::ip::tcp::socket socket(my_context);
  13222. socket.open(boost::asio::ip::tcp::v4());
  13223. [endsect]
  13224. [section:overload2 basic_seq_packet_socket::open (2 of 2 overloads)]
  13225. ['Inherited from basic_socket.]
  13226. Open the socket using the specified protocol.
  13227. void open(
  13228. const protocol_type & protocol,
  13229. boost::system::error_code & ec);
  13230. This function opens the socket so that it will use the specified protocol.
  13231. [heading Parameters]
  13232. [variablelist
  13233. [[protocol][An object specifying which protocol is to be used.]]
  13234. [[ec][Set to indicate what error occurred, if any.]]
  13235. ]
  13236. [heading Example]
  13237. boost::asio::ip::tcp::socket socket(my_context);
  13238. boost::system::error_code ec;
  13239. socket.open(boost::asio::ip::tcp::v4(), ec);
  13240. if (ec)
  13241. {
  13242. // An error occurred.
  13243. }
  13244. [endsect]
  13245. [endsect]
  13246. [section:operator_eq_ basic_seq_packet_socket::operator=]
  13247. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.operator_eq_..operator=..basic_seq_packet_socket]
  13248. Move-assign a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] from another.
  13249. basic_seq_packet_socket & ``[link boost_asio.reference.basic_seq_packet_socket.operator_eq_.overload1 operator=]``(
  13250. basic_seq_packet_socket && other);
  13251. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.operator_eq_.overload1 more...]]``
  13252. Move-assign a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] from a socket of another protocol type.
  13253. template<
  13254. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  13255. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  13256. enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_seq_packet_socket & >::type ``[link boost_asio.reference.basic_seq_packet_socket.operator_eq_.overload2 operator=]``(
  13257. basic_seq_packet_socket< Protocol1, Executor1 > && other);
  13258. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.operator_eq_.overload2 more...]]``
  13259. [section:overload1 basic_seq_packet_socket::operator= (1 of 2 overloads)]
  13260. Move-assign a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] from another.
  13261. basic_seq_packet_socket & operator=(
  13262. basic_seq_packet_socket && other);
  13263. This assignment operator moves a sequenced packet socket from one object to another.
  13264. [heading Parameters]
  13265. [variablelist
  13266. [[other][The other [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] object from which the move will occur.]]
  13267. ]
  13268. [heading Remarks]
  13269. Following the move, the moved-from object is in the same state as if constructed using the `basic_seq_packet_socket(const executor_type&)` constructor.
  13270. [endsect]
  13271. [section:overload2 basic_seq_packet_socket::operator= (2 of 2 overloads)]
  13272. Move-assign a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] from a socket of another protocol type.
  13273. template<
  13274. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  13275. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  13276. enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_seq_packet_socket & >::type operator=(
  13277. basic_seq_packet_socket< Protocol1, Executor1 > && other);
  13278. This assignment operator moves a sequenced packet socket from one object to another.
  13279. [heading Parameters]
  13280. [variablelist
  13281. [[other][The other [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] object from which the move will occur.]]
  13282. ]
  13283. [heading Remarks]
  13284. Following the move, the moved-from object is in the same state as if constructed using the `basic_seq_packet_socket(const executor_type&)` constructor.
  13285. [endsect]
  13286. [endsect]
  13287. [section:out_of_band_inline basic_seq_packet_socket::out_of_band_inline]
  13288. ['Inherited from socket_base.]
  13289. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.out_of_band_inline..out_of_band_inline..basic_seq_packet_socket]
  13290. Socket option for putting received out-of-band data inline.
  13291. typedef implementation_defined out_of_band_inline;
  13292. Implements the SOL\_SOCKET/SO\_OOBINLINE socket option.
  13293. [heading Examples]
  13294. Setting the option:
  13295. boost::asio::ip::tcp::socket socket(my_context);
  13296. ...
  13297. boost::asio::socket_base::out_of_band_inline option(true);
  13298. socket.set_option(option);
  13299. Getting the current option value:
  13300. boost::asio::ip::tcp::socket socket(my_context);
  13301. ...
  13302. boost::asio::socket_base::out_of_band_inline option;
  13303. socket.get_option(option);
  13304. bool value = option.value();
  13305. [heading Requirements]
  13306. ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
  13307. ['Convenience header: ][^boost/asio.hpp]
  13308. [endsect]
  13309. [section:protocol_type basic_seq_packet_socket::protocol_type]
  13310. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.protocol_type..protocol_type..basic_seq_packet_socket]
  13311. The protocol type.
  13312. typedef Protocol protocol_type;
  13313. [heading Requirements]
  13314. ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
  13315. ['Convenience header: ][^boost/asio.hpp]
  13316. [endsect]
  13317. [section:receive basic_seq_packet_socket::receive]
  13318. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.receive..receive..basic_seq_packet_socket]
  13319. Receive some data on the socket.
  13320. template<
  13321. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  13322. std::size_t ``[link boost_asio.reference.basic_seq_packet_socket.receive.overload1 receive]``(
  13323. const MutableBufferSequence & buffers,
  13324. socket_base::message_flags & out_flags);
  13325. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.receive.overload1 more...]]``
  13326. template<
  13327. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  13328. std::size_t ``[link boost_asio.reference.basic_seq_packet_socket.receive.overload2 receive]``(
  13329. const MutableBufferSequence & buffers,
  13330. socket_base::message_flags in_flags,
  13331. socket_base::message_flags & out_flags);
  13332. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.receive.overload2 more...]]``
  13333. Receive some data on a connected socket.
  13334. template<
  13335. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  13336. std::size_t ``[link boost_asio.reference.basic_seq_packet_socket.receive.overload3 receive]``(
  13337. const MutableBufferSequence & buffers,
  13338. socket_base::message_flags in_flags,
  13339. socket_base::message_flags & out_flags,
  13340. boost::system::error_code & ec);
  13341. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.receive.overload3 more...]]``
  13342. [section:overload1 basic_seq_packet_socket::receive (1 of 3 overloads)]
  13343. Receive some data on the socket.
  13344. template<
  13345. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  13346. std::size_t receive(
  13347. const MutableBufferSequence & buffers,
  13348. socket_base::message_flags & out_flags);
  13349. This function is used to receive data on the sequenced packet socket. The function call will block until data has been received successfully, or until an error occurs.
  13350. [heading Parameters]
  13351. [variablelist
  13352. [[buffers][One or more buffers into which the data will be received.]]
  13353. [[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.]]
  13354. ]
  13355. [heading Return Value]
  13356. The number of bytes received.
  13357. [heading Exceptions]
  13358. [variablelist
  13359. [[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
  13360. ]
  13361. [heading Example]
  13362. To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  13363. socket.receive(boost::asio::buffer(data, size), out_flags);
  13364. See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  13365. [endsect]
  13366. [section:overload2 basic_seq_packet_socket::receive (2 of 3 overloads)]
  13367. Receive some data on the socket.
  13368. template<
  13369. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  13370. std::size_t receive(
  13371. const MutableBufferSequence & buffers,
  13372. socket_base::message_flags in_flags,
  13373. socket_base::message_flags & out_flags);
  13374. This function is used to receive data on the sequenced packet socket. The function call will block until data has been received successfully, or until an error occurs.
  13375. [heading Parameters]
  13376. [variablelist
  13377. [[buffers][One or more buffers into which the data will be received.]]
  13378. [[in_flags][Flags specifying how the receive call is to be made.]]
  13379. [[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.]]
  13380. ]
  13381. [heading Return Value]
  13382. The number of bytes received.
  13383. [heading Exceptions]
  13384. [variablelist
  13385. [[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
  13386. ]
  13387. [heading Remarks]
  13388. The receive operation may not receive all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
  13389. [heading Example]
  13390. To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  13391. socket.receive(boost::asio::buffer(data, size), 0, out_flags);
  13392. See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  13393. [endsect]
  13394. [section:overload3 basic_seq_packet_socket::receive (3 of 3 overloads)]
  13395. Receive some data on a connected socket.
  13396. template<
  13397. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  13398. std::size_t receive(
  13399. const MutableBufferSequence & buffers,
  13400. socket_base::message_flags in_flags,
  13401. socket_base::message_flags & out_flags,
  13402. boost::system::error_code & ec);
  13403. This function is used to receive data on the sequenced packet socket. The function call will block until data has been received successfully, or until an error occurs.
  13404. [heading Parameters]
  13405. [variablelist
  13406. [[buffers][One or more buffers into which the data will be received.]]
  13407. [[in_flags][Flags specifying how the receive call is to be made.]]
  13408. [[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.]]
  13409. [[ec][Set to indicate what error occurred, if any.]]
  13410. ]
  13411. [heading Return Value]
  13412. The number of bytes received. Returns 0 if an error occurred.
  13413. [heading Remarks]
  13414. The receive operation may not receive all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
  13415. [endsect]
  13416. [endsect]
  13417. [section:receive_buffer_size basic_seq_packet_socket::receive_buffer_size]
  13418. ['Inherited from socket_base.]
  13419. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.receive_buffer_size..receive_buffer_size..basic_seq_packet_socket]
  13420. Socket option for the receive buffer size of a socket.
  13421. typedef implementation_defined receive_buffer_size;
  13422. Implements the SOL\_SOCKET/SO\_RCVBUF socket option.
  13423. [heading Examples]
  13424. Setting the option:
  13425. boost::asio::ip::tcp::socket socket(my_context);
  13426. ...
  13427. boost::asio::socket_base::receive_buffer_size option(8192);
  13428. socket.set_option(option);
  13429. Getting the current option value:
  13430. boost::asio::ip::tcp::socket socket(my_context);
  13431. ...
  13432. boost::asio::socket_base::receive_buffer_size option;
  13433. socket.get_option(option);
  13434. int size = option.value();
  13435. [heading Requirements]
  13436. ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
  13437. ['Convenience header: ][^boost/asio.hpp]
  13438. [endsect]
  13439. [section:receive_low_watermark basic_seq_packet_socket::receive_low_watermark]
  13440. ['Inherited from socket_base.]
  13441. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.receive_low_watermark..receive_low_watermark..basic_seq_packet_socket]
  13442. Socket option for the receive low watermark.
  13443. typedef implementation_defined receive_low_watermark;
  13444. Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option.
  13445. [heading Examples]
  13446. Setting the option:
  13447. boost::asio::ip::tcp::socket socket(my_context);
  13448. ...
  13449. boost::asio::socket_base::receive_low_watermark option(1024);
  13450. socket.set_option(option);
  13451. Getting the current option value:
  13452. boost::asio::ip::tcp::socket socket(my_context);
  13453. ...
  13454. boost::asio::socket_base::receive_low_watermark option;
  13455. socket.get_option(option);
  13456. int size = option.value();
  13457. [heading Requirements]
  13458. ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
  13459. ['Convenience header: ][^boost/asio.hpp]
  13460. [endsect]
  13461. [section:release basic_seq_packet_socket::release]
  13462. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.release..release..basic_seq_packet_socket]
  13463. Release ownership of the underlying native socket.
  13464. native_handle_type ``[link boost_asio.reference.basic_seq_packet_socket.release.overload1 release]``();
  13465. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.release.overload1 more...]]``
  13466. native_handle_type ``[link boost_asio.reference.basic_seq_packet_socket.release.overload2 release]``(
  13467. boost::system::error_code & ec);
  13468. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.release.overload2 more...]]``
  13469. [section:overload1 basic_seq_packet_socket::release (1 of 2 overloads)]
  13470. ['Inherited from basic_socket.]
  13471. Release ownership of the underlying native socket.
  13472. native_handle_type release();
  13473. This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. Ownership of the native socket is then transferred to the caller.
  13474. [heading Exceptions]
  13475. [variablelist
  13476. [[boost::system::system_error][Thrown on failure.]]
  13477. ]
  13478. [heading Remarks]
  13479. This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms.
  13480. [endsect]
  13481. [section:overload2 basic_seq_packet_socket::release (2 of 2 overloads)]
  13482. ['Inherited from basic_socket.]
  13483. Release ownership of the underlying native socket.
  13484. native_handle_type release(
  13485. boost::system::error_code & ec);
  13486. This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. Ownership of the native socket is then transferred to the caller.
  13487. [heading Parameters]
  13488. [variablelist
  13489. [[ec][Set to indicate what error occurred, if any.]]
  13490. ]
  13491. [heading Remarks]
  13492. This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms.
  13493. [endsect]
  13494. [endsect]
  13495. [section:remote_endpoint basic_seq_packet_socket::remote_endpoint]
  13496. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.remote_endpoint..remote_endpoint..basic_seq_packet_socket]
  13497. Get the remote endpoint of the socket.
  13498. endpoint_type ``[link boost_asio.reference.basic_seq_packet_socket.remote_endpoint.overload1 remote_endpoint]``() const;
  13499. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.remote_endpoint.overload1 more...]]``
  13500. endpoint_type ``[link boost_asio.reference.basic_seq_packet_socket.remote_endpoint.overload2 remote_endpoint]``(
  13501. boost::system::error_code & ec) const;
  13502. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.remote_endpoint.overload2 more...]]``
  13503. [section:overload1 basic_seq_packet_socket::remote_endpoint (1 of 2 overloads)]
  13504. ['Inherited from basic_socket.]
  13505. Get the remote endpoint of the socket.
  13506. endpoint_type remote_endpoint() const;
  13507. This function is used to obtain the remote endpoint of the socket.
  13508. [heading Return Value]
  13509. An object that represents the remote endpoint of the socket.
  13510. [heading Exceptions]
  13511. [variablelist
  13512. [[boost::system::system_error][Thrown on failure.]]
  13513. ]
  13514. [heading Example]
  13515. boost::asio::ip::tcp::socket socket(my_context);
  13516. ...
  13517. boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint();
  13518. [endsect]
  13519. [section:overload2 basic_seq_packet_socket::remote_endpoint (2 of 2 overloads)]
  13520. ['Inherited from basic_socket.]
  13521. Get the remote endpoint of the socket.
  13522. endpoint_type remote_endpoint(
  13523. boost::system::error_code & ec) const;
  13524. This function is used to obtain the remote endpoint of the socket.
  13525. [heading Parameters]
  13526. [variablelist
  13527. [[ec][Set to indicate what error occurred, if any.]]
  13528. ]
  13529. [heading Return Value]
  13530. An object that represents the remote endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
  13531. [heading Example]
  13532. boost::asio::ip::tcp::socket socket(my_context);
  13533. ...
  13534. boost::system::error_code ec;
  13535. boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(ec);
  13536. if (ec)
  13537. {
  13538. // An error occurred.
  13539. }
  13540. [endsect]
  13541. [endsect]
  13542. [section:reuse_address basic_seq_packet_socket::reuse_address]
  13543. ['Inherited from socket_base.]
  13544. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.reuse_address..reuse_address..basic_seq_packet_socket]
  13545. Socket option to allow the socket to be bound to an address that is already in use.
  13546. typedef implementation_defined reuse_address;
  13547. Implements the SOL\_SOCKET/SO\_REUSEADDR socket option.
  13548. [heading Examples]
  13549. Setting the option:
  13550. boost::asio::ip::tcp::acceptor acceptor(my_context);
  13551. ...
  13552. boost::asio::socket_base::reuse_address option(true);
  13553. acceptor.set_option(option);
  13554. Getting the current option value:
  13555. boost::asio::ip::tcp::acceptor acceptor(my_context);
  13556. ...
  13557. boost::asio::socket_base::reuse_address option;
  13558. acceptor.get_option(option);
  13559. bool is_set = option.value();
  13560. [heading Requirements]
  13561. ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
  13562. ['Convenience header: ][^boost/asio.hpp]
  13563. [endsect]
  13564. [section:send basic_seq_packet_socket::send]
  13565. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.send..send..basic_seq_packet_socket]
  13566. Send some data on the socket.
  13567. template<
  13568. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  13569. std::size_t ``[link boost_asio.reference.basic_seq_packet_socket.send.overload1 send]``(
  13570. const ConstBufferSequence & buffers,
  13571. socket_base::message_flags flags);
  13572. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.send.overload1 more...]]``
  13573. template<
  13574. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  13575. std::size_t ``[link boost_asio.reference.basic_seq_packet_socket.send.overload2 send]``(
  13576. const ConstBufferSequence & buffers,
  13577. socket_base::message_flags flags,
  13578. boost::system::error_code & ec);
  13579. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.send.overload2 more...]]``
  13580. [section:overload1 basic_seq_packet_socket::send (1 of 2 overloads)]
  13581. Send some data on the socket.
  13582. template<
  13583. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  13584. std::size_t send(
  13585. const ConstBufferSequence & buffers,
  13586. socket_base::message_flags flags);
  13587. This function is used to send data on the sequenced packet socket. The function call will block until the data has been sent successfully, or an until error occurs.
  13588. [heading Parameters]
  13589. [variablelist
  13590. [[buffers][One or more data buffers to be sent on the socket.]]
  13591. [[flags][Flags specifying how the send call is to be made.]]
  13592. ]
  13593. [heading Return Value]
  13594. The number of bytes sent.
  13595. [heading Exceptions]
  13596. [variablelist
  13597. [[boost::system::system_error][Thrown on failure.]]
  13598. ]
  13599. [heading Example]
  13600. To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  13601. socket.send(boost::asio::buffer(data, size), 0);
  13602. See the [link boost_asio.reference.buffer `buffer`] documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  13603. [endsect]
  13604. [section:overload2 basic_seq_packet_socket::send (2 of 2 overloads)]
  13605. Send some data on the socket.
  13606. template<
  13607. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  13608. std::size_t send(
  13609. const ConstBufferSequence & buffers,
  13610. socket_base::message_flags flags,
  13611. boost::system::error_code & ec);
  13612. This function is used to send data on the sequenced packet socket. The function call will block the data has been sent successfully, or an until error occurs.
  13613. [heading Parameters]
  13614. [variablelist
  13615. [[buffers][One or more data buffers to be sent on the socket.]]
  13616. [[flags][Flags specifying how the send call is to be made.]]
  13617. [[ec][Set to indicate what error occurred, if any.]]
  13618. ]
  13619. [heading Return Value]
  13620. The number of bytes sent. Returns 0 if an error occurred.
  13621. [heading Remarks]
  13622. The send operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
  13623. [endsect]
  13624. [endsect]
  13625. [section:send_buffer_size basic_seq_packet_socket::send_buffer_size]
  13626. ['Inherited from socket_base.]
  13627. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.send_buffer_size..send_buffer_size..basic_seq_packet_socket]
  13628. Socket option for the send buffer size of a socket.
  13629. typedef implementation_defined send_buffer_size;
  13630. Implements the SOL\_SOCKET/SO\_SNDBUF socket option.
  13631. [heading Examples]
  13632. Setting the option:
  13633. boost::asio::ip::tcp::socket socket(my_context);
  13634. ...
  13635. boost::asio::socket_base::send_buffer_size option(8192);
  13636. socket.set_option(option);
  13637. Getting the current option value:
  13638. boost::asio::ip::tcp::socket socket(my_context);
  13639. ...
  13640. boost::asio::socket_base::send_buffer_size option;
  13641. socket.get_option(option);
  13642. int size = option.value();
  13643. [heading Requirements]
  13644. ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
  13645. ['Convenience header: ][^boost/asio.hpp]
  13646. [endsect]
  13647. [section:send_low_watermark basic_seq_packet_socket::send_low_watermark]
  13648. ['Inherited from socket_base.]
  13649. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.send_low_watermark..send_low_watermark..basic_seq_packet_socket]
  13650. Socket option for the send low watermark.
  13651. typedef implementation_defined send_low_watermark;
  13652. Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option.
  13653. [heading Examples]
  13654. Setting the option:
  13655. boost::asio::ip::tcp::socket socket(my_context);
  13656. ...
  13657. boost::asio::socket_base::send_low_watermark option(1024);
  13658. socket.set_option(option);
  13659. Getting the current option value:
  13660. boost::asio::ip::tcp::socket socket(my_context);
  13661. ...
  13662. boost::asio::socket_base::send_low_watermark option;
  13663. socket.get_option(option);
  13664. int size = option.value();
  13665. [heading Requirements]
  13666. ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
  13667. ['Convenience header: ][^boost/asio.hpp]
  13668. [endsect]
  13669. [section:set_option basic_seq_packet_socket::set_option]
  13670. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.set_option..set_option..basic_seq_packet_socket]
  13671. Set an option on the socket.
  13672. template<
  13673. typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
  13674. void ``[link boost_asio.reference.basic_seq_packet_socket.set_option.overload1 set_option]``(
  13675. const SettableSocketOption & option);
  13676. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.set_option.overload1 more...]]``
  13677. template<
  13678. typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
  13679. void ``[link boost_asio.reference.basic_seq_packet_socket.set_option.overload2 set_option]``(
  13680. const SettableSocketOption & option,
  13681. boost::system::error_code & ec);
  13682. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.set_option.overload2 more...]]``
  13683. [section:overload1 basic_seq_packet_socket::set_option (1 of 2 overloads)]
  13684. ['Inherited from basic_socket.]
  13685. Set an option on the socket.
  13686. template<
  13687. typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
  13688. void set_option(
  13689. const SettableSocketOption & option);
  13690. This function is used to set an option on the socket.
  13691. [heading Parameters]
  13692. [variablelist
  13693. [[option][The new option value to be set on the socket.]]
  13694. ]
  13695. [heading Exceptions]
  13696. [variablelist
  13697. [[boost::system::system_error][Thrown on failure.]]
  13698. ]
  13699. [heading Example]
  13700. Setting the IPPROTO\_TCP/TCP\_NODELAY option:
  13701. boost::asio::ip::tcp::socket socket(my_context);
  13702. ...
  13703. boost::asio::ip::tcp::no_delay option(true);
  13704. socket.set_option(option);
  13705. [endsect]
  13706. [section:overload2 basic_seq_packet_socket::set_option (2 of 2 overloads)]
  13707. ['Inherited from basic_socket.]
  13708. Set an option on the socket.
  13709. template<
  13710. typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
  13711. void set_option(
  13712. const SettableSocketOption & option,
  13713. boost::system::error_code & ec);
  13714. This function is used to set an option on the socket.
  13715. [heading Parameters]
  13716. [variablelist
  13717. [[option][The new option value to be set on the socket.]]
  13718. [[ec][Set to indicate what error occurred, if any.]]
  13719. ]
  13720. [heading Example]
  13721. Setting the IPPROTO\_TCP/TCP\_NODELAY option:
  13722. boost::asio::ip::tcp::socket socket(my_context);
  13723. ...
  13724. boost::asio::ip::tcp::no_delay option(true);
  13725. boost::system::error_code ec;
  13726. socket.set_option(option, ec);
  13727. if (ec)
  13728. {
  13729. // An error occurred.
  13730. }
  13731. [endsect]
  13732. [endsect]
  13733. [section:shutdown basic_seq_packet_socket::shutdown]
  13734. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.shutdown..shutdown..basic_seq_packet_socket]
  13735. Disable sends or receives on the socket.
  13736. void ``[link boost_asio.reference.basic_seq_packet_socket.shutdown.overload1 shutdown]``(
  13737. shutdown_type what);
  13738. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.shutdown.overload1 more...]]``
  13739. void ``[link boost_asio.reference.basic_seq_packet_socket.shutdown.overload2 shutdown]``(
  13740. shutdown_type what,
  13741. boost::system::error_code & ec);
  13742. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.shutdown.overload2 more...]]``
  13743. [section:overload1 basic_seq_packet_socket::shutdown (1 of 2 overloads)]
  13744. ['Inherited from basic_socket.]
  13745. Disable sends or receives on the socket.
  13746. void shutdown(
  13747. shutdown_type what);
  13748. This function is used to disable send operations, receive operations, or both.
  13749. [heading Parameters]
  13750. [variablelist
  13751. [[what][Determines what types of operation will no longer be allowed.]]
  13752. ]
  13753. [heading Exceptions]
  13754. [variablelist
  13755. [[boost::system::system_error][Thrown on failure.]]
  13756. ]
  13757. [heading Example]
  13758. Shutting down the send side of the socket:
  13759. boost::asio::ip::tcp::socket socket(my_context);
  13760. ...
  13761. socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send);
  13762. [endsect]
  13763. [section:overload2 basic_seq_packet_socket::shutdown (2 of 2 overloads)]
  13764. ['Inherited from basic_socket.]
  13765. Disable sends or receives on the socket.
  13766. void shutdown(
  13767. shutdown_type what,
  13768. boost::system::error_code & ec);
  13769. This function is used to disable send operations, receive operations, or both.
  13770. [heading Parameters]
  13771. [variablelist
  13772. [[what][Determines what types of operation will no longer be allowed.]]
  13773. [[ec][Set to indicate what error occurred, if any.]]
  13774. ]
  13775. [heading Example]
  13776. Shutting down the send side of the socket:
  13777. boost::asio::ip::tcp::socket socket(my_context);
  13778. ...
  13779. boost::system::error_code ec;
  13780. socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ec);
  13781. if (ec)
  13782. {
  13783. // An error occurred.
  13784. }
  13785. [endsect]
  13786. [endsect]
  13787. [section:shutdown_type basic_seq_packet_socket::shutdown_type]
  13788. ['Inherited from socket_base.]
  13789. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.shutdown_type..shutdown_type..basic_seq_packet_socket]
  13790. Different ways a socket may be shutdown.
  13791. enum shutdown_type
  13792. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.shutdown_type.shutdown_receive..shutdown_receive..basic_seq_packet_socket]
  13793. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.shutdown_type.shutdown_send..shutdown_send..basic_seq_packet_socket]
  13794. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.shutdown_type.shutdown_both..shutdown_both..basic_seq_packet_socket]
  13795. [heading Values]
  13796. [variablelist
  13797. [
  13798. [shutdown_receive]
  13799. [Shutdown the receive side of the socket. ]
  13800. ]
  13801. [
  13802. [shutdown_send]
  13803. [Shutdown the send side of the socket. ]
  13804. ]
  13805. [
  13806. [shutdown_both]
  13807. [Shutdown both send and receive on the socket. ]
  13808. ]
  13809. ]
  13810. [endsect]
  13811. [section:wait basic_seq_packet_socket::wait]
  13812. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.wait..wait..basic_seq_packet_socket]
  13813. Wait for the socket to become ready to read, ready to write, or to have pending error conditions.
  13814. void ``[link boost_asio.reference.basic_seq_packet_socket.wait.overload1 wait]``(
  13815. wait_type w);
  13816. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.wait.overload1 more...]]``
  13817. void ``[link boost_asio.reference.basic_seq_packet_socket.wait.overload2 wait]``(
  13818. wait_type w,
  13819. boost::system::error_code & ec);
  13820. `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.wait.overload2 more...]]``
  13821. [section:overload1 basic_seq_packet_socket::wait (1 of 2 overloads)]
  13822. ['Inherited from basic_socket.]
  13823. Wait for the socket to become ready to read, ready to write, or to have pending error conditions.
  13824. void wait(
  13825. wait_type w);
  13826. This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state.
  13827. [heading Parameters]
  13828. [variablelist
  13829. [[w][Specifies the desired socket state.]]
  13830. ]
  13831. [heading Example]
  13832. Waiting for a socket to become readable.
  13833. boost::asio::ip::tcp::socket socket(my_context);
  13834. ...
  13835. socket.wait(boost::asio::ip::tcp::socket::wait_read);
  13836. [endsect]
  13837. [section:overload2 basic_seq_packet_socket::wait (2 of 2 overloads)]
  13838. ['Inherited from basic_socket.]
  13839. Wait for the socket to become ready to read, ready to write, or to have pending error conditions.
  13840. void wait(
  13841. wait_type w,
  13842. boost::system::error_code & ec);
  13843. This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state.
  13844. [heading Parameters]
  13845. [variablelist
  13846. [[w][Specifies the desired socket state.]]
  13847. [[ec][Set to indicate what error occurred, if any.]]
  13848. ]
  13849. [heading Example]
  13850. Waiting for a socket to become readable.
  13851. boost::asio::ip::tcp::socket socket(my_context);
  13852. ...
  13853. boost::system::error_code ec;
  13854. socket.wait(boost::asio::ip::tcp::socket::wait_read, ec);
  13855. [endsect]
  13856. [endsect]
  13857. [section:wait_type basic_seq_packet_socket::wait_type]
  13858. ['Inherited from socket_base.]
  13859. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.wait_type..wait_type..basic_seq_packet_socket]
  13860. Wait types.
  13861. enum wait_type
  13862. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.wait_type.wait_read..wait_read..basic_seq_packet_socket]
  13863. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.wait_type.wait_write..wait_write..basic_seq_packet_socket]
  13864. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket.wait_type.wait_error..wait_error..basic_seq_packet_socket]
  13865. [heading Values]
  13866. [variablelist
  13867. [
  13868. [wait_read]
  13869. [Wait for a socket to become ready to read. ]
  13870. ]
  13871. [
  13872. [wait_write]
  13873. [Wait for a socket to become ready to write. ]
  13874. ]
  13875. [
  13876. [wait_error]
  13877. [Wait for a socket to have error conditions pending. ]
  13878. ]
  13879. ]
  13880. For use with `basic_socket::wait()` and `basic_socket::async_wait()`.
  13881. [endsect]
  13882. [section:_basic_seq_packet_socket basic_seq_packet_socket::~basic_seq_packet_socket]
  13883. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket._basic_seq_packet_socket..~basic_seq_packet_socket..basic_seq_packet_socket]
  13884. Destroys the socket.
  13885. ~basic_seq_packet_socket();
  13886. This function destroys the socket, cancelling any outstanding asynchronous operations associated with the socket as if by calling `cancel`.
  13887. [endsect]
  13888. [endsect]
  13889. [section:basic_seq_packet_socket__rebind_executor basic_seq_packet_socket::rebind_executor]
  13890. Rebinds the socket type to another executor.
  13891. template<
  13892. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  13893. struct rebind_executor
  13894. [heading Types]
  13895. [table
  13896. [[Name][Description]]
  13897. [
  13898. [[link boost_asio.reference.basic_seq_packet_socket__rebind_executor.other [*other]]]
  13899. [The socket type when rebound to the specified executor. ]
  13900. ]
  13901. ]
  13902. [heading Requirements]
  13903. ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
  13904. ['Convenience header: ][^boost/asio.hpp]
  13905. [section:other basic_seq_packet_socket::rebind_executor::other]
  13906. [indexterm2 boost_asio.indexterm.basic_seq_packet_socket__rebind_executor.other..other..basic_seq_packet_socket::rebind_executor]
  13907. The socket type when rebound to the specified executor.
  13908. typedef basic_seq_packet_socket< Protocol, Executor1 > other;
  13909. [heading Types]
  13910. [table
  13911. [[Name][Description]]
  13912. [
  13913. [[link boost_asio.reference.basic_seq_packet_socket__rebind_executor [*rebind_executor]]]
  13914. [Rebinds the socket type to another executor. ]
  13915. ]
  13916. [
  13917. [[link boost_asio.reference.basic_seq_packet_socket.broadcast [*broadcast]]]
  13918. [Socket option to permit sending of broadcast messages. ]
  13919. ]
  13920. [
  13921. [[link boost_asio.reference.basic_seq_packet_socket.bytes_readable [*bytes_readable]]]
  13922. [IO control command to get the amount of data that can be read without blocking. ]
  13923. ]
  13924. [
  13925. [[link boost_asio.reference.basic_seq_packet_socket.debug [*debug]]]
  13926. [Socket option to enable socket-level debugging. ]
  13927. ]
  13928. [
  13929. [[link boost_asio.reference.basic_seq_packet_socket.do_not_route [*do_not_route]]]
  13930. [Socket option to prevent routing, use local interfaces only. ]
  13931. ]
  13932. [
  13933. [[link boost_asio.reference.basic_seq_packet_socket.enable_connection_aborted [*enable_connection_aborted]]]
  13934. [Socket option to report aborted connections on accept. ]
  13935. ]
  13936. [
  13937. [[link boost_asio.reference.basic_seq_packet_socket.endpoint_type [*endpoint_type]]]
  13938. [The endpoint type. ]
  13939. ]
  13940. [
  13941. [[link boost_asio.reference.basic_seq_packet_socket.executor_type [*executor_type]]]
  13942. [The type of the executor associated with the object. ]
  13943. ]
  13944. [
  13945. [[link boost_asio.reference.basic_seq_packet_socket.keep_alive [*keep_alive]]]
  13946. [Socket option to send keep-alives. ]
  13947. ]
  13948. [
  13949. [[link boost_asio.reference.basic_seq_packet_socket.linger [*linger]]]
  13950. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  13951. ]
  13952. [
  13953. [[link boost_asio.reference.basic_seq_packet_socket.lowest_layer_type [*lowest_layer_type]]]
  13954. [A basic_socket is always the lowest layer. ]
  13955. ]
  13956. [
  13957. [[link boost_asio.reference.basic_seq_packet_socket.message_flags [*message_flags]]]
  13958. [Bitmask type for flags that can be passed to send and receive operations. ]
  13959. ]
  13960. [
  13961. [[link boost_asio.reference.basic_seq_packet_socket.native_handle_type [*native_handle_type]]]
  13962. [The native representation of a socket. ]
  13963. ]
  13964. [
  13965. [[link boost_asio.reference.basic_seq_packet_socket.out_of_band_inline [*out_of_band_inline]]]
  13966. [Socket option for putting received out-of-band data inline. ]
  13967. ]
  13968. [
  13969. [[link boost_asio.reference.basic_seq_packet_socket.protocol_type [*protocol_type]]]
  13970. [The protocol type. ]
  13971. ]
  13972. [
  13973. [[link boost_asio.reference.basic_seq_packet_socket.receive_buffer_size [*receive_buffer_size]]]
  13974. [Socket option for the receive buffer size of a socket. ]
  13975. ]
  13976. [
  13977. [[link boost_asio.reference.basic_seq_packet_socket.receive_low_watermark [*receive_low_watermark]]]
  13978. [Socket option for the receive low watermark. ]
  13979. ]
  13980. [
  13981. [[link boost_asio.reference.basic_seq_packet_socket.reuse_address [*reuse_address]]]
  13982. [Socket option to allow the socket to be bound to an address that is already in use. ]
  13983. ]
  13984. [
  13985. [[link boost_asio.reference.basic_seq_packet_socket.send_buffer_size [*send_buffer_size]]]
  13986. [Socket option for the send buffer size of a socket. ]
  13987. ]
  13988. [
  13989. [[link boost_asio.reference.basic_seq_packet_socket.send_low_watermark [*send_low_watermark]]]
  13990. [Socket option for the send low watermark. ]
  13991. ]
  13992. [
  13993. [[link boost_asio.reference.basic_seq_packet_socket.shutdown_type [*shutdown_type]]]
  13994. [Different ways a socket may be shutdown. ]
  13995. ]
  13996. [
  13997. [[link boost_asio.reference.basic_seq_packet_socket.wait_type [*wait_type]]]
  13998. [Wait types. ]
  13999. ]
  14000. ]
  14001. [heading Member Functions]
  14002. [table
  14003. [[Name][Description]]
  14004. [
  14005. [[link boost_asio.reference.basic_seq_packet_socket.assign [*assign]]]
  14006. [Assign an existing native socket to the socket. ]
  14007. ]
  14008. [
  14009. [[link boost_asio.reference.basic_seq_packet_socket.async_connect [*async_connect]]]
  14010. [Start an asynchronous connect. ]
  14011. ]
  14012. [
  14013. [[link boost_asio.reference.basic_seq_packet_socket.async_receive [*async_receive]]]
  14014. [Start an asynchronous receive. ]
  14015. ]
  14016. [
  14017. [[link boost_asio.reference.basic_seq_packet_socket.async_send [*async_send]]]
  14018. [Start an asynchronous send. ]
  14019. ]
  14020. [
  14021. [[link boost_asio.reference.basic_seq_packet_socket.async_wait [*async_wait]]]
  14022. [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  14023. ]
  14024. [
  14025. [[link boost_asio.reference.basic_seq_packet_socket.at_mark [*at_mark]]]
  14026. [Determine whether the socket is at the out-of-band data mark. ]
  14027. ]
  14028. [
  14029. [[link boost_asio.reference.basic_seq_packet_socket.available [*available]]]
  14030. [Determine the number of bytes available for reading. ]
  14031. ]
  14032. [
  14033. [[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket [*basic_seq_packet_socket]]]
  14034. [Construct a basic_seq_packet_socket without opening it.
  14035. [hr]
  14036. Construct and open a basic_seq_packet_socket.
  14037. [hr]
  14038. Construct a basic_seq_packet_socket, opening it and binding it to the given local endpoint.
  14039. [hr]
  14040. Construct a basic_seq_packet_socket on an existing native socket.
  14041. [hr]
  14042. Move-construct a basic_seq_packet_socket from another.
  14043. [hr]
  14044. Move-construct a basic_seq_packet_socket from a socket of another protocol type. ]
  14045. ]
  14046. [
  14047. [[link boost_asio.reference.basic_seq_packet_socket.bind [*bind]]]
  14048. [Bind the socket to the given local endpoint. ]
  14049. ]
  14050. [
  14051. [[link boost_asio.reference.basic_seq_packet_socket.cancel [*cancel]]]
  14052. [Cancel all asynchronous operations associated with the socket. ]
  14053. ]
  14054. [
  14055. [[link boost_asio.reference.basic_seq_packet_socket.close [*close]]]
  14056. [Close the socket. ]
  14057. ]
  14058. [
  14059. [[link boost_asio.reference.basic_seq_packet_socket.connect [*connect]]]
  14060. [Connect the socket to the specified endpoint. ]
  14061. ]
  14062. [
  14063. [[link boost_asio.reference.basic_seq_packet_socket.get_executor [*get_executor]]]
  14064. [Get the executor associated with the object. ]
  14065. ]
  14066. [
  14067. [[link boost_asio.reference.basic_seq_packet_socket.get_option [*get_option]]]
  14068. [Get an option from the socket. ]
  14069. ]
  14070. [
  14071. [[link boost_asio.reference.basic_seq_packet_socket.io_control [*io_control]]]
  14072. [Perform an IO control command on the socket. ]
  14073. ]
  14074. [
  14075. [[link boost_asio.reference.basic_seq_packet_socket.is_open [*is_open]]]
  14076. [Determine whether the socket is open. ]
  14077. ]
  14078. [
  14079. [[link boost_asio.reference.basic_seq_packet_socket.local_endpoint [*local_endpoint]]]
  14080. [Get the local endpoint of the socket. ]
  14081. ]
  14082. [
  14083. [[link boost_asio.reference.basic_seq_packet_socket.lowest_layer [*lowest_layer]]]
  14084. [Get a reference to the lowest layer.
  14085. [hr]
  14086. Get a const reference to the lowest layer. ]
  14087. ]
  14088. [
  14089. [[link boost_asio.reference.basic_seq_packet_socket.native_handle [*native_handle]]]
  14090. [Get the native socket representation. ]
  14091. ]
  14092. [
  14093. [[link boost_asio.reference.basic_seq_packet_socket.native_non_blocking [*native_non_blocking]]]
  14094. [Gets the non-blocking mode of the native socket implementation.
  14095. [hr]
  14096. Sets the non-blocking mode of the native socket implementation. ]
  14097. ]
  14098. [
  14099. [[link boost_asio.reference.basic_seq_packet_socket.non_blocking [*non_blocking]]]
  14100. [Gets the non-blocking mode of the socket.
  14101. [hr]
  14102. Sets the non-blocking mode of the socket. ]
  14103. ]
  14104. [
  14105. [[link boost_asio.reference.basic_seq_packet_socket.open [*open]]]
  14106. [Open the socket using the specified protocol. ]
  14107. ]
  14108. [
  14109. [[link boost_asio.reference.basic_seq_packet_socket.operator_eq_ [*operator=]]]
  14110. [Move-assign a basic_seq_packet_socket from another.
  14111. [hr]
  14112. Move-assign a basic_seq_packet_socket from a socket of another protocol type. ]
  14113. ]
  14114. [
  14115. [[link boost_asio.reference.basic_seq_packet_socket.receive [*receive]]]
  14116. [Receive some data on the socket.
  14117. [hr]
  14118. Receive some data on a connected socket. ]
  14119. ]
  14120. [
  14121. [[link boost_asio.reference.basic_seq_packet_socket.release [*release]]]
  14122. [Release ownership of the underlying native socket. ]
  14123. ]
  14124. [
  14125. [[link boost_asio.reference.basic_seq_packet_socket.remote_endpoint [*remote_endpoint]]]
  14126. [Get the remote endpoint of the socket. ]
  14127. ]
  14128. [
  14129. [[link boost_asio.reference.basic_seq_packet_socket.send [*send]]]
  14130. [Send some data on the socket. ]
  14131. ]
  14132. [
  14133. [[link boost_asio.reference.basic_seq_packet_socket.set_option [*set_option]]]
  14134. [Set an option on the socket. ]
  14135. ]
  14136. [
  14137. [[link boost_asio.reference.basic_seq_packet_socket.shutdown [*shutdown]]]
  14138. [Disable sends or receives on the socket. ]
  14139. ]
  14140. [
  14141. [[link boost_asio.reference.basic_seq_packet_socket.wait [*wait]]]
  14142. [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  14143. ]
  14144. [
  14145. [[link boost_asio.reference.basic_seq_packet_socket._basic_seq_packet_socket [*~basic_seq_packet_socket]]]
  14146. [Destroys the socket. ]
  14147. ]
  14148. ]
  14149. [heading Data Members]
  14150. [table
  14151. [[Name][Description]]
  14152. [
  14153. [[link boost_asio.reference.basic_seq_packet_socket.max_connections [*max_connections]]]
  14154. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  14155. ]
  14156. [
  14157. [[link boost_asio.reference.basic_seq_packet_socket.max_listen_connections [*max_listen_connections]]]
  14158. [The maximum length of the queue of pending incoming connections. ]
  14159. ]
  14160. [
  14161. [[link boost_asio.reference.basic_seq_packet_socket.message_do_not_route [*message_do_not_route]]]
  14162. [Specify that the data should not be subject to routing. ]
  14163. ]
  14164. [
  14165. [[link boost_asio.reference.basic_seq_packet_socket.message_end_of_record [*message_end_of_record]]]
  14166. [Specifies that the data marks the end of a record. ]
  14167. ]
  14168. [
  14169. [[link boost_asio.reference.basic_seq_packet_socket.message_out_of_band [*message_out_of_band]]]
  14170. [Process out-of-band data. ]
  14171. ]
  14172. [
  14173. [[link boost_asio.reference.basic_seq_packet_socket.message_peek [*message_peek]]]
  14174. [Peek at incoming data without removing it from the input queue. ]
  14175. ]
  14176. ]
  14177. [heading Protected Data Members]
  14178. [table
  14179. [[Name][Description]]
  14180. [
  14181. [[link boost_asio.reference.basic_seq_packet_socket.impl_ [*impl_]]]
  14182. []
  14183. ]
  14184. ]
  14185. The [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] class template provides asynchronous and blocking sequenced packet socket functionality.
  14186. [heading Thread Safety]
  14187. ['Distinct] ['objects:] Safe.
  14188. ['Shared] ['objects:] Unsafe.
  14189. [heading Requirements]
  14190. ['Header: ][^boost/asio/basic_seq_packet_socket.hpp]
  14191. ['Convenience header: ][^boost/asio.hpp]
  14192. [endsect]
  14193. [endsect]
  14194. [section:basic_serial_port basic_serial_port]
  14195. Provides serial port functionality.
  14196. template<
  14197. typename ``[link boost_asio.reference.Executor1 Executor]`` = executor>
  14198. class basic_serial_port :
  14199. public serial_port_base
  14200. [heading Types]
  14201. [table
  14202. [[Name][Description]]
  14203. [
  14204. [[link boost_asio.reference.basic_serial_port__rebind_executor [*rebind_executor]]]
  14205. [Rebinds the serial port type to another executor. ]
  14206. ]
  14207. [
  14208. [[link boost_asio.reference.basic_serial_port.executor_type [*executor_type]]]
  14209. [The type of the executor associated with the object. ]
  14210. ]
  14211. [
  14212. [[link boost_asio.reference.basic_serial_port.lowest_layer_type [*lowest_layer_type]]]
  14213. [A basic_basic_serial_port is always the lowest layer. ]
  14214. ]
  14215. [
  14216. [[link boost_asio.reference.basic_serial_port.native_handle_type [*native_handle_type]]]
  14217. [The native representation of a serial port. ]
  14218. ]
  14219. ]
  14220. [heading Member Functions]
  14221. [table
  14222. [[Name][Description]]
  14223. [
  14224. [[link boost_asio.reference.basic_serial_port.assign [*assign]]]
  14225. [Assign an existing native serial port to the serial port. ]
  14226. ]
  14227. [
  14228. [[link boost_asio.reference.basic_serial_port.async_read_some [*async_read_some]]]
  14229. [Start an asynchronous read. ]
  14230. ]
  14231. [
  14232. [[link boost_asio.reference.basic_serial_port.async_write_some [*async_write_some]]]
  14233. [Start an asynchronous write. ]
  14234. ]
  14235. [
  14236. [[link boost_asio.reference.basic_serial_port.basic_serial_port [*basic_serial_port]]]
  14237. [Construct a basic_serial_port without opening it.
  14238. [hr]
  14239. Construct and open a basic_serial_port.
  14240. [hr]
  14241. Construct a basic_serial_port on an existing native serial port.
  14242. [hr]
  14243. Move-construct a basic_serial_port from another. ]
  14244. ]
  14245. [
  14246. [[link boost_asio.reference.basic_serial_port.cancel [*cancel]]]
  14247. [Cancel all asynchronous operations associated with the serial port. ]
  14248. ]
  14249. [
  14250. [[link boost_asio.reference.basic_serial_port.close [*close]]]
  14251. [Close the serial port. ]
  14252. ]
  14253. [
  14254. [[link boost_asio.reference.basic_serial_port.get_executor [*get_executor]]]
  14255. [Get the executor associated with the object. ]
  14256. ]
  14257. [
  14258. [[link boost_asio.reference.basic_serial_port.get_option [*get_option]]]
  14259. [Get an option from the serial port. ]
  14260. ]
  14261. [
  14262. [[link boost_asio.reference.basic_serial_port.is_open [*is_open]]]
  14263. [Determine whether the serial port is open. ]
  14264. ]
  14265. [
  14266. [[link boost_asio.reference.basic_serial_port.lowest_layer [*lowest_layer]]]
  14267. [Get a reference to the lowest layer.
  14268. [hr]
  14269. Get a const reference to the lowest layer. ]
  14270. ]
  14271. [
  14272. [[link boost_asio.reference.basic_serial_port.native_handle [*native_handle]]]
  14273. [Get the native serial port representation. ]
  14274. ]
  14275. [
  14276. [[link boost_asio.reference.basic_serial_port.open [*open]]]
  14277. [Open the serial port using the specified device name. ]
  14278. ]
  14279. [
  14280. [[link boost_asio.reference.basic_serial_port.operator_eq_ [*operator=]]]
  14281. [Move-assign a basic_serial_port from another. ]
  14282. ]
  14283. [
  14284. [[link boost_asio.reference.basic_serial_port.read_some [*read_some]]]
  14285. [Read some data from the serial port. ]
  14286. ]
  14287. [
  14288. [[link boost_asio.reference.basic_serial_port.send_break [*send_break]]]
  14289. [Send a break sequence to the serial port. ]
  14290. ]
  14291. [
  14292. [[link boost_asio.reference.basic_serial_port.set_option [*set_option]]]
  14293. [Set an option on the serial port. ]
  14294. ]
  14295. [
  14296. [[link boost_asio.reference.basic_serial_port.write_some [*write_some]]]
  14297. [Write some data to the serial port. ]
  14298. ]
  14299. [
  14300. [[link boost_asio.reference.basic_serial_port._basic_serial_port [*~basic_serial_port]]]
  14301. [Destroys the serial port. ]
  14302. ]
  14303. ]
  14304. The [link boost_asio.reference.basic_serial_port `basic_serial_port`] class provides a wrapper over serial port functionality.
  14305. [heading Thread Safety]
  14306. ['Distinct] ['objects:] Safe.
  14307. ['Shared] ['objects:] Unsafe.
  14308. [heading Requirements]
  14309. ['Header: ][^boost/asio/basic_serial_port.hpp]
  14310. ['Convenience header: ][^boost/asio.hpp]
  14311. [section:assign basic_serial_port::assign]
  14312. [indexterm2 boost_asio.indexterm.basic_serial_port.assign..assign..basic_serial_port]
  14313. Assign an existing native serial port to the serial port.
  14314. void ``[link boost_asio.reference.basic_serial_port.assign.overload1 assign]``(
  14315. const native_handle_type & native_serial_port);
  14316. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.assign.overload1 more...]]``
  14317. void ``[link boost_asio.reference.basic_serial_port.assign.overload2 assign]``(
  14318. const native_handle_type & native_serial_port,
  14319. boost::system::error_code & ec);
  14320. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.assign.overload2 more...]]``
  14321. [section:overload1 basic_serial_port::assign (1 of 2 overloads)]
  14322. Assign an existing native serial port to the serial port.
  14323. void assign(
  14324. const native_handle_type & native_serial_port);
  14325. [endsect]
  14326. [section:overload2 basic_serial_port::assign (2 of 2 overloads)]
  14327. Assign an existing native serial port to the serial port.
  14328. void assign(
  14329. const native_handle_type & native_serial_port,
  14330. boost::system::error_code & ec);
  14331. [endsect]
  14332. [endsect]
  14333. [section:async_read_some basic_serial_port::async_read_some]
  14334. [indexterm2 boost_asio.indexterm.basic_serial_port.async_read_some..async_read_some..basic_serial_port]
  14335. Start an asynchronous read.
  14336. template<
  14337. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  14338. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  14339. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_some(
  14340. const MutableBufferSequence & buffers,
  14341. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  14342. This function is used to asynchronously read data from the serial port. The function call always returns immediately.
  14343. [heading Parameters]
  14344. [variablelist
  14345. [[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.]]
  14346. [[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:
  14347. ``
  14348. void handler(
  14349. const boost::system::error_code& error, // Result of operation.
  14350. std::size_t bytes_transferred // Number of bytes read.
  14351. );
  14352. ``
  14353. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  14354. ]
  14355. [heading Remarks]
  14356. The read operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.async_read `async_read`] function if you need to ensure that the requested amount of data is read before the asynchronous operation completes.
  14357. [heading Example]
  14358. To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  14359. basic_serial_port.async_read_some(
  14360. boost::asio::buffer(data, size), handler);
  14361. See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  14362. [endsect]
  14363. [section:async_write_some basic_serial_port::async_write_some]
  14364. [indexterm2 boost_asio.indexterm.basic_serial_port.async_write_some..async_write_some..basic_serial_port]
  14365. Start an asynchronous write.
  14366. template<
  14367. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  14368. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  14369. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_some(
  14370. const ConstBufferSequence & buffers,
  14371. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  14372. This function is used to asynchronously write data to the serial port. The function call always returns immediately.
  14373. [heading Parameters]
  14374. [variablelist
  14375. [[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.]]
  14376. [[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:
  14377. ``
  14378. void handler(
  14379. const boost::system::error_code& error, // Result of operation.
  14380. std::size_t bytes_transferred // Number of bytes written.
  14381. );
  14382. ``
  14383. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  14384. ]
  14385. [heading Remarks]
  14386. The write operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.async_write `async_write`] function if you need to ensure that all data is written before the asynchronous operation completes.
  14387. [heading Example]
  14388. To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  14389. basic_serial_port.async_write_some(
  14390. boost::asio::buffer(data, size), handler);
  14391. See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  14392. [endsect]
  14393. [section:basic_serial_port basic_serial_port::basic_serial_port]
  14394. [indexterm2 boost_asio.indexterm.basic_serial_port.basic_serial_port..basic_serial_port..basic_serial_port]
  14395. Construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] without opening it.
  14396. explicit ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload1 basic_serial_port]``(
  14397. const executor_type & ex);
  14398. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload1 more...]]``
  14399. template<
  14400. typename ExecutionContext>
  14401. explicit ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload2 basic_serial_port]``(
  14402. ExecutionContext & context,
  14403. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value, basic_serial_port >::type * = 0);
  14404. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload2 more...]]``
  14405. Construct and open a [link boost_asio.reference.basic_serial_port `basic_serial_port`].
  14406. ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload3 basic_serial_port]``(
  14407. const executor_type & ex,
  14408. const char * device);
  14409. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload3 more...]]``
  14410. template<
  14411. typename ExecutionContext>
  14412. ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload4 basic_serial_port]``(
  14413. ExecutionContext & context,
  14414. const char * device,
  14415. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  14416. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload4 more...]]``
  14417. ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload5 basic_serial_port]``(
  14418. const executor_type & ex,
  14419. const std::string & device);
  14420. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload5 more...]]``
  14421. template<
  14422. typename ExecutionContext>
  14423. ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload6 basic_serial_port]``(
  14424. ExecutionContext & context,
  14425. const std::string & device,
  14426. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  14427. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload6 more...]]``
  14428. Construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] on an existing native serial port.
  14429. ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload7 basic_serial_port]``(
  14430. const executor_type & ex,
  14431. const native_handle_type & native_serial_port);
  14432. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload7 more...]]``
  14433. template<
  14434. typename ExecutionContext>
  14435. ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload8 basic_serial_port]``(
  14436. ExecutionContext & context,
  14437. const native_handle_type & native_serial_port,
  14438. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  14439. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload8 more...]]``
  14440. Move-construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] from another.
  14441. ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload9 basic_serial_port]``(
  14442. basic_serial_port && other);
  14443. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload9 more...]]``
  14444. [section:overload1 basic_serial_port::basic_serial_port (1 of 9 overloads)]
  14445. Construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] without opening it.
  14446. basic_serial_port(
  14447. const executor_type & ex);
  14448. This constructor creates a serial port without opening it.
  14449. [heading Parameters]
  14450. [variablelist
  14451. [[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. ]]
  14452. ]
  14453. [endsect]
  14454. [section:overload2 basic_serial_port::basic_serial_port (2 of 9 overloads)]
  14455. Construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] without opening it.
  14456. template<
  14457. typename ExecutionContext>
  14458. basic_serial_port(
  14459. ExecutionContext & context,
  14460. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value, basic_serial_port >::type * = 0);
  14461. This constructor creates a serial port without opening it.
  14462. [heading Parameters]
  14463. [variablelist
  14464. [[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. ]]
  14465. ]
  14466. [endsect]
  14467. [section:overload3 basic_serial_port::basic_serial_port (3 of 9 overloads)]
  14468. Construct and open a [link boost_asio.reference.basic_serial_port `basic_serial_port`].
  14469. basic_serial_port(
  14470. const executor_type & ex,
  14471. const char * device);
  14472. This constructor creates and opens a serial port for the specified device name.
  14473. [heading Parameters]
  14474. [variablelist
  14475. [[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.]]
  14476. [[device][The platform-specific device name for this serial port. ]]
  14477. ]
  14478. [endsect]
  14479. [section:overload4 basic_serial_port::basic_serial_port (4 of 9 overloads)]
  14480. Construct and open a [link boost_asio.reference.basic_serial_port `basic_serial_port`].
  14481. template<
  14482. typename ExecutionContext>
  14483. basic_serial_port(
  14484. ExecutionContext & context,
  14485. const char * device,
  14486. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  14487. This constructor creates and opens a serial port for the specified device name.
  14488. [heading Parameters]
  14489. [variablelist
  14490. [[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.]]
  14491. [[device][The platform-specific device name for this serial port. ]]
  14492. ]
  14493. [endsect]
  14494. [section:overload5 basic_serial_port::basic_serial_port (5 of 9 overloads)]
  14495. Construct and open a [link boost_asio.reference.basic_serial_port `basic_serial_port`].
  14496. basic_serial_port(
  14497. const executor_type & ex,
  14498. const std::string & device);
  14499. This constructor creates and opens a serial port for the specified device name.
  14500. [heading Parameters]
  14501. [variablelist
  14502. [[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.]]
  14503. [[device][The platform-specific device name for this serial port. ]]
  14504. ]
  14505. [endsect]
  14506. [section:overload6 basic_serial_port::basic_serial_port (6 of 9 overloads)]
  14507. Construct and open a [link boost_asio.reference.basic_serial_port `basic_serial_port`].
  14508. template<
  14509. typename ExecutionContext>
  14510. basic_serial_port(
  14511. ExecutionContext & context,
  14512. const std::string & device,
  14513. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  14514. This constructor creates and opens a serial port for the specified device name.
  14515. [heading Parameters]
  14516. [variablelist
  14517. [[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.]]
  14518. [[device][The platform-specific device name for this serial port. ]]
  14519. ]
  14520. [endsect]
  14521. [section:overload7 basic_serial_port::basic_serial_port (7 of 9 overloads)]
  14522. Construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] on an existing native serial port.
  14523. basic_serial_port(
  14524. const executor_type & ex,
  14525. const native_handle_type & native_serial_port);
  14526. This constructor creates a serial port object to hold an existing native serial port.
  14527. [heading Parameters]
  14528. [variablelist
  14529. [[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.]]
  14530. [[native_serial_port][A native serial port.]]
  14531. ]
  14532. [heading Exceptions]
  14533. [variablelist
  14534. [[boost::system::system_error][Thrown on failure. ]]
  14535. ]
  14536. [endsect]
  14537. [section:overload8 basic_serial_port::basic_serial_port (8 of 9 overloads)]
  14538. Construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] on an existing native serial port.
  14539. template<
  14540. typename ExecutionContext>
  14541. basic_serial_port(
  14542. ExecutionContext & context,
  14543. const native_handle_type & native_serial_port,
  14544. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  14545. This constructor creates a serial port object to hold an existing native serial port.
  14546. [heading Parameters]
  14547. [variablelist
  14548. [[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.]]
  14549. [[native_serial_port][A native serial port.]]
  14550. ]
  14551. [heading Exceptions]
  14552. [variablelist
  14553. [[boost::system::system_error][Thrown on failure. ]]
  14554. ]
  14555. [endsect]
  14556. [section:overload9 basic_serial_port::basic_serial_port (9 of 9 overloads)]
  14557. Move-construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] from another.
  14558. basic_serial_port(
  14559. basic_serial_port && other);
  14560. This constructor moves a serial port from one object to another.
  14561. [heading Parameters]
  14562. [variablelist
  14563. [[other][The other [link boost_asio.reference.basic_serial_port `basic_serial_port`] object from which the move will occur.]]
  14564. ]
  14565. [heading Remarks]
  14566. Following the move, the moved-from object is in the same state as if constructed using the `basic_serial_port(const executor_type&)` constructor.
  14567. [endsect]
  14568. [endsect]
  14569. [section:cancel basic_serial_port::cancel]
  14570. [indexterm2 boost_asio.indexterm.basic_serial_port.cancel..cancel..basic_serial_port]
  14571. Cancel all asynchronous operations associated with the serial port.
  14572. void ``[link boost_asio.reference.basic_serial_port.cancel.overload1 cancel]``();
  14573. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.cancel.overload1 more...]]``
  14574. void ``[link boost_asio.reference.basic_serial_port.cancel.overload2 cancel]``(
  14575. boost::system::error_code & ec);
  14576. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.cancel.overload2 more...]]``
  14577. [section:overload1 basic_serial_port::cancel (1 of 2 overloads)]
  14578. Cancel all asynchronous operations associated with the serial port.
  14579. void cancel();
  14580. This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
  14581. [heading Exceptions]
  14582. [variablelist
  14583. [[boost::system::system_error][Thrown on failure. ]]
  14584. ]
  14585. [endsect]
  14586. [section:overload2 basic_serial_port::cancel (2 of 2 overloads)]
  14587. Cancel all asynchronous operations associated with the serial port.
  14588. void cancel(
  14589. boost::system::error_code & ec);
  14590. This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
  14591. [heading Parameters]
  14592. [variablelist
  14593. [[ec][Set to indicate what error occurred, if any. ]]
  14594. ]
  14595. [endsect]
  14596. [endsect]
  14597. [section:close basic_serial_port::close]
  14598. [indexterm2 boost_asio.indexterm.basic_serial_port.close..close..basic_serial_port]
  14599. Close the serial port.
  14600. void ``[link boost_asio.reference.basic_serial_port.close.overload1 close]``();
  14601. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.close.overload1 more...]]``
  14602. void ``[link boost_asio.reference.basic_serial_port.close.overload2 close]``(
  14603. boost::system::error_code & ec);
  14604. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.close.overload2 more...]]``
  14605. [section:overload1 basic_serial_port::close (1 of 2 overloads)]
  14606. Close the serial port.
  14607. void close();
  14608. This function is used to close the serial port. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
  14609. [heading Exceptions]
  14610. [variablelist
  14611. [[boost::system::system_error][Thrown on failure. ]]
  14612. ]
  14613. [endsect]
  14614. [section:overload2 basic_serial_port::close (2 of 2 overloads)]
  14615. Close the serial port.
  14616. void close(
  14617. boost::system::error_code & ec);
  14618. This function is used to close the serial port. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
  14619. [heading Parameters]
  14620. [variablelist
  14621. [[ec][Set to indicate what error occurred, if any. ]]
  14622. ]
  14623. [endsect]
  14624. [endsect]
  14625. [section:executor_type basic_serial_port::executor_type]
  14626. [indexterm2 boost_asio.indexterm.basic_serial_port.executor_type..executor_type..basic_serial_port]
  14627. The type of the executor associated with the object.
  14628. typedef Executor executor_type;
  14629. [heading Requirements]
  14630. ['Header: ][^boost/asio/basic_serial_port.hpp]
  14631. ['Convenience header: ][^boost/asio.hpp]
  14632. [endsect]
  14633. [section:get_executor basic_serial_port::get_executor]
  14634. [indexterm2 boost_asio.indexterm.basic_serial_port.get_executor..get_executor..basic_serial_port]
  14635. Get the executor associated with the object.
  14636. executor_type get_executor();
  14637. [endsect]
  14638. [section:get_option basic_serial_port::get_option]
  14639. [indexterm2 boost_asio.indexterm.basic_serial_port.get_option..get_option..basic_serial_port]
  14640. Get an option from the serial port.
  14641. template<
  14642. typename ``[link boost_asio.reference.GettableSerialPortOption GettableSerialPortOption]``>
  14643. void ``[link boost_asio.reference.basic_serial_port.get_option.overload1 get_option]``(
  14644. GettableSerialPortOption & option) const;
  14645. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.get_option.overload1 more...]]``
  14646. template<
  14647. typename ``[link boost_asio.reference.GettableSerialPortOption GettableSerialPortOption]``>
  14648. void ``[link boost_asio.reference.basic_serial_port.get_option.overload2 get_option]``(
  14649. GettableSerialPortOption & option,
  14650. boost::system::error_code & ec) const;
  14651. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.get_option.overload2 more...]]``
  14652. [section:overload1 basic_serial_port::get_option (1 of 2 overloads)]
  14653. Get an option from the serial port.
  14654. template<
  14655. typename ``[link boost_asio.reference.GettableSerialPortOption GettableSerialPortOption]``>
  14656. void get_option(
  14657. GettableSerialPortOption & option) const;
  14658. This function is used to get the current value of an option on the serial port.
  14659. [heading Parameters]
  14660. [variablelist
  14661. [[option][The option value to be obtained from the serial port.]]
  14662. ]
  14663. [heading Exceptions]
  14664. [variablelist
  14665. [[boost::system::system_error][Thrown on failure.]]
  14666. ]
  14667. [endsect]
  14668. [section:overload2 basic_serial_port::get_option (2 of 2 overloads)]
  14669. Get an option from the serial port.
  14670. template<
  14671. typename ``[link boost_asio.reference.GettableSerialPortOption GettableSerialPortOption]``>
  14672. void get_option(
  14673. GettableSerialPortOption & option,
  14674. boost::system::error_code & ec) const;
  14675. This function is used to get the current value of an option on the serial port.
  14676. [heading Parameters]
  14677. [variablelist
  14678. [[option][The option value to be obtained from the serial port.]]
  14679. [[ec][Set to indicate what error occurred, if any.]]
  14680. ]
  14681. [endsect]
  14682. [endsect]
  14683. [section:is_open basic_serial_port::is_open]
  14684. [indexterm2 boost_asio.indexterm.basic_serial_port.is_open..is_open..basic_serial_port]
  14685. Determine whether the serial port is open.
  14686. bool is_open() const;
  14687. [endsect]
  14688. [section:lowest_layer basic_serial_port::lowest_layer]
  14689. [indexterm2 boost_asio.indexterm.basic_serial_port.lowest_layer..lowest_layer..basic_serial_port]
  14690. Get a reference to the lowest layer.
  14691. lowest_layer_type & ``[link boost_asio.reference.basic_serial_port.lowest_layer.overload1 lowest_layer]``();
  14692. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.lowest_layer.overload1 more...]]``
  14693. Get a const reference to the lowest layer.
  14694. const lowest_layer_type & ``[link boost_asio.reference.basic_serial_port.lowest_layer.overload2 lowest_layer]``() const;
  14695. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.lowest_layer.overload2 more...]]``
  14696. [section:overload1 basic_serial_port::lowest_layer (1 of 2 overloads)]
  14697. Get a reference to the lowest layer.
  14698. lowest_layer_type & lowest_layer();
  14699. This function returns a reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_serial_port `basic_serial_port`] cannot contain any further layers, it simply returns a reference to itself.
  14700. [heading Return Value]
  14701. A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
  14702. [endsect]
  14703. [section:overload2 basic_serial_port::lowest_layer (2 of 2 overloads)]
  14704. Get a const reference to the lowest layer.
  14705. const lowest_layer_type & lowest_layer() const;
  14706. This function returns a const reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_serial_port `basic_serial_port`] cannot contain any further layers, it simply returns a reference to itself.
  14707. [heading Return Value]
  14708. A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
  14709. [endsect]
  14710. [endsect]
  14711. [section:lowest_layer_type basic_serial_port::lowest_layer_type]
  14712. [indexterm2 boost_asio.indexterm.basic_serial_port.lowest_layer_type..lowest_layer_type..basic_serial_port]
  14713. A basic\_basic\_serial\_port is always the lowest layer.
  14714. typedef basic_serial_port lowest_layer_type;
  14715. [heading Types]
  14716. [table
  14717. [[Name][Description]]
  14718. [
  14719. [[link boost_asio.reference.basic_serial_port__rebind_executor [*rebind_executor]]]
  14720. [Rebinds the serial port type to another executor. ]
  14721. ]
  14722. [
  14723. [[link boost_asio.reference.basic_serial_port.executor_type [*executor_type]]]
  14724. [The type of the executor associated with the object. ]
  14725. ]
  14726. [
  14727. [[link boost_asio.reference.basic_serial_port.lowest_layer_type [*lowest_layer_type]]]
  14728. [A basic_basic_serial_port is always the lowest layer. ]
  14729. ]
  14730. [
  14731. [[link boost_asio.reference.basic_serial_port.native_handle_type [*native_handle_type]]]
  14732. [The native representation of a serial port. ]
  14733. ]
  14734. ]
  14735. [heading Member Functions]
  14736. [table
  14737. [[Name][Description]]
  14738. [
  14739. [[link boost_asio.reference.basic_serial_port.assign [*assign]]]
  14740. [Assign an existing native serial port to the serial port. ]
  14741. ]
  14742. [
  14743. [[link boost_asio.reference.basic_serial_port.async_read_some [*async_read_some]]]
  14744. [Start an asynchronous read. ]
  14745. ]
  14746. [
  14747. [[link boost_asio.reference.basic_serial_port.async_write_some [*async_write_some]]]
  14748. [Start an asynchronous write. ]
  14749. ]
  14750. [
  14751. [[link boost_asio.reference.basic_serial_port.basic_serial_port [*basic_serial_port]]]
  14752. [Construct a basic_serial_port without opening it.
  14753. [hr]
  14754. Construct and open a basic_serial_port.
  14755. [hr]
  14756. Construct a basic_serial_port on an existing native serial port.
  14757. [hr]
  14758. Move-construct a basic_serial_port from another. ]
  14759. ]
  14760. [
  14761. [[link boost_asio.reference.basic_serial_port.cancel [*cancel]]]
  14762. [Cancel all asynchronous operations associated with the serial port. ]
  14763. ]
  14764. [
  14765. [[link boost_asio.reference.basic_serial_port.close [*close]]]
  14766. [Close the serial port. ]
  14767. ]
  14768. [
  14769. [[link boost_asio.reference.basic_serial_port.get_executor [*get_executor]]]
  14770. [Get the executor associated with the object. ]
  14771. ]
  14772. [
  14773. [[link boost_asio.reference.basic_serial_port.get_option [*get_option]]]
  14774. [Get an option from the serial port. ]
  14775. ]
  14776. [
  14777. [[link boost_asio.reference.basic_serial_port.is_open [*is_open]]]
  14778. [Determine whether the serial port is open. ]
  14779. ]
  14780. [
  14781. [[link boost_asio.reference.basic_serial_port.lowest_layer [*lowest_layer]]]
  14782. [Get a reference to the lowest layer.
  14783. [hr]
  14784. Get a const reference to the lowest layer. ]
  14785. ]
  14786. [
  14787. [[link boost_asio.reference.basic_serial_port.native_handle [*native_handle]]]
  14788. [Get the native serial port representation. ]
  14789. ]
  14790. [
  14791. [[link boost_asio.reference.basic_serial_port.open [*open]]]
  14792. [Open the serial port using the specified device name. ]
  14793. ]
  14794. [
  14795. [[link boost_asio.reference.basic_serial_port.operator_eq_ [*operator=]]]
  14796. [Move-assign a basic_serial_port from another. ]
  14797. ]
  14798. [
  14799. [[link boost_asio.reference.basic_serial_port.read_some [*read_some]]]
  14800. [Read some data from the serial port. ]
  14801. ]
  14802. [
  14803. [[link boost_asio.reference.basic_serial_port.send_break [*send_break]]]
  14804. [Send a break sequence to the serial port. ]
  14805. ]
  14806. [
  14807. [[link boost_asio.reference.basic_serial_port.set_option [*set_option]]]
  14808. [Set an option on the serial port. ]
  14809. ]
  14810. [
  14811. [[link boost_asio.reference.basic_serial_port.write_some [*write_some]]]
  14812. [Write some data to the serial port. ]
  14813. ]
  14814. [
  14815. [[link boost_asio.reference.basic_serial_port._basic_serial_port [*~basic_serial_port]]]
  14816. [Destroys the serial port. ]
  14817. ]
  14818. ]
  14819. The [link boost_asio.reference.basic_serial_port `basic_serial_port`] class provides a wrapper over serial port functionality.
  14820. [heading Thread Safety]
  14821. ['Distinct] ['objects:] Safe.
  14822. ['Shared] ['objects:] Unsafe.
  14823. [heading Requirements]
  14824. ['Header: ][^boost/asio/basic_serial_port.hpp]
  14825. ['Convenience header: ][^boost/asio.hpp]
  14826. [endsect]
  14827. [section:native_handle basic_serial_port::native_handle]
  14828. [indexterm2 boost_asio.indexterm.basic_serial_port.native_handle..native_handle..basic_serial_port]
  14829. Get the native serial port representation.
  14830. native_handle_type native_handle();
  14831. This function may be used to obtain the underlying representation of the serial port. This is intended to allow access to native serial port functionality that is not otherwise provided.
  14832. [endsect]
  14833. [section:native_handle_type basic_serial_port::native_handle_type]
  14834. [indexterm2 boost_asio.indexterm.basic_serial_port.native_handle_type..native_handle_type..basic_serial_port]
  14835. The native representation of a serial port.
  14836. typedef implementation_defined native_handle_type;
  14837. [heading Requirements]
  14838. ['Header: ][^boost/asio/basic_serial_port.hpp]
  14839. ['Convenience header: ][^boost/asio.hpp]
  14840. [endsect]
  14841. [section:open basic_serial_port::open]
  14842. [indexterm2 boost_asio.indexterm.basic_serial_port.open..open..basic_serial_port]
  14843. Open the serial port using the specified device name.
  14844. void ``[link boost_asio.reference.basic_serial_port.open.overload1 open]``(
  14845. const std::string & device);
  14846. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.open.overload1 more...]]``
  14847. void ``[link boost_asio.reference.basic_serial_port.open.overload2 open]``(
  14848. const std::string & device,
  14849. boost::system::error_code & ec);
  14850. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.open.overload2 more...]]``
  14851. [section:overload1 basic_serial_port::open (1 of 2 overloads)]
  14852. Open the serial port using the specified device name.
  14853. void open(
  14854. const std::string & device);
  14855. This function opens the serial port for the specified device name.
  14856. [heading Parameters]
  14857. [variablelist
  14858. [[device][The platform-specific device name.]]
  14859. ]
  14860. [heading Exceptions]
  14861. [variablelist
  14862. [[boost::system::system_error][Thrown on failure. ]]
  14863. ]
  14864. [endsect]
  14865. [section:overload2 basic_serial_port::open (2 of 2 overloads)]
  14866. Open the serial port using the specified device name.
  14867. void open(
  14868. const std::string & device,
  14869. boost::system::error_code & ec);
  14870. This function opens the serial port using the given platform-specific device name.
  14871. [heading Parameters]
  14872. [variablelist
  14873. [[device][The platform-specific device name.]]
  14874. [[ec][Set the indicate what error occurred, if any. ]]
  14875. ]
  14876. [endsect]
  14877. [endsect]
  14878. [section:operator_eq_ basic_serial_port::operator=]
  14879. [indexterm2 boost_asio.indexterm.basic_serial_port.operator_eq_..operator=..basic_serial_port]
  14880. Move-assign a [link boost_asio.reference.basic_serial_port `basic_serial_port`] from another.
  14881. basic_serial_port & operator=(
  14882. basic_serial_port && other);
  14883. This assignment operator moves a serial port from one object to another.
  14884. [heading Parameters]
  14885. [variablelist
  14886. [[other][The other [link boost_asio.reference.basic_serial_port `basic_serial_port`] object from which the move will occur.]]
  14887. ]
  14888. [heading Remarks]
  14889. Following the move, the moved-from object is in the same state as if constructed using the `basic_serial_port(const executor_type&)` constructor.
  14890. [endsect]
  14891. [section:read_some basic_serial_port::read_some]
  14892. [indexterm2 boost_asio.indexterm.basic_serial_port.read_some..read_some..basic_serial_port]
  14893. Read some data from the serial port.
  14894. template<
  14895. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  14896. std::size_t ``[link boost_asio.reference.basic_serial_port.read_some.overload1 read_some]``(
  14897. const MutableBufferSequence & buffers);
  14898. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.read_some.overload1 more...]]``
  14899. template<
  14900. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  14901. std::size_t ``[link boost_asio.reference.basic_serial_port.read_some.overload2 read_some]``(
  14902. const MutableBufferSequence & buffers,
  14903. boost::system::error_code & ec);
  14904. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.read_some.overload2 more...]]``
  14905. [section:overload1 basic_serial_port::read_some (1 of 2 overloads)]
  14906. Read some data from the serial port.
  14907. template<
  14908. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  14909. std::size_t read_some(
  14910. const MutableBufferSequence & buffers);
  14911. This function is used to read data from the serial port. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
  14912. [heading Parameters]
  14913. [variablelist
  14914. [[buffers][One or more buffers into which the data will be read.]]
  14915. ]
  14916. [heading Return Value]
  14917. The number of bytes read.
  14918. [heading Exceptions]
  14919. [variablelist
  14920. [[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
  14921. ]
  14922. [heading Remarks]
  14923. The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
  14924. [heading Example]
  14925. To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  14926. basic_serial_port.read_some(boost::asio::buffer(data, size));
  14927. See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  14928. [endsect]
  14929. [section:overload2 basic_serial_port::read_some (2 of 2 overloads)]
  14930. Read some data from the serial port.
  14931. template<
  14932. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  14933. std::size_t read_some(
  14934. const MutableBufferSequence & buffers,
  14935. boost::system::error_code & ec);
  14936. This function is used to read data from the serial port. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
  14937. [heading Parameters]
  14938. [variablelist
  14939. [[buffers][One or more buffers into which the data will be read.]]
  14940. [[ec][Set to indicate what error occurred, if any.]]
  14941. ]
  14942. [heading Return Value]
  14943. The number of bytes read. Returns 0 if an error occurred.
  14944. [heading Remarks]
  14945. The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
  14946. [endsect]
  14947. [endsect]
  14948. [section:send_break basic_serial_port::send_break]
  14949. [indexterm2 boost_asio.indexterm.basic_serial_port.send_break..send_break..basic_serial_port]
  14950. Send a break sequence to the serial port.
  14951. void ``[link boost_asio.reference.basic_serial_port.send_break.overload1 send_break]``();
  14952. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.send_break.overload1 more...]]``
  14953. void ``[link boost_asio.reference.basic_serial_port.send_break.overload2 send_break]``(
  14954. boost::system::error_code & ec);
  14955. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.send_break.overload2 more...]]``
  14956. [section:overload1 basic_serial_port::send_break (1 of 2 overloads)]
  14957. Send a break sequence to the serial port.
  14958. void send_break();
  14959. This function causes a break sequence of platform-specific duration to be sent out the serial port.
  14960. [heading Exceptions]
  14961. [variablelist
  14962. [[boost::system::system_error][Thrown on failure. ]]
  14963. ]
  14964. [endsect]
  14965. [section:overload2 basic_serial_port::send_break (2 of 2 overloads)]
  14966. Send a break sequence to the serial port.
  14967. void send_break(
  14968. boost::system::error_code & ec);
  14969. This function causes a break sequence of platform-specific duration to be sent out the serial port.
  14970. [heading Parameters]
  14971. [variablelist
  14972. [[ec][Set to indicate what error occurred, if any. ]]
  14973. ]
  14974. [endsect]
  14975. [endsect]
  14976. [section:set_option basic_serial_port::set_option]
  14977. [indexterm2 boost_asio.indexterm.basic_serial_port.set_option..set_option..basic_serial_port]
  14978. Set an option on the serial port.
  14979. template<
  14980. typename ``[link boost_asio.reference.SettableSerialPortOption SettableSerialPortOption]``>
  14981. void ``[link boost_asio.reference.basic_serial_port.set_option.overload1 set_option]``(
  14982. const SettableSerialPortOption & option);
  14983. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.set_option.overload1 more...]]``
  14984. template<
  14985. typename ``[link boost_asio.reference.SettableSerialPortOption SettableSerialPortOption]``>
  14986. void ``[link boost_asio.reference.basic_serial_port.set_option.overload2 set_option]``(
  14987. const SettableSerialPortOption & option,
  14988. boost::system::error_code & ec);
  14989. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.set_option.overload2 more...]]``
  14990. [section:overload1 basic_serial_port::set_option (1 of 2 overloads)]
  14991. Set an option on the serial port.
  14992. template<
  14993. typename ``[link boost_asio.reference.SettableSerialPortOption SettableSerialPortOption]``>
  14994. void set_option(
  14995. const SettableSerialPortOption & option);
  14996. This function is used to set an option on the serial port.
  14997. [heading Parameters]
  14998. [variablelist
  14999. [[option][The option value to be set on the serial port.]]
  15000. ]
  15001. [heading Exceptions]
  15002. [variablelist
  15003. [[boost::system::system_error][Thrown on failure.]]
  15004. ]
  15005. [endsect]
  15006. [section:overload2 basic_serial_port::set_option (2 of 2 overloads)]
  15007. Set an option on the serial port.
  15008. template<
  15009. typename ``[link boost_asio.reference.SettableSerialPortOption SettableSerialPortOption]``>
  15010. void set_option(
  15011. const SettableSerialPortOption & option,
  15012. boost::system::error_code & ec);
  15013. This function is used to set an option on the serial port.
  15014. [heading Parameters]
  15015. [variablelist
  15016. [[option][The option value to be set on the serial port.]]
  15017. [[ec][Set to indicate what error occurred, if any.]]
  15018. ]
  15019. [endsect]
  15020. [endsect]
  15021. [section:write_some basic_serial_port::write_some]
  15022. [indexterm2 boost_asio.indexterm.basic_serial_port.write_some..write_some..basic_serial_port]
  15023. Write some data to the serial port.
  15024. template<
  15025. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  15026. std::size_t ``[link boost_asio.reference.basic_serial_port.write_some.overload1 write_some]``(
  15027. const ConstBufferSequence & buffers);
  15028. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.write_some.overload1 more...]]``
  15029. template<
  15030. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  15031. std::size_t ``[link boost_asio.reference.basic_serial_port.write_some.overload2 write_some]``(
  15032. const ConstBufferSequence & buffers,
  15033. boost::system::error_code & ec);
  15034. `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.write_some.overload2 more...]]``
  15035. [section:overload1 basic_serial_port::write_some (1 of 2 overloads)]
  15036. Write some data to the serial port.
  15037. template<
  15038. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  15039. std::size_t write_some(
  15040. const ConstBufferSequence & buffers);
  15041. This function is used to write data to the serial port. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
  15042. [heading Parameters]
  15043. [variablelist
  15044. [[buffers][One or more data buffers to be written to the serial port.]]
  15045. ]
  15046. [heading Return Value]
  15047. The number of bytes written.
  15048. [heading Exceptions]
  15049. [variablelist
  15050. [[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
  15051. ]
  15052. [heading Remarks]
  15053. The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
  15054. [heading Example]
  15055. To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  15056. basic_serial_port.write_some(boost::asio::buffer(data, size));
  15057. See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  15058. [endsect]
  15059. [section:overload2 basic_serial_port::write_some (2 of 2 overloads)]
  15060. Write some data to the serial port.
  15061. template<
  15062. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  15063. std::size_t write_some(
  15064. const ConstBufferSequence & buffers,
  15065. boost::system::error_code & ec);
  15066. This function is used to write data to the serial port. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
  15067. [heading Parameters]
  15068. [variablelist
  15069. [[buffers][One or more data buffers to be written to the serial port.]]
  15070. [[ec][Set to indicate what error occurred, if any.]]
  15071. ]
  15072. [heading Return Value]
  15073. The number of bytes written. Returns 0 if an error occurred.
  15074. [heading Remarks]
  15075. The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
  15076. [endsect]
  15077. [endsect]
  15078. [section:_basic_serial_port basic_serial_port::~basic_serial_port]
  15079. [indexterm2 boost_asio.indexterm.basic_serial_port._basic_serial_port..~basic_serial_port..basic_serial_port]
  15080. Destroys the serial port.
  15081. ~basic_serial_port();
  15082. This function destroys the serial port, cancelling any outstanding asynchronous wait operations associated with the serial port as if by calling `cancel`.
  15083. [endsect]
  15084. [endsect]
  15085. [section:basic_serial_port__rebind_executor basic_serial_port::rebind_executor]
  15086. Rebinds the serial port type to another executor.
  15087. template<
  15088. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  15089. struct rebind_executor
  15090. [heading Types]
  15091. [table
  15092. [[Name][Description]]
  15093. [
  15094. [[link boost_asio.reference.basic_serial_port__rebind_executor.other [*other]]]
  15095. [The serial port type when rebound to the specified executor. ]
  15096. ]
  15097. ]
  15098. [heading Requirements]
  15099. ['Header: ][^boost/asio/basic_serial_port.hpp]
  15100. ['Convenience header: ][^boost/asio.hpp]
  15101. [section:other basic_serial_port::rebind_executor::other]
  15102. [indexterm2 boost_asio.indexterm.basic_serial_port__rebind_executor.other..other..basic_serial_port::rebind_executor]
  15103. The serial port type when rebound to the specified executor.
  15104. typedef basic_serial_port< Executor1 > other;
  15105. [heading Types]
  15106. [table
  15107. [[Name][Description]]
  15108. [
  15109. [[link boost_asio.reference.basic_serial_port__rebind_executor [*rebind_executor]]]
  15110. [Rebinds the serial port type to another executor. ]
  15111. ]
  15112. [
  15113. [[link boost_asio.reference.basic_serial_port.executor_type [*executor_type]]]
  15114. [The type of the executor associated with the object. ]
  15115. ]
  15116. [
  15117. [[link boost_asio.reference.basic_serial_port.lowest_layer_type [*lowest_layer_type]]]
  15118. [A basic_basic_serial_port is always the lowest layer. ]
  15119. ]
  15120. [
  15121. [[link boost_asio.reference.basic_serial_port.native_handle_type [*native_handle_type]]]
  15122. [The native representation of a serial port. ]
  15123. ]
  15124. ]
  15125. [heading Member Functions]
  15126. [table
  15127. [[Name][Description]]
  15128. [
  15129. [[link boost_asio.reference.basic_serial_port.assign [*assign]]]
  15130. [Assign an existing native serial port to the serial port. ]
  15131. ]
  15132. [
  15133. [[link boost_asio.reference.basic_serial_port.async_read_some [*async_read_some]]]
  15134. [Start an asynchronous read. ]
  15135. ]
  15136. [
  15137. [[link boost_asio.reference.basic_serial_port.async_write_some [*async_write_some]]]
  15138. [Start an asynchronous write. ]
  15139. ]
  15140. [
  15141. [[link boost_asio.reference.basic_serial_port.basic_serial_port [*basic_serial_port]]]
  15142. [Construct a basic_serial_port without opening it.
  15143. [hr]
  15144. Construct and open a basic_serial_port.
  15145. [hr]
  15146. Construct a basic_serial_port on an existing native serial port.
  15147. [hr]
  15148. Move-construct a basic_serial_port from another. ]
  15149. ]
  15150. [
  15151. [[link boost_asio.reference.basic_serial_port.cancel [*cancel]]]
  15152. [Cancel all asynchronous operations associated with the serial port. ]
  15153. ]
  15154. [
  15155. [[link boost_asio.reference.basic_serial_port.close [*close]]]
  15156. [Close the serial port. ]
  15157. ]
  15158. [
  15159. [[link boost_asio.reference.basic_serial_port.get_executor [*get_executor]]]
  15160. [Get the executor associated with the object. ]
  15161. ]
  15162. [
  15163. [[link boost_asio.reference.basic_serial_port.get_option [*get_option]]]
  15164. [Get an option from the serial port. ]
  15165. ]
  15166. [
  15167. [[link boost_asio.reference.basic_serial_port.is_open [*is_open]]]
  15168. [Determine whether the serial port is open. ]
  15169. ]
  15170. [
  15171. [[link boost_asio.reference.basic_serial_port.lowest_layer [*lowest_layer]]]
  15172. [Get a reference to the lowest layer.
  15173. [hr]
  15174. Get a const reference to the lowest layer. ]
  15175. ]
  15176. [
  15177. [[link boost_asio.reference.basic_serial_port.native_handle [*native_handle]]]
  15178. [Get the native serial port representation. ]
  15179. ]
  15180. [
  15181. [[link boost_asio.reference.basic_serial_port.open [*open]]]
  15182. [Open the serial port using the specified device name. ]
  15183. ]
  15184. [
  15185. [[link boost_asio.reference.basic_serial_port.operator_eq_ [*operator=]]]
  15186. [Move-assign a basic_serial_port from another. ]
  15187. ]
  15188. [
  15189. [[link boost_asio.reference.basic_serial_port.read_some [*read_some]]]
  15190. [Read some data from the serial port. ]
  15191. ]
  15192. [
  15193. [[link boost_asio.reference.basic_serial_port.send_break [*send_break]]]
  15194. [Send a break sequence to the serial port. ]
  15195. ]
  15196. [
  15197. [[link boost_asio.reference.basic_serial_port.set_option [*set_option]]]
  15198. [Set an option on the serial port. ]
  15199. ]
  15200. [
  15201. [[link boost_asio.reference.basic_serial_port.write_some [*write_some]]]
  15202. [Write some data to the serial port. ]
  15203. ]
  15204. [
  15205. [[link boost_asio.reference.basic_serial_port._basic_serial_port [*~basic_serial_port]]]
  15206. [Destroys the serial port. ]
  15207. ]
  15208. ]
  15209. The [link boost_asio.reference.basic_serial_port `basic_serial_port`] class provides a wrapper over serial port functionality.
  15210. [heading Thread Safety]
  15211. ['Distinct] ['objects:] Safe.
  15212. ['Shared] ['objects:] Unsafe.
  15213. [heading Requirements]
  15214. ['Header: ][^boost/asio/basic_serial_port.hpp]
  15215. ['Convenience header: ][^boost/asio.hpp]
  15216. [endsect]
  15217. [endsect]
  15218. [section:basic_signal_set basic_signal_set]
  15219. Provides signal functionality.
  15220. template<
  15221. typename ``[link boost_asio.reference.Executor1 Executor]`` = executor>
  15222. class basic_signal_set
  15223. [heading Types]
  15224. [table
  15225. [[Name][Description]]
  15226. [
  15227. [[link boost_asio.reference.basic_signal_set__rebind_executor [*rebind_executor]]]
  15228. [Rebinds the signal set type to another executor. ]
  15229. ]
  15230. [
  15231. [[link boost_asio.reference.basic_signal_set.executor_type [*executor_type]]]
  15232. [The type of the executor associated with the object. ]
  15233. ]
  15234. ]
  15235. [heading Member Functions]
  15236. [table
  15237. [[Name][Description]]
  15238. [
  15239. [[link boost_asio.reference.basic_signal_set.add [*add]]]
  15240. [Add a signal to a signal_set. ]
  15241. ]
  15242. [
  15243. [[link boost_asio.reference.basic_signal_set.async_wait [*async_wait]]]
  15244. [Start an asynchronous operation to wait for a signal to be delivered. ]
  15245. ]
  15246. [
  15247. [[link boost_asio.reference.basic_signal_set.basic_signal_set [*basic_signal_set]]]
  15248. [Construct a signal set without adding any signals.
  15249. [hr]
  15250. Construct a signal set and add one signal.
  15251. [hr]
  15252. Construct a signal set and add two signals.
  15253. [hr]
  15254. Construct a signal set and add three signals. ]
  15255. ]
  15256. [
  15257. [[link boost_asio.reference.basic_signal_set.cancel [*cancel]]]
  15258. [Cancel all operations associated with the signal set. ]
  15259. ]
  15260. [
  15261. [[link boost_asio.reference.basic_signal_set.clear [*clear]]]
  15262. [Remove all signals from a signal_set. ]
  15263. ]
  15264. [
  15265. [[link boost_asio.reference.basic_signal_set.get_executor [*get_executor]]]
  15266. [Get the executor associated with the object. ]
  15267. ]
  15268. [
  15269. [[link boost_asio.reference.basic_signal_set.remove [*remove]]]
  15270. [Remove a signal from a signal_set. ]
  15271. ]
  15272. [
  15273. [[link boost_asio.reference.basic_signal_set._basic_signal_set [*~basic_signal_set]]]
  15274. [Destroys the signal set. ]
  15275. ]
  15276. ]
  15277. The [link boost_asio.reference.basic_signal_set `basic_signal_set`] class provides the ability to perform an asynchronous wait for one or more signals to occur.
  15278. [heading Thread Safety]
  15279. ['Distinct] ['objects:] Safe.
  15280. ['Shared] ['objects:] Unsafe.
  15281. [heading Example]
  15282. Performing an asynchronous wait:
  15283. void handler(
  15284. const boost::system::error_code& error,
  15285. int signal_number)
  15286. {
  15287. if (!error)
  15288. {
  15289. // A signal occurred.
  15290. }
  15291. }
  15292. ...
  15293. // Construct a signal set registered for process termination.
  15294. boost::asio::signal_set signals(my_context, SIGINT, SIGTERM);
  15295. // Start an asynchronous wait for one of the signals to occur.
  15296. signals.async_wait(handler);
  15297. [heading Queueing of signal notifications]
  15298. If a signal is registered with a signal\_set, and the signal occurs when there are no waiting handlers, then the signal notification is queued. The next async\_wait operation on that signal\_set will dequeue the notification. If multiple notifications are queued, subsequent async\_wait operations dequeue them one at a time. Signal notifications are dequeued in order of ascending signal number.
  15299. If a signal number is removed from a signal\_set (using the `remove` or `erase` member functions) then any queued notifications for that signal are discarded.
  15300. [heading Multiple registration of signals]
  15301. The same signal number may be registered with different signal\_set objects. When the signal occurs, one handler is called for each signal\_set object.
  15302. Note that multiple registration only works for signals that are registered using Asio. The application must not also register a signal handler using functions such as `signal()` or `sigaction()`.
  15303. [heading Signal masking on POSIX platforms]
  15304. POSIX allows signals to be blocked using functions such as `sigprocmask()` and `pthread_sigmask()`. For signals to be delivered, programs must ensure that any signals registered using signal\_set objects are unblocked in at least one thread.
  15305. [heading Requirements]
  15306. ['Header: ][^boost/asio/basic_signal_set.hpp]
  15307. ['Convenience header: ][^boost/asio.hpp]
  15308. [section:add basic_signal_set::add]
  15309. [indexterm2 boost_asio.indexterm.basic_signal_set.add..add..basic_signal_set]
  15310. Add a signal to a signal\_set.
  15311. void ``[link boost_asio.reference.basic_signal_set.add.overload1 add]``(
  15312. int signal_number);
  15313. `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.add.overload1 more...]]``
  15314. void ``[link boost_asio.reference.basic_signal_set.add.overload2 add]``(
  15315. int signal_number,
  15316. boost::system::error_code & ec);
  15317. `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.add.overload2 more...]]``
  15318. [section:overload1 basic_signal_set::add (1 of 2 overloads)]
  15319. Add a signal to a signal\_set.
  15320. void add(
  15321. int signal_number);
  15322. This function adds the specified signal to the set. It has no effect if the signal is already in the set.
  15323. [heading Parameters]
  15324. [variablelist
  15325. [[signal_number][The signal to be added to the set.]]
  15326. ]
  15327. [heading Exceptions]
  15328. [variablelist
  15329. [[boost::system::system_error][Thrown on failure. ]]
  15330. ]
  15331. [endsect]
  15332. [section:overload2 basic_signal_set::add (2 of 2 overloads)]
  15333. Add a signal to a signal\_set.
  15334. void add(
  15335. int signal_number,
  15336. boost::system::error_code & ec);
  15337. This function adds the specified signal to the set. It has no effect if the signal is already in the set.
  15338. [heading Parameters]
  15339. [variablelist
  15340. [[signal_number][The signal to be added to the set.]]
  15341. [[ec][Set to indicate what error occurred, if any. ]]
  15342. ]
  15343. [endsect]
  15344. [endsect]
  15345. [section:async_wait basic_signal_set::async_wait]
  15346. [indexterm2 boost_asio.indexterm.basic_signal_set.async_wait..async_wait..basic_signal_set]
  15347. Start an asynchronous operation to wait for a signal to be delivered.
  15348. template<
  15349. typename ``[link boost_asio.reference.SignalHandler SignalHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  15350. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait(
  15351. SignalHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  15352. This function may be used to initiate an asynchronous wait against the signal set. It always returns immediately.
  15353. For each call to `async_wait()`, the supplied handler will be called exactly once. The handler will be called when:
  15354. * One of the registered signals in the signal set occurs; or
  15355. * The signal set was cancelled, in which case the handler is passed the error code `boost::asio::error::operation_aborted`.
  15356. [heading Parameters]
  15357. [variablelist
  15358. [[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:
  15359. ``
  15360. void handler(
  15361. const boost::system::error_code& error, // Result of operation.
  15362. int signal_number // Indicates which signal occurred.
  15363. );
  15364. ``
  15365. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
  15366. ]
  15367. [endsect]
  15368. [section:basic_signal_set basic_signal_set::basic_signal_set]
  15369. [indexterm2 boost_asio.indexterm.basic_signal_set.basic_signal_set..basic_signal_set..basic_signal_set]
  15370. Construct a signal set without adding any signals.
  15371. explicit ``[link boost_asio.reference.basic_signal_set.basic_signal_set.overload1 basic_signal_set]``(
  15372. const executor_type & ex);
  15373. `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.basic_signal_set.overload1 more...]]``
  15374. template<
  15375. typename ExecutionContext>
  15376. explicit ``[link boost_asio.reference.basic_signal_set.basic_signal_set.overload2 basic_signal_set]``(
  15377. ExecutionContext & context,
  15378. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  15379. `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.basic_signal_set.overload2 more...]]``
  15380. Construct a signal set and add one signal.
  15381. ``[link boost_asio.reference.basic_signal_set.basic_signal_set.overload3 basic_signal_set]``(
  15382. const executor_type & ex,
  15383. int signal_number_1);
  15384. `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.basic_signal_set.overload3 more...]]``
  15385. template<
  15386. typename ExecutionContext>
  15387. ``[link boost_asio.reference.basic_signal_set.basic_signal_set.overload4 basic_signal_set]``(
  15388. ExecutionContext & context,
  15389. int signal_number_1,
  15390. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  15391. `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.basic_signal_set.overload4 more...]]``
  15392. Construct a signal set and add two signals.
  15393. ``[link boost_asio.reference.basic_signal_set.basic_signal_set.overload5 basic_signal_set]``(
  15394. const executor_type & ex,
  15395. int signal_number_1,
  15396. int signal_number_2);
  15397. `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.basic_signal_set.overload5 more...]]``
  15398. template<
  15399. typename ExecutionContext>
  15400. ``[link boost_asio.reference.basic_signal_set.basic_signal_set.overload6 basic_signal_set]``(
  15401. ExecutionContext & context,
  15402. int signal_number_1,
  15403. int signal_number_2,
  15404. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  15405. `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.basic_signal_set.overload6 more...]]``
  15406. Construct a signal set and add three signals.
  15407. ``[link boost_asio.reference.basic_signal_set.basic_signal_set.overload7 basic_signal_set]``(
  15408. const executor_type & ex,
  15409. int signal_number_1,
  15410. int signal_number_2,
  15411. int signal_number_3);
  15412. `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.basic_signal_set.overload7 more...]]``
  15413. template<
  15414. typename ExecutionContext>
  15415. ``[link boost_asio.reference.basic_signal_set.basic_signal_set.overload8 basic_signal_set]``(
  15416. ExecutionContext & context,
  15417. int signal_number_1,
  15418. int signal_number_2,
  15419. int signal_number_3,
  15420. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  15421. `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.basic_signal_set.overload8 more...]]``
  15422. [section:overload1 basic_signal_set::basic_signal_set (1 of 8 overloads)]
  15423. Construct a signal set without adding any signals.
  15424. basic_signal_set(
  15425. const executor_type & ex);
  15426. This constructor creates a signal set without registering for any signals.
  15427. [heading Parameters]
  15428. [variablelist
  15429. [[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. ]]
  15430. ]
  15431. [endsect]
  15432. [section:overload2 basic_signal_set::basic_signal_set (2 of 8 overloads)]
  15433. Construct a signal set without adding any signals.
  15434. template<
  15435. typename ExecutionContext>
  15436. basic_signal_set(
  15437. ExecutionContext & context,
  15438. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  15439. This constructor creates a signal set without registering for any signals.
  15440. [heading Parameters]
  15441. [variablelist
  15442. [[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. ]]
  15443. ]
  15444. [endsect]
  15445. [section:overload3 basic_signal_set::basic_signal_set (3 of 8 overloads)]
  15446. Construct a signal set and add one signal.
  15447. basic_signal_set(
  15448. const executor_type & ex,
  15449. int signal_number_1);
  15450. This constructor creates a signal set and registers for one signal.
  15451. [heading Parameters]
  15452. [variablelist
  15453. [[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.]]
  15454. [[signal_number_1][The signal number to be added.]]
  15455. ]
  15456. [heading Remarks]
  15457. This constructor is equivalent to performing:
  15458. boost::asio::signal_set signals(ex);
  15459. signals.add(signal_number_1);
  15460. [endsect]
  15461. [section:overload4 basic_signal_set::basic_signal_set (4 of 8 overloads)]
  15462. Construct a signal set and add one signal.
  15463. template<
  15464. typename ExecutionContext>
  15465. basic_signal_set(
  15466. ExecutionContext & context,
  15467. int signal_number_1,
  15468. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  15469. This constructor creates a signal set and registers for one signal.
  15470. [heading Parameters]
  15471. [variablelist
  15472. [[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.]]
  15473. [[signal_number_1][The signal number to be added.]]
  15474. ]
  15475. [heading Remarks]
  15476. This constructor is equivalent to performing:
  15477. boost::asio::signal_set signals(context);
  15478. signals.add(signal_number_1);
  15479. [endsect]
  15480. [section:overload5 basic_signal_set::basic_signal_set (5 of 8 overloads)]
  15481. Construct a signal set and add two signals.
  15482. basic_signal_set(
  15483. const executor_type & ex,
  15484. int signal_number_1,
  15485. int signal_number_2);
  15486. This constructor creates a signal set and registers for two signals.
  15487. [heading Parameters]
  15488. [variablelist
  15489. [[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.]]
  15490. [[signal_number_1][The first signal number to be added.]]
  15491. [[signal_number_2][The second signal number to be added.]]
  15492. ]
  15493. [heading Remarks]
  15494. This constructor is equivalent to performing:
  15495. boost::asio::signal_set signals(ex);
  15496. signals.add(signal_number_1);
  15497. signals.add(signal_number_2);
  15498. [endsect]
  15499. [section:overload6 basic_signal_set::basic_signal_set (6 of 8 overloads)]
  15500. Construct a signal set and add two signals.
  15501. template<
  15502. typename ExecutionContext>
  15503. basic_signal_set(
  15504. ExecutionContext & context,
  15505. int signal_number_1,
  15506. int signal_number_2,
  15507. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  15508. This constructor creates a signal set and registers for two signals.
  15509. [heading Parameters]
  15510. [variablelist
  15511. [[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.]]
  15512. [[signal_number_1][The first signal number to be added.]]
  15513. [[signal_number_2][The second signal number to be added.]]
  15514. ]
  15515. [heading Remarks]
  15516. This constructor is equivalent to performing:
  15517. boost::asio::signal_set signals(context);
  15518. signals.add(signal_number_1);
  15519. signals.add(signal_number_2);
  15520. [endsect]
  15521. [section:overload7 basic_signal_set::basic_signal_set (7 of 8 overloads)]
  15522. Construct a signal set and add three signals.
  15523. basic_signal_set(
  15524. const executor_type & ex,
  15525. int signal_number_1,
  15526. int signal_number_2,
  15527. int signal_number_3);
  15528. This constructor creates a signal set and registers for three signals.
  15529. [heading Parameters]
  15530. [variablelist
  15531. [[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.]]
  15532. [[signal_number_1][The first signal number to be added.]]
  15533. [[signal_number_2][The second signal number to be added.]]
  15534. [[signal_number_3][The third signal number to be added.]]
  15535. ]
  15536. [heading Remarks]
  15537. This constructor is equivalent to performing:
  15538. boost::asio::signal_set signals(ex);
  15539. signals.add(signal_number_1);
  15540. signals.add(signal_number_2);
  15541. signals.add(signal_number_3);
  15542. [endsect]
  15543. [section:overload8 basic_signal_set::basic_signal_set (8 of 8 overloads)]
  15544. Construct a signal set and add three signals.
  15545. template<
  15546. typename ExecutionContext>
  15547. basic_signal_set(
  15548. ExecutionContext & context,
  15549. int signal_number_1,
  15550. int signal_number_2,
  15551. int signal_number_3,
  15552. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  15553. This constructor creates a signal set and registers for three signals.
  15554. [heading Parameters]
  15555. [variablelist
  15556. [[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.]]
  15557. [[signal_number_1][The first signal number to be added.]]
  15558. [[signal_number_2][The second signal number to be added.]]
  15559. [[signal_number_3][The third signal number to be added.]]
  15560. ]
  15561. [heading Remarks]
  15562. This constructor is equivalent to performing:
  15563. boost::asio::signal_set signals(context);
  15564. signals.add(signal_number_1);
  15565. signals.add(signal_number_2);
  15566. signals.add(signal_number_3);
  15567. [endsect]
  15568. [endsect]
  15569. [section:cancel basic_signal_set::cancel]
  15570. [indexterm2 boost_asio.indexterm.basic_signal_set.cancel..cancel..basic_signal_set]
  15571. Cancel all operations associated with the signal set.
  15572. void ``[link boost_asio.reference.basic_signal_set.cancel.overload1 cancel]``();
  15573. `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.cancel.overload1 more...]]``
  15574. void ``[link boost_asio.reference.basic_signal_set.cancel.overload2 cancel]``(
  15575. boost::system::error_code & ec);
  15576. `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.cancel.overload2 more...]]``
  15577. [section:overload1 basic_signal_set::cancel (1 of 2 overloads)]
  15578. Cancel all operations associated with the signal set.
  15579. void cancel();
  15580. This function forces the completion of any pending asynchronous wait operations against the signal set. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
  15581. Cancellation does not alter the set of registered signals.
  15582. [heading Exceptions]
  15583. [variablelist
  15584. [[boost::system::system_error][Thrown on failure.]]
  15585. ]
  15586. [heading Remarks]
  15587. If a registered signal occurred before `cancel()` is called, then the handlers for asynchronous wait operations will:
  15588. * have already been invoked; or
  15589. * have been queued for invocation in the near future.
  15590. These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation.
  15591. [endsect]
  15592. [section:overload2 basic_signal_set::cancel (2 of 2 overloads)]
  15593. Cancel all operations associated with the signal set.
  15594. void cancel(
  15595. boost::system::error_code & ec);
  15596. This function forces the completion of any pending asynchronous wait operations against the signal set. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
  15597. Cancellation does not alter the set of registered signals.
  15598. [heading Parameters]
  15599. [variablelist
  15600. [[ec][Set to indicate what error occurred, if any.]]
  15601. ]
  15602. [heading Remarks]
  15603. If a registered signal occurred before `cancel()` is called, then the handlers for asynchronous wait operations will:
  15604. * have already been invoked; or
  15605. * have been queued for invocation in the near future.
  15606. These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation.
  15607. [endsect]
  15608. [endsect]
  15609. [section:clear basic_signal_set::clear]
  15610. [indexterm2 boost_asio.indexterm.basic_signal_set.clear..clear..basic_signal_set]
  15611. Remove all signals from a signal\_set.
  15612. void ``[link boost_asio.reference.basic_signal_set.clear.overload1 clear]``();
  15613. `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.clear.overload1 more...]]``
  15614. void ``[link boost_asio.reference.basic_signal_set.clear.overload2 clear]``(
  15615. boost::system::error_code & ec);
  15616. `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.clear.overload2 more...]]``
  15617. [section:overload1 basic_signal_set::clear (1 of 2 overloads)]
  15618. Remove all signals from a signal\_set.
  15619. void clear();
  15620. This function removes all signals from the set. It has no effect if the set is already empty.
  15621. [heading Exceptions]
  15622. [variablelist
  15623. [[boost::system::system_error][Thrown on failure.]]
  15624. ]
  15625. [heading Remarks]
  15626. Removes all queued notifications.
  15627. [endsect]
  15628. [section:overload2 basic_signal_set::clear (2 of 2 overloads)]
  15629. Remove all signals from a signal\_set.
  15630. void clear(
  15631. boost::system::error_code & ec);
  15632. This function removes all signals from the set. It has no effect if the set is already empty.
  15633. [heading Parameters]
  15634. [variablelist
  15635. [[ec][Set to indicate what error occurred, if any.]]
  15636. ]
  15637. [heading Remarks]
  15638. Removes all queued notifications.
  15639. [endsect]
  15640. [endsect]
  15641. [section:executor_type basic_signal_set::executor_type]
  15642. [indexterm2 boost_asio.indexterm.basic_signal_set.executor_type..executor_type..basic_signal_set]
  15643. The type of the executor associated with the object.
  15644. typedef Executor executor_type;
  15645. [heading Requirements]
  15646. ['Header: ][^boost/asio/basic_signal_set.hpp]
  15647. ['Convenience header: ][^boost/asio.hpp]
  15648. [endsect]
  15649. [section:get_executor basic_signal_set::get_executor]
  15650. [indexterm2 boost_asio.indexterm.basic_signal_set.get_executor..get_executor..basic_signal_set]
  15651. Get the executor associated with the object.
  15652. executor_type get_executor();
  15653. [endsect]
  15654. [section:remove basic_signal_set::remove]
  15655. [indexterm2 boost_asio.indexterm.basic_signal_set.remove..remove..basic_signal_set]
  15656. Remove a signal from a signal\_set.
  15657. void ``[link boost_asio.reference.basic_signal_set.remove.overload1 remove]``(
  15658. int signal_number);
  15659. `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.remove.overload1 more...]]``
  15660. void ``[link boost_asio.reference.basic_signal_set.remove.overload2 remove]``(
  15661. int signal_number,
  15662. boost::system::error_code & ec);
  15663. `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.remove.overload2 more...]]``
  15664. [section:overload1 basic_signal_set::remove (1 of 2 overloads)]
  15665. Remove a signal from a signal\_set.
  15666. void remove(
  15667. int signal_number);
  15668. This function removes the specified signal from the set. It has no effect if the signal is not in the set.
  15669. [heading Parameters]
  15670. [variablelist
  15671. [[signal_number][The signal to be removed from the set.]]
  15672. ]
  15673. [heading Exceptions]
  15674. [variablelist
  15675. [[boost::system::system_error][Thrown on failure.]]
  15676. ]
  15677. [heading Remarks]
  15678. Removes any notifications that have been queued for the specified signal number.
  15679. [endsect]
  15680. [section:overload2 basic_signal_set::remove (2 of 2 overloads)]
  15681. Remove a signal from a signal\_set.
  15682. void remove(
  15683. int signal_number,
  15684. boost::system::error_code & ec);
  15685. This function removes the specified signal from the set. It has no effect if the signal is not in the set.
  15686. [heading Parameters]
  15687. [variablelist
  15688. [[signal_number][The signal to be removed from the set.]]
  15689. [[ec][Set to indicate what error occurred, if any.]]
  15690. ]
  15691. [heading Remarks]
  15692. Removes any notifications that have been queued for the specified signal number.
  15693. [endsect]
  15694. [endsect]
  15695. [section:_basic_signal_set basic_signal_set::~basic_signal_set]
  15696. [indexterm2 boost_asio.indexterm.basic_signal_set._basic_signal_set..~basic_signal_set..basic_signal_set]
  15697. Destroys the signal set.
  15698. ~basic_signal_set();
  15699. This function destroys the signal set, cancelling any outstanding asynchronous wait operations associated with the signal set as if by calling `cancel`.
  15700. [endsect]
  15701. [endsect]
  15702. [section:basic_signal_set__rebind_executor basic_signal_set::rebind_executor]
  15703. Rebinds the signal set type to another executor.
  15704. template<
  15705. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  15706. struct rebind_executor
  15707. [heading Types]
  15708. [table
  15709. [[Name][Description]]
  15710. [
  15711. [[link boost_asio.reference.basic_signal_set__rebind_executor.other [*other]]]
  15712. [The signal set type when rebound to the specified executor. ]
  15713. ]
  15714. ]
  15715. [heading Requirements]
  15716. ['Header: ][^boost/asio/basic_signal_set.hpp]
  15717. ['Convenience header: ][^boost/asio.hpp]
  15718. [section:other basic_signal_set::rebind_executor::other]
  15719. [indexterm2 boost_asio.indexterm.basic_signal_set__rebind_executor.other..other..basic_signal_set::rebind_executor]
  15720. The signal set type when rebound to the specified executor.
  15721. typedef basic_signal_set< Executor1 > other;
  15722. [heading Types]
  15723. [table
  15724. [[Name][Description]]
  15725. [
  15726. [[link boost_asio.reference.basic_signal_set__rebind_executor [*rebind_executor]]]
  15727. [Rebinds the signal set type to another executor. ]
  15728. ]
  15729. [
  15730. [[link boost_asio.reference.basic_signal_set.executor_type [*executor_type]]]
  15731. [The type of the executor associated with the object. ]
  15732. ]
  15733. ]
  15734. [heading Member Functions]
  15735. [table
  15736. [[Name][Description]]
  15737. [
  15738. [[link boost_asio.reference.basic_signal_set.add [*add]]]
  15739. [Add a signal to a signal_set. ]
  15740. ]
  15741. [
  15742. [[link boost_asio.reference.basic_signal_set.async_wait [*async_wait]]]
  15743. [Start an asynchronous operation to wait for a signal to be delivered. ]
  15744. ]
  15745. [
  15746. [[link boost_asio.reference.basic_signal_set.basic_signal_set [*basic_signal_set]]]
  15747. [Construct a signal set without adding any signals.
  15748. [hr]
  15749. Construct a signal set and add one signal.
  15750. [hr]
  15751. Construct a signal set and add two signals.
  15752. [hr]
  15753. Construct a signal set and add three signals. ]
  15754. ]
  15755. [
  15756. [[link boost_asio.reference.basic_signal_set.cancel [*cancel]]]
  15757. [Cancel all operations associated with the signal set. ]
  15758. ]
  15759. [
  15760. [[link boost_asio.reference.basic_signal_set.clear [*clear]]]
  15761. [Remove all signals from a signal_set. ]
  15762. ]
  15763. [
  15764. [[link boost_asio.reference.basic_signal_set.get_executor [*get_executor]]]
  15765. [Get the executor associated with the object. ]
  15766. ]
  15767. [
  15768. [[link boost_asio.reference.basic_signal_set.remove [*remove]]]
  15769. [Remove a signal from a signal_set. ]
  15770. ]
  15771. [
  15772. [[link boost_asio.reference.basic_signal_set._basic_signal_set [*~basic_signal_set]]]
  15773. [Destroys the signal set. ]
  15774. ]
  15775. ]
  15776. The [link boost_asio.reference.basic_signal_set `basic_signal_set`] class provides the ability to perform an asynchronous wait for one or more signals to occur.
  15777. [heading Thread Safety]
  15778. ['Distinct] ['objects:] Safe.
  15779. ['Shared] ['objects:] Unsafe.
  15780. [heading Example]
  15781. Performing an asynchronous wait:
  15782. void handler(
  15783. const boost::system::error_code& error,
  15784. int signal_number)
  15785. {
  15786. if (!error)
  15787. {
  15788. // A signal occurred.
  15789. }
  15790. }
  15791. ...
  15792. // Construct a signal set registered for process termination.
  15793. boost::asio::signal_set signals(my_context, SIGINT, SIGTERM);
  15794. // Start an asynchronous wait for one of the signals to occur.
  15795. signals.async_wait(handler);
  15796. [heading Queueing of signal notifications]
  15797. If a signal is registered with a signal\_set, and the signal occurs when there are no waiting handlers, then the signal notification is queued. The next async\_wait operation on that signal\_set will dequeue the notification. If multiple notifications are queued, subsequent async\_wait operations dequeue them one at a time. Signal notifications are dequeued in order of ascending signal number.
  15798. If a signal number is removed from a signal\_set (using the `remove` or `erase` member functions) then any queued notifications for that signal are discarded.
  15799. [heading Multiple registration of signals]
  15800. The same signal number may be registered with different signal\_set objects. When the signal occurs, one handler is called for each signal\_set object.
  15801. Note that multiple registration only works for signals that are registered using Asio. The application must not also register a signal handler using functions such as `signal()` or `sigaction()`.
  15802. [heading Signal masking on POSIX platforms]
  15803. POSIX allows signals to be blocked using functions such as `sigprocmask()` and `pthread_sigmask()`. For signals to be delivered, programs must ensure that any signals registered using signal\_set objects are unblocked in at least one thread.
  15804. [heading Requirements]
  15805. ['Header: ][^boost/asio/basic_signal_set.hpp]
  15806. ['Convenience header: ][^boost/asio.hpp]
  15807. [endsect]
  15808. [endsect]
  15809. [section:basic_socket basic_socket]
  15810. Provides socket functionality.
  15811. template<
  15812. typename ``[link boost_asio.reference.Protocol Protocol]``,
  15813. typename ``[link boost_asio.reference.Executor1 Executor]``>
  15814. class basic_socket :
  15815. public socket_base
  15816. [heading Types]
  15817. [table
  15818. [[Name][Description]]
  15819. [
  15820. [[link boost_asio.reference.basic_socket__rebind_executor [*rebind_executor]]]
  15821. [Rebinds the socket type to another executor. ]
  15822. ]
  15823. [
  15824. [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]]
  15825. [Socket option to permit sending of broadcast messages. ]
  15826. ]
  15827. [
  15828. [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]]
  15829. [IO control command to get the amount of data that can be read without blocking. ]
  15830. ]
  15831. [
  15832. [[link boost_asio.reference.basic_socket.debug [*debug]]]
  15833. [Socket option to enable socket-level debugging. ]
  15834. ]
  15835. [
  15836. [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]]
  15837. [Socket option to prevent routing, use local interfaces only. ]
  15838. ]
  15839. [
  15840. [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]]
  15841. [Socket option to report aborted connections on accept. ]
  15842. ]
  15843. [
  15844. [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]]
  15845. [The endpoint type. ]
  15846. ]
  15847. [
  15848. [[link boost_asio.reference.basic_socket.executor_type [*executor_type]]]
  15849. [The type of the executor associated with the object. ]
  15850. ]
  15851. [
  15852. [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]]
  15853. [Socket option to send keep-alives. ]
  15854. ]
  15855. [
  15856. [[link boost_asio.reference.basic_socket.linger [*linger]]]
  15857. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  15858. ]
  15859. [
  15860. [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]]
  15861. [A basic_socket is always the lowest layer. ]
  15862. ]
  15863. [
  15864. [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]]
  15865. [Bitmask type for flags that can be passed to send and receive operations. ]
  15866. ]
  15867. [
  15868. [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]]
  15869. [The native representation of a socket. ]
  15870. ]
  15871. [
  15872. [[link boost_asio.reference.basic_socket.out_of_band_inline [*out_of_band_inline]]]
  15873. [Socket option for putting received out-of-band data inline. ]
  15874. ]
  15875. [
  15876. [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]]
  15877. [The protocol type. ]
  15878. ]
  15879. [
  15880. [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]]
  15881. [Socket option for the receive buffer size of a socket. ]
  15882. ]
  15883. [
  15884. [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]]
  15885. [Socket option for the receive low watermark. ]
  15886. ]
  15887. [
  15888. [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]]
  15889. [Socket option to allow the socket to be bound to an address that is already in use. ]
  15890. ]
  15891. [
  15892. [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]]
  15893. [Socket option for the send buffer size of a socket. ]
  15894. ]
  15895. [
  15896. [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]]
  15897. [Socket option for the send low watermark. ]
  15898. ]
  15899. [
  15900. [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]]
  15901. [Different ways a socket may be shutdown. ]
  15902. ]
  15903. [
  15904. [[link boost_asio.reference.basic_socket.wait_type [*wait_type]]]
  15905. [Wait types. ]
  15906. ]
  15907. ]
  15908. [heading Member Functions]
  15909. [table
  15910. [[Name][Description]]
  15911. [
  15912. [[link boost_asio.reference.basic_socket.assign [*assign]]]
  15913. [Assign an existing native socket to the socket. ]
  15914. ]
  15915. [
  15916. [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]]
  15917. [Start an asynchronous connect. ]
  15918. ]
  15919. [
  15920. [[link boost_asio.reference.basic_socket.async_wait [*async_wait]]]
  15921. [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  15922. ]
  15923. [
  15924. [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]]
  15925. [Determine whether the socket is at the out-of-band data mark. ]
  15926. ]
  15927. [
  15928. [[link boost_asio.reference.basic_socket.available [*available]]]
  15929. [Determine the number of bytes available for reading. ]
  15930. ]
  15931. [
  15932. [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]]]
  15933. [Construct a basic_socket without opening it.
  15934. [hr]
  15935. Construct and open a basic_socket.
  15936. [hr]
  15937. Construct a basic_socket, opening it and binding it to the given local endpoint.
  15938. [hr]
  15939. Construct a basic_socket on an existing native socket.
  15940. [hr]
  15941. Move-construct a basic_socket from another.
  15942. [hr]
  15943. Move-construct a basic_socket from a socket of another protocol type. ]
  15944. ]
  15945. [
  15946. [[link boost_asio.reference.basic_socket.bind [*bind]]]
  15947. [Bind the socket to the given local endpoint. ]
  15948. ]
  15949. [
  15950. [[link boost_asio.reference.basic_socket.cancel [*cancel]]]
  15951. [Cancel all asynchronous operations associated with the socket. ]
  15952. ]
  15953. [
  15954. [[link boost_asio.reference.basic_socket.close [*close]]]
  15955. [Close the socket. ]
  15956. ]
  15957. [
  15958. [[link boost_asio.reference.basic_socket.connect [*connect]]]
  15959. [Connect the socket to the specified endpoint. ]
  15960. ]
  15961. [
  15962. [[link boost_asio.reference.basic_socket.get_executor [*get_executor]]]
  15963. [Get the executor associated with the object. ]
  15964. ]
  15965. [
  15966. [[link boost_asio.reference.basic_socket.get_option [*get_option]]]
  15967. [Get an option from the socket. ]
  15968. ]
  15969. [
  15970. [[link boost_asio.reference.basic_socket.io_control [*io_control]]]
  15971. [Perform an IO control command on the socket. ]
  15972. ]
  15973. [
  15974. [[link boost_asio.reference.basic_socket.is_open [*is_open]]]
  15975. [Determine whether the socket is open. ]
  15976. ]
  15977. [
  15978. [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]]
  15979. [Get the local endpoint of the socket. ]
  15980. ]
  15981. [
  15982. [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]]
  15983. [Get a reference to the lowest layer.
  15984. [hr]
  15985. Get a const reference to the lowest layer. ]
  15986. ]
  15987. [
  15988. [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]]
  15989. [Get the native socket representation. ]
  15990. ]
  15991. [
  15992. [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]]
  15993. [Gets the non-blocking mode of the native socket implementation.
  15994. [hr]
  15995. Sets the non-blocking mode of the native socket implementation. ]
  15996. ]
  15997. [
  15998. [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]]
  15999. [Gets the non-blocking mode of the socket.
  16000. [hr]
  16001. Sets the non-blocking mode of the socket. ]
  16002. ]
  16003. [
  16004. [[link boost_asio.reference.basic_socket.open [*open]]]
  16005. [Open the socket using the specified protocol. ]
  16006. ]
  16007. [
  16008. [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]]
  16009. [Move-assign a basic_socket from another.
  16010. [hr]
  16011. Move-assign a basic_socket from a socket of another protocol type. ]
  16012. ]
  16013. [
  16014. [[link boost_asio.reference.basic_socket.release [*release]]]
  16015. [Release ownership of the underlying native socket. ]
  16016. ]
  16017. [
  16018. [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]]
  16019. [Get the remote endpoint of the socket. ]
  16020. ]
  16021. [
  16022. [[link boost_asio.reference.basic_socket.set_option [*set_option]]]
  16023. [Set an option on the socket. ]
  16024. ]
  16025. [
  16026. [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]]
  16027. [Disable sends or receives on the socket. ]
  16028. ]
  16029. [
  16030. [[link boost_asio.reference.basic_socket.wait [*wait]]]
  16031. [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  16032. ]
  16033. ]
  16034. [heading Protected Member Functions]
  16035. [table
  16036. [[Name][Description]]
  16037. [
  16038. [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]]]
  16039. [Protected destructor to prevent deletion through this type. ]
  16040. ]
  16041. ]
  16042. [heading Data Members]
  16043. [table
  16044. [[Name][Description]]
  16045. [
  16046. [[link boost_asio.reference.basic_socket.max_connections [*max_connections]]]
  16047. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  16048. ]
  16049. [
  16050. [[link boost_asio.reference.basic_socket.max_listen_connections [*max_listen_connections]]]
  16051. [The maximum length of the queue of pending incoming connections. ]
  16052. ]
  16053. [
  16054. [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]]]
  16055. [Specify that the data should not be subject to routing. ]
  16056. ]
  16057. [
  16058. [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]]]
  16059. [Specifies that the data marks the end of a record. ]
  16060. ]
  16061. [
  16062. [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]]]
  16063. [Process out-of-band data. ]
  16064. ]
  16065. [
  16066. [[link boost_asio.reference.basic_socket.message_peek [*message_peek]]]
  16067. [Peek at incoming data without removing it from the input queue. ]
  16068. ]
  16069. ]
  16070. [heading Protected Data Members]
  16071. [table
  16072. [[Name][Description]]
  16073. [
  16074. [[link boost_asio.reference.basic_socket.impl_ [*impl_]]]
  16075. []
  16076. ]
  16077. ]
  16078. The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
  16079. [heading Thread Safety]
  16080. ['Distinct] ['objects:] Safe.
  16081. ['Shared] ['objects:] Unsafe.
  16082. [heading Requirements]
  16083. ['Header: ][^boost/asio/basic_socket.hpp]
  16084. ['Convenience header: ][^boost/asio.hpp]
  16085. [section:assign basic_socket::assign]
  16086. [indexterm2 boost_asio.indexterm.basic_socket.assign..assign..basic_socket]
  16087. Assign an existing native socket to the socket.
  16088. void ``[link boost_asio.reference.basic_socket.assign.overload1 assign]``(
  16089. const protocol_type & protocol,
  16090. const native_handle_type & native_socket);
  16091. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.assign.overload1 more...]]``
  16092. void ``[link boost_asio.reference.basic_socket.assign.overload2 assign]``(
  16093. const protocol_type & protocol,
  16094. const native_handle_type & native_socket,
  16095. boost::system::error_code & ec);
  16096. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.assign.overload2 more...]]``
  16097. [section:overload1 basic_socket::assign (1 of 2 overloads)]
  16098. Assign an existing native socket to the socket.
  16099. void assign(
  16100. const protocol_type & protocol,
  16101. const native_handle_type & native_socket);
  16102. [endsect]
  16103. [section:overload2 basic_socket::assign (2 of 2 overloads)]
  16104. Assign an existing native socket to the socket.
  16105. void assign(
  16106. const protocol_type & protocol,
  16107. const native_handle_type & native_socket,
  16108. boost::system::error_code & ec);
  16109. [endsect]
  16110. [endsect]
  16111. [section:async_connect basic_socket::async_connect]
  16112. [indexterm2 boost_asio.indexterm.basic_socket.async_connect..async_connect..basic_socket]
  16113. Start an asynchronous connect.
  16114. template<
  16115. typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  16116. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect(
  16117. const endpoint_type & peer_endpoint,
  16118. ConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  16119. This function is used to asynchronously connect a socket to the specified remote endpoint. The function call always returns immediately.
  16120. The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
  16121. [heading Parameters]
  16122. [variablelist
  16123. [[peer_endpoint][The remote endpoint to which the socket will be connected. Copies will be made of the endpoint object as required.]]
  16124. [[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:
  16125. ``
  16126. void handler(
  16127. const boost::system::error_code& error // Result of operation
  16128. );
  16129. ``
  16130. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  16131. ]
  16132. [heading Example]
  16133. void connect_handler(const boost::system::error_code& error)
  16134. {
  16135. if (!error)
  16136. {
  16137. // Connect succeeded.
  16138. }
  16139. }
  16140. ...
  16141. boost::asio::ip::tcp::socket socket(my_context);
  16142. boost::asio::ip::tcp::endpoint endpoint(
  16143. boost::asio::ip::address::from_string("1.2.3.4"), 12345);
  16144. socket.async_connect(endpoint, connect_handler);
  16145. [endsect]
  16146. [section:async_wait basic_socket::async_wait]
  16147. [indexterm2 boost_asio.indexterm.basic_socket.async_wait..async_wait..basic_socket]
  16148. Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions.
  16149. template<
  16150. typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  16151. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait(
  16152. wait_type w,
  16153. WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  16154. This function is used to perform an asynchronous wait for a socket to enter a ready to read, write or error condition state.
  16155. [heading Parameters]
  16156. [variablelist
  16157. [[w][Specifies the desired socket state.]]
  16158. [[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:
  16159. ``
  16160. void handler(
  16161. const boost::system::error_code& error // Result of operation
  16162. );
  16163. ``
  16164. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  16165. ]
  16166. [heading Example]
  16167. void wait_handler(const boost::system::error_code& error)
  16168. {
  16169. if (!error)
  16170. {
  16171. // Wait succeeded.
  16172. }
  16173. }
  16174. ...
  16175. boost::asio::ip::tcp::socket socket(my_context);
  16176. ...
  16177. socket.async_wait(boost::asio::ip::tcp::socket::wait_read, wait_handler);
  16178. [endsect]
  16179. [section:at_mark basic_socket::at_mark]
  16180. [indexterm2 boost_asio.indexterm.basic_socket.at_mark..at_mark..basic_socket]
  16181. Determine whether the socket is at the out-of-band data mark.
  16182. bool ``[link boost_asio.reference.basic_socket.at_mark.overload1 at_mark]``() const;
  16183. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.at_mark.overload1 more...]]``
  16184. bool ``[link boost_asio.reference.basic_socket.at_mark.overload2 at_mark]``(
  16185. boost::system::error_code & ec) const;
  16186. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.at_mark.overload2 more...]]``
  16187. [section:overload1 basic_socket::at_mark (1 of 2 overloads)]
  16188. Determine whether the socket is at the out-of-band data mark.
  16189. bool at_mark() const;
  16190. This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
  16191. [heading Return Value]
  16192. A bool indicating whether the socket is at the out-of-band data mark.
  16193. [heading Exceptions]
  16194. [variablelist
  16195. [[boost::system::system_error][Thrown on failure. ]]
  16196. ]
  16197. [endsect]
  16198. [section:overload2 basic_socket::at_mark (2 of 2 overloads)]
  16199. Determine whether the socket is at the out-of-band data mark.
  16200. bool at_mark(
  16201. boost::system::error_code & ec) const;
  16202. This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
  16203. [heading Parameters]
  16204. [variablelist
  16205. [[ec][Set to indicate what error occurred, if any.]]
  16206. ]
  16207. [heading Return Value]
  16208. A bool indicating whether the socket is at the out-of-band data mark.
  16209. [endsect]
  16210. [endsect]
  16211. [section:available basic_socket::available]
  16212. [indexterm2 boost_asio.indexterm.basic_socket.available..available..basic_socket]
  16213. Determine the number of bytes available for reading.
  16214. std::size_t ``[link boost_asio.reference.basic_socket.available.overload1 available]``() const;
  16215. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.available.overload1 more...]]``
  16216. std::size_t ``[link boost_asio.reference.basic_socket.available.overload2 available]``(
  16217. boost::system::error_code & ec) const;
  16218. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.available.overload2 more...]]``
  16219. [section:overload1 basic_socket::available (1 of 2 overloads)]
  16220. Determine the number of bytes available for reading.
  16221. std::size_t available() const;
  16222. This function is used to determine the number of bytes that may be read without blocking.
  16223. [heading Return Value]
  16224. The number of bytes that may be read without blocking, or 0 if an error occurs.
  16225. [heading Exceptions]
  16226. [variablelist
  16227. [[boost::system::system_error][Thrown on failure. ]]
  16228. ]
  16229. [endsect]
  16230. [section:overload2 basic_socket::available (2 of 2 overloads)]
  16231. Determine the number of bytes available for reading.
  16232. std::size_t available(
  16233. boost::system::error_code & ec) const;
  16234. This function is used to determine the number of bytes that may be read without blocking.
  16235. [heading Parameters]
  16236. [variablelist
  16237. [[ec][Set to indicate what error occurred, if any.]]
  16238. ]
  16239. [heading Return Value]
  16240. The number of bytes that may be read without blocking, or 0 if an error occurs.
  16241. [endsect]
  16242. [endsect]
  16243. [section:basic_socket basic_socket::basic_socket]
  16244. [indexterm2 boost_asio.indexterm.basic_socket.basic_socket..basic_socket..basic_socket]
  16245. Construct a [link boost_asio.reference.basic_socket `basic_socket`] without opening it.
  16246. explicit ``[link boost_asio.reference.basic_socket.basic_socket.overload1 basic_socket]``(
  16247. const executor_type & ex);
  16248. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload1 more...]]``
  16249. template<
  16250. typename ExecutionContext>
  16251. explicit ``[link boost_asio.reference.basic_socket.basic_socket.overload2 basic_socket]``(
  16252. ExecutionContext & context,
  16253. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  16254. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload2 more...]]``
  16255. Construct and open a [link boost_asio.reference.basic_socket `basic_socket`].
  16256. ``[link boost_asio.reference.basic_socket.basic_socket.overload3 basic_socket]``(
  16257. const executor_type & ex,
  16258. const protocol_type & protocol);
  16259. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload3 more...]]``
  16260. template<
  16261. typename ExecutionContext>
  16262. ``[link boost_asio.reference.basic_socket.basic_socket.overload4 basic_socket]``(
  16263. ExecutionContext & context,
  16264. const protocol_type & protocol,
  16265. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  16266. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload4 more...]]``
  16267. Construct a [link boost_asio.reference.basic_socket `basic_socket`], opening it and binding it to the given local endpoint.
  16268. ``[link boost_asio.reference.basic_socket.basic_socket.overload5 basic_socket]``(
  16269. const executor_type & ex,
  16270. const endpoint_type & endpoint);
  16271. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload5 more...]]``
  16272. template<
  16273. typename ExecutionContext>
  16274. ``[link boost_asio.reference.basic_socket.basic_socket.overload6 basic_socket]``(
  16275. ExecutionContext & context,
  16276. const endpoint_type & endpoint,
  16277. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  16278. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload6 more...]]``
  16279. Construct a [link boost_asio.reference.basic_socket `basic_socket`] on an existing native socket.
  16280. ``[link boost_asio.reference.basic_socket.basic_socket.overload7 basic_socket]``(
  16281. const executor_type & ex,
  16282. const protocol_type & protocol,
  16283. const native_handle_type & native_socket);
  16284. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload7 more...]]``
  16285. template<
  16286. typename ExecutionContext>
  16287. ``[link boost_asio.reference.basic_socket.basic_socket.overload8 basic_socket]``(
  16288. ExecutionContext & context,
  16289. const protocol_type & protocol,
  16290. const native_handle_type & native_socket,
  16291. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  16292. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload8 more...]]``
  16293. Move-construct a [link boost_asio.reference.basic_socket `basic_socket`] from another.
  16294. ``[link boost_asio.reference.basic_socket.basic_socket.overload9 basic_socket]``(
  16295. basic_socket && other);
  16296. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload9 more...]]``
  16297. Move-construct a [link boost_asio.reference.basic_socket `basic_socket`] from a socket of another protocol type.
  16298. template<
  16299. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  16300. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  16301. ``[link boost_asio.reference.basic_socket.basic_socket.overload10 basic_socket]``(
  16302. basic_socket< Protocol1, Executor1 > && other,
  16303. typename enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type * = 0);
  16304. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload10 more...]]``
  16305. [section:overload1 basic_socket::basic_socket (1 of 10 overloads)]
  16306. Construct a [link boost_asio.reference.basic_socket `basic_socket`] without opening it.
  16307. basic_socket(
  16308. const executor_type & ex);
  16309. This constructor creates a socket without opening it.
  16310. [heading Parameters]
  16311. [variablelist
  16312. [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket. ]]
  16313. ]
  16314. [endsect]
  16315. [section:overload2 basic_socket::basic_socket (2 of 10 overloads)]
  16316. Construct a [link boost_asio.reference.basic_socket `basic_socket`] without opening it.
  16317. template<
  16318. typename ExecutionContext>
  16319. basic_socket(
  16320. ExecutionContext & context,
  16321. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  16322. This constructor creates a socket without opening it.
  16323. [heading Parameters]
  16324. [variablelist
  16325. [[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. ]]
  16326. ]
  16327. [endsect]
  16328. [section:overload3 basic_socket::basic_socket (3 of 10 overloads)]
  16329. Construct and open a [link boost_asio.reference.basic_socket `basic_socket`].
  16330. basic_socket(
  16331. const executor_type & ex,
  16332. const protocol_type & protocol);
  16333. This constructor creates and opens a socket.
  16334. [heading Parameters]
  16335. [variablelist
  16336. [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
  16337. [[protocol][An object specifying protocol parameters to be used.]]
  16338. ]
  16339. [heading Exceptions]
  16340. [variablelist
  16341. [[boost::system::system_error][Thrown on failure. ]]
  16342. ]
  16343. [endsect]
  16344. [section:overload4 basic_socket::basic_socket (4 of 10 overloads)]
  16345. Construct and open a [link boost_asio.reference.basic_socket `basic_socket`].
  16346. template<
  16347. typename ExecutionContext>
  16348. basic_socket(
  16349. ExecutionContext & context,
  16350. const protocol_type & protocol,
  16351. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  16352. This constructor creates and opens a socket.
  16353. [heading Parameters]
  16354. [variablelist
  16355. [[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.]]
  16356. [[protocol][An object specifying protocol parameters to be used.]]
  16357. ]
  16358. [heading Exceptions]
  16359. [variablelist
  16360. [[boost::system::system_error][Thrown on failure. ]]
  16361. ]
  16362. [endsect]
  16363. [section:overload5 basic_socket::basic_socket (5 of 10 overloads)]
  16364. Construct a [link boost_asio.reference.basic_socket `basic_socket`], opening it and binding it to the given local endpoint.
  16365. basic_socket(
  16366. const executor_type & ex,
  16367. const endpoint_type & endpoint);
  16368. This constructor creates a socket and automatically opens it bound to the specified endpoint on the local machine. The protocol used is the protocol associated with the given endpoint.
  16369. [heading Parameters]
  16370. [variablelist
  16371. [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
  16372. [[endpoint][An endpoint on the local machine to which the socket will be bound.]]
  16373. ]
  16374. [heading Exceptions]
  16375. [variablelist
  16376. [[boost::system::system_error][Thrown on failure. ]]
  16377. ]
  16378. [endsect]
  16379. [section:overload6 basic_socket::basic_socket (6 of 10 overloads)]
  16380. Construct a [link boost_asio.reference.basic_socket `basic_socket`], opening it and binding it to the given local endpoint.
  16381. template<
  16382. typename ExecutionContext>
  16383. basic_socket(
  16384. ExecutionContext & context,
  16385. const endpoint_type & endpoint,
  16386. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  16387. This constructor creates a socket and automatically opens it bound to the specified endpoint on the local machine. The protocol used is the protocol associated with the given endpoint.
  16388. [heading Parameters]
  16389. [variablelist
  16390. [[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.]]
  16391. [[endpoint][An endpoint on the local machine to which the socket will be bound.]]
  16392. ]
  16393. [heading Exceptions]
  16394. [variablelist
  16395. [[boost::system::system_error][Thrown on failure. ]]
  16396. ]
  16397. [endsect]
  16398. [section:overload7 basic_socket::basic_socket (7 of 10 overloads)]
  16399. Construct a [link boost_asio.reference.basic_socket `basic_socket`] on an existing native socket.
  16400. basic_socket(
  16401. const executor_type & ex,
  16402. const protocol_type & protocol,
  16403. const native_handle_type & native_socket);
  16404. This constructor creates a socket object to hold an existing native socket.
  16405. [heading Parameters]
  16406. [variablelist
  16407. [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
  16408. [[protocol][An object specifying protocol parameters to be used.]]
  16409. [[native_socket][A native socket.]]
  16410. ]
  16411. [heading Exceptions]
  16412. [variablelist
  16413. [[boost::system::system_error][Thrown on failure. ]]
  16414. ]
  16415. [endsect]
  16416. [section:overload8 basic_socket::basic_socket (8 of 10 overloads)]
  16417. Construct a [link boost_asio.reference.basic_socket `basic_socket`] on an existing native socket.
  16418. template<
  16419. typename ExecutionContext>
  16420. basic_socket(
  16421. ExecutionContext & context,
  16422. const protocol_type & protocol,
  16423. const native_handle_type & native_socket,
  16424. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  16425. This constructor creates a socket object to hold an existing native socket.
  16426. [heading Parameters]
  16427. [variablelist
  16428. [[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.]]
  16429. [[protocol][An object specifying protocol parameters to be used.]]
  16430. [[native_socket][A native socket.]]
  16431. ]
  16432. [heading Exceptions]
  16433. [variablelist
  16434. [[boost::system::system_error][Thrown on failure. ]]
  16435. ]
  16436. [endsect]
  16437. [section:overload9 basic_socket::basic_socket (9 of 10 overloads)]
  16438. Move-construct a [link boost_asio.reference.basic_socket `basic_socket`] from another.
  16439. basic_socket(
  16440. basic_socket && other);
  16441. This constructor moves a socket from one object to another.
  16442. [heading Parameters]
  16443. [variablelist
  16444. [[other][The other [link boost_asio.reference.basic_socket `basic_socket`] object from which the move will occur.]]
  16445. ]
  16446. [heading Remarks]
  16447. Following the move, the moved-from object is in the same state as if constructed using the `basic_socket(const executor_type&) constructor`.
  16448. [endsect]
  16449. [section:overload10 basic_socket::basic_socket (10 of 10 overloads)]
  16450. Move-construct a [link boost_asio.reference.basic_socket `basic_socket`] from a socket of another protocol type.
  16451. template<
  16452. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  16453. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  16454. basic_socket(
  16455. basic_socket< Protocol1, Executor1 > && other,
  16456. typename enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type * = 0);
  16457. This constructor moves a socket from one object to another.
  16458. [heading Parameters]
  16459. [variablelist
  16460. [[other][The other [link boost_asio.reference.basic_socket `basic_socket`] object from which the move will occur.]]
  16461. ]
  16462. [heading Remarks]
  16463. Following the move, the moved-from object is in the same state as if constructed using the `basic_socket(const executor_type&) constructor`.
  16464. [endsect]
  16465. [endsect]
  16466. [section:bind basic_socket::bind]
  16467. [indexterm2 boost_asio.indexterm.basic_socket.bind..bind..basic_socket]
  16468. Bind the socket to the given local endpoint.
  16469. void ``[link boost_asio.reference.basic_socket.bind.overload1 bind]``(
  16470. const endpoint_type & endpoint);
  16471. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.bind.overload1 more...]]``
  16472. void ``[link boost_asio.reference.basic_socket.bind.overload2 bind]``(
  16473. const endpoint_type & endpoint,
  16474. boost::system::error_code & ec);
  16475. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.bind.overload2 more...]]``
  16476. [section:overload1 basic_socket::bind (1 of 2 overloads)]
  16477. Bind the socket to the given local endpoint.
  16478. void bind(
  16479. const endpoint_type & endpoint);
  16480. This function binds the socket to the specified endpoint on the local machine.
  16481. [heading Parameters]
  16482. [variablelist
  16483. [[endpoint][An endpoint on the local machine to which the socket will be bound.]]
  16484. ]
  16485. [heading Exceptions]
  16486. [variablelist
  16487. [[boost::system::system_error][Thrown on failure.]]
  16488. ]
  16489. [heading Example]
  16490. boost::asio::ip::tcp::socket socket(my_context);
  16491. socket.open(boost::asio::ip::tcp::v4());
  16492. socket.bind(boost::asio::ip::tcp::endpoint(
  16493. boost::asio::ip::tcp::v4(), 12345));
  16494. [endsect]
  16495. [section:overload2 basic_socket::bind (2 of 2 overloads)]
  16496. Bind the socket to the given local endpoint.
  16497. void bind(
  16498. const endpoint_type & endpoint,
  16499. boost::system::error_code & ec);
  16500. This function binds the socket to the specified endpoint on the local machine.
  16501. [heading Parameters]
  16502. [variablelist
  16503. [[endpoint][An endpoint on the local machine to which the socket will be bound.]]
  16504. [[ec][Set to indicate what error occurred, if any.]]
  16505. ]
  16506. [heading Example]
  16507. boost::asio::ip::tcp::socket socket(my_context);
  16508. socket.open(boost::asio::ip::tcp::v4());
  16509. boost::system::error_code ec;
  16510. socket.bind(boost::asio::ip::tcp::endpoint(
  16511. boost::asio::ip::tcp::v4(), 12345), ec);
  16512. if (ec)
  16513. {
  16514. // An error occurred.
  16515. }
  16516. [endsect]
  16517. [endsect]
  16518. [section:broadcast basic_socket::broadcast]
  16519. ['Inherited from socket_base.]
  16520. [indexterm2 boost_asio.indexterm.basic_socket.broadcast..broadcast..basic_socket]
  16521. Socket option to permit sending of broadcast messages.
  16522. typedef implementation_defined broadcast;
  16523. Implements the SOL\_SOCKET/SO\_BROADCAST socket option.
  16524. [heading Examples]
  16525. Setting the option:
  16526. boost::asio::ip::udp::socket socket(my_context);
  16527. ...
  16528. boost::asio::socket_base::broadcast option(true);
  16529. socket.set_option(option);
  16530. Getting the current option value:
  16531. boost::asio::ip::udp::socket socket(my_context);
  16532. ...
  16533. boost::asio::socket_base::broadcast option;
  16534. socket.get_option(option);
  16535. bool is_set = option.value();
  16536. [heading Requirements]
  16537. ['Header: ][^boost/asio/basic_socket.hpp]
  16538. ['Convenience header: ][^boost/asio.hpp]
  16539. [endsect]
  16540. [section:bytes_readable basic_socket::bytes_readable]
  16541. ['Inherited from socket_base.]
  16542. [indexterm2 boost_asio.indexterm.basic_socket.bytes_readable..bytes_readable..basic_socket]
  16543. IO control command to get the amount of data that can be read without blocking.
  16544. typedef implementation_defined bytes_readable;
  16545. Implements the FIONREAD IO control command.
  16546. [heading Example]
  16547. boost::asio::ip::tcp::socket socket(my_context);
  16548. ...
  16549. boost::asio::socket_base::bytes_readable command(true);
  16550. socket.io_control(command);
  16551. std::size_t bytes_readable = command.get();
  16552. [heading Requirements]
  16553. ['Header: ][^boost/asio/basic_socket.hpp]
  16554. ['Convenience header: ][^boost/asio.hpp]
  16555. [endsect]
  16556. [section:cancel basic_socket::cancel]
  16557. [indexterm2 boost_asio.indexterm.basic_socket.cancel..cancel..basic_socket]
  16558. Cancel all asynchronous operations associated with the socket.
  16559. void ``[link boost_asio.reference.basic_socket.cancel.overload1 cancel]``();
  16560. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.cancel.overload1 more...]]``
  16561. void ``[link boost_asio.reference.basic_socket.cancel.overload2 cancel]``(
  16562. boost::system::error_code & ec);
  16563. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.cancel.overload2 more...]]``
  16564. [section:overload1 basic_socket::cancel (1 of 2 overloads)]
  16565. Cancel all asynchronous operations associated with the socket.
  16566. void cancel();
  16567. This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
  16568. [heading Exceptions]
  16569. [variablelist
  16570. [[boost::system::system_error][Thrown on failure.]]
  16571. ]
  16572. [heading Remarks]
  16573. Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
  16574. * It will only cancel asynchronous operations that were initiated in the current thread.
  16575. * 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.
  16576. For portable cancellation, consider using one of the following alternatives:
  16577. * Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
  16578. * Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
  16579. When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above.
  16580. [endsect]
  16581. [section:overload2 basic_socket::cancel (2 of 2 overloads)]
  16582. Cancel all asynchronous operations associated with the socket.
  16583. void cancel(
  16584. boost::system::error_code & ec);
  16585. This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
  16586. [heading Parameters]
  16587. [variablelist
  16588. [[ec][Set to indicate what error occurred, if any.]]
  16589. ]
  16590. [heading Remarks]
  16591. Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
  16592. * It will only cancel asynchronous operations that were initiated in the current thread.
  16593. * 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.
  16594. For portable cancellation, consider using one of the following alternatives:
  16595. * Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
  16596. * Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
  16597. When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above.
  16598. [endsect]
  16599. [endsect]
  16600. [section:close basic_socket::close]
  16601. [indexterm2 boost_asio.indexterm.basic_socket.close..close..basic_socket]
  16602. Close the socket.
  16603. void ``[link boost_asio.reference.basic_socket.close.overload1 close]``();
  16604. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.close.overload1 more...]]``
  16605. void ``[link boost_asio.reference.basic_socket.close.overload2 close]``(
  16606. boost::system::error_code & ec);
  16607. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.close.overload2 more...]]``
  16608. [section:overload1 basic_socket::close (1 of 2 overloads)]
  16609. Close the socket.
  16610. void close();
  16611. This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
  16612. [heading Exceptions]
  16613. [variablelist
  16614. [[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
  16615. ]
  16616. [heading Remarks]
  16617. For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket.
  16618. [endsect]
  16619. [section:overload2 basic_socket::close (2 of 2 overloads)]
  16620. Close the socket.
  16621. void close(
  16622. boost::system::error_code & ec);
  16623. This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
  16624. [heading Parameters]
  16625. [variablelist
  16626. [[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
  16627. ]
  16628. [heading Example]
  16629. boost::asio::ip::tcp::socket socket(my_context);
  16630. ...
  16631. boost::system::error_code ec;
  16632. socket.close(ec);
  16633. if (ec)
  16634. {
  16635. // An error occurred.
  16636. }
  16637. [heading Remarks]
  16638. For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket.
  16639. [endsect]
  16640. [endsect]
  16641. [section:connect basic_socket::connect]
  16642. [indexterm2 boost_asio.indexterm.basic_socket.connect..connect..basic_socket]
  16643. Connect the socket to the specified endpoint.
  16644. void ``[link boost_asio.reference.basic_socket.connect.overload1 connect]``(
  16645. const endpoint_type & peer_endpoint);
  16646. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.connect.overload1 more...]]``
  16647. void ``[link boost_asio.reference.basic_socket.connect.overload2 connect]``(
  16648. const endpoint_type & peer_endpoint,
  16649. boost::system::error_code & ec);
  16650. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.connect.overload2 more...]]``
  16651. [section:overload1 basic_socket::connect (1 of 2 overloads)]
  16652. Connect the socket to the specified endpoint.
  16653. void connect(
  16654. const endpoint_type & peer_endpoint);
  16655. This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
  16656. The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
  16657. [heading Parameters]
  16658. [variablelist
  16659. [[peer_endpoint][The remote endpoint to which the socket will be connected.]]
  16660. ]
  16661. [heading Exceptions]
  16662. [variablelist
  16663. [[boost::system::system_error][Thrown on failure.]]
  16664. ]
  16665. [heading Example]
  16666. boost::asio::ip::tcp::socket socket(my_context);
  16667. boost::asio::ip::tcp::endpoint endpoint(
  16668. boost::asio::ip::address::from_string("1.2.3.4"), 12345);
  16669. socket.connect(endpoint);
  16670. [endsect]
  16671. [section:overload2 basic_socket::connect (2 of 2 overloads)]
  16672. Connect the socket to the specified endpoint.
  16673. void connect(
  16674. const endpoint_type & peer_endpoint,
  16675. boost::system::error_code & ec);
  16676. This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
  16677. The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
  16678. [heading Parameters]
  16679. [variablelist
  16680. [[peer_endpoint][The remote endpoint to which the socket will be connected.]]
  16681. [[ec][Set to indicate what error occurred, if any.]]
  16682. ]
  16683. [heading Example]
  16684. boost::asio::ip::tcp::socket socket(my_context);
  16685. boost::asio::ip::tcp::endpoint endpoint(
  16686. boost::asio::ip::address::from_string("1.2.3.4"), 12345);
  16687. boost::system::error_code ec;
  16688. socket.connect(endpoint, ec);
  16689. if (ec)
  16690. {
  16691. // An error occurred.
  16692. }
  16693. [endsect]
  16694. [endsect]
  16695. [section:debug basic_socket::debug]
  16696. ['Inherited from socket_base.]
  16697. [indexterm2 boost_asio.indexterm.basic_socket.debug..debug..basic_socket]
  16698. Socket option to enable socket-level debugging.
  16699. typedef implementation_defined debug;
  16700. Implements the SOL\_SOCKET/SO\_DEBUG socket option.
  16701. [heading Examples]
  16702. Setting the option:
  16703. boost::asio::ip::tcp::socket socket(my_context);
  16704. ...
  16705. boost::asio::socket_base::debug option(true);
  16706. socket.set_option(option);
  16707. Getting the current option value:
  16708. boost::asio::ip::tcp::socket socket(my_context);
  16709. ...
  16710. boost::asio::socket_base::debug option;
  16711. socket.get_option(option);
  16712. bool is_set = option.value();
  16713. [heading Requirements]
  16714. ['Header: ][^boost/asio/basic_socket.hpp]
  16715. ['Convenience header: ][^boost/asio.hpp]
  16716. [endsect]
  16717. [section:do_not_route basic_socket::do_not_route]
  16718. ['Inherited from socket_base.]
  16719. [indexterm2 boost_asio.indexterm.basic_socket.do_not_route..do_not_route..basic_socket]
  16720. Socket option to prevent routing, use local interfaces only.
  16721. typedef implementation_defined do_not_route;
  16722. Implements the SOL\_SOCKET/SO\_DONTROUTE socket option.
  16723. [heading Examples]
  16724. Setting the option:
  16725. boost::asio::ip::udp::socket socket(my_context);
  16726. ...
  16727. boost::asio::socket_base::do_not_route option(true);
  16728. socket.set_option(option);
  16729. Getting the current option value:
  16730. boost::asio::ip::udp::socket socket(my_context);
  16731. ...
  16732. boost::asio::socket_base::do_not_route option;
  16733. socket.get_option(option);
  16734. bool is_set = option.value();
  16735. [heading Requirements]
  16736. ['Header: ][^boost/asio/basic_socket.hpp]
  16737. ['Convenience header: ][^boost/asio.hpp]
  16738. [endsect]
  16739. [section:enable_connection_aborted basic_socket::enable_connection_aborted]
  16740. ['Inherited from socket_base.]
  16741. [indexterm2 boost_asio.indexterm.basic_socket.enable_connection_aborted..enable_connection_aborted..basic_socket]
  16742. Socket option to report aborted connections on accept.
  16743. typedef implementation_defined enable_connection_aborted;
  16744. Implements a custom socket option that determines whether or not an accept operation is permitted to fail with `boost::asio::error::connection_aborted`. By default the option is false.
  16745. [heading Examples]
  16746. Setting the option:
  16747. boost::asio::ip::tcp::acceptor acceptor(my_context);
  16748. ...
  16749. boost::asio::socket_base::enable_connection_aborted option(true);
  16750. acceptor.set_option(option);
  16751. Getting the current option value:
  16752. boost::asio::ip::tcp::acceptor acceptor(my_context);
  16753. ...
  16754. boost::asio::socket_base::enable_connection_aborted option;
  16755. acceptor.get_option(option);
  16756. bool is_set = option.value();
  16757. [heading Requirements]
  16758. ['Header: ][^boost/asio/basic_socket.hpp]
  16759. ['Convenience header: ][^boost/asio.hpp]
  16760. [endsect]
  16761. [section:endpoint_type basic_socket::endpoint_type]
  16762. [indexterm2 boost_asio.indexterm.basic_socket.endpoint_type..endpoint_type..basic_socket]
  16763. The endpoint type.
  16764. typedef Protocol::endpoint endpoint_type;
  16765. [heading Requirements]
  16766. ['Header: ][^boost/asio/basic_socket.hpp]
  16767. ['Convenience header: ][^boost/asio.hpp]
  16768. [endsect]
  16769. [section:executor_type basic_socket::executor_type]
  16770. [indexterm2 boost_asio.indexterm.basic_socket.executor_type..executor_type..basic_socket]
  16771. The type of the executor associated with the object.
  16772. typedef Executor executor_type;
  16773. [heading Requirements]
  16774. ['Header: ][^boost/asio/basic_socket.hpp]
  16775. ['Convenience header: ][^boost/asio.hpp]
  16776. [endsect]
  16777. [section:get_executor basic_socket::get_executor]
  16778. [indexterm2 boost_asio.indexterm.basic_socket.get_executor..get_executor..basic_socket]
  16779. Get the executor associated with the object.
  16780. executor_type get_executor();
  16781. [endsect]
  16782. [section:get_option basic_socket::get_option]
  16783. [indexterm2 boost_asio.indexterm.basic_socket.get_option..get_option..basic_socket]
  16784. Get an option from the socket.
  16785. template<
  16786. typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
  16787. void ``[link boost_asio.reference.basic_socket.get_option.overload1 get_option]``(
  16788. GettableSocketOption & option) const;
  16789. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.get_option.overload1 more...]]``
  16790. template<
  16791. typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
  16792. void ``[link boost_asio.reference.basic_socket.get_option.overload2 get_option]``(
  16793. GettableSocketOption & option,
  16794. boost::system::error_code & ec) const;
  16795. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.get_option.overload2 more...]]``
  16796. [section:overload1 basic_socket::get_option (1 of 2 overloads)]
  16797. Get an option from the socket.
  16798. template<
  16799. typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
  16800. void get_option(
  16801. GettableSocketOption & option) const;
  16802. This function is used to get the current value of an option on the socket.
  16803. [heading Parameters]
  16804. [variablelist
  16805. [[option][The option value to be obtained from the socket.]]
  16806. ]
  16807. [heading Exceptions]
  16808. [variablelist
  16809. [[boost::system::system_error][Thrown on failure.]]
  16810. ]
  16811. [heading Example]
  16812. Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option:
  16813. boost::asio::ip::tcp::socket socket(my_context);
  16814. ...
  16815. boost::asio::ip::tcp::socket::keep_alive option;
  16816. socket.get_option(option);
  16817. bool is_set = option.value();
  16818. [endsect]
  16819. [section:overload2 basic_socket::get_option (2 of 2 overloads)]
  16820. Get an option from the socket.
  16821. template<
  16822. typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
  16823. void get_option(
  16824. GettableSocketOption & option,
  16825. boost::system::error_code & ec) const;
  16826. This function is used to get the current value of an option on the socket.
  16827. [heading Parameters]
  16828. [variablelist
  16829. [[option][The option value to be obtained from the socket.]]
  16830. [[ec][Set to indicate what error occurred, if any.]]
  16831. ]
  16832. [heading Example]
  16833. Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option:
  16834. boost::asio::ip::tcp::socket socket(my_context);
  16835. ...
  16836. boost::asio::ip::tcp::socket::keep_alive option;
  16837. boost::system::error_code ec;
  16838. socket.get_option(option, ec);
  16839. if (ec)
  16840. {
  16841. // An error occurred.
  16842. }
  16843. bool is_set = option.value();
  16844. [endsect]
  16845. [endsect]
  16846. [section:impl_ basic_socket::impl_]
  16847. [indexterm2 boost_asio.indexterm.basic_socket.impl_..impl_..basic_socket]
  16848. detail::io_object_impl< detail::reactive_socket_service< Protocol >, Executor > impl_;
  16849. [endsect]
  16850. [section:io_control basic_socket::io_control]
  16851. [indexterm2 boost_asio.indexterm.basic_socket.io_control..io_control..basic_socket]
  16852. Perform an IO control command on the socket.
  16853. template<
  16854. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  16855. void ``[link boost_asio.reference.basic_socket.io_control.overload1 io_control]``(
  16856. IoControlCommand & command);
  16857. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.io_control.overload1 more...]]``
  16858. template<
  16859. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  16860. void ``[link boost_asio.reference.basic_socket.io_control.overload2 io_control]``(
  16861. IoControlCommand & command,
  16862. boost::system::error_code & ec);
  16863. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.io_control.overload2 more...]]``
  16864. [section:overload1 basic_socket::io_control (1 of 2 overloads)]
  16865. Perform an IO control command on the socket.
  16866. template<
  16867. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  16868. void io_control(
  16869. IoControlCommand & command);
  16870. This function is used to execute an IO control command on the socket.
  16871. [heading Parameters]
  16872. [variablelist
  16873. [[command][The IO control command to be performed on the socket.]]
  16874. ]
  16875. [heading Exceptions]
  16876. [variablelist
  16877. [[boost::system::system_error][Thrown on failure.]]
  16878. ]
  16879. [heading Example]
  16880. Getting the number of bytes ready to read:
  16881. boost::asio::ip::tcp::socket socket(my_context);
  16882. ...
  16883. boost::asio::ip::tcp::socket::bytes_readable command;
  16884. socket.io_control(command);
  16885. std::size_t bytes_readable = command.get();
  16886. [endsect]
  16887. [section:overload2 basic_socket::io_control (2 of 2 overloads)]
  16888. Perform an IO control command on the socket.
  16889. template<
  16890. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  16891. void io_control(
  16892. IoControlCommand & command,
  16893. boost::system::error_code & ec);
  16894. This function is used to execute an IO control command on the socket.
  16895. [heading Parameters]
  16896. [variablelist
  16897. [[command][The IO control command to be performed on the socket.]]
  16898. [[ec][Set to indicate what error occurred, if any.]]
  16899. ]
  16900. [heading Example]
  16901. Getting the number of bytes ready to read:
  16902. boost::asio::ip::tcp::socket socket(my_context);
  16903. ...
  16904. boost::asio::ip::tcp::socket::bytes_readable command;
  16905. boost::system::error_code ec;
  16906. socket.io_control(command, ec);
  16907. if (ec)
  16908. {
  16909. // An error occurred.
  16910. }
  16911. std::size_t bytes_readable = command.get();
  16912. [endsect]
  16913. [endsect]
  16914. [section:is_open basic_socket::is_open]
  16915. [indexterm2 boost_asio.indexterm.basic_socket.is_open..is_open..basic_socket]
  16916. Determine whether the socket is open.
  16917. bool is_open() const;
  16918. [endsect]
  16919. [section:keep_alive basic_socket::keep_alive]
  16920. ['Inherited from socket_base.]
  16921. [indexterm2 boost_asio.indexterm.basic_socket.keep_alive..keep_alive..basic_socket]
  16922. Socket option to send keep-alives.
  16923. typedef implementation_defined keep_alive;
  16924. Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option.
  16925. [heading Examples]
  16926. Setting the option:
  16927. boost::asio::ip::tcp::socket socket(my_context);
  16928. ...
  16929. boost::asio::socket_base::keep_alive option(true);
  16930. socket.set_option(option);
  16931. Getting the current option value:
  16932. boost::asio::ip::tcp::socket socket(my_context);
  16933. ...
  16934. boost::asio::socket_base::keep_alive option;
  16935. socket.get_option(option);
  16936. bool is_set = option.value();
  16937. [heading Requirements]
  16938. ['Header: ][^boost/asio/basic_socket.hpp]
  16939. ['Convenience header: ][^boost/asio.hpp]
  16940. [endsect]
  16941. [section:linger basic_socket::linger]
  16942. ['Inherited from socket_base.]
  16943. [indexterm2 boost_asio.indexterm.basic_socket.linger..linger..basic_socket]
  16944. Socket option to specify whether the socket lingers on close if unsent data is present.
  16945. typedef implementation_defined linger;
  16946. Implements the SOL\_SOCKET/SO\_LINGER socket option.
  16947. [heading Examples]
  16948. Setting the option:
  16949. boost::asio::ip::tcp::socket socket(my_context);
  16950. ...
  16951. boost::asio::socket_base::linger option(true, 30);
  16952. socket.set_option(option);
  16953. Getting the current option value:
  16954. boost::asio::ip::tcp::socket socket(my_context);
  16955. ...
  16956. boost::asio::socket_base::linger option;
  16957. socket.get_option(option);
  16958. bool is_set = option.enabled();
  16959. unsigned short timeout = option.timeout();
  16960. [heading Requirements]
  16961. ['Header: ][^boost/asio/basic_socket.hpp]
  16962. ['Convenience header: ][^boost/asio.hpp]
  16963. [endsect]
  16964. [section:local_endpoint basic_socket::local_endpoint]
  16965. [indexterm2 boost_asio.indexterm.basic_socket.local_endpoint..local_endpoint..basic_socket]
  16966. Get the local endpoint of the socket.
  16967. endpoint_type ``[link boost_asio.reference.basic_socket.local_endpoint.overload1 local_endpoint]``() const;
  16968. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.local_endpoint.overload1 more...]]``
  16969. endpoint_type ``[link boost_asio.reference.basic_socket.local_endpoint.overload2 local_endpoint]``(
  16970. boost::system::error_code & ec) const;
  16971. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.local_endpoint.overload2 more...]]``
  16972. [section:overload1 basic_socket::local_endpoint (1 of 2 overloads)]
  16973. Get the local endpoint of the socket.
  16974. endpoint_type local_endpoint() const;
  16975. This function is used to obtain the locally bound endpoint of the socket.
  16976. [heading Return Value]
  16977. An object that represents the local endpoint of the socket.
  16978. [heading Exceptions]
  16979. [variablelist
  16980. [[boost::system::system_error][Thrown on failure.]]
  16981. ]
  16982. [heading Example]
  16983. boost::asio::ip::tcp::socket socket(my_context);
  16984. ...
  16985. boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint();
  16986. [endsect]
  16987. [section:overload2 basic_socket::local_endpoint (2 of 2 overloads)]
  16988. Get the local endpoint of the socket.
  16989. endpoint_type local_endpoint(
  16990. boost::system::error_code & ec) const;
  16991. This function is used to obtain the locally bound endpoint of the socket.
  16992. [heading Parameters]
  16993. [variablelist
  16994. [[ec][Set to indicate what error occurred, if any.]]
  16995. ]
  16996. [heading Return Value]
  16997. An object that represents the local endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
  16998. [heading Example]
  16999. boost::asio::ip::tcp::socket socket(my_context);
  17000. ...
  17001. boost::system::error_code ec;
  17002. boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(ec);
  17003. if (ec)
  17004. {
  17005. // An error occurred.
  17006. }
  17007. [endsect]
  17008. [endsect]
  17009. [section:lowest_layer basic_socket::lowest_layer]
  17010. [indexterm2 boost_asio.indexterm.basic_socket.lowest_layer..lowest_layer..basic_socket]
  17011. Get a reference to the lowest layer.
  17012. lowest_layer_type & ``[link boost_asio.reference.basic_socket.lowest_layer.overload1 lowest_layer]``();
  17013. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.lowest_layer.overload1 more...]]``
  17014. Get a const reference to the lowest layer.
  17015. const lowest_layer_type & ``[link boost_asio.reference.basic_socket.lowest_layer.overload2 lowest_layer]``() const;
  17016. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.lowest_layer.overload2 more...]]``
  17017. [section:overload1 basic_socket::lowest_layer (1 of 2 overloads)]
  17018. Get a reference to the lowest layer.
  17019. lowest_layer_type & lowest_layer();
  17020. This function returns a reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
  17021. [heading Return Value]
  17022. A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
  17023. [endsect]
  17024. [section:overload2 basic_socket::lowest_layer (2 of 2 overloads)]
  17025. Get a const reference to the lowest layer.
  17026. const lowest_layer_type & lowest_layer() const;
  17027. This function returns a const reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
  17028. [heading Return Value]
  17029. A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
  17030. [endsect]
  17031. [endsect]
  17032. [section:lowest_layer_type basic_socket::lowest_layer_type]
  17033. [indexterm2 boost_asio.indexterm.basic_socket.lowest_layer_type..lowest_layer_type..basic_socket]
  17034. A [link boost_asio.reference.basic_socket `basic_socket`] is always the lowest layer.
  17035. typedef basic_socket< Protocol, Executor > lowest_layer_type;
  17036. [heading Types]
  17037. [table
  17038. [[Name][Description]]
  17039. [
  17040. [[link boost_asio.reference.basic_socket__rebind_executor [*rebind_executor]]]
  17041. [Rebinds the socket type to another executor. ]
  17042. ]
  17043. [
  17044. [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]]
  17045. [Socket option to permit sending of broadcast messages. ]
  17046. ]
  17047. [
  17048. [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]]
  17049. [IO control command to get the amount of data that can be read without blocking. ]
  17050. ]
  17051. [
  17052. [[link boost_asio.reference.basic_socket.debug [*debug]]]
  17053. [Socket option to enable socket-level debugging. ]
  17054. ]
  17055. [
  17056. [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]]
  17057. [Socket option to prevent routing, use local interfaces only. ]
  17058. ]
  17059. [
  17060. [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]]
  17061. [Socket option to report aborted connections on accept. ]
  17062. ]
  17063. [
  17064. [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]]
  17065. [The endpoint type. ]
  17066. ]
  17067. [
  17068. [[link boost_asio.reference.basic_socket.executor_type [*executor_type]]]
  17069. [The type of the executor associated with the object. ]
  17070. ]
  17071. [
  17072. [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]]
  17073. [Socket option to send keep-alives. ]
  17074. ]
  17075. [
  17076. [[link boost_asio.reference.basic_socket.linger [*linger]]]
  17077. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  17078. ]
  17079. [
  17080. [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]]
  17081. [A basic_socket is always the lowest layer. ]
  17082. ]
  17083. [
  17084. [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]]
  17085. [Bitmask type for flags that can be passed to send and receive operations. ]
  17086. ]
  17087. [
  17088. [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]]
  17089. [The native representation of a socket. ]
  17090. ]
  17091. [
  17092. [[link boost_asio.reference.basic_socket.out_of_band_inline [*out_of_band_inline]]]
  17093. [Socket option for putting received out-of-band data inline. ]
  17094. ]
  17095. [
  17096. [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]]
  17097. [The protocol type. ]
  17098. ]
  17099. [
  17100. [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]]
  17101. [Socket option for the receive buffer size of a socket. ]
  17102. ]
  17103. [
  17104. [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]]
  17105. [Socket option for the receive low watermark. ]
  17106. ]
  17107. [
  17108. [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]]
  17109. [Socket option to allow the socket to be bound to an address that is already in use. ]
  17110. ]
  17111. [
  17112. [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]]
  17113. [Socket option for the send buffer size of a socket. ]
  17114. ]
  17115. [
  17116. [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]]
  17117. [Socket option for the send low watermark. ]
  17118. ]
  17119. [
  17120. [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]]
  17121. [Different ways a socket may be shutdown. ]
  17122. ]
  17123. [
  17124. [[link boost_asio.reference.basic_socket.wait_type [*wait_type]]]
  17125. [Wait types. ]
  17126. ]
  17127. ]
  17128. [heading Member Functions]
  17129. [table
  17130. [[Name][Description]]
  17131. [
  17132. [[link boost_asio.reference.basic_socket.assign [*assign]]]
  17133. [Assign an existing native socket to the socket. ]
  17134. ]
  17135. [
  17136. [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]]
  17137. [Start an asynchronous connect. ]
  17138. ]
  17139. [
  17140. [[link boost_asio.reference.basic_socket.async_wait [*async_wait]]]
  17141. [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  17142. ]
  17143. [
  17144. [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]]
  17145. [Determine whether the socket is at the out-of-band data mark. ]
  17146. ]
  17147. [
  17148. [[link boost_asio.reference.basic_socket.available [*available]]]
  17149. [Determine the number of bytes available for reading. ]
  17150. ]
  17151. [
  17152. [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]]]
  17153. [Construct a basic_socket without opening it.
  17154. [hr]
  17155. Construct and open a basic_socket.
  17156. [hr]
  17157. Construct a basic_socket, opening it and binding it to the given local endpoint.
  17158. [hr]
  17159. Construct a basic_socket on an existing native socket.
  17160. [hr]
  17161. Move-construct a basic_socket from another.
  17162. [hr]
  17163. Move-construct a basic_socket from a socket of another protocol type. ]
  17164. ]
  17165. [
  17166. [[link boost_asio.reference.basic_socket.bind [*bind]]]
  17167. [Bind the socket to the given local endpoint. ]
  17168. ]
  17169. [
  17170. [[link boost_asio.reference.basic_socket.cancel [*cancel]]]
  17171. [Cancel all asynchronous operations associated with the socket. ]
  17172. ]
  17173. [
  17174. [[link boost_asio.reference.basic_socket.close [*close]]]
  17175. [Close the socket. ]
  17176. ]
  17177. [
  17178. [[link boost_asio.reference.basic_socket.connect [*connect]]]
  17179. [Connect the socket to the specified endpoint. ]
  17180. ]
  17181. [
  17182. [[link boost_asio.reference.basic_socket.get_executor [*get_executor]]]
  17183. [Get the executor associated with the object. ]
  17184. ]
  17185. [
  17186. [[link boost_asio.reference.basic_socket.get_option [*get_option]]]
  17187. [Get an option from the socket. ]
  17188. ]
  17189. [
  17190. [[link boost_asio.reference.basic_socket.io_control [*io_control]]]
  17191. [Perform an IO control command on the socket. ]
  17192. ]
  17193. [
  17194. [[link boost_asio.reference.basic_socket.is_open [*is_open]]]
  17195. [Determine whether the socket is open. ]
  17196. ]
  17197. [
  17198. [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]]
  17199. [Get the local endpoint of the socket. ]
  17200. ]
  17201. [
  17202. [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]]
  17203. [Get a reference to the lowest layer.
  17204. [hr]
  17205. Get a const reference to the lowest layer. ]
  17206. ]
  17207. [
  17208. [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]]
  17209. [Get the native socket representation. ]
  17210. ]
  17211. [
  17212. [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]]
  17213. [Gets the non-blocking mode of the native socket implementation.
  17214. [hr]
  17215. Sets the non-blocking mode of the native socket implementation. ]
  17216. ]
  17217. [
  17218. [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]]
  17219. [Gets the non-blocking mode of the socket.
  17220. [hr]
  17221. Sets the non-blocking mode of the socket. ]
  17222. ]
  17223. [
  17224. [[link boost_asio.reference.basic_socket.open [*open]]]
  17225. [Open the socket using the specified protocol. ]
  17226. ]
  17227. [
  17228. [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]]
  17229. [Move-assign a basic_socket from another.
  17230. [hr]
  17231. Move-assign a basic_socket from a socket of another protocol type. ]
  17232. ]
  17233. [
  17234. [[link boost_asio.reference.basic_socket.release [*release]]]
  17235. [Release ownership of the underlying native socket. ]
  17236. ]
  17237. [
  17238. [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]]
  17239. [Get the remote endpoint of the socket. ]
  17240. ]
  17241. [
  17242. [[link boost_asio.reference.basic_socket.set_option [*set_option]]]
  17243. [Set an option on the socket. ]
  17244. ]
  17245. [
  17246. [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]]
  17247. [Disable sends or receives on the socket. ]
  17248. ]
  17249. [
  17250. [[link boost_asio.reference.basic_socket.wait [*wait]]]
  17251. [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  17252. ]
  17253. ]
  17254. [heading Protected Member Functions]
  17255. [table
  17256. [[Name][Description]]
  17257. [
  17258. [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]]]
  17259. [Protected destructor to prevent deletion through this type. ]
  17260. ]
  17261. ]
  17262. [heading Data Members]
  17263. [table
  17264. [[Name][Description]]
  17265. [
  17266. [[link boost_asio.reference.basic_socket.max_connections [*max_connections]]]
  17267. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  17268. ]
  17269. [
  17270. [[link boost_asio.reference.basic_socket.max_listen_connections [*max_listen_connections]]]
  17271. [The maximum length of the queue of pending incoming connections. ]
  17272. ]
  17273. [
  17274. [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]]]
  17275. [Specify that the data should not be subject to routing. ]
  17276. ]
  17277. [
  17278. [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]]]
  17279. [Specifies that the data marks the end of a record. ]
  17280. ]
  17281. [
  17282. [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]]]
  17283. [Process out-of-band data. ]
  17284. ]
  17285. [
  17286. [[link boost_asio.reference.basic_socket.message_peek [*message_peek]]]
  17287. [Peek at incoming data without removing it from the input queue. ]
  17288. ]
  17289. ]
  17290. [heading Protected Data Members]
  17291. [table
  17292. [[Name][Description]]
  17293. [
  17294. [[link boost_asio.reference.basic_socket.impl_ [*impl_]]]
  17295. []
  17296. ]
  17297. ]
  17298. The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
  17299. [heading Thread Safety]
  17300. ['Distinct] ['objects:] Safe.
  17301. ['Shared] ['objects:] Unsafe.
  17302. [heading Requirements]
  17303. ['Header: ][^boost/asio/basic_socket.hpp]
  17304. ['Convenience header: ][^boost/asio.hpp]
  17305. [endsect]
  17306. [section:max_connections basic_socket::max_connections]
  17307. ['Inherited from socket_base.]
  17308. [indexterm2 boost_asio.indexterm.basic_socket.max_connections..max_connections..basic_socket]
  17309. (Deprecated: Use max\_listen\_connections.) The maximum length of the queue of pending incoming connections.
  17310. static const int max_connections = implementation_defined;
  17311. [endsect]
  17312. [section:max_listen_connections basic_socket::max_listen_connections]
  17313. ['Inherited from socket_base.]
  17314. [indexterm2 boost_asio.indexterm.basic_socket.max_listen_connections..max_listen_connections..basic_socket]
  17315. The maximum length of the queue of pending incoming connections.
  17316. static const int max_listen_connections = implementation_defined;
  17317. [endsect]
  17318. [section:message_do_not_route basic_socket::message_do_not_route]
  17319. ['Inherited from socket_base.]
  17320. [indexterm2 boost_asio.indexterm.basic_socket.message_do_not_route..message_do_not_route..basic_socket]
  17321. Specify that the data should not be subject to routing.
  17322. static const int message_do_not_route = implementation_defined;
  17323. [endsect]
  17324. [section:message_end_of_record basic_socket::message_end_of_record]
  17325. ['Inherited from socket_base.]
  17326. [indexterm2 boost_asio.indexterm.basic_socket.message_end_of_record..message_end_of_record..basic_socket]
  17327. Specifies that the data marks the end of a record.
  17328. static const int message_end_of_record = implementation_defined;
  17329. [endsect]
  17330. [section:message_flags basic_socket::message_flags]
  17331. ['Inherited from socket_base.]
  17332. [indexterm2 boost_asio.indexterm.basic_socket.message_flags..message_flags..basic_socket]
  17333. Bitmask type for flags that can be passed to send and receive operations.
  17334. typedef int message_flags;
  17335. [heading Requirements]
  17336. ['Header: ][^boost/asio/basic_socket.hpp]
  17337. ['Convenience header: ][^boost/asio.hpp]
  17338. [endsect]
  17339. [section:message_out_of_band basic_socket::message_out_of_band]
  17340. ['Inherited from socket_base.]
  17341. [indexterm2 boost_asio.indexterm.basic_socket.message_out_of_band..message_out_of_band..basic_socket]
  17342. Process out-of-band data.
  17343. static const int message_out_of_band = implementation_defined;
  17344. [endsect]
  17345. [section:message_peek basic_socket::message_peek]
  17346. ['Inherited from socket_base.]
  17347. [indexterm2 boost_asio.indexterm.basic_socket.message_peek..message_peek..basic_socket]
  17348. Peek at incoming data without removing it from the input queue.
  17349. static const int message_peek = implementation_defined;
  17350. [endsect]
  17351. [section:native_handle basic_socket::native_handle]
  17352. [indexterm2 boost_asio.indexterm.basic_socket.native_handle..native_handle..basic_socket]
  17353. Get the native socket representation.
  17354. native_handle_type native_handle();
  17355. This function may be used to obtain the underlying representation of the socket. This is intended to allow access to native socket functionality that is not otherwise provided.
  17356. [endsect]
  17357. [section:native_handle_type basic_socket::native_handle_type]
  17358. [indexterm2 boost_asio.indexterm.basic_socket.native_handle_type..native_handle_type..basic_socket]
  17359. The native representation of a socket.
  17360. typedef implementation_defined native_handle_type;
  17361. [heading Requirements]
  17362. ['Header: ][^boost/asio/basic_socket.hpp]
  17363. ['Convenience header: ][^boost/asio.hpp]
  17364. [endsect]
  17365. [section:native_non_blocking basic_socket::native_non_blocking]
  17366. [indexterm2 boost_asio.indexterm.basic_socket.native_non_blocking..native_non_blocking..basic_socket]
  17367. Gets the non-blocking mode of the native socket implementation.
  17368. bool ``[link boost_asio.reference.basic_socket.native_non_blocking.overload1 native_non_blocking]``() const;
  17369. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.native_non_blocking.overload1 more...]]``
  17370. Sets the non-blocking mode of the native socket implementation.
  17371. void ``[link boost_asio.reference.basic_socket.native_non_blocking.overload2 native_non_blocking]``(
  17372. bool mode);
  17373. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.native_non_blocking.overload2 more...]]``
  17374. void ``[link boost_asio.reference.basic_socket.native_non_blocking.overload3 native_non_blocking]``(
  17375. bool mode,
  17376. boost::system::error_code & ec);
  17377. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.native_non_blocking.overload3 more...]]``
  17378. [section:overload1 basic_socket::native_non_blocking (1 of 3 overloads)]
  17379. Gets the non-blocking mode of the native socket implementation.
  17380. bool native_non_blocking() const;
  17381. This function is used to retrieve the non-blocking mode of the underlying native socket. This mode has no effect on the behaviour of the socket object's synchronous operations.
  17382. [heading Return Value]
  17383. `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).
  17384. [heading Remarks]
  17385. The current non-blocking mode is cached by the socket object. Consequently, the return value may be incorrect if the non-blocking mode was set directly on the native socket.
  17386. [heading Example]
  17387. This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
  17388. template <typename Handler>
  17389. struct sendfile_op
  17390. {
  17391. tcp::socket& sock_;
  17392. int fd_;
  17393. Handler handler_;
  17394. off_t offset_;
  17395. std::size_t total_bytes_transferred_;
  17396. // Function call operator meeting WriteHandler requirements.
  17397. // Used as the handler for the async_write_some operation.
  17398. void operator()(boost::system::error_code ec, std::size_t)
  17399. {
  17400. // Put the underlying socket into non-blocking mode.
  17401. if (!ec)
  17402. if (!sock_.native_non_blocking())
  17403. sock_.native_non_blocking(true, ec);
  17404. if (!ec)
  17405. {
  17406. for (;;)
  17407. {
  17408. // Try the system call.
  17409. errno = 0;
  17410. int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
  17411. ec = boost::system::error_code(n < 0 ? errno : 0,
  17412. boost::asio::error::get_system_category());
  17413. total_bytes_transferred_ += ec ? 0 : n;
  17414. // Retry operation immediately if interrupted by signal.
  17415. if (ec == boost::asio::error::interrupted)
  17416. continue;
  17417. // Check if we need to run the operation again.
  17418. if (ec == boost::asio::error::would_block
  17419. || ec == boost::asio::error::try_again)
  17420. {
  17421. // We have to wait for the socket to become ready again.
  17422. sock_.async_wait(tcp::socket::wait_write, *this);
  17423. return;
  17424. }
  17425. if (ec || n == 0)
  17426. {
  17427. // An error occurred, or we have reached the end of the file.
  17428. // Either way we must exit the loop so we can call the handler.
  17429. break;
  17430. }
  17431. // Loop around to try calling sendfile again.
  17432. }
  17433. }
  17434. // Pass result back to user's handler.
  17435. handler_(ec, total_bytes_transferred_);
  17436. }
  17437. };
  17438. template <typename Handler>
  17439. void async_sendfile(tcp::socket& sock, int fd, Handler h)
  17440. {
  17441. sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
  17442. sock.async_wait(tcp::socket::wait_write, op);
  17443. }
  17444. [endsect]
  17445. [section:overload2 basic_socket::native_non_blocking (2 of 3 overloads)]
  17446. Sets the non-blocking mode of the native socket implementation.
  17447. void native_non_blocking(
  17448. bool mode);
  17449. This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
  17450. [heading Parameters]
  17451. [variablelist
  17452. [[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).]]
  17453. ]
  17454. [heading Exceptions]
  17455. [variablelist
  17456. [[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.]]
  17457. ]
  17458. [heading Example]
  17459. This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
  17460. template <typename Handler>
  17461. struct sendfile_op
  17462. {
  17463. tcp::socket& sock_;
  17464. int fd_;
  17465. Handler handler_;
  17466. off_t offset_;
  17467. std::size_t total_bytes_transferred_;
  17468. // Function call operator meeting WriteHandler requirements.
  17469. // Used as the handler for the async_write_some operation.
  17470. void operator()(boost::system::error_code ec, std::size_t)
  17471. {
  17472. // Put the underlying socket into non-blocking mode.
  17473. if (!ec)
  17474. if (!sock_.native_non_blocking())
  17475. sock_.native_non_blocking(true, ec);
  17476. if (!ec)
  17477. {
  17478. for (;;)
  17479. {
  17480. // Try the system call.
  17481. errno = 0;
  17482. int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
  17483. ec = boost::system::error_code(n < 0 ? errno : 0,
  17484. boost::asio::error::get_system_category());
  17485. total_bytes_transferred_ += ec ? 0 : n;
  17486. // Retry operation immediately if interrupted by signal.
  17487. if (ec == boost::asio::error::interrupted)
  17488. continue;
  17489. // Check if we need to run the operation again.
  17490. if (ec == boost::asio::error::would_block
  17491. || ec == boost::asio::error::try_again)
  17492. {
  17493. // We have to wait for the socket to become ready again.
  17494. sock_.async_wait(tcp::socket::wait_write, *this);
  17495. return;
  17496. }
  17497. if (ec || n == 0)
  17498. {
  17499. // An error occurred, or we have reached the end of the file.
  17500. // Either way we must exit the loop so we can call the handler.
  17501. break;
  17502. }
  17503. // Loop around to try calling sendfile again.
  17504. }
  17505. }
  17506. // Pass result back to user's handler.
  17507. handler_(ec, total_bytes_transferred_);
  17508. }
  17509. };
  17510. template <typename Handler>
  17511. void async_sendfile(tcp::socket& sock, int fd, Handler h)
  17512. {
  17513. sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
  17514. sock.async_wait(tcp::socket::wait_write, op);
  17515. }
  17516. [endsect]
  17517. [section:overload3 basic_socket::native_non_blocking (3 of 3 overloads)]
  17518. Sets the non-blocking mode of the native socket implementation.
  17519. void native_non_blocking(
  17520. bool mode,
  17521. boost::system::error_code & ec);
  17522. This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
  17523. [heading Parameters]
  17524. [variablelist
  17525. [[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).]]
  17526. [[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.]]
  17527. ]
  17528. [heading Example]
  17529. This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
  17530. template <typename Handler>
  17531. struct sendfile_op
  17532. {
  17533. tcp::socket& sock_;
  17534. int fd_;
  17535. Handler handler_;
  17536. off_t offset_;
  17537. std::size_t total_bytes_transferred_;
  17538. // Function call operator meeting WriteHandler requirements.
  17539. // Used as the handler for the async_write_some operation.
  17540. void operator()(boost::system::error_code ec, std::size_t)
  17541. {
  17542. // Put the underlying socket into non-blocking mode.
  17543. if (!ec)
  17544. if (!sock_.native_non_blocking())
  17545. sock_.native_non_blocking(true, ec);
  17546. if (!ec)
  17547. {
  17548. for (;;)
  17549. {
  17550. // Try the system call.
  17551. errno = 0;
  17552. int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
  17553. ec = boost::system::error_code(n < 0 ? errno : 0,
  17554. boost::asio::error::get_system_category());
  17555. total_bytes_transferred_ += ec ? 0 : n;
  17556. // Retry operation immediately if interrupted by signal.
  17557. if (ec == boost::asio::error::interrupted)
  17558. continue;
  17559. // Check if we need to run the operation again.
  17560. if (ec == boost::asio::error::would_block
  17561. || ec == boost::asio::error::try_again)
  17562. {
  17563. // We have to wait for the socket to become ready again.
  17564. sock_.async_wait(tcp::socket::wait_write, *this);
  17565. return;
  17566. }
  17567. if (ec || n == 0)
  17568. {
  17569. // An error occurred, or we have reached the end of the file.
  17570. // Either way we must exit the loop so we can call the handler.
  17571. break;
  17572. }
  17573. // Loop around to try calling sendfile again.
  17574. }
  17575. }
  17576. // Pass result back to user's handler.
  17577. handler_(ec, total_bytes_transferred_);
  17578. }
  17579. };
  17580. template <typename Handler>
  17581. void async_sendfile(tcp::socket& sock, int fd, Handler h)
  17582. {
  17583. sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
  17584. sock.async_wait(tcp::socket::wait_write, op);
  17585. }
  17586. [endsect]
  17587. [endsect]
  17588. [section:non_blocking basic_socket::non_blocking]
  17589. [indexterm2 boost_asio.indexterm.basic_socket.non_blocking..non_blocking..basic_socket]
  17590. Gets the non-blocking mode of the socket.
  17591. bool ``[link boost_asio.reference.basic_socket.non_blocking.overload1 non_blocking]``() const;
  17592. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.non_blocking.overload1 more...]]``
  17593. Sets the non-blocking mode of the socket.
  17594. void ``[link boost_asio.reference.basic_socket.non_blocking.overload2 non_blocking]``(
  17595. bool mode);
  17596. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.non_blocking.overload2 more...]]``
  17597. void ``[link boost_asio.reference.basic_socket.non_blocking.overload3 non_blocking]``(
  17598. bool mode,
  17599. boost::system::error_code & ec);
  17600. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.non_blocking.overload3 more...]]``
  17601. [section:overload1 basic_socket::non_blocking (1 of 3 overloads)]
  17602. Gets the non-blocking mode of the socket.
  17603. bool non_blocking() const;
  17604. [heading Return Value]
  17605. `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.
  17606. [heading Remarks]
  17607. The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
  17608. [endsect]
  17609. [section:overload2 basic_socket::non_blocking (2 of 3 overloads)]
  17610. Sets the non-blocking mode of the socket.
  17611. void non_blocking(
  17612. bool mode);
  17613. [heading Parameters]
  17614. [variablelist
  17615. [[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.]]
  17616. ]
  17617. [heading Exceptions]
  17618. [variablelist
  17619. [[boost::system::system_error][Thrown on failure.]]
  17620. ]
  17621. [heading Remarks]
  17622. The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
  17623. [endsect]
  17624. [section:overload3 basic_socket::non_blocking (3 of 3 overloads)]
  17625. Sets the non-blocking mode of the socket.
  17626. void non_blocking(
  17627. bool mode,
  17628. boost::system::error_code & ec);
  17629. [heading Parameters]
  17630. [variablelist
  17631. [[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.]]
  17632. [[ec][Set to indicate what error occurred, if any.]]
  17633. ]
  17634. [heading Remarks]
  17635. The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
  17636. [endsect]
  17637. [endsect]
  17638. [section:open basic_socket::open]
  17639. [indexterm2 boost_asio.indexterm.basic_socket.open..open..basic_socket]
  17640. Open the socket using the specified protocol.
  17641. void ``[link boost_asio.reference.basic_socket.open.overload1 open]``(
  17642. const protocol_type & protocol = protocol_type());
  17643. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.open.overload1 more...]]``
  17644. void ``[link boost_asio.reference.basic_socket.open.overload2 open]``(
  17645. const protocol_type & protocol,
  17646. boost::system::error_code & ec);
  17647. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.open.overload2 more...]]``
  17648. [section:overload1 basic_socket::open (1 of 2 overloads)]
  17649. Open the socket using the specified protocol.
  17650. void open(
  17651. const protocol_type & protocol = protocol_type());
  17652. This function opens the socket so that it will use the specified protocol.
  17653. [heading Parameters]
  17654. [variablelist
  17655. [[protocol][An object specifying protocol parameters to be used.]]
  17656. ]
  17657. [heading Exceptions]
  17658. [variablelist
  17659. [[boost::system::system_error][Thrown on failure.]]
  17660. ]
  17661. [heading Example]
  17662. boost::asio::ip::tcp::socket socket(my_context);
  17663. socket.open(boost::asio::ip::tcp::v4());
  17664. [endsect]
  17665. [section:overload2 basic_socket::open (2 of 2 overloads)]
  17666. Open the socket using the specified protocol.
  17667. void open(
  17668. const protocol_type & protocol,
  17669. boost::system::error_code & ec);
  17670. This function opens the socket so that it will use the specified protocol.
  17671. [heading Parameters]
  17672. [variablelist
  17673. [[protocol][An object specifying which protocol is to be used.]]
  17674. [[ec][Set to indicate what error occurred, if any.]]
  17675. ]
  17676. [heading Example]
  17677. boost::asio::ip::tcp::socket socket(my_context);
  17678. boost::system::error_code ec;
  17679. socket.open(boost::asio::ip::tcp::v4(), ec);
  17680. if (ec)
  17681. {
  17682. // An error occurred.
  17683. }
  17684. [endsect]
  17685. [endsect]
  17686. [section:operator_eq_ basic_socket::operator=]
  17687. [indexterm2 boost_asio.indexterm.basic_socket.operator_eq_..operator=..basic_socket]
  17688. Move-assign a [link boost_asio.reference.basic_socket `basic_socket`] from another.
  17689. basic_socket & ``[link boost_asio.reference.basic_socket.operator_eq_.overload1 operator=]``(
  17690. basic_socket && other);
  17691. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.operator_eq_.overload1 more...]]``
  17692. Move-assign a [link boost_asio.reference.basic_socket `basic_socket`] from a socket of another protocol type.
  17693. template<
  17694. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  17695. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  17696. enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_socket & >::type ``[link boost_asio.reference.basic_socket.operator_eq_.overload2 operator=]``(
  17697. basic_socket< Protocol1, Executor1 > && other);
  17698. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.operator_eq_.overload2 more...]]``
  17699. [section:overload1 basic_socket::operator= (1 of 2 overloads)]
  17700. Move-assign a [link boost_asio.reference.basic_socket `basic_socket`] from another.
  17701. basic_socket & operator=(
  17702. basic_socket && other);
  17703. This assignment operator moves a socket from one object to another.
  17704. [heading Parameters]
  17705. [variablelist
  17706. [[other][The other [link boost_asio.reference.basic_socket `basic_socket`] object from which the move will occur.]]
  17707. ]
  17708. [heading Remarks]
  17709. Following the move, the moved-from object is in the same state as if constructed using the `basic_socket(const executor_type&) constructor`.
  17710. [endsect]
  17711. [section:overload2 basic_socket::operator= (2 of 2 overloads)]
  17712. Move-assign a [link boost_asio.reference.basic_socket `basic_socket`] from a socket of another protocol type.
  17713. template<
  17714. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  17715. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  17716. enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_socket & >::type operator=(
  17717. basic_socket< Protocol1, Executor1 > && other);
  17718. This assignment operator moves a socket from one object to another.
  17719. [heading Parameters]
  17720. [variablelist
  17721. [[other][The other [link boost_asio.reference.basic_socket `basic_socket`] object from which the move will occur.]]
  17722. ]
  17723. [heading Remarks]
  17724. Following the move, the moved-from object is in the same state as if constructed using the `basic_socket(const executor_type&) constructor`.
  17725. [endsect]
  17726. [endsect]
  17727. [section:out_of_band_inline basic_socket::out_of_band_inline]
  17728. ['Inherited from socket_base.]
  17729. [indexterm2 boost_asio.indexterm.basic_socket.out_of_band_inline..out_of_band_inline..basic_socket]
  17730. Socket option for putting received out-of-band data inline.
  17731. typedef implementation_defined out_of_band_inline;
  17732. Implements the SOL\_SOCKET/SO\_OOBINLINE socket option.
  17733. [heading Examples]
  17734. Setting the option:
  17735. boost::asio::ip::tcp::socket socket(my_context);
  17736. ...
  17737. boost::asio::socket_base::out_of_band_inline option(true);
  17738. socket.set_option(option);
  17739. Getting the current option value:
  17740. boost::asio::ip::tcp::socket socket(my_context);
  17741. ...
  17742. boost::asio::socket_base::out_of_band_inline option;
  17743. socket.get_option(option);
  17744. bool value = option.value();
  17745. [heading Requirements]
  17746. ['Header: ][^boost/asio/basic_socket.hpp]
  17747. ['Convenience header: ][^boost/asio.hpp]
  17748. [endsect]
  17749. [section:protocol_type basic_socket::protocol_type]
  17750. [indexterm2 boost_asio.indexterm.basic_socket.protocol_type..protocol_type..basic_socket]
  17751. The protocol type.
  17752. typedef Protocol protocol_type;
  17753. [heading Requirements]
  17754. ['Header: ][^boost/asio/basic_socket.hpp]
  17755. ['Convenience header: ][^boost/asio.hpp]
  17756. [endsect]
  17757. [section:receive_buffer_size basic_socket::receive_buffer_size]
  17758. ['Inherited from socket_base.]
  17759. [indexterm2 boost_asio.indexterm.basic_socket.receive_buffer_size..receive_buffer_size..basic_socket]
  17760. Socket option for the receive buffer size of a socket.
  17761. typedef implementation_defined receive_buffer_size;
  17762. Implements the SOL\_SOCKET/SO\_RCVBUF socket option.
  17763. [heading Examples]
  17764. Setting the option:
  17765. boost::asio::ip::tcp::socket socket(my_context);
  17766. ...
  17767. boost::asio::socket_base::receive_buffer_size option(8192);
  17768. socket.set_option(option);
  17769. Getting the current option value:
  17770. boost::asio::ip::tcp::socket socket(my_context);
  17771. ...
  17772. boost::asio::socket_base::receive_buffer_size option;
  17773. socket.get_option(option);
  17774. int size = option.value();
  17775. [heading Requirements]
  17776. ['Header: ][^boost/asio/basic_socket.hpp]
  17777. ['Convenience header: ][^boost/asio.hpp]
  17778. [endsect]
  17779. [section:receive_low_watermark basic_socket::receive_low_watermark]
  17780. ['Inherited from socket_base.]
  17781. [indexterm2 boost_asio.indexterm.basic_socket.receive_low_watermark..receive_low_watermark..basic_socket]
  17782. Socket option for the receive low watermark.
  17783. typedef implementation_defined receive_low_watermark;
  17784. Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option.
  17785. [heading Examples]
  17786. Setting the option:
  17787. boost::asio::ip::tcp::socket socket(my_context);
  17788. ...
  17789. boost::asio::socket_base::receive_low_watermark option(1024);
  17790. socket.set_option(option);
  17791. Getting the current option value:
  17792. boost::asio::ip::tcp::socket socket(my_context);
  17793. ...
  17794. boost::asio::socket_base::receive_low_watermark option;
  17795. socket.get_option(option);
  17796. int size = option.value();
  17797. [heading Requirements]
  17798. ['Header: ][^boost/asio/basic_socket.hpp]
  17799. ['Convenience header: ][^boost/asio.hpp]
  17800. [endsect]
  17801. [section:release basic_socket::release]
  17802. [indexterm2 boost_asio.indexterm.basic_socket.release..release..basic_socket]
  17803. Release ownership of the underlying native socket.
  17804. native_handle_type ``[link boost_asio.reference.basic_socket.release.overload1 release]``();
  17805. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.release.overload1 more...]]``
  17806. native_handle_type ``[link boost_asio.reference.basic_socket.release.overload2 release]``(
  17807. boost::system::error_code & ec);
  17808. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.release.overload2 more...]]``
  17809. [section:overload1 basic_socket::release (1 of 2 overloads)]
  17810. Release ownership of the underlying native socket.
  17811. native_handle_type release();
  17812. This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. Ownership of the native socket is then transferred to the caller.
  17813. [heading Exceptions]
  17814. [variablelist
  17815. [[boost::system::system_error][Thrown on failure.]]
  17816. ]
  17817. [heading Remarks]
  17818. This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms.
  17819. [endsect]
  17820. [section:overload2 basic_socket::release (2 of 2 overloads)]
  17821. Release ownership of the underlying native socket.
  17822. native_handle_type release(
  17823. boost::system::error_code & ec);
  17824. This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. Ownership of the native socket is then transferred to the caller.
  17825. [heading Parameters]
  17826. [variablelist
  17827. [[ec][Set to indicate what error occurred, if any.]]
  17828. ]
  17829. [heading Remarks]
  17830. This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms.
  17831. [endsect]
  17832. [endsect]
  17833. [section:remote_endpoint basic_socket::remote_endpoint]
  17834. [indexterm2 boost_asio.indexterm.basic_socket.remote_endpoint..remote_endpoint..basic_socket]
  17835. Get the remote endpoint of the socket.
  17836. endpoint_type ``[link boost_asio.reference.basic_socket.remote_endpoint.overload1 remote_endpoint]``() const;
  17837. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.remote_endpoint.overload1 more...]]``
  17838. endpoint_type ``[link boost_asio.reference.basic_socket.remote_endpoint.overload2 remote_endpoint]``(
  17839. boost::system::error_code & ec) const;
  17840. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.remote_endpoint.overload2 more...]]``
  17841. [section:overload1 basic_socket::remote_endpoint (1 of 2 overloads)]
  17842. Get the remote endpoint of the socket.
  17843. endpoint_type remote_endpoint() const;
  17844. This function is used to obtain the remote endpoint of the socket.
  17845. [heading Return Value]
  17846. An object that represents the remote endpoint of the socket.
  17847. [heading Exceptions]
  17848. [variablelist
  17849. [[boost::system::system_error][Thrown on failure.]]
  17850. ]
  17851. [heading Example]
  17852. boost::asio::ip::tcp::socket socket(my_context);
  17853. ...
  17854. boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint();
  17855. [endsect]
  17856. [section:overload2 basic_socket::remote_endpoint (2 of 2 overloads)]
  17857. Get the remote endpoint of the socket.
  17858. endpoint_type remote_endpoint(
  17859. boost::system::error_code & ec) const;
  17860. This function is used to obtain the remote endpoint of the socket.
  17861. [heading Parameters]
  17862. [variablelist
  17863. [[ec][Set to indicate what error occurred, if any.]]
  17864. ]
  17865. [heading Return Value]
  17866. An object that represents the remote endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
  17867. [heading Example]
  17868. boost::asio::ip::tcp::socket socket(my_context);
  17869. ...
  17870. boost::system::error_code ec;
  17871. boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(ec);
  17872. if (ec)
  17873. {
  17874. // An error occurred.
  17875. }
  17876. [endsect]
  17877. [endsect]
  17878. [section:reuse_address basic_socket::reuse_address]
  17879. ['Inherited from socket_base.]
  17880. [indexterm2 boost_asio.indexterm.basic_socket.reuse_address..reuse_address..basic_socket]
  17881. Socket option to allow the socket to be bound to an address that is already in use.
  17882. typedef implementation_defined reuse_address;
  17883. Implements the SOL\_SOCKET/SO\_REUSEADDR socket option.
  17884. [heading Examples]
  17885. Setting the option:
  17886. boost::asio::ip::tcp::acceptor acceptor(my_context);
  17887. ...
  17888. boost::asio::socket_base::reuse_address option(true);
  17889. acceptor.set_option(option);
  17890. Getting the current option value:
  17891. boost::asio::ip::tcp::acceptor acceptor(my_context);
  17892. ...
  17893. boost::asio::socket_base::reuse_address option;
  17894. acceptor.get_option(option);
  17895. bool is_set = option.value();
  17896. [heading Requirements]
  17897. ['Header: ][^boost/asio/basic_socket.hpp]
  17898. ['Convenience header: ][^boost/asio.hpp]
  17899. [endsect]
  17900. [section:send_buffer_size basic_socket::send_buffer_size]
  17901. ['Inherited from socket_base.]
  17902. [indexterm2 boost_asio.indexterm.basic_socket.send_buffer_size..send_buffer_size..basic_socket]
  17903. Socket option for the send buffer size of a socket.
  17904. typedef implementation_defined send_buffer_size;
  17905. Implements the SOL\_SOCKET/SO\_SNDBUF socket option.
  17906. [heading Examples]
  17907. Setting the option:
  17908. boost::asio::ip::tcp::socket socket(my_context);
  17909. ...
  17910. boost::asio::socket_base::send_buffer_size option(8192);
  17911. socket.set_option(option);
  17912. Getting the current option value:
  17913. boost::asio::ip::tcp::socket socket(my_context);
  17914. ...
  17915. boost::asio::socket_base::send_buffer_size option;
  17916. socket.get_option(option);
  17917. int size = option.value();
  17918. [heading Requirements]
  17919. ['Header: ][^boost/asio/basic_socket.hpp]
  17920. ['Convenience header: ][^boost/asio.hpp]
  17921. [endsect]
  17922. [section:send_low_watermark basic_socket::send_low_watermark]
  17923. ['Inherited from socket_base.]
  17924. [indexterm2 boost_asio.indexterm.basic_socket.send_low_watermark..send_low_watermark..basic_socket]
  17925. Socket option for the send low watermark.
  17926. typedef implementation_defined send_low_watermark;
  17927. Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option.
  17928. [heading Examples]
  17929. Setting the option:
  17930. boost::asio::ip::tcp::socket socket(my_context);
  17931. ...
  17932. boost::asio::socket_base::send_low_watermark option(1024);
  17933. socket.set_option(option);
  17934. Getting the current option value:
  17935. boost::asio::ip::tcp::socket socket(my_context);
  17936. ...
  17937. boost::asio::socket_base::send_low_watermark option;
  17938. socket.get_option(option);
  17939. int size = option.value();
  17940. [heading Requirements]
  17941. ['Header: ][^boost/asio/basic_socket.hpp]
  17942. ['Convenience header: ][^boost/asio.hpp]
  17943. [endsect]
  17944. [section:set_option basic_socket::set_option]
  17945. [indexterm2 boost_asio.indexterm.basic_socket.set_option..set_option..basic_socket]
  17946. Set an option on the socket.
  17947. template<
  17948. typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
  17949. void ``[link boost_asio.reference.basic_socket.set_option.overload1 set_option]``(
  17950. const SettableSocketOption & option);
  17951. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.set_option.overload1 more...]]``
  17952. template<
  17953. typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
  17954. void ``[link boost_asio.reference.basic_socket.set_option.overload2 set_option]``(
  17955. const SettableSocketOption & option,
  17956. boost::system::error_code & ec);
  17957. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.set_option.overload2 more...]]``
  17958. [section:overload1 basic_socket::set_option (1 of 2 overloads)]
  17959. Set an option on the socket.
  17960. template<
  17961. typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
  17962. void set_option(
  17963. const SettableSocketOption & option);
  17964. This function is used to set an option on the socket.
  17965. [heading Parameters]
  17966. [variablelist
  17967. [[option][The new option value to be set on the socket.]]
  17968. ]
  17969. [heading Exceptions]
  17970. [variablelist
  17971. [[boost::system::system_error][Thrown on failure.]]
  17972. ]
  17973. [heading Example]
  17974. Setting the IPPROTO\_TCP/TCP\_NODELAY option:
  17975. boost::asio::ip::tcp::socket socket(my_context);
  17976. ...
  17977. boost::asio::ip::tcp::no_delay option(true);
  17978. socket.set_option(option);
  17979. [endsect]
  17980. [section:overload2 basic_socket::set_option (2 of 2 overloads)]
  17981. Set an option on the socket.
  17982. template<
  17983. typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
  17984. void set_option(
  17985. const SettableSocketOption & option,
  17986. boost::system::error_code & ec);
  17987. This function is used to set an option on the socket.
  17988. [heading Parameters]
  17989. [variablelist
  17990. [[option][The new option value to be set on the socket.]]
  17991. [[ec][Set to indicate what error occurred, if any.]]
  17992. ]
  17993. [heading Example]
  17994. Setting the IPPROTO\_TCP/TCP\_NODELAY option:
  17995. boost::asio::ip::tcp::socket socket(my_context);
  17996. ...
  17997. boost::asio::ip::tcp::no_delay option(true);
  17998. boost::system::error_code ec;
  17999. socket.set_option(option, ec);
  18000. if (ec)
  18001. {
  18002. // An error occurred.
  18003. }
  18004. [endsect]
  18005. [endsect]
  18006. [section:shutdown basic_socket::shutdown]
  18007. [indexterm2 boost_asio.indexterm.basic_socket.shutdown..shutdown..basic_socket]
  18008. Disable sends or receives on the socket.
  18009. void ``[link boost_asio.reference.basic_socket.shutdown.overload1 shutdown]``(
  18010. shutdown_type what);
  18011. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.shutdown.overload1 more...]]``
  18012. void ``[link boost_asio.reference.basic_socket.shutdown.overload2 shutdown]``(
  18013. shutdown_type what,
  18014. boost::system::error_code & ec);
  18015. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.shutdown.overload2 more...]]``
  18016. [section:overload1 basic_socket::shutdown (1 of 2 overloads)]
  18017. Disable sends or receives on the socket.
  18018. void shutdown(
  18019. shutdown_type what);
  18020. This function is used to disable send operations, receive operations, or both.
  18021. [heading Parameters]
  18022. [variablelist
  18023. [[what][Determines what types of operation will no longer be allowed.]]
  18024. ]
  18025. [heading Exceptions]
  18026. [variablelist
  18027. [[boost::system::system_error][Thrown on failure.]]
  18028. ]
  18029. [heading Example]
  18030. Shutting down the send side of the socket:
  18031. boost::asio::ip::tcp::socket socket(my_context);
  18032. ...
  18033. socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send);
  18034. [endsect]
  18035. [section:overload2 basic_socket::shutdown (2 of 2 overloads)]
  18036. Disable sends or receives on the socket.
  18037. void shutdown(
  18038. shutdown_type what,
  18039. boost::system::error_code & ec);
  18040. This function is used to disable send operations, receive operations, or both.
  18041. [heading Parameters]
  18042. [variablelist
  18043. [[what][Determines what types of operation will no longer be allowed.]]
  18044. [[ec][Set to indicate what error occurred, if any.]]
  18045. ]
  18046. [heading Example]
  18047. Shutting down the send side of the socket:
  18048. boost::asio::ip::tcp::socket socket(my_context);
  18049. ...
  18050. boost::system::error_code ec;
  18051. socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ec);
  18052. if (ec)
  18053. {
  18054. // An error occurred.
  18055. }
  18056. [endsect]
  18057. [endsect]
  18058. [section:shutdown_type basic_socket::shutdown_type]
  18059. ['Inherited from socket_base.]
  18060. [indexterm2 boost_asio.indexterm.basic_socket.shutdown_type..shutdown_type..basic_socket]
  18061. Different ways a socket may be shutdown.
  18062. enum shutdown_type
  18063. [indexterm2 boost_asio.indexterm.basic_socket.shutdown_type.shutdown_receive..shutdown_receive..basic_socket]
  18064. [indexterm2 boost_asio.indexterm.basic_socket.shutdown_type.shutdown_send..shutdown_send..basic_socket]
  18065. [indexterm2 boost_asio.indexterm.basic_socket.shutdown_type.shutdown_both..shutdown_both..basic_socket]
  18066. [heading Values]
  18067. [variablelist
  18068. [
  18069. [shutdown_receive]
  18070. [Shutdown the receive side of the socket. ]
  18071. ]
  18072. [
  18073. [shutdown_send]
  18074. [Shutdown the send side of the socket. ]
  18075. ]
  18076. [
  18077. [shutdown_both]
  18078. [Shutdown both send and receive on the socket. ]
  18079. ]
  18080. ]
  18081. [endsect]
  18082. [section:wait basic_socket::wait]
  18083. [indexterm2 boost_asio.indexterm.basic_socket.wait..wait..basic_socket]
  18084. Wait for the socket to become ready to read, ready to write, or to have pending error conditions.
  18085. void ``[link boost_asio.reference.basic_socket.wait.overload1 wait]``(
  18086. wait_type w);
  18087. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.wait.overload1 more...]]``
  18088. void ``[link boost_asio.reference.basic_socket.wait.overload2 wait]``(
  18089. wait_type w,
  18090. boost::system::error_code & ec);
  18091. `` [''''&raquo;''' [link boost_asio.reference.basic_socket.wait.overload2 more...]]``
  18092. [section:overload1 basic_socket::wait (1 of 2 overloads)]
  18093. Wait for the socket to become ready to read, ready to write, or to have pending error conditions.
  18094. void wait(
  18095. wait_type w);
  18096. This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state.
  18097. [heading Parameters]
  18098. [variablelist
  18099. [[w][Specifies the desired socket state.]]
  18100. ]
  18101. [heading Example]
  18102. Waiting for a socket to become readable.
  18103. boost::asio::ip::tcp::socket socket(my_context);
  18104. ...
  18105. socket.wait(boost::asio::ip::tcp::socket::wait_read);
  18106. [endsect]
  18107. [section:overload2 basic_socket::wait (2 of 2 overloads)]
  18108. Wait for the socket to become ready to read, ready to write, or to have pending error conditions.
  18109. void wait(
  18110. wait_type w,
  18111. boost::system::error_code & ec);
  18112. This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state.
  18113. [heading Parameters]
  18114. [variablelist
  18115. [[w][Specifies the desired socket state.]]
  18116. [[ec][Set to indicate what error occurred, if any.]]
  18117. ]
  18118. [heading Example]
  18119. Waiting for a socket to become readable.
  18120. boost::asio::ip::tcp::socket socket(my_context);
  18121. ...
  18122. boost::system::error_code ec;
  18123. socket.wait(boost::asio::ip::tcp::socket::wait_read, ec);
  18124. [endsect]
  18125. [endsect]
  18126. [section:wait_type basic_socket::wait_type]
  18127. ['Inherited from socket_base.]
  18128. [indexterm2 boost_asio.indexterm.basic_socket.wait_type..wait_type..basic_socket]
  18129. Wait types.
  18130. enum wait_type
  18131. [indexterm2 boost_asio.indexterm.basic_socket.wait_type.wait_read..wait_read..basic_socket]
  18132. [indexterm2 boost_asio.indexterm.basic_socket.wait_type.wait_write..wait_write..basic_socket]
  18133. [indexterm2 boost_asio.indexterm.basic_socket.wait_type.wait_error..wait_error..basic_socket]
  18134. [heading Values]
  18135. [variablelist
  18136. [
  18137. [wait_read]
  18138. [Wait for a socket to become ready to read. ]
  18139. ]
  18140. [
  18141. [wait_write]
  18142. [Wait for a socket to become ready to write. ]
  18143. ]
  18144. [
  18145. [wait_error]
  18146. [Wait for a socket to have error conditions pending. ]
  18147. ]
  18148. ]
  18149. For use with `basic_socket::wait()` and `basic_socket::async_wait()`.
  18150. [endsect]
  18151. [section:_basic_socket basic_socket::~basic_socket]
  18152. [indexterm2 boost_asio.indexterm.basic_socket._basic_socket..~basic_socket..basic_socket]
  18153. Protected destructor to prevent deletion through this type.
  18154. ~basic_socket();
  18155. This function destroys the socket, cancelling any outstanding asynchronous operations associated with the socket as if by calling `cancel`.
  18156. [endsect]
  18157. [endsect]
  18158. [section:basic_socket__rebind_executor basic_socket::rebind_executor]
  18159. Rebinds the socket type to another executor.
  18160. template<
  18161. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  18162. struct rebind_executor
  18163. [heading Types]
  18164. [table
  18165. [[Name][Description]]
  18166. [
  18167. [[link boost_asio.reference.basic_socket__rebind_executor.other [*other]]]
  18168. [The socket type when rebound to the specified executor. ]
  18169. ]
  18170. ]
  18171. [heading Requirements]
  18172. ['Header: ][^boost/asio/basic_socket.hpp]
  18173. ['Convenience header: ][^boost/asio.hpp]
  18174. [section:other basic_socket::rebind_executor::other]
  18175. [indexterm2 boost_asio.indexterm.basic_socket__rebind_executor.other..other..basic_socket::rebind_executor]
  18176. The socket type when rebound to the specified executor.
  18177. typedef basic_socket< Protocol, Executor1 > other;
  18178. [heading Types]
  18179. [table
  18180. [[Name][Description]]
  18181. [
  18182. [[link boost_asio.reference.basic_socket__rebind_executor [*rebind_executor]]]
  18183. [Rebinds the socket type to another executor. ]
  18184. ]
  18185. [
  18186. [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]]
  18187. [Socket option to permit sending of broadcast messages. ]
  18188. ]
  18189. [
  18190. [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]]
  18191. [IO control command to get the amount of data that can be read without blocking. ]
  18192. ]
  18193. [
  18194. [[link boost_asio.reference.basic_socket.debug [*debug]]]
  18195. [Socket option to enable socket-level debugging. ]
  18196. ]
  18197. [
  18198. [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]]
  18199. [Socket option to prevent routing, use local interfaces only. ]
  18200. ]
  18201. [
  18202. [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]]
  18203. [Socket option to report aborted connections on accept. ]
  18204. ]
  18205. [
  18206. [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]]
  18207. [The endpoint type. ]
  18208. ]
  18209. [
  18210. [[link boost_asio.reference.basic_socket.executor_type [*executor_type]]]
  18211. [The type of the executor associated with the object. ]
  18212. ]
  18213. [
  18214. [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]]
  18215. [Socket option to send keep-alives. ]
  18216. ]
  18217. [
  18218. [[link boost_asio.reference.basic_socket.linger [*linger]]]
  18219. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  18220. ]
  18221. [
  18222. [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]]
  18223. [A basic_socket is always the lowest layer. ]
  18224. ]
  18225. [
  18226. [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]]
  18227. [Bitmask type for flags that can be passed to send and receive operations. ]
  18228. ]
  18229. [
  18230. [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]]
  18231. [The native representation of a socket. ]
  18232. ]
  18233. [
  18234. [[link boost_asio.reference.basic_socket.out_of_band_inline [*out_of_band_inline]]]
  18235. [Socket option for putting received out-of-band data inline. ]
  18236. ]
  18237. [
  18238. [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]]
  18239. [The protocol type. ]
  18240. ]
  18241. [
  18242. [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]]
  18243. [Socket option for the receive buffer size of a socket. ]
  18244. ]
  18245. [
  18246. [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]]
  18247. [Socket option for the receive low watermark. ]
  18248. ]
  18249. [
  18250. [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]]
  18251. [Socket option to allow the socket to be bound to an address that is already in use. ]
  18252. ]
  18253. [
  18254. [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]]
  18255. [Socket option for the send buffer size of a socket. ]
  18256. ]
  18257. [
  18258. [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]]
  18259. [Socket option for the send low watermark. ]
  18260. ]
  18261. [
  18262. [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]]
  18263. [Different ways a socket may be shutdown. ]
  18264. ]
  18265. [
  18266. [[link boost_asio.reference.basic_socket.wait_type [*wait_type]]]
  18267. [Wait types. ]
  18268. ]
  18269. ]
  18270. [heading Member Functions]
  18271. [table
  18272. [[Name][Description]]
  18273. [
  18274. [[link boost_asio.reference.basic_socket.assign [*assign]]]
  18275. [Assign an existing native socket to the socket. ]
  18276. ]
  18277. [
  18278. [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]]
  18279. [Start an asynchronous connect. ]
  18280. ]
  18281. [
  18282. [[link boost_asio.reference.basic_socket.async_wait [*async_wait]]]
  18283. [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  18284. ]
  18285. [
  18286. [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]]
  18287. [Determine whether the socket is at the out-of-band data mark. ]
  18288. ]
  18289. [
  18290. [[link boost_asio.reference.basic_socket.available [*available]]]
  18291. [Determine the number of bytes available for reading. ]
  18292. ]
  18293. [
  18294. [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]]]
  18295. [Construct a basic_socket without opening it.
  18296. [hr]
  18297. Construct and open a basic_socket.
  18298. [hr]
  18299. Construct a basic_socket, opening it and binding it to the given local endpoint.
  18300. [hr]
  18301. Construct a basic_socket on an existing native socket.
  18302. [hr]
  18303. Move-construct a basic_socket from another.
  18304. [hr]
  18305. Move-construct a basic_socket from a socket of another protocol type. ]
  18306. ]
  18307. [
  18308. [[link boost_asio.reference.basic_socket.bind [*bind]]]
  18309. [Bind the socket to the given local endpoint. ]
  18310. ]
  18311. [
  18312. [[link boost_asio.reference.basic_socket.cancel [*cancel]]]
  18313. [Cancel all asynchronous operations associated with the socket. ]
  18314. ]
  18315. [
  18316. [[link boost_asio.reference.basic_socket.close [*close]]]
  18317. [Close the socket. ]
  18318. ]
  18319. [
  18320. [[link boost_asio.reference.basic_socket.connect [*connect]]]
  18321. [Connect the socket to the specified endpoint. ]
  18322. ]
  18323. [
  18324. [[link boost_asio.reference.basic_socket.get_executor [*get_executor]]]
  18325. [Get the executor associated with the object. ]
  18326. ]
  18327. [
  18328. [[link boost_asio.reference.basic_socket.get_option [*get_option]]]
  18329. [Get an option from the socket. ]
  18330. ]
  18331. [
  18332. [[link boost_asio.reference.basic_socket.io_control [*io_control]]]
  18333. [Perform an IO control command on the socket. ]
  18334. ]
  18335. [
  18336. [[link boost_asio.reference.basic_socket.is_open [*is_open]]]
  18337. [Determine whether the socket is open. ]
  18338. ]
  18339. [
  18340. [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]]
  18341. [Get the local endpoint of the socket. ]
  18342. ]
  18343. [
  18344. [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]]
  18345. [Get a reference to the lowest layer.
  18346. [hr]
  18347. Get a const reference to the lowest layer. ]
  18348. ]
  18349. [
  18350. [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]]
  18351. [Get the native socket representation. ]
  18352. ]
  18353. [
  18354. [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]]
  18355. [Gets the non-blocking mode of the native socket implementation.
  18356. [hr]
  18357. Sets the non-blocking mode of the native socket implementation. ]
  18358. ]
  18359. [
  18360. [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]]
  18361. [Gets the non-blocking mode of the socket.
  18362. [hr]
  18363. Sets the non-blocking mode of the socket. ]
  18364. ]
  18365. [
  18366. [[link boost_asio.reference.basic_socket.open [*open]]]
  18367. [Open the socket using the specified protocol. ]
  18368. ]
  18369. [
  18370. [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]]
  18371. [Move-assign a basic_socket from another.
  18372. [hr]
  18373. Move-assign a basic_socket from a socket of another protocol type. ]
  18374. ]
  18375. [
  18376. [[link boost_asio.reference.basic_socket.release [*release]]]
  18377. [Release ownership of the underlying native socket. ]
  18378. ]
  18379. [
  18380. [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]]
  18381. [Get the remote endpoint of the socket. ]
  18382. ]
  18383. [
  18384. [[link boost_asio.reference.basic_socket.set_option [*set_option]]]
  18385. [Set an option on the socket. ]
  18386. ]
  18387. [
  18388. [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]]
  18389. [Disable sends or receives on the socket. ]
  18390. ]
  18391. [
  18392. [[link boost_asio.reference.basic_socket.wait [*wait]]]
  18393. [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  18394. ]
  18395. ]
  18396. [heading Protected Member Functions]
  18397. [table
  18398. [[Name][Description]]
  18399. [
  18400. [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]]]
  18401. [Protected destructor to prevent deletion through this type. ]
  18402. ]
  18403. ]
  18404. [heading Data Members]
  18405. [table
  18406. [[Name][Description]]
  18407. [
  18408. [[link boost_asio.reference.basic_socket.max_connections [*max_connections]]]
  18409. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  18410. ]
  18411. [
  18412. [[link boost_asio.reference.basic_socket.max_listen_connections [*max_listen_connections]]]
  18413. [The maximum length of the queue of pending incoming connections. ]
  18414. ]
  18415. [
  18416. [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]]]
  18417. [Specify that the data should not be subject to routing. ]
  18418. ]
  18419. [
  18420. [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]]]
  18421. [Specifies that the data marks the end of a record. ]
  18422. ]
  18423. [
  18424. [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]]]
  18425. [Process out-of-band data. ]
  18426. ]
  18427. [
  18428. [[link boost_asio.reference.basic_socket.message_peek [*message_peek]]]
  18429. [Peek at incoming data without removing it from the input queue. ]
  18430. ]
  18431. ]
  18432. [heading Protected Data Members]
  18433. [table
  18434. [[Name][Description]]
  18435. [
  18436. [[link boost_asio.reference.basic_socket.impl_ [*impl_]]]
  18437. []
  18438. ]
  18439. ]
  18440. The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
  18441. [heading Thread Safety]
  18442. ['Distinct] ['objects:] Safe.
  18443. ['Shared] ['objects:] Unsafe.
  18444. [heading Requirements]
  18445. ['Header: ][^boost/asio/basic_socket.hpp]
  18446. ['Convenience header: ][^boost/asio.hpp]
  18447. [endsect]
  18448. [endsect]
  18449. [section:basic_socket_acceptor basic_socket_acceptor]
  18450. Provides the ability to accept new connections.
  18451. template<
  18452. typename ``[link boost_asio.reference.Protocol Protocol]``,
  18453. typename ``[link boost_asio.reference.Executor1 Executor]``>
  18454. class basic_socket_acceptor :
  18455. public socket_base
  18456. [heading Types]
  18457. [table
  18458. [[Name][Description]]
  18459. [
  18460. [[link boost_asio.reference.basic_socket_acceptor__rebind_executor [*rebind_executor]]]
  18461. [Rebinds the acceptor type to another executor. ]
  18462. ]
  18463. [
  18464. [[link boost_asio.reference.basic_socket_acceptor.broadcast [*broadcast]]]
  18465. [Socket option to permit sending of broadcast messages. ]
  18466. ]
  18467. [
  18468. [[link boost_asio.reference.basic_socket_acceptor.bytes_readable [*bytes_readable]]]
  18469. [IO control command to get the amount of data that can be read without blocking. ]
  18470. ]
  18471. [
  18472. [[link boost_asio.reference.basic_socket_acceptor.debug [*debug]]]
  18473. [Socket option to enable socket-level debugging. ]
  18474. ]
  18475. [
  18476. [[link boost_asio.reference.basic_socket_acceptor.do_not_route [*do_not_route]]]
  18477. [Socket option to prevent routing, use local interfaces only. ]
  18478. ]
  18479. [
  18480. [[link boost_asio.reference.basic_socket_acceptor.enable_connection_aborted [*enable_connection_aborted]]]
  18481. [Socket option to report aborted connections on accept. ]
  18482. ]
  18483. [
  18484. [[link boost_asio.reference.basic_socket_acceptor.endpoint_type [*endpoint_type]]]
  18485. [The endpoint type. ]
  18486. ]
  18487. [
  18488. [[link boost_asio.reference.basic_socket_acceptor.executor_type [*executor_type]]]
  18489. [The type of the executor associated with the object. ]
  18490. ]
  18491. [
  18492. [[link boost_asio.reference.basic_socket_acceptor.keep_alive [*keep_alive]]]
  18493. [Socket option to send keep-alives. ]
  18494. ]
  18495. [
  18496. [[link boost_asio.reference.basic_socket_acceptor.linger [*linger]]]
  18497. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  18498. ]
  18499. [
  18500. [[link boost_asio.reference.basic_socket_acceptor.message_flags [*message_flags]]]
  18501. [Bitmask type for flags that can be passed to send and receive operations. ]
  18502. ]
  18503. [
  18504. [[link boost_asio.reference.basic_socket_acceptor.native_handle_type [*native_handle_type]]]
  18505. [The native representation of an acceptor. ]
  18506. ]
  18507. [
  18508. [[link boost_asio.reference.basic_socket_acceptor.out_of_band_inline [*out_of_band_inline]]]
  18509. [Socket option for putting received out-of-band data inline. ]
  18510. ]
  18511. [
  18512. [[link boost_asio.reference.basic_socket_acceptor.protocol_type [*protocol_type]]]
  18513. [The protocol type. ]
  18514. ]
  18515. [
  18516. [[link boost_asio.reference.basic_socket_acceptor.receive_buffer_size [*receive_buffer_size]]]
  18517. [Socket option for the receive buffer size of a socket. ]
  18518. ]
  18519. [
  18520. [[link boost_asio.reference.basic_socket_acceptor.receive_low_watermark [*receive_low_watermark]]]
  18521. [Socket option for the receive low watermark. ]
  18522. ]
  18523. [
  18524. [[link boost_asio.reference.basic_socket_acceptor.reuse_address [*reuse_address]]]
  18525. [Socket option to allow the socket to be bound to an address that is already in use. ]
  18526. ]
  18527. [
  18528. [[link boost_asio.reference.basic_socket_acceptor.send_buffer_size [*send_buffer_size]]]
  18529. [Socket option for the send buffer size of a socket. ]
  18530. ]
  18531. [
  18532. [[link boost_asio.reference.basic_socket_acceptor.send_low_watermark [*send_low_watermark]]]
  18533. [Socket option for the send low watermark. ]
  18534. ]
  18535. [
  18536. [[link boost_asio.reference.basic_socket_acceptor.shutdown_type [*shutdown_type]]]
  18537. [Different ways a socket may be shutdown. ]
  18538. ]
  18539. [
  18540. [[link boost_asio.reference.basic_socket_acceptor.wait_type [*wait_type]]]
  18541. [Wait types. ]
  18542. ]
  18543. ]
  18544. [heading Member Functions]
  18545. [table
  18546. [[Name][Description]]
  18547. [
  18548. [[link boost_asio.reference.basic_socket_acceptor.accept [*accept]]]
  18549. [Accept a new connection.
  18550. [hr]
  18551. Accept a new connection and obtain the endpoint of the peer. ]
  18552. ]
  18553. [
  18554. [[link boost_asio.reference.basic_socket_acceptor.assign [*assign]]]
  18555. [Assigns an existing native acceptor to the acceptor. ]
  18556. ]
  18557. [
  18558. [[link boost_asio.reference.basic_socket_acceptor.async_accept [*async_accept]]]
  18559. [Start an asynchronous accept. ]
  18560. ]
  18561. [
  18562. [[link boost_asio.reference.basic_socket_acceptor.async_wait [*async_wait]]]
  18563. [Asynchronously wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. ]
  18564. ]
  18565. [
  18566. [[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor [*basic_socket_acceptor]]]
  18567. [Construct an acceptor without opening it.
  18568. [hr]
  18569. Construct an open acceptor.
  18570. [hr]
  18571. Construct an acceptor opened on the given endpoint.
  18572. [hr]
  18573. Construct a basic_socket_acceptor on an existing native acceptor.
  18574. [hr]
  18575. Move-construct a basic_socket_acceptor from another.
  18576. [hr]
  18577. Move-construct a basic_socket_acceptor from an acceptor of another protocol type. ]
  18578. ]
  18579. [
  18580. [[link boost_asio.reference.basic_socket_acceptor.bind [*bind]]]
  18581. [Bind the acceptor to the given local endpoint. ]
  18582. ]
  18583. [
  18584. [[link boost_asio.reference.basic_socket_acceptor.cancel [*cancel]]]
  18585. [Cancel all asynchronous operations associated with the acceptor. ]
  18586. ]
  18587. [
  18588. [[link boost_asio.reference.basic_socket_acceptor.close [*close]]]
  18589. [Close the acceptor. ]
  18590. ]
  18591. [
  18592. [[link boost_asio.reference.basic_socket_acceptor.get_executor [*get_executor]]]
  18593. [Get the executor associated with the object. ]
  18594. ]
  18595. [
  18596. [[link boost_asio.reference.basic_socket_acceptor.get_option [*get_option]]]
  18597. [Get an option from the acceptor. ]
  18598. ]
  18599. [
  18600. [[link boost_asio.reference.basic_socket_acceptor.io_control [*io_control]]]
  18601. [Perform an IO control command on the acceptor. ]
  18602. ]
  18603. [
  18604. [[link boost_asio.reference.basic_socket_acceptor.is_open [*is_open]]]
  18605. [Determine whether the acceptor is open. ]
  18606. ]
  18607. [
  18608. [[link boost_asio.reference.basic_socket_acceptor.listen [*listen]]]
  18609. [Place the acceptor into the state where it will listen for new connections. ]
  18610. ]
  18611. [
  18612. [[link boost_asio.reference.basic_socket_acceptor.local_endpoint [*local_endpoint]]]
  18613. [Get the local endpoint of the acceptor. ]
  18614. ]
  18615. [
  18616. [[link boost_asio.reference.basic_socket_acceptor.native_handle [*native_handle]]]
  18617. [Get the native acceptor representation. ]
  18618. ]
  18619. [
  18620. [[link boost_asio.reference.basic_socket_acceptor.native_non_blocking [*native_non_blocking]]]
  18621. [Gets the non-blocking mode of the native acceptor implementation.
  18622. [hr]
  18623. Sets the non-blocking mode of the native acceptor implementation. ]
  18624. ]
  18625. [
  18626. [[link boost_asio.reference.basic_socket_acceptor.non_blocking [*non_blocking]]]
  18627. [Gets the non-blocking mode of the acceptor.
  18628. [hr]
  18629. Sets the non-blocking mode of the acceptor. ]
  18630. ]
  18631. [
  18632. [[link boost_asio.reference.basic_socket_acceptor.open [*open]]]
  18633. [Open the acceptor using the specified protocol. ]
  18634. ]
  18635. [
  18636. [[link boost_asio.reference.basic_socket_acceptor.operator_eq_ [*operator=]]]
  18637. [Move-assign a basic_socket_acceptor from another.
  18638. [hr]
  18639. Move-assign a basic_socket_acceptor from an acceptor of another protocol type. ]
  18640. ]
  18641. [
  18642. [[link boost_asio.reference.basic_socket_acceptor.release [*release]]]
  18643. [Release ownership of the underlying native acceptor. ]
  18644. ]
  18645. [
  18646. [[link boost_asio.reference.basic_socket_acceptor.set_option [*set_option]]]
  18647. [Set an option on the acceptor. ]
  18648. ]
  18649. [
  18650. [[link boost_asio.reference.basic_socket_acceptor.wait [*wait]]]
  18651. [Wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. ]
  18652. ]
  18653. [
  18654. [[link boost_asio.reference.basic_socket_acceptor._basic_socket_acceptor [*~basic_socket_acceptor]]]
  18655. [Destroys the acceptor. ]
  18656. ]
  18657. ]
  18658. [heading Data Members]
  18659. [table
  18660. [[Name][Description]]
  18661. [
  18662. [[link boost_asio.reference.basic_socket_acceptor.max_connections [*max_connections]]]
  18663. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  18664. ]
  18665. [
  18666. [[link boost_asio.reference.basic_socket_acceptor.max_listen_connections [*max_listen_connections]]]
  18667. [The maximum length of the queue of pending incoming connections. ]
  18668. ]
  18669. [
  18670. [[link boost_asio.reference.basic_socket_acceptor.message_do_not_route [*message_do_not_route]]]
  18671. [Specify that the data should not be subject to routing. ]
  18672. ]
  18673. [
  18674. [[link boost_asio.reference.basic_socket_acceptor.message_end_of_record [*message_end_of_record]]]
  18675. [Specifies that the data marks the end of a record. ]
  18676. ]
  18677. [
  18678. [[link boost_asio.reference.basic_socket_acceptor.message_out_of_band [*message_out_of_band]]]
  18679. [Process out-of-band data. ]
  18680. ]
  18681. [
  18682. [[link boost_asio.reference.basic_socket_acceptor.message_peek [*message_peek]]]
  18683. [Peek at incoming data without removing it from the input queue. ]
  18684. ]
  18685. ]
  18686. The [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] class template is used for accepting new socket connections.
  18687. [heading Thread Safety]
  18688. ['Distinct] ['objects:] Safe.
  18689. ['Shared] ['objects:] Unsafe.
  18690. [heading Example]
  18691. Opening a socket acceptor with the SO\_REUSEADDR option enabled:
  18692. boost::asio::ip::tcp::acceptor acceptor(my_context);
  18693. boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), port);
  18694. acceptor.open(endpoint.protocol());
  18695. acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
  18696. acceptor.bind(endpoint);
  18697. acceptor.listen();
  18698. [heading Requirements]
  18699. ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
  18700. ['Convenience header: ][^boost/asio.hpp]
  18701. [section:accept basic_socket_acceptor::accept]
  18702. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.accept..accept..basic_socket_acceptor]
  18703. Accept a new connection.
  18704. template<
  18705. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  18706. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  18707. void ``[link boost_asio.reference.basic_socket_acceptor.accept.overload1 accept]``(
  18708. basic_socket< Protocol1, Executor1 > & peer,
  18709. typename enable_if< is_convertible< Protocol, Protocol1 >::value >::type * = 0);
  18710. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload1 more...]]``
  18711. template<
  18712. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  18713. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  18714. void ``[link boost_asio.reference.basic_socket_acceptor.accept.overload2 accept]``(
  18715. basic_socket< Protocol1, Executor1 > & peer,
  18716. boost::system::error_code & ec,
  18717. typename enable_if< is_convertible< Protocol, Protocol1 >::value >::type * = 0);
  18718. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload2 more...]]``
  18719. Accept a new connection and obtain the endpoint of the peer.
  18720. template<
  18721. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  18722. void ``[link boost_asio.reference.basic_socket_acceptor.accept.overload3 accept]``(
  18723. basic_socket< protocol_type, Executor1 > & peer,
  18724. endpoint_type & peer_endpoint);
  18725. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload3 more...]]``
  18726. template<
  18727. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  18728. void ``[link boost_asio.reference.basic_socket_acceptor.accept.overload4 accept]``(
  18729. basic_socket< protocol_type, Executor1 > & peer,
  18730. endpoint_type & peer_endpoint,
  18731. boost::system::error_code & ec);
  18732. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload4 more...]]``
  18733. Protocol::socket::template rebind_executor< executor_type >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload5 accept]``();
  18734. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload5 more...]]``
  18735. Protocol::socket::template rebind_executor< executor_type >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload6 accept]``(
  18736. boost::system::error_code & ec);
  18737. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload6 more...]]``
  18738. template<
  18739. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  18740. Protocol::socket::template rebind_executor< Executor1 >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload7 accept]``(
  18741. const Executor1 & ex,
  18742. typename enable_if< is_executor< Executor1 >::value >::type * = 0);
  18743. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload7 more...]]``
  18744. template<
  18745. typename ExecutionContext>
  18746. Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload8 accept]``(
  18747. ExecutionContext & context,
  18748. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  18749. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload8 more...]]``
  18750. template<
  18751. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  18752. Protocol::socket::template rebind_executor< Executor1 >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload9 accept]``(
  18753. const Executor1 & ex,
  18754. boost::system::error_code & ec,
  18755. typename enable_if< is_executor< Executor1 >::value >::type * = 0);
  18756. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload9 more...]]``
  18757. template<
  18758. typename ExecutionContext>
  18759. Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload10 accept]``(
  18760. ExecutionContext & context,
  18761. boost::system::error_code & ec,
  18762. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  18763. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload10 more...]]``
  18764. Protocol::socket::template rebind_executor< executor_type >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload11 accept]``(
  18765. endpoint_type & peer_endpoint);
  18766. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload11 more...]]``
  18767. Protocol::socket::template rebind_executor< executor_type >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload12 accept]``(
  18768. endpoint_type & peer_endpoint,
  18769. boost::system::error_code & ec);
  18770. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload12 more...]]``
  18771. template<
  18772. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  18773. Protocol::socket::template rebind_executor< Executor1 >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload13 accept]``(
  18774. const Executor1 & ex,
  18775. endpoint_type & peer_endpoint,
  18776. typename enable_if< is_executor< Executor1 >::value >::type * = 0);
  18777. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload13 more...]]``
  18778. template<
  18779. typename ExecutionContext>
  18780. Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload14 accept]``(
  18781. ExecutionContext & context,
  18782. endpoint_type & peer_endpoint,
  18783. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  18784. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload14 more...]]``
  18785. template<
  18786. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  18787. Protocol::socket::template rebind_executor< Executor1 >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload15 accept]``(
  18788. const executor_type & ex,
  18789. endpoint_type & peer_endpoint,
  18790. boost::system::error_code & ec,
  18791. typename enable_if< is_executor< Executor1 >::value >::type * = 0);
  18792. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload15 more...]]``
  18793. template<
  18794. typename ExecutionContext>
  18795. Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type >::other ``[link boost_asio.reference.basic_socket_acceptor.accept.overload16 accept]``(
  18796. ExecutionContext & context,
  18797. endpoint_type & peer_endpoint,
  18798. boost::system::error_code & ec,
  18799. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  18800. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload16 more...]]``
  18801. [section:overload1 basic_socket_acceptor::accept (1 of 16 overloads)]
  18802. Accept a new connection.
  18803. template<
  18804. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  18805. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  18806. void accept(
  18807. basic_socket< Protocol1, Executor1 > & peer,
  18808. typename enable_if< is_convertible< Protocol, Protocol1 >::value >::type * = 0);
  18809. This function is used to accept a new connection from a peer into the given socket. The function call will block until a new connection has been accepted successfully or an error occurs.
  18810. [heading Parameters]
  18811. [variablelist
  18812. [[peer][The socket into which the new connection will be accepted.]]
  18813. ]
  18814. [heading Exceptions]
  18815. [variablelist
  18816. [[boost::system::system_error][Thrown on failure.]]
  18817. ]
  18818. [heading Example]
  18819. boost::asio::ip::tcp::acceptor acceptor(my_context);
  18820. ...
  18821. boost::asio::ip::tcp::socket socket(my_context);
  18822. acceptor.accept(socket);
  18823. [endsect]
  18824. [section:overload2 basic_socket_acceptor::accept (2 of 16 overloads)]
  18825. Accept a new connection.
  18826. template<
  18827. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  18828. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  18829. void accept(
  18830. basic_socket< Protocol1, Executor1 > & peer,
  18831. boost::system::error_code & ec,
  18832. typename enable_if< is_convertible< Protocol, Protocol1 >::value >::type * = 0);
  18833. This function is used to accept a new connection from a peer into the given socket. The function call will block until a new connection has been accepted successfully or an error occurs.
  18834. [heading Parameters]
  18835. [variablelist
  18836. [[peer][The socket into which the new connection will be accepted.]]
  18837. [[ec][Set to indicate what error occurred, if any.]]
  18838. ]
  18839. [heading Example]
  18840. boost::asio::ip::tcp::acceptor acceptor(my_context);
  18841. ...
  18842. boost::asio::ip::tcp::socket socket(my_context);
  18843. boost::system::error_code ec;
  18844. acceptor.accept(socket, ec);
  18845. if (ec)
  18846. {
  18847. // An error occurred.
  18848. }
  18849. [endsect]
  18850. [section:overload3 basic_socket_acceptor::accept (3 of 16 overloads)]
  18851. Accept a new connection and obtain the endpoint of the peer.
  18852. template<
  18853. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  18854. void accept(
  18855. basic_socket< protocol_type, Executor1 > & peer,
  18856. endpoint_type & peer_endpoint);
  18857. This function is used to accept a new connection from a peer into the given socket, and additionally provide the endpoint of the remote peer. The function call will block until a new connection has been accepted successfully or an error occurs.
  18858. [heading Parameters]
  18859. [variablelist
  18860. [[peer][The socket into which the new connection will be accepted.]]
  18861. [[peer_endpoint][An endpoint object which will receive the endpoint of the remote peer.]]
  18862. ]
  18863. [heading Exceptions]
  18864. [variablelist
  18865. [[boost::system::system_error][Thrown on failure.]]
  18866. ]
  18867. [heading Example]
  18868. boost::asio::ip::tcp::acceptor acceptor(my_context);
  18869. ...
  18870. boost::asio::ip::tcp::socket socket(my_context);
  18871. boost::asio::ip::tcp::endpoint endpoint;
  18872. acceptor.accept(socket, endpoint);
  18873. [endsect]
  18874. [section:overload4 basic_socket_acceptor::accept (4 of 16 overloads)]
  18875. Accept a new connection and obtain the endpoint of the peer.
  18876. template<
  18877. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  18878. void accept(
  18879. basic_socket< protocol_type, Executor1 > & peer,
  18880. endpoint_type & peer_endpoint,
  18881. boost::system::error_code & ec);
  18882. This function is used to accept a new connection from a peer into the given socket, and additionally provide the endpoint of the remote peer. The function call will block until a new connection has been accepted successfully or an error occurs.
  18883. [heading Parameters]
  18884. [variablelist
  18885. [[peer][The socket into which the new connection will be accepted.]]
  18886. [[peer_endpoint][An endpoint object which will receive the endpoint of the remote peer.]]
  18887. [[ec][Set to indicate what error occurred, if any.]]
  18888. ]
  18889. [heading Example]
  18890. boost::asio::ip::tcp::acceptor acceptor(my_context);
  18891. ...
  18892. boost::asio::ip::tcp::socket socket(my_context);
  18893. boost::asio::ip::tcp::endpoint endpoint;
  18894. boost::system::error_code ec;
  18895. acceptor.accept(socket, endpoint, ec);
  18896. if (ec)
  18897. {
  18898. // An error occurred.
  18899. }
  18900. [endsect]
  18901. [section:overload5 basic_socket_acceptor::accept (5 of 16 overloads)]
  18902. Accept a new connection.
  18903. Protocol::socket::template rebind_executor< executor_type >::other accept();
  18904. This function is used to accept a new connection from a peer. The function call will block until a new connection has been accepted successfully or an error occurs.
  18905. This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
  18906. [heading Return Value]
  18907. A socket object representing the newly accepted connection.
  18908. [heading Exceptions]
  18909. [variablelist
  18910. [[boost::system::system_error][Thrown on failure.]]
  18911. ]
  18912. [heading Example]
  18913. boost::asio::ip::tcp::acceptor acceptor(my_context);
  18914. ...
  18915. boost::asio::ip::tcp::socket socket(acceptor.accept());
  18916. [endsect]
  18917. [section:overload6 basic_socket_acceptor::accept (6 of 16 overloads)]
  18918. Accept a new connection.
  18919. Protocol::socket::template rebind_executor< executor_type >::other accept(
  18920. boost::system::error_code & ec);
  18921. This function is used to accept a new connection from a peer. The function call will block until a new connection has been accepted successfully or an error occurs.
  18922. This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
  18923. [heading Parameters]
  18924. [variablelist
  18925. [[ec][Set to indicate what error occurred, if any.]]
  18926. ]
  18927. [heading Return Value]
  18928. On success, a socket object representing the newly accepted connection. On error, a socket object where `is_open()` is false.
  18929. [heading Example]
  18930. boost::asio::ip::tcp::acceptor acceptor(my_context);
  18931. ...
  18932. boost::asio::ip::tcp::socket socket(acceptor.accept(ec));
  18933. if (ec)
  18934. {
  18935. // An error occurred.
  18936. }
  18937. [endsect]
  18938. [section:overload7 basic_socket_acceptor::accept (7 of 16 overloads)]
  18939. Accept a new connection.
  18940. template<
  18941. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  18942. Protocol::socket::template rebind_executor< Executor1 >::other accept(
  18943. const Executor1 & ex,
  18944. typename enable_if< is_executor< Executor1 >::value >::type * = 0);
  18945. This function is used to accept a new connection from a peer. The function call will block until a new connection has been accepted successfully or an error occurs.
  18946. This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
  18947. [heading Parameters]
  18948. [variablelist
  18949. [[ex][The I/O executor object to be used for the newly accepted socket.]]
  18950. ]
  18951. [heading Return Value]
  18952. A socket object representing the newly accepted connection.
  18953. [heading Exceptions]
  18954. [variablelist
  18955. [[boost::system::system_error][Thrown on failure.]]
  18956. ]
  18957. [heading Example]
  18958. boost::asio::ip::tcp::acceptor acceptor(my_context);
  18959. ...
  18960. boost::asio::ip::tcp::socket socket(acceptor.accept());
  18961. [endsect]
  18962. [section:overload8 basic_socket_acceptor::accept (8 of 16 overloads)]
  18963. Accept a new connection.
  18964. template<
  18965. typename ExecutionContext>
  18966. Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type >::other accept(
  18967. ExecutionContext & context,
  18968. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  18969. This function is used to accept a new connection from a peer. The function call will block until a new connection has been accepted successfully or an error occurs.
  18970. This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
  18971. [heading Parameters]
  18972. [variablelist
  18973. [[context][The I/O execution context object to be used for the newly accepted socket.]]
  18974. ]
  18975. [heading Return Value]
  18976. A socket object representing the newly accepted connection.
  18977. [heading Exceptions]
  18978. [variablelist
  18979. [[boost::system::system_error][Thrown on failure.]]
  18980. ]
  18981. [heading Example]
  18982. boost::asio::ip::tcp::acceptor acceptor(my_context);
  18983. ...
  18984. boost::asio::ip::tcp::socket socket(acceptor.accept());
  18985. [endsect]
  18986. [section:overload9 basic_socket_acceptor::accept (9 of 16 overloads)]
  18987. Accept a new connection.
  18988. template<
  18989. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  18990. Protocol::socket::template rebind_executor< Executor1 >::other accept(
  18991. const Executor1 & ex,
  18992. boost::system::error_code & ec,
  18993. typename enable_if< is_executor< Executor1 >::value >::type * = 0);
  18994. This function is used to accept a new connection from a peer. The function call will block until a new connection has been accepted successfully or an error occurs.
  18995. This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
  18996. [heading Parameters]
  18997. [variablelist
  18998. [[ex][The I/O executor object to be used for the newly accepted socket.]]
  18999. [[ec][Set to indicate what error occurred, if any.]]
  19000. ]
  19001. [heading Return Value]
  19002. On success, a socket object representing the newly accepted connection. On error, a socket object where `is_open()` is false.
  19003. [heading Example]
  19004. boost::asio::ip::tcp::acceptor acceptor(my_context);
  19005. ...
  19006. boost::asio::ip::tcp::socket socket(acceptor.accept(my_context2, ec));
  19007. if (ec)
  19008. {
  19009. // An error occurred.
  19010. }
  19011. [endsect]
  19012. [section:overload10 basic_socket_acceptor::accept (10 of 16 overloads)]
  19013. Accept a new connection.
  19014. template<
  19015. typename ExecutionContext>
  19016. Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type >::other accept(
  19017. ExecutionContext & context,
  19018. boost::system::error_code & ec,
  19019. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  19020. This function is used to accept a new connection from a peer. The function call will block until a new connection has been accepted successfully or an error occurs.
  19021. This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
  19022. [heading Parameters]
  19023. [variablelist
  19024. [[context][The I/O execution context object to be used for the newly accepted socket.]]
  19025. [[ec][Set to indicate what error occurred, if any.]]
  19026. ]
  19027. [heading Return Value]
  19028. On success, a socket object representing the newly accepted connection. On error, a socket object where `is_open()` is false.
  19029. [heading Example]
  19030. boost::asio::ip::tcp::acceptor acceptor(my_context);
  19031. ...
  19032. boost::asio::ip::tcp::socket socket(acceptor.accept(my_context2, ec));
  19033. if (ec)
  19034. {
  19035. // An error occurred.
  19036. }
  19037. [endsect]
  19038. [section:overload11 basic_socket_acceptor::accept (11 of 16 overloads)]
  19039. Accept a new connection.
  19040. Protocol::socket::template rebind_executor< executor_type >::other accept(
  19041. endpoint_type & peer_endpoint);
  19042. This function is used to accept a new connection from a peer. The function call will block until a new connection has been accepted successfully or an error occurs.
  19043. This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
  19044. [heading Parameters]
  19045. [variablelist
  19046. [[peer_endpoint][An endpoint object into which the endpoint of the remote peer will be written.]]
  19047. ]
  19048. [heading Return Value]
  19049. A socket object representing the newly accepted connection.
  19050. [heading Exceptions]
  19051. [variablelist
  19052. [[boost::system::system_error][Thrown on failure.]]
  19053. ]
  19054. [heading Example]
  19055. boost::asio::ip::tcp::acceptor acceptor(my_context);
  19056. ...
  19057. boost::asio::ip::tcp::endpoint endpoint;
  19058. boost::asio::ip::tcp::socket socket(acceptor.accept(endpoint));
  19059. [endsect]
  19060. [section:overload12 basic_socket_acceptor::accept (12 of 16 overloads)]
  19061. Accept a new connection.
  19062. Protocol::socket::template rebind_executor< executor_type >::other accept(
  19063. endpoint_type & peer_endpoint,
  19064. boost::system::error_code & ec);
  19065. This function is used to accept a new connection from a peer. The function call will block until a new connection has been accepted successfully or an error occurs.
  19066. This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
  19067. [heading Parameters]
  19068. [variablelist
  19069. [[peer_endpoint][An endpoint object into which the endpoint of the remote peer will be written.]]
  19070. [[ec][Set to indicate what error occurred, if any.]]
  19071. ]
  19072. [heading Return Value]
  19073. On success, a socket object representing the newly accepted connection. On error, a socket object where `is_open()` is false.
  19074. [heading Example]
  19075. boost::asio::ip::tcp::acceptor acceptor(my_context);
  19076. ...
  19077. boost::asio::ip::tcp::endpoint endpoint;
  19078. boost::asio::ip::tcp::socket socket(acceptor.accept(endpoint, ec));
  19079. if (ec)
  19080. {
  19081. // An error occurred.
  19082. }
  19083. [endsect]
  19084. [section:overload13 basic_socket_acceptor::accept (13 of 16 overloads)]
  19085. Accept a new connection.
  19086. template<
  19087. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  19088. Protocol::socket::template rebind_executor< Executor1 >::other accept(
  19089. const Executor1 & ex,
  19090. endpoint_type & peer_endpoint,
  19091. typename enable_if< is_executor< Executor1 >::value >::type * = 0);
  19092. This function is used to accept a new connection from a peer. The function call will block until a new connection has been accepted successfully or an error occurs.
  19093. This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
  19094. [heading Parameters]
  19095. [variablelist
  19096. [[ex][The I/O executor object to be used for the newly accepted socket.]]
  19097. [[peer_endpoint][An endpoint object into which the endpoint of the remote peer will be written.]]
  19098. ]
  19099. [heading Return Value]
  19100. A socket object representing the newly accepted connection.
  19101. [heading Exceptions]
  19102. [variablelist
  19103. [[boost::system::system_error][Thrown on failure.]]
  19104. ]
  19105. [heading Example]
  19106. boost::asio::ip::tcp::acceptor acceptor(my_context);
  19107. ...
  19108. boost::asio::ip::tcp::endpoint endpoint;
  19109. boost::asio::ip::tcp::socket socket(
  19110. acceptor.accept(my_context2, endpoint));
  19111. [endsect]
  19112. [section:overload14 basic_socket_acceptor::accept (14 of 16 overloads)]
  19113. Accept a new connection.
  19114. template<
  19115. typename ExecutionContext>
  19116. Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type >::other accept(
  19117. ExecutionContext & context,
  19118. endpoint_type & peer_endpoint,
  19119. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  19120. This function is used to accept a new connection from a peer. The function call will block until a new connection has been accepted successfully or an error occurs.
  19121. This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
  19122. [heading Parameters]
  19123. [variablelist
  19124. [[context][The I/O execution context object to be used for the newly accepted socket.]]
  19125. [[peer_endpoint][An endpoint object into which the endpoint of the remote peer will be written.]]
  19126. ]
  19127. [heading Return Value]
  19128. A socket object representing the newly accepted connection.
  19129. [heading Exceptions]
  19130. [variablelist
  19131. [[boost::system::system_error][Thrown on failure.]]
  19132. ]
  19133. [heading Example]
  19134. boost::asio::ip::tcp::acceptor acceptor(my_context);
  19135. ...
  19136. boost::asio::ip::tcp::endpoint endpoint;
  19137. boost::asio::ip::tcp::socket socket(
  19138. acceptor.accept(my_context2, endpoint));
  19139. [endsect]
  19140. [section:overload15 basic_socket_acceptor::accept (15 of 16 overloads)]
  19141. Accept a new connection.
  19142. template<
  19143. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  19144. Protocol::socket::template rebind_executor< Executor1 >::other accept(
  19145. const executor_type & ex,
  19146. endpoint_type & peer_endpoint,
  19147. boost::system::error_code & ec,
  19148. typename enable_if< is_executor< Executor1 >::value >::type * = 0);
  19149. This function is used to accept a new connection from a peer. The function call will block until a new connection has been accepted successfully or an error occurs.
  19150. This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
  19151. [heading Parameters]
  19152. [variablelist
  19153. [[ex][The I/O executor object to be used for the newly accepted socket.]]
  19154. [[peer_endpoint][An endpoint object into which the endpoint of the remote peer will be written.]]
  19155. [[ec][Set to indicate what error occurred, if any.]]
  19156. ]
  19157. [heading Return Value]
  19158. On success, a socket object representing the newly accepted connection. On error, a socket object where `is_open()` is false.
  19159. [heading Example]
  19160. boost::asio::ip::tcp::acceptor acceptor(my_context);
  19161. ...
  19162. boost::asio::ip::tcp::endpoint endpoint;
  19163. boost::asio::ip::tcp::socket socket(
  19164. acceptor.accept(my_context2, endpoint, ec));
  19165. if (ec)
  19166. {
  19167. // An error occurred.
  19168. }
  19169. [endsect]
  19170. [section:overload16 basic_socket_acceptor::accept (16 of 16 overloads)]
  19171. Accept a new connection.
  19172. template<
  19173. typename ExecutionContext>
  19174. Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type >::other accept(
  19175. ExecutionContext & context,
  19176. endpoint_type & peer_endpoint,
  19177. boost::system::error_code & ec,
  19178. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  19179. This function is used to accept a new connection from a peer. The function call will block until a new connection has been accepted successfully or an error occurs.
  19180. This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
  19181. [heading Parameters]
  19182. [variablelist
  19183. [[context][The I/O execution context object to be used for the newly accepted socket.]]
  19184. [[peer_endpoint][An endpoint object into which the endpoint of the remote peer will be written.]]
  19185. [[ec][Set to indicate what error occurred, if any.]]
  19186. ]
  19187. [heading Return Value]
  19188. On success, a socket object representing the newly accepted connection. On error, a socket object where `is_open()` is false.
  19189. [heading Example]
  19190. boost::asio::ip::tcp::acceptor acceptor(my_context);
  19191. ...
  19192. boost::asio::ip::tcp::endpoint endpoint;
  19193. boost::asio::ip::tcp::socket socket(
  19194. acceptor.accept(my_context2, endpoint, ec));
  19195. if (ec)
  19196. {
  19197. // An error occurred.
  19198. }
  19199. [endsect]
  19200. [endsect]
  19201. [section:assign basic_socket_acceptor::assign]
  19202. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.assign..assign..basic_socket_acceptor]
  19203. Assigns an existing native acceptor to the acceptor.
  19204. void ``[link boost_asio.reference.basic_socket_acceptor.assign.overload1 assign]``(
  19205. const protocol_type & protocol,
  19206. const native_handle_type & native_acceptor);
  19207. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.assign.overload1 more...]]``
  19208. void ``[link boost_asio.reference.basic_socket_acceptor.assign.overload2 assign]``(
  19209. const protocol_type & protocol,
  19210. const native_handle_type & native_acceptor,
  19211. boost::system::error_code & ec);
  19212. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.assign.overload2 more...]]``
  19213. [section:overload1 basic_socket_acceptor::assign (1 of 2 overloads)]
  19214. Assigns an existing native acceptor to the acceptor.
  19215. void assign(
  19216. const protocol_type & protocol,
  19217. const native_handle_type & native_acceptor);
  19218. [endsect]
  19219. [section:overload2 basic_socket_acceptor::assign (2 of 2 overloads)]
  19220. Assigns an existing native acceptor to the acceptor.
  19221. void assign(
  19222. const protocol_type & protocol,
  19223. const native_handle_type & native_acceptor,
  19224. boost::system::error_code & ec);
  19225. [endsect]
  19226. [endsect]
  19227. [section:async_accept basic_socket_acceptor::async_accept]
  19228. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.async_accept..async_accept..basic_socket_acceptor]
  19229. Start an asynchronous accept.
  19230. template<
  19231. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  19232. typename ``[link boost_asio.reference.Executor1 Executor1]``,
  19233. typename ``[link boost_asio.reference.AcceptHandler AcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  19234. ``[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]``(
  19235. basic_socket< Protocol1, Executor1 > & peer,
  19236. AcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  19237. typename enable_if< is_convertible< Protocol, Protocol1 >::value >::type * = 0);
  19238. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.async_accept.overload1 more...]]``
  19239. template<
  19240. typename ``[link boost_asio.reference.Executor1 Executor1]``,
  19241. typename ``[link boost_asio.reference.AcceptHandler AcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  19242. ``[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]``(
  19243. basic_socket< protocol_type, Executor1 > & peer,
  19244. endpoint_type & peer_endpoint,
  19245. AcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  19246. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.async_accept.overload2 more...]]``
  19247. template<
  19248. typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  19249. ``[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]``(
  19250. MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  19251. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.async_accept.overload3 more...]]``
  19252. template<
  19253. typename ``[link boost_asio.reference.Executor1 Executor1]``,
  19254. typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  19255. ``[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]``(
  19256. const Executor1 & ex,
  19257. MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  19258. typename enable_if< is_executor< Executor1 >::value >::type * = 0);
  19259. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.async_accept.overload4 more...]]``
  19260. template<
  19261. typename ExecutionContext,
  19262. typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  19263. ``[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]``(
  19264. ExecutionContext & context,
  19265. MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  19266. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  19267. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.async_accept.overload5 more...]]``
  19268. template<
  19269. typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  19270. ``[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]``(
  19271. endpoint_type & peer_endpoint,
  19272. MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  19273. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.async_accept.overload6 more...]]``
  19274. template<
  19275. typename ``[link boost_asio.reference.Executor1 Executor1]``,
  19276. typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  19277. ``[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]``(
  19278. const Executor1 & ex,
  19279. endpoint_type & peer_endpoint,
  19280. MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  19281. typename enable_if< is_executor< Executor1 >::value >::type * = 0);
  19282. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.async_accept.overload7 more...]]``
  19283. template<
  19284. typename ExecutionContext,
  19285. typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  19286. ``[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]``(
  19287. ExecutionContext & context,
  19288. endpoint_type & peer_endpoint,
  19289. MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  19290. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  19291. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.async_accept.overload8 more...]]``
  19292. [section:overload1 basic_socket_acceptor::async_accept (1 of 8 overloads)]
  19293. Start an asynchronous accept.
  19294. template<
  19295. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  19296. typename ``[link boost_asio.reference.Executor1 Executor1]``,
  19297. typename ``[link boost_asio.reference.AcceptHandler AcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  19298. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_accept(
  19299. basic_socket< Protocol1, Executor1 > & peer,
  19300. AcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  19301. typename enable_if< is_convertible< Protocol, Protocol1 >::value >::type * = 0);
  19302. This function is used to asynchronously accept a new connection into a socket. The function call always returns immediately.
  19303. [heading Parameters]
  19304. [variablelist
  19305. [[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.]]
  19306. [[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:
  19307. ``
  19308. void handler(
  19309. const boost::system::error_code& error // Result of operation.
  19310. );
  19311. ``
  19312. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  19313. ]
  19314. [heading Example]
  19315. void accept_handler(const boost::system::error_code& error)
  19316. {
  19317. if (!error)
  19318. {
  19319. // Accept succeeded.
  19320. }
  19321. }
  19322. ...
  19323. boost::asio::ip::tcp::acceptor acceptor(my_context);
  19324. ...
  19325. boost::asio::ip::tcp::socket socket(my_context);
  19326. acceptor.async_accept(socket, accept_handler);
  19327. [endsect]
  19328. [section:overload2 basic_socket_acceptor::async_accept (2 of 8 overloads)]
  19329. Start an asynchronous accept.
  19330. template<
  19331. typename ``[link boost_asio.reference.Executor1 Executor1]``,
  19332. typename ``[link boost_asio.reference.AcceptHandler AcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  19333. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_accept(
  19334. basic_socket< protocol_type, Executor1 > & peer,
  19335. endpoint_type & peer_endpoint,
  19336. AcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  19337. This function is used to asynchronously accept a new connection into a socket, and additionally obtain the endpoint of the remote peer. The function call always returns immediately.
  19338. [heading Parameters]
  19339. [variablelist
  19340. [[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.]]
  19341. [[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.]]
  19342. [[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:
  19343. ``
  19344. void handler(
  19345. const boost::system::error_code& error // Result of operation.
  19346. );
  19347. ``
  19348. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
  19349. ]
  19350. [endsect]
  19351. [section:overload3 basic_socket_acceptor::async_accept (3 of 8 overloads)]
  19352. Start an asynchronous accept.
  19353. template<
  19354. typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  19355. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_accept(
  19356. MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  19357. This function is used to asynchronously accept a new connection. The function call always returns immediately.
  19358. This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
  19359. [heading Parameters]
  19360. [variablelist
  19361. [[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:
  19362. ``
  19363. void handler(
  19364. // Result of operation.
  19365. const boost::system::error_code& error,
  19366. // On success, the newly accepted socket.
  19367. typename Protocol::socket::template
  19368. rebind_executor<executor_type>::other peer
  19369. );
  19370. ``
  19371. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  19372. ]
  19373. [heading Example]
  19374. void accept_handler(const boost::system::error_code& error,
  19375. boost::asio::ip::tcp::socket peer)
  19376. {
  19377. if (!error)
  19378. {
  19379. // Accept succeeded.
  19380. }
  19381. }
  19382. ...
  19383. boost::asio::ip::tcp::acceptor acceptor(my_context);
  19384. ...
  19385. acceptor.async_accept(accept_handler);
  19386. [endsect]
  19387. [section:overload4 basic_socket_acceptor::async_accept (4 of 8 overloads)]
  19388. Start an asynchronous accept.
  19389. template<
  19390. typename ``[link boost_asio.reference.Executor1 Executor1]``,
  19391. typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  19392. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_accept(
  19393. const Executor1 & ex,
  19394. MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  19395. typename enable_if< is_executor< Executor1 >::value >::type * = 0);
  19396. This function is used to asynchronously accept a new connection. The function call always returns immediately.
  19397. This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
  19398. [heading Parameters]
  19399. [variablelist
  19400. [[ex][The I/O executor object to be used for the newly accepted socket.]]
  19401. [[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:
  19402. ``
  19403. void handler(
  19404. const boost::system::error_code& error, // Result of operation.
  19405. typename Protocol::socket::template rebind_executor<
  19406. Executor1>::other peer // On success, the newly accepted socket.
  19407. );
  19408. ``
  19409. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  19410. ]
  19411. [heading Example]
  19412. void accept_handler(const boost::system::error_code& error,
  19413. boost::asio::ip::tcp::socket peer)
  19414. {
  19415. if (!error)
  19416. {
  19417. // Accept succeeded.
  19418. }
  19419. }
  19420. ...
  19421. boost::asio::ip::tcp::acceptor acceptor(my_context);
  19422. ...
  19423. acceptor.async_accept(my_context2, accept_handler);
  19424. [endsect]
  19425. [section:overload5 basic_socket_acceptor::async_accept (5 of 8 overloads)]
  19426. Start an asynchronous accept.
  19427. template<
  19428. typename ExecutionContext,
  19429. typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  19430. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_accept(
  19431. ExecutionContext & context,
  19432. MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  19433. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  19434. This function is used to asynchronously accept a new connection. The function call always returns immediately.
  19435. This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
  19436. [heading Parameters]
  19437. [variablelist
  19438. [[context][The I/O execution context object to be used for the newly accepted socket.]]
  19439. [[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:
  19440. ``
  19441. void handler(
  19442. const boost::system::error_code& error, // Result of operation.
  19443. typename Protocol::socket::template rebind_executor<
  19444. typename ExecutionContext::executor_type>::other peer
  19445. // On success, the newly accepted socket.
  19446. );
  19447. ``
  19448. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  19449. ]
  19450. [heading Example]
  19451. void accept_handler(const boost::system::error_code& error,
  19452. boost::asio::ip::tcp::socket peer)
  19453. {
  19454. if (!error)
  19455. {
  19456. // Accept succeeded.
  19457. }
  19458. }
  19459. ...
  19460. boost::asio::ip::tcp::acceptor acceptor(my_context);
  19461. ...
  19462. acceptor.async_accept(my_context2, accept_handler);
  19463. [endsect]
  19464. [section:overload6 basic_socket_acceptor::async_accept (6 of 8 overloads)]
  19465. Start an asynchronous accept.
  19466. template<
  19467. typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  19468. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_accept(
  19469. endpoint_type & peer_endpoint,
  19470. MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  19471. This function is used to asynchronously accept a new connection. The function call always returns immediately.
  19472. This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
  19473. [heading Parameters]
  19474. [variablelist
  19475. [[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.]]
  19476. [[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:
  19477. ``
  19478. void handler(
  19479. // Result of operation.
  19480. const boost::system::error_code& error,
  19481. // On success, the newly accepted socket.
  19482. typename Protocol::socket::template
  19483. rebind_executor<executor_type>::other peer
  19484. );
  19485. ``
  19486. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  19487. ]
  19488. [heading Example]
  19489. void accept_handler(const boost::system::error_code& error,
  19490. boost::asio::ip::tcp::socket peer)
  19491. {
  19492. if (!error)
  19493. {
  19494. // Accept succeeded.
  19495. }
  19496. }
  19497. ...
  19498. boost::asio::ip::tcp::acceptor acceptor(my_context);
  19499. ...
  19500. boost::asio::ip::tcp::endpoint endpoint;
  19501. acceptor.async_accept(endpoint, accept_handler);
  19502. [endsect]
  19503. [section:overload7 basic_socket_acceptor::async_accept (7 of 8 overloads)]
  19504. Start an asynchronous accept.
  19505. template<
  19506. typename ``[link boost_asio.reference.Executor1 Executor1]``,
  19507. typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  19508. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_accept(
  19509. const Executor1 & ex,
  19510. endpoint_type & peer_endpoint,
  19511. MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  19512. typename enable_if< is_executor< Executor1 >::value >::type * = 0);
  19513. This function is used to asynchronously accept a new connection. The function call always returns immediately.
  19514. This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
  19515. [heading Parameters]
  19516. [variablelist
  19517. [[ex][The I/O executor object to be used for the newly accepted socket.]]
  19518. [[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.]]
  19519. [[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:
  19520. ``
  19521. void handler(
  19522. const boost::system::error_code& error, // Result of operation.
  19523. typename Protocol::socket::template rebind_executor<
  19524. Executor1>::other peer // On success, the newly accepted socket.
  19525. );
  19526. ``
  19527. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  19528. ]
  19529. [heading Example]
  19530. void accept_handler(const boost::system::error_code& error,
  19531. boost::asio::ip::tcp::socket peer)
  19532. {
  19533. if (!error)
  19534. {
  19535. // Accept succeeded.
  19536. }
  19537. }
  19538. ...
  19539. boost::asio::ip::tcp::acceptor acceptor(my_context);
  19540. ...
  19541. boost::asio::ip::tcp::endpoint endpoint;
  19542. acceptor.async_accept(my_context2, endpoint, accept_handler);
  19543. [endsect]
  19544. [section:overload8 basic_socket_acceptor::async_accept (8 of 8 overloads)]
  19545. Start an asynchronous accept.
  19546. template<
  19547. typename ExecutionContext,
  19548. typename ``[link boost_asio.reference.MoveAcceptHandler MoveAcceptHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  19549. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_accept(
  19550. ExecutionContext & context,
  19551. endpoint_type & peer_endpoint,
  19552. MoveAcceptHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  19553. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  19554. This function is used to asynchronously accept a new connection. The function call always returns immediately.
  19555. This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.
  19556. [heading Parameters]
  19557. [variablelist
  19558. [[context][The I/O execution context object to be used for the newly accepted socket.]]
  19559. [[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.]]
  19560. [[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:
  19561. ``
  19562. void handler(
  19563. const boost::system::error_code& error, // Result of operation.
  19564. typename Protocol::socket::template rebind_executor<
  19565. typename ExecutionContext::executor_type>::other peer
  19566. // On success, the newly accepted socket.
  19567. );
  19568. ``
  19569. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  19570. ]
  19571. [heading Example]
  19572. void accept_handler(const boost::system::error_code& error,
  19573. boost::asio::ip::tcp::socket peer)
  19574. {
  19575. if (!error)
  19576. {
  19577. // Accept succeeded.
  19578. }
  19579. }
  19580. ...
  19581. boost::asio::ip::tcp::acceptor acceptor(my_context);
  19582. ...
  19583. boost::asio::ip::tcp::endpoint endpoint;
  19584. acceptor.async_accept(my_context2, endpoint, accept_handler);
  19585. [endsect]
  19586. [endsect]
  19587. [section:async_wait basic_socket_acceptor::async_wait]
  19588. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.async_wait..async_wait..basic_socket_acceptor]
  19589. Asynchronously wait for the acceptor to become ready to read, ready to write, or to have pending error conditions.
  19590. template<
  19591. typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  19592. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait(
  19593. wait_type w,
  19594. WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  19595. This function is used to perform an asynchronous wait for an acceptor to enter a ready to read, write or error condition state.
  19596. [heading Parameters]
  19597. [variablelist
  19598. [[w][Specifies the desired acceptor state.]]
  19599. [[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:
  19600. ``
  19601. void handler(
  19602. const boost::system::error_code& error // Result of operation
  19603. );
  19604. ``
  19605. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  19606. ]
  19607. [heading Example]
  19608. void wait_handler(const boost::system::error_code& error)
  19609. {
  19610. if (!error)
  19611. {
  19612. // Wait succeeded.
  19613. }
  19614. }
  19615. ...
  19616. boost::asio::ip::tcp::acceptor acceptor(my_context);
  19617. ...
  19618. acceptor.async_wait(
  19619. boost::asio::ip::tcp::acceptor::wait_read,
  19620. wait_handler);
  19621. [endsect]
  19622. [section:basic_socket_acceptor basic_socket_acceptor::basic_socket_acceptor]
  19623. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.basic_socket_acceptor..basic_socket_acceptor..basic_socket_acceptor]
  19624. Construct an acceptor without opening it.
  19625. explicit ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload1 basic_socket_acceptor]``(
  19626. const executor_type & ex);
  19627. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload1 more...]]``
  19628. template<
  19629. typename ExecutionContext>
  19630. explicit ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload2 basic_socket_acceptor]``(
  19631. ExecutionContext & context,
  19632. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  19633. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload2 more...]]``
  19634. Construct an open acceptor.
  19635. ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload3 basic_socket_acceptor]``(
  19636. const executor_type & ex,
  19637. const protocol_type & protocol);
  19638. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload3 more...]]``
  19639. template<
  19640. typename ExecutionContext>
  19641. ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload4 basic_socket_acceptor]``(
  19642. ExecutionContext & context,
  19643. const protocol_type & protocol,
  19644. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  19645. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload4 more...]]``
  19646. Construct an acceptor opened on the given endpoint.
  19647. ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload5 basic_socket_acceptor]``(
  19648. const executor_type & ex,
  19649. const endpoint_type & endpoint,
  19650. bool reuse_addr = true);
  19651. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload5 more...]]``
  19652. template<
  19653. typename ExecutionContext>
  19654. ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload6 basic_socket_acceptor]``(
  19655. ExecutionContext & context,
  19656. const endpoint_type & endpoint,
  19657. bool reuse_addr = true,
  19658. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  19659. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload6 more...]]``
  19660. Construct a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] on an existing native acceptor.
  19661. ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload7 basic_socket_acceptor]``(
  19662. const executor_type & ex,
  19663. const protocol_type & protocol,
  19664. const native_handle_type & native_acceptor);
  19665. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload7 more...]]``
  19666. template<
  19667. typename ExecutionContext>
  19668. ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload8 basic_socket_acceptor]``(
  19669. ExecutionContext & context,
  19670. const protocol_type & protocol,
  19671. const native_handle_type & native_acceptor,
  19672. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  19673. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload8 more...]]``
  19674. Move-construct a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] from another.
  19675. ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload9 basic_socket_acceptor]``(
  19676. basic_socket_acceptor && other);
  19677. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload9 more...]]``
  19678. Move-construct a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] from an acceptor of another protocol type.
  19679. template<
  19680. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  19681. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  19682. ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload10 basic_socket_acceptor]``(
  19683. basic_socket_acceptor< Protocol1, Executor1 > && other,
  19684. typename enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type * = 0);
  19685. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload10 more...]]``
  19686. [section:overload1 basic_socket_acceptor::basic_socket_acceptor (1 of 10 overloads)]
  19687. Construct an acceptor without opening it.
  19688. basic_socket_acceptor(
  19689. const executor_type & ex);
  19690. This constructor creates an acceptor without opening it to listen for new connections. The `open()` function must be called before the acceptor can accept new socket connections.
  19691. [heading Parameters]
  19692. [variablelist
  19693. [[ex][The I/O executor that the acceptor will use, by default, to dispatch handlers for any asynchronous operations performed on the acceptor. ]]
  19694. ]
  19695. [endsect]
  19696. [section:overload2 basic_socket_acceptor::basic_socket_acceptor (2 of 10 overloads)]
  19697. Construct an acceptor without opening it.
  19698. template<
  19699. typename ExecutionContext>
  19700. basic_socket_acceptor(
  19701. ExecutionContext & context,
  19702. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  19703. This constructor creates an acceptor without opening it to listen for new connections. The `open()` function must be called before the acceptor can accept new socket connections.
  19704. [heading Parameters]
  19705. [variablelist
  19706. [[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. ]]
  19707. ]
  19708. [endsect]
  19709. [section:overload3 basic_socket_acceptor::basic_socket_acceptor (3 of 10 overloads)]
  19710. Construct an open acceptor.
  19711. basic_socket_acceptor(
  19712. const executor_type & ex,
  19713. const protocol_type & protocol);
  19714. This constructor creates an acceptor and automatically opens it.
  19715. [heading Parameters]
  19716. [variablelist
  19717. [[ex][The I/O executor that the acceptor will use, by default, to dispatch handlers for any asynchronous operations performed on the acceptor.]]
  19718. [[protocol][An object specifying protocol parameters to be used.]]
  19719. ]
  19720. [heading Exceptions]
  19721. [variablelist
  19722. [[boost::system::system_error][Thrown on failure. ]]
  19723. ]
  19724. [endsect]
  19725. [section:overload4 basic_socket_acceptor::basic_socket_acceptor (4 of 10 overloads)]
  19726. Construct an open acceptor.
  19727. template<
  19728. typename ExecutionContext>
  19729. basic_socket_acceptor(
  19730. ExecutionContext & context,
  19731. const protocol_type & protocol,
  19732. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  19733. This constructor creates an acceptor and automatically opens it.
  19734. [heading Parameters]
  19735. [variablelist
  19736. [[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.]]
  19737. [[protocol][An object specifying protocol parameters to be used.]]
  19738. ]
  19739. [heading Exceptions]
  19740. [variablelist
  19741. [[boost::system::system_error][Thrown on failure. ]]
  19742. ]
  19743. [endsect]
  19744. [section:overload5 basic_socket_acceptor::basic_socket_acceptor (5 of 10 overloads)]
  19745. Construct an acceptor opened on the given endpoint.
  19746. basic_socket_acceptor(
  19747. const executor_type & ex,
  19748. const endpoint_type & endpoint,
  19749. bool reuse_addr = true);
  19750. This constructor creates an acceptor and automatically opens it to listen for new connections on the specified endpoint.
  19751. [heading Parameters]
  19752. [variablelist
  19753. [[ex][The I/O executor that the acceptor will use, by default, to dispatch handlers for any asynchronous operations performed on the acceptor.]]
  19754. [[endpoint][An endpoint on the local machine on which the acceptor will listen for new connections.]]
  19755. [[reuse_addr][Whether the constructor should set the socket option `socket_base::reuse_address`.]]
  19756. ]
  19757. [heading Exceptions]
  19758. [variablelist
  19759. [[boost::system::system_error][Thrown on failure.]]
  19760. ]
  19761. [heading Remarks]
  19762. This constructor is equivalent to the following code:
  19763. basic_socket_acceptor<Protocol> acceptor(my_context);
  19764. acceptor.open(endpoint.protocol());
  19765. if (reuse_addr)
  19766. acceptor.set_option(socket_base::reuse_address(true));
  19767. acceptor.bind(endpoint);
  19768. acceptor.listen();
  19769. [endsect]
  19770. [section:overload6 basic_socket_acceptor::basic_socket_acceptor (6 of 10 overloads)]
  19771. Construct an acceptor opened on the given endpoint.
  19772. template<
  19773. typename ExecutionContext>
  19774. basic_socket_acceptor(
  19775. ExecutionContext & context,
  19776. const endpoint_type & endpoint,
  19777. bool reuse_addr = true,
  19778. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  19779. This constructor creates an acceptor and automatically opens it to listen for new connections on the specified endpoint.
  19780. [heading Parameters]
  19781. [variablelist
  19782. [[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.]]
  19783. [[endpoint][An endpoint on the local machine on which the acceptor will listen for new connections.]]
  19784. [[reuse_addr][Whether the constructor should set the socket option `socket_base::reuse_address`.]]
  19785. ]
  19786. [heading Exceptions]
  19787. [variablelist
  19788. [[boost::system::system_error][Thrown on failure.]]
  19789. ]
  19790. [heading Remarks]
  19791. This constructor is equivalent to the following code:
  19792. basic_socket_acceptor<Protocol> acceptor(my_context);
  19793. acceptor.open(endpoint.protocol());
  19794. if (reuse_addr)
  19795. acceptor.set_option(socket_base::reuse_address(true));
  19796. acceptor.bind(endpoint);
  19797. acceptor.listen();
  19798. [endsect]
  19799. [section:overload7 basic_socket_acceptor::basic_socket_acceptor (7 of 10 overloads)]
  19800. Construct a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] on an existing native acceptor.
  19801. basic_socket_acceptor(
  19802. const executor_type & ex,
  19803. const protocol_type & protocol,
  19804. const native_handle_type & native_acceptor);
  19805. This constructor creates an acceptor object to hold an existing native acceptor.
  19806. [heading Parameters]
  19807. [variablelist
  19808. [[ex][The I/O executor that the acceptor will use, by default, to dispatch handlers for any asynchronous operations performed on the acceptor.]]
  19809. [[protocol][An object specifying protocol parameters to be used.]]
  19810. [[native_acceptor][A native acceptor.]]
  19811. ]
  19812. [heading Exceptions]
  19813. [variablelist
  19814. [[boost::system::system_error][Thrown on failure. ]]
  19815. ]
  19816. [endsect]
  19817. [section:overload8 basic_socket_acceptor::basic_socket_acceptor (8 of 10 overloads)]
  19818. Construct a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] on an existing native acceptor.
  19819. template<
  19820. typename ExecutionContext>
  19821. basic_socket_acceptor(
  19822. ExecutionContext & context,
  19823. const protocol_type & protocol,
  19824. const native_handle_type & native_acceptor,
  19825. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  19826. This constructor creates an acceptor object to hold an existing native acceptor.
  19827. [heading Parameters]
  19828. [variablelist
  19829. [[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.]]
  19830. [[protocol][An object specifying protocol parameters to be used.]]
  19831. [[native_acceptor][A native acceptor.]]
  19832. ]
  19833. [heading Exceptions]
  19834. [variablelist
  19835. [[boost::system::system_error][Thrown on failure. ]]
  19836. ]
  19837. [endsect]
  19838. [section:overload9 basic_socket_acceptor::basic_socket_acceptor (9 of 10 overloads)]
  19839. Move-construct a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] from another.
  19840. basic_socket_acceptor(
  19841. basic_socket_acceptor && other);
  19842. This constructor moves an acceptor from one object to another.
  19843. [heading Parameters]
  19844. [variablelist
  19845. [[other][The other [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] object from which the move will occur.]]
  19846. ]
  19847. [heading Remarks]
  19848. Following the move, the moved-from object is in the same state as if constructed using the `basic_socket_acceptor(const executor_type&)` constructor.
  19849. [endsect]
  19850. [section:overload10 basic_socket_acceptor::basic_socket_acceptor (10 of 10 overloads)]
  19851. Move-construct a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] from an acceptor of another protocol type.
  19852. template<
  19853. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  19854. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  19855. basic_socket_acceptor(
  19856. basic_socket_acceptor< Protocol1, Executor1 > && other,
  19857. typename enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type * = 0);
  19858. This constructor moves an acceptor from one object to another.
  19859. [heading Parameters]
  19860. [variablelist
  19861. [[other][The other [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] object from which the move will occur.]]
  19862. ]
  19863. [heading Remarks]
  19864. Following the move, the moved-from object is in the same state as if constructed using the `basic_socket_acceptor(const executor_type&)` constructor.
  19865. [endsect]
  19866. [endsect]
  19867. [section:bind basic_socket_acceptor::bind]
  19868. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.bind..bind..basic_socket_acceptor]
  19869. Bind the acceptor to the given local endpoint.
  19870. void ``[link boost_asio.reference.basic_socket_acceptor.bind.overload1 bind]``(
  19871. const endpoint_type & endpoint);
  19872. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.bind.overload1 more...]]``
  19873. void ``[link boost_asio.reference.basic_socket_acceptor.bind.overload2 bind]``(
  19874. const endpoint_type & endpoint,
  19875. boost::system::error_code & ec);
  19876. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.bind.overload2 more...]]``
  19877. [section:overload1 basic_socket_acceptor::bind (1 of 2 overloads)]
  19878. Bind the acceptor to the given local endpoint.
  19879. void bind(
  19880. const endpoint_type & endpoint);
  19881. This function binds the socket acceptor to the specified endpoint on the local machine.
  19882. [heading Parameters]
  19883. [variablelist
  19884. [[endpoint][An endpoint on the local machine to which the socket acceptor will be bound.]]
  19885. ]
  19886. [heading Exceptions]
  19887. [variablelist
  19888. [[boost::system::system_error][Thrown on failure.]]
  19889. ]
  19890. [heading Example]
  19891. boost::asio::ip::tcp::acceptor acceptor(my_context);
  19892. boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), 12345);
  19893. acceptor.open(endpoint.protocol());
  19894. acceptor.bind(endpoint);
  19895. [endsect]
  19896. [section:overload2 basic_socket_acceptor::bind (2 of 2 overloads)]
  19897. Bind the acceptor to the given local endpoint.
  19898. void bind(
  19899. const endpoint_type & endpoint,
  19900. boost::system::error_code & ec);
  19901. This function binds the socket acceptor to the specified endpoint on the local machine.
  19902. [heading Parameters]
  19903. [variablelist
  19904. [[endpoint][An endpoint on the local machine to which the socket acceptor will be bound.]]
  19905. [[ec][Set to indicate what error occurred, if any.]]
  19906. ]
  19907. [heading Example]
  19908. boost::asio::ip::tcp::acceptor acceptor(my_context);
  19909. boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), 12345);
  19910. acceptor.open(endpoint.protocol());
  19911. boost::system::error_code ec;
  19912. acceptor.bind(endpoint, ec);
  19913. if (ec)
  19914. {
  19915. // An error occurred.
  19916. }
  19917. [endsect]
  19918. [endsect]
  19919. [section:broadcast basic_socket_acceptor::broadcast]
  19920. ['Inherited from socket_base.]
  19921. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.broadcast..broadcast..basic_socket_acceptor]
  19922. Socket option to permit sending of broadcast messages.
  19923. typedef implementation_defined broadcast;
  19924. Implements the SOL\_SOCKET/SO\_BROADCAST socket option.
  19925. [heading Examples]
  19926. Setting the option:
  19927. boost::asio::ip::udp::socket socket(my_context);
  19928. ...
  19929. boost::asio::socket_base::broadcast option(true);
  19930. socket.set_option(option);
  19931. Getting the current option value:
  19932. boost::asio::ip::udp::socket socket(my_context);
  19933. ...
  19934. boost::asio::socket_base::broadcast option;
  19935. socket.get_option(option);
  19936. bool is_set = option.value();
  19937. [heading Requirements]
  19938. ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
  19939. ['Convenience header: ][^boost/asio.hpp]
  19940. [endsect]
  19941. [section:bytes_readable basic_socket_acceptor::bytes_readable]
  19942. ['Inherited from socket_base.]
  19943. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.bytes_readable..bytes_readable..basic_socket_acceptor]
  19944. IO control command to get the amount of data that can be read without blocking.
  19945. typedef implementation_defined bytes_readable;
  19946. Implements the FIONREAD IO control command.
  19947. [heading Example]
  19948. boost::asio::ip::tcp::socket socket(my_context);
  19949. ...
  19950. boost::asio::socket_base::bytes_readable command(true);
  19951. socket.io_control(command);
  19952. std::size_t bytes_readable = command.get();
  19953. [heading Requirements]
  19954. ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
  19955. ['Convenience header: ][^boost/asio.hpp]
  19956. [endsect]
  19957. [section:cancel basic_socket_acceptor::cancel]
  19958. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.cancel..cancel..basic_socket_acceptor]
  19959. Cancel all asynchronous operations associated with the acceptor.
  19960. void ``[link boost_asio.reference.basic_socket_acceptor.cancel.overload1 cancel]``();
  19961. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.cancel.overload1 more...]]``
  19962. void ``[link boost_asio.reference.basic_socket_acceptor.cancel.overload2 cancel]``(
  19963. boost::system::error_code & ec);
  19964. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.cancel.overload2 more...]]``
  19965. [section:overload1 basic_socket_acceptor::cancel (1 of 2 overloads)]
  19966. Cancel all asynchronous operations associated with the acceptor.
  19967. void cancel();
  19968. This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
  19969. [heading Exceptions]
  19970. [variablelist
  19971. [[boost::system::system_error][Thrown on failure. ]]
  19972. ]
  19973. [endsect]
  19974. [section:overload2 basic_socket_acceptor::cancel (2 of 2 overloads)]
  19975. Cancel all asynchronous operations associated with the acceptor.
  19976. void cancel(
  19977. boost::system::error_code & ec);
  19978. This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
  19979. [heading Parameters]
  19980. [variablelist
  19981. [[ec][Set to indicate what error occurred, if any. ]]
  19982. ]
  19983. [endsect]
  19984. [endsect]
  19985. [section:close basic_socket_acceptor::close]
  19986. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.close..close..basic_socket_acceptor]
  19987. Close the acceptor.
  19988. void ``[link boost_asio.reference.basic_socket_acceptor.close.overload1 close]``();
  19989. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.close.overload1 more...]]``
  19990. void ``[link boost_asio.reference.basic_socket_acceptor.close.overload2 close]``(
  19991. boost::system::error_code & ec);
  19992. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.close.overload2 more...]]``
  19993. [section:overload1 basic_socket_acceptor::close (1 of 2 overloads)]
  19994. Close the acceptor.
  19995. void close();
  19996. This function is used to close the acceptor. Any asynchronous accept operations will be cancelled immediately.
  19997. A subsequent call to `open()` is required before the acceptor can again be used to again perform socket accept operations.
  19998. [heading Exceptions]
  19999. [variablelist
  20000. [[boost::system::system_error][Thrown on failure. ]]
  20001. ]
  20002. [endsect]
  20003. [section:overload2 basic_socket_acceptor::close (2 of 2 overloads)]
  20004. Close the acceptor.
  20005. void close(
  20006. boost::system::error_code & ec);
  20007. This function is used to close the acceptor. Any asynchronous accept operations will be cancelled immediately.
  20008. A subsequent call to `open()` is required before the acceptor can again be used to again perform socket accept operations.
  20009. [heading Parameters]
  20010. [variablelist
  20011. [[ec][Set to indicate what error occurred, if any.]]
  20012. ]
  20013. [heading Example]
  20014. boost::asio::ip::tcp::acceptor acceptor(my_context);
  20015. ...
  20016. boost::system::error_code ec;
  20017. acceptor.close(ec);
  20018. if (ec)
  20019. {
  20020. // An error occurred.
  20021. }
  20022. [endsect]
  20023. [endsect]
  20024. [section:debug basic_socket_acceptor::debug]
  20025. ['Inherited from socket_base.]
  20026. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.debug..debug..basic_socket_acceptor]
  20027. Socket option to enable socket-level debugging.
  20028. typedef implementation_defined debug;
  20029. Implements the SOL\_SOCKET/SO\_DEBUG socket option.
  20030. [heading Examples]
  20031. Setting the option:
  20032. boost::asio::ip::tcp::socket socket(my_context);
  20033. ...
  20034. boost::asio::socket_base::debug option(true);
  20035. socket.set_option(option);
  20036. Getting the current option value:
  20037. boost::asio::ip::tcp::socket socket(my_context);
  20038. ...
  20039. boost::asio::socket_base::debug option;
  20040. socket.get_option(option);
  20041. bool is_set = option.value();
  20042. [heading Requirements]
  20043. ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
  20044. ['Convenience header: ][^boost/asio.hpp]
  20045. [endsect]
  20046. [section:do_not_route basic_socket_acceptor::do_not_route]
  20047. ['Inherited from socket_base.]
  20048. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.do_not_route..do_not_route..basic_socket_acceptor]
  20049. Socket option to prevent routing, use local interfaces only.
  20050. typedef implementation_defined do_not_route;
  20051. Implements the SOL\_SOCKET/SO\_DONTROUTE socket option.
  20052. [heading Examples]
  20053. Setting the option:
  20054. boost::asio::ip::udp::socket socket(my_context);
  20055. ...
  20056. boost::asio::socket_base::do_not_route option(true);
  20057. socket.set_option(option);
  20058. Getting the current option value:
  20059. boost::asio::ip::udp::socket socket(my_context);
  20060. ...
  20061. boost::asio::socket_base::do_not_route option;
  20062. socket.get_option(option);
  20063. bool is_set = option.value();
  20064. [heading Requirements]
  20065. ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
  20066. ['Convenience header: ][^boost/asio.hpp]
  20067. [endsect]
  20068. [section:enable_connection_aborted basic_socket_acceptor::enable_connection_aborted]
  20069. ['Inherited from socket_base.]
  20070. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.enable_connection_aborted..enable_connection_aborted..basic_socket_acceptor]
  20071. Socket option to report aborted connections on accept.
  20072. typedef implementation_defined enable_connection_aborted;
  20073. Implements a custom socket option that determines whether or not an accept operation is permitted to fail with `boost::asio::error::connection_aborted`. By default the option is false.
  20074. [heading Examples]
  20075. Setting the option:
  20076. boost::asio::ip::tcp::acceptor acceptor(my_context);
  20077. ...
  20078. boost::asio::socket_base::enable_connection_aborted option(true);
  20079. acceptor.set_option(option);
  20080. Getting the current option value:
  20081. boost::asio::ip::tcp::acceptor acceptor(my_context);
  20082. ...
  20083. boost::asio::socket_base::enable_connection_aborted option;
  20084. acceptor.get_option(option);
  20085. bool is_set = option.value();
  20086. [heading Requirements]
  20087. ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
  20088. ['Convenience header: ][^boost/asio.hpp]
  20089. [endsect]
  20090. [section:endpoint_type basic_socket_acceptor::endpoint_type]
  20091. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.endpoint_type..endpoint_type..basic_socket_acceptor]
  20092. The endpoint type.
  20093. typedef Protocol::endpoint endpoint_type;
  20094. [heading Requirements]
  20095. ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
  20096. ['Convenience header: ][^boost/asio.hpp]
  20097. [endsect]
  20098. [section:executor_type basic_socket_acceptor::executor_type]
  20099. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.executor_type..executor_type..basic_socket_acceptor]
  20100. The type of the executor associated with the object.
  20101. typedef Executor executor_type;
  20102. [heading Requirements]
  20103. ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
  20104. ['Convenience header: ][^boost/asio.hpp]
  20105. [endsect]
  20106. [section:get_executor basic_socket_acceptor::get_executor]
  20107. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.get_executor..get_executor..basic_socket_acceptor]
  20108. Get the executor associated with the object.
  20109. executor_type get_executor();
  20110. [endsect]
  20111. [section:get_option basic_socket_acceptor::get_option]
  20112. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.get_option..get_option..basic_socket_acceptor]
  20113. Get an option from the acceptor.
  20114. template<
  20115. typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
  20116. void ``[link boost_asio.reference.basic_socket_acceptor.get_option.overload1 get_option]``(
  20117. GettableSocketOption & option) const;
  20118. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.get_option.overload1 more...]]``
  20119. template<
  20120. typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
  20121. void ``[link boost_asio.reference.basic_socket_acceptor.get_option.overload2 get_option]``(
  20122. GettableSocketOption & option,
  20123. boost::system::error_code & ec) const;
  20124. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.get_option.overload2 more...]]``
  20125. [section:overload1 basic_socket_acceptor::get_option (1 of 2 overloads)]
  20126. Get an option from the acceptor.
  20127. template<
  20128. typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
  20129. void get_option(
  20130. GettableSocketOption & option) const;
  20131. This function is used to get the current value of an option on the acceptor.
  20132. [heading Parameters]
  20133. [variablelist
  20134. [[option][The option value to be obtained from the acceptor.]]
  20135. ]
  20136. [heading Exceptions]
  20137. [variablelist
  20138. [[boost::system::system_error][Thrown on failure.]]
  20139. ]
  20140. [heading Example]
  20141. Getting the value of the SOL\_SOCKET/SO\_REUSEADDR option:
  20142. boost::asio::ip::tcp::acceptor acceptor(my_context);
  20143. ...
  20144. boost::asio::ip::tcp::acceptor::reuse_address option;
  20145. acceptor.get_option(option);
  20146. bool is_set = option.get();
  20147. [endsect]
  20148. [section:overload2 basic_socket_acceptor::get_option (2 of 2 overloads)]
  20149. Get an option from the acceptor.
  20150. template<
  20151. typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
  20152. void get_option(
  20153. GettableSocketOption & option,
  20154. boost::system::error_code & ec) const;
  20155. This function is used to get the current value of an option on the acceptor.
  20156. [heading Parameters]
  20157. [variablelist
  20158. [[option][The option value to be obtained from the acceptor.]]
  20159. [[ec][Set to indicate what error occurred, if any.]]
  20160. ]
  20161. [heading Example]
  20162. Getting the value of the SOL\_SOCKET/SO\_REUSEADDR option:
  20163. boost::asio::ip::tcp::acceptor acceptor(my_context);
  20164. ...
  20165. boost::asio::ip::tcp::acceptor::reuse_address option;
  20166. boost::system::error_code ec;
  20167. acceptor.get_option(option, ec);
  20168. if (ec)
  20169. {
  20170. // An error occurred.
  20171. }
  20172. bool is_set = option.get();
  20173. [endsect]
  20174. [endsect]
  20175. [section:io_control basic_socket_acceptor::io_control]
  20176. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.io_control..io_control..basic_socket_acceptor]
  20177. Perform an IO control command on the acceptor.
  20178. template<
  20179. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  20180. void ``[link boost_asio.reference.basic_socket_acceptor.io_control.overload1 io_control]``(
  20181. IoControlCommand & command);
  20182. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.io_control.overload1 more...]]``
  20183. template<
  20184. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  20185. void ``[link boost_asio.reference.basic_socket_acceptor.io_control.overload2 io_control]``(
  20186. IoControlCommand & command,
  20187. boost::system::error_code & ec);
  20188. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.io_control.overload2 more...]]``
  20189. [section:overload1 basic_socket_acceptor::io_control (1 of 2 overloads)]
  20190. Perform an IO control command on the acceptor.
  20191. template<
  20192. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  20193. void io_control(
  20194. IoControlCommand & command);
  20195. This function is used to execute an IO control command on the acceptor.
  20196. [heading Parameters]
  20197. [variablelist
  20198. [[command][The IO control command to be performed on the acceptor.]]
  20199. ]
  20200. [heading Exceptions]
  20201. [variablelist
  20202. [[boost::system::system_error][Thrown on failure.]]
  20203. ]
  20204. [heading Example]
  20205. Getting the number of bytes ready to read:
  20206. boost::asio::ip::tcp::acceptor acceptor(my_context);
  20207. ...
  20208. boost::asio::ip::tcp::acceptor::non_blocking_io command(true);
  20209. socket.io_control(command);
  20210. [endsect]
  20211. [section:overload2 basic_socket_acceptor::io_control (2 of 2 overloads)]
  20212. Perform an IO control command on the acceptor.
  20213. template<
  20214. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  20215. void io_control(
  20216. IoControlCommand & command,
  20217. boost::system::error_code & ec);
  20218. This function is used to execute an IO control command on the acceptor.
  20219. [heading Parameters]
  20220. [variablelist
  20221. [[command][The IO control command to be performed on the acceptor.]]
  20222. [[ec][Set to indicate what error occurred, if any.]]
  20223. ]
  20224. [heading Example]
  20225. Getting the number of bytes ready to read:
  20226. boost::asio::ip::tcp::acceptor acceptor(my_context);
  20227. ...
  20228. boost::asio::ip::tcp::acceptor::non_blocking_io command(true);
  20229. boost::system::error_code ec;
  20230. socket.io_control(command, ec);
  20231. if (ec)
  20232. {
  20233. // An error occurred.
  20234. }
  20235. [endsect]
  20236. [endsect]
  20237. [section:is_open basic_socket_acceptor::is_open]
  20238. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.is_open..is_open..basic_socket_acceptor]
  20239. Determine whether the acceptor is open.
  20240. bool is_open() const;
  20241. [endsect]
  20242. [section:keep_alive basic_socket_acceptor::keep_alive]
  20243. ['Inherited from socket_base.]
  20244. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.keep_alive..keep_alive..basic_socket_acceptor]
  20245. Socket option to send keep-alives.
  20246. typedef implementation_defined keep_alive;
  20247. Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option.
  20248. [heading Examples]
  20249. Setting the option:
  20250. boost::asio::ip::tcp::socket socket(my_context);
  20251. ...
  20252. boost::asio::socket_base::keep_alive option(true);
  20253. socket.set_option(option);
  20254. Getting the current option value:
  20255. boost::asio::ip::tcp::socket socket(my_context);
  20256. ...
  20257. boost::asio::socket_base::keep_alive option;
  20258. socket.get_option(option);
  20259. bool is_set = option.value();
  20260. [heading Requirements]
  20261. ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
  20262. ['Convenience header: ][^boost/asio.hpp]
  20263. [endsect]
  20264. [section:linger basic_socket_acceptor::linger]
  20265. ['Inherited from socket_base.]
  20266. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.linger..linger..basic_socket_acceptor]
  20267. Socket option to specify whether the socket lingers on close if unsent data is present.
  20268. typedef implementation_defined linger;
  20269. Implements the SOL\_SOCKET/SO\_LINGER socket option.
  20270. [heading Examples]
  20271. Setting the option:
  20272. boost::asio::ip::tcp::socket socket(my_context);
  20273. ...
  20274. boost::asio::socket_base::linger option(true, 30);
  20275. socket.set_option(option);
  20276. Getting the current option value:
  20277. boost::asio::ip::tcp::socket socket(my_context);
  20278. ...
  20279. boost::asio::socket_base::linger option;
  20280. socket.get_option(option);
  20281. bool is_set = option.enabled();
  20282. unsigned short timeout = option.timeout();
  20283. [heading Requirements]
  20284. ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
  20285. ['Convenience header: ][^boost/asio.hpp]
  20286. [endsect]
  20287. [section:listen basic_socket_acceptor::listen]
  20288. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.listen..listen..basic_socket_acceptor]
  20289. Place the acceptor into the state where it will listen for new connections.
  20290. void ``[link boost_asio.reference.basic_socket_acceptor.listen.overload1 listen]``(
  20291. int backlog = socket_base::max_listen_connections);
  20292. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.listen.overload1 more...]]``
  20293. void ``[link boost_asio.reference.basic_socket_acceptor.listen.overload2 listen]``(
  20294. int backlog,
  20295. boost::system::error_code & ec);
  20296. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.listen.overload2 more...]]``
  20297. [section:overload1 basic_socket_acceptor::listen (1 of 2 overloads)]
  20298. Place the acceptor into the state where it will listen for new connections.
  20299. void listen(
  20300. int backlog = socket_base::max_listen_connections);
  20301. This function puts the socket acceptor into the state where it may accept new connections.
  20302. [heading Parameters]
  20303. [variablelist
  20304. [[backlog][The maximum length of the queue of pending connections.]]
  20305. ]
  20306. [heading Exceptions]
  20307. [variablelist
  20308. [[boost::system::system_error][Thrown on failure. ]]
  20309. ]
  20310. [endsect]
  20311. [section:overload2 basic_socket_acceptor::listen (2 of 2 overloads)]
  20312. Place the acceptor into the state where it will listen for new connections.
  20313. void listen(
  20314. int backlog,
  20315. boost::system::error_code & ec);
  20316. This function puts the socket acceptor into the state where it may accept new connections.
  20317. [heading Parameters]
  20318. [variablelist
  20319. [[backlog][The maximum length of the queue of pending connections.]]
  20320. [[ec][Set to indicate what error occurred, if any.]]
  20321. ]
  20322. [heading Example]
  20323. boost::asio::ip::tcp::acceptor acceptor(my_context);
  20324. ...
  20325. boost::system::error_code ec;
  20326. acceptor.listen(boost::asio::socket_base::max_listen_connections, ec);
  20327. if (ec)
  20328. {
  20329. // An error occurred.
  20330. }
  20331. [endsect]
  20332. [endsect]
  20333. [section:local_endpoint basic_socket_acceptor::local_endpoint]
  20334. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.local_endpoint..local_endpoint..basic_socket_acceptor]
  20335. Get the local endpoint of the acceptor.
  20336. endpoint_type ``[link boost_asio.reference.basic_socket_acceptor.local_endpoint.overload1 local_endpoint]``() const;
  20337. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.local_endpoint.overload1 more...]]``
  20338. endpoint_type ``[link boost_asio.reference.basic_socket_acceptor.local_endpoint.overload2 local_endpoint]``(
  20339. boost::system::error_code & ec) const;
  20340. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.local_endpoint.overload2 more...]]``
  20341. [section:overload1 basic_socket_acceptor::local_endpoint (1 of 2 overloads)]
  20342. Get the local endpoint of the acceptor.
  20343. endpoint_type local_endpoint() const;
  20344. This function is used to obtain the locally bound endpoint of the acceptor.
  20345. [heading Return Value]
  20346. An object that represents the local endpoint of the acceptor.
  20347. [heading Exceptions]
  20348. [variablelist
  20349. [[boost::system::system_error][Thrown on failure.]]
  20350. ]
  20351. [heading Example]
  20352. boost::asio::ip::tcp::acceptor acceptor(my_context);
  20353. ...
  20354. boost::asio::ip::tcp::endpoint endpoint = acceptor.local_endpoint();
  20355. [endsect]
  20356. [section:overload2 basic_socket_acceptor::local_endpoint (2 of 2 overloads)]
  20357. Get the local endpoint of the acceptor.
  20358. endpoint_type local_endpoint(
  20359. boost::system::error_code & ec) const;
  20360. This function is used to obtain the locally bound endpoint of the acceptor.
  20361. [heading Parameters]
  20362. [variablelist
  20363. [[ec][Set to indicate what error occurred, if any.]]
  20364. ]
  20365. [heading Return Value]
  20366. An object that represents the local endpoint of the acceptor. Returns a default-constructed endpoint object if an error occurred and the error handler did not throw an exception.
  20367. [heading Example]
  20368. boost::asio::ip::tcp::acceptor acceptor(my_context);
  20369. ...
  20370. boost::system::error_code ec;
  20371. boost::asio::ip::tcp::endpoint endpoint = acceptor.local_endpoint(ec);
  20372. if (ec)
  20373. {
  20374. // An error occurred.
  20375. }
  20376. [endsect]
  20377. [endsect]
  20378. [section:max_connections basic_socket_acceptor::max_connections]
  20379. ['Inherited from socket_base.]
  20380. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.max_connections..max_connections..basic_socket_acceptor]
  20381. (Deprecated: Use max\_listen\_connections.) The maximum length of the queue of pending incoming connections.
  20382. static const int max_connections = implementation_defined;
  20383. [endsect]
  20384. [section:max_listen_connections basic_socket_acceptor::max_listen_connections]
  20385. ['Inherited from socket_base.]
  20386. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.max_listen_connections..max_listen_connections..basic_socket_acceptor]
  20387. The maximum length of the queue of pending incoming connections.
  20388. static const int max_listen_connections = implementation_defined;
  20389. [endsect]
  20390. [section:message_do_not_route basic_socket_acceptor::message_do_not_route]
  20391. ['Inherited from socket_base.]
  20392. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.message_do_not_route..message_do_not_route..basic_socket_acceptor]
  20393. Specify that the data should not be subject to routing.
  20394. static const int message_do_not_route = implementation_defined;
  20395. [endsect]
  20396. [section:message_end_of_record basic_socket_acceptor::message_end_of_record]
  20397. ['Inherited from socket_base.]
  20398. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.message_end_of_record..message_end_of_record..basic_socket_acceptor]
  20399. Specifies that the data marks the end of a record.
  20400. static const int message_end_of_record = implementation_defined;
  20401. [endsect]
  20402. [section:message_flags basic_socket_acceptor::message_flags]
  20403. ['Inherited from socket_base.]
  20404. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.message_flags..message_flags..basic_socket_acceptor]
  20405. Bitmask type for flags that can be passed to send and receive operations.
  20406. typedef int message_flags;
  20407. [heading Requirements]
  20408. ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
  20409. ['Convenience header: ][^boost/asio.hpp]
  20410. [endsect]
  20411. [section:message_out_of_band basic_socket_acceptor::message_out_of_band]
  20412. ['Inherited from socket_base.]
  20413. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.message_out_of_band..message_out_of_band..basic_socket_acceptor]
  20414. Process out-of-band data.
  20415. static const int message_out_of_band = implementation_defined;
  20416. [endsect]
  20417. [section:message_peek basic_socket_acceptor::message_peek]
  20418. ['Inherited from socket_base.]
  20419. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.message_peek..message_peek..basic_socket_acceptor]
  20420. Peek at incoming data without removing it from the input queue.
  20421. static const int message_peek = implementation_defined;
  20422. [endsect]
  20423. [section:native_handle basic_socket_acceptor::native_handle]
  20424. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.native_handle..native_handle..basic_socket_acceptor]
  20425. Get the native acceptor representation.
  20426. native_handle_type native_handle();
  20427. This function may be used to obtain the underlying representation of the acceptor. This is intended to allow access to native acceptor functionality that is not otherwise provided.
  20428. [endsect]
  20429. [section:native_handle_type basic_socket_acceptor::native_handle_type]
  20430. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.native_handle_type..native_handle_type..basic_socket_acceptor]
  20431. The native representation of an acceptor.
  20432. typedef implementation_defined native_handle_type;
  20433. [heading Requirements]
  20434. ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
  20435. ['Convenience header: ][^boost/asio.hpp]
  20436. [endsect]
  20437. [section:native_non_blocking basic_socket_acceptor::native_non_blocking]
  20438. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.native_non_blocking..native_non_blocking..basic_socket_acceptor]
  20439. Gets the non-blocking mode of the native acceptor implementation.
  20440. bool ``[link boost_asio.reference.basic_socket_acceptor.native_non_blocking.overload1 native_non_blocking]``() const;
  20441. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.native_non_blocking.overload1 more...]]``
  20442. Sets the non-blocking mode of the native acceptor implementation.
  20443. void ``[link boost_asio.reference.basic_socket_acceptor.native_non_blocking.overload2 native_non_blocking]``(
  20444. bool mode);
  20445. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.native_non_blocking.overload2 more...]]``
  20446. void ``[link boost_asio.reference.basic_socket_acceptor.native_non_blocking.overload3 native_non_blocking]``(
  20447. bool mode,
  20448. boost::system::error_code & ec);
  20449. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.native_non_blocking.overload3 more...]]``
  20450. [section:overload1 basic_socket_acceptor::native_non_blocking (1 of 3 overloads)]
  20451. Gets the non-blocking mode of the native acceptor implementation.
  20452. bool native_non_blocking() const;
  20453. This function is used to retrieve the non-blocking mode of the underlying native acceptor. This mode has no effect on the behaviour of the acceptor object's synchronous operations.
  20454. [heading Return Value]
  20455. `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).
  20456. [heading Remarks]
  20457. The current non-blocking mode is cached by the acceptor object. Consequently, the return value may be incorrect if the non-blocking mode was set directly on the native acceptor.
  20458. [endsect]
  20459. [section:overload2 basic_socket_acceptor::native_non_blocking (2 of 3 overloads)]
  20460. Sets the non-blocking mode of the native acceptor implementation.
  20461. void native_non_blocking(
  20462. bool mode);
  20463. This function is used to modify the non-blocking mode of the underlying native acceptor. It has no effect on the behaviour of the acceptor object's synchronous operations.
  20464. [heading Parameters]
  20465. [variablelist
  20466. [[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).]]
  20467. ]
  20468. [heading Exceptions]
  20469. [variablelist
  20470. [[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. ]]
  20471. ]
  20472. [endsect]
  20473. [section:overload3 basic_socket_acceptor::native_non_blocking (3 of 3 overloads)]
  20474. Sets the non-blocking mode of the native acceptor implementation.
  20475. void native_non_blocking(
  20476. bool mode,
  20477. boost::system::error_code & ec);
  20478. This function is used to modify the non-blocking mode of the underlying native acceptor. It has no effect on the behaviour of the acceptor object's synchronous operations.
  20479. [heading Parameters]
  20480. [variablelist
  20481. [[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).]]
  20482. [[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. ]]
  20483. ]
  20484. [endsect]
  20485. [endsect]
  20486. [section:non_blocking basic_socket_acceptor::non_blocking]
  20487. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.non_blocking..non_blocking..basic_socket_acceptor]
  20488. Gets the non-blocking mode of the acceptor.
  20489. bool ``[link boost_asio.reference.basic_socket_acceptor.non_blocking.overload1 non_blocking]``() const;
  20490. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.non_blocking.overload1 more...]]``
  20491. Sets the non-blocking mode of the acceptor.
  20492. void ``[link boost_asio.reference.basic_socket_acceptor.non_blocking.overload2 non_blocking]``(
  20493. bool mode);
  20494. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.non_blocking.overload2 more...]]``
  20495. void ``[link boost_asio.reference.basic_socket_acceptor.non_blocking.overload3 non_blocking]``(
  20496. bool mode,
  20497. boost::system::error_code & ec);
  20498. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.non_blocking.overload3 more...]]``
  20499. [section:overload1 basic_socket_acceptor::non_blocking (1 of 3 overloads)]
  20500. Gets the non-blocking mode of the acceptor.
  20501. bool non_blocking() const;
  20502. [heading Return Value]
  20503. `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.
  20504. [heading Remarks]
  20505. The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
  20506. [endsect]
  20507. [section:overload2 basic_socket_acceptor::non_blocking (2 of 3 overloads)]
  20508. Sets the non-blocking mode of the acceptor.
  20509. void non_blocking(
  20510. bool mode);
  20511. [heading Parameters]
  20512. [variablelist
  20513. [[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.]]
  20514. ]
  20515. [heading Exceptions]
  20516. [variablelist
  20517. [[boost::system::system_error][Thrown on failure.]]
  20518. ]
  20519. [heading Remarks]
  20520. The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
  20521. [endsect]
  20522. [section:overload3 basic_socket_acceptor::non_blocking (3 of 3 overloads)]
  20523. Sets the non-blocking mode of the acceptor.
  20524. void non_blocking(
  20525. bool mode,
  20526. boost::system::error_code & ec);
  20527. [heading Parameters]
  20528. [variablelist
  20529. [[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.]]
  20530. [[ec][Set to indicate what error occurred, if any.]]
  20531. ]
  20532. [heading Remarks]
  20533. The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
  20534. [endsect]
  20535. [endsect]
  20536. [section:open basic_socket_acceptor::open]
  20537. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.open..open..basic_socket_acceptor]
  20538. Open the acceptor using the specified protocol.
  20539. void ``[link boost_asio.reference.basic_socket_acceptor.open.overload1 open]``(
  20540. const protocol_type & protocol = protocol_type());
  20541. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.open.overload1 more...]]``
  20542. void ``[link boost_asio.reference.basic_socket_acceptor.open.overload2 open]``(
  20543. const protocol_type & protocol,
  20544. boost::system::error_code & ec);
  20545. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.open.overload2 more...]]``
  20546. [section:overload1 basic_socket_acceptor::open (1 of 2 overloads)]
  20547. Open the acceptor using the specified protocol.
  20548. void open(
  20549. const protocol_type & protocol = protocol_type());
  20550. This function opens the socket acceptor so that it will use the specified protocol.
  20551. [heading Parameters]
  20552. [variablelist
  20553. [[protocol][An object specifying which protocol is to be used.]]
  20554. ]
  20555. [heading Exceptions]
  20556. [variablelist
  20557. [[boost::system::system_error][Thrown on failure.]]
  20558. ]
  20559. [heading Example]
  20560. boost::asio::ip::tcp::acceptor acceptor(my_context);
  20561. acceptor.open(boost::asio::ip::tcp::v4());
  20562. [endsect]
  20563. [section:overload2 basic_socket_acceptor::open (2 of 2 overloads)]
  20564. Open the acceptor using the specified protocol.
  20565. void open(
  20566. const protocol_type & protocol,
  20567. boost::system::error_code & ec);
  20568. This function opens the socket acceptor so that it will use the specified protocol.
  20569. [heading Parameters]
  20570. [variablelist
  20571. [[protocol][An object specifying which protocol is to be used.]]
  20572. [[ec][Set to indicate what error occurred, if any.]]
  20573. ]
  20574. [heading Example]
  20575. boost::asio::ip::tcp::acceptor acceptor(my_context);
  20576. boost::system::error_code ec;
  20577. acceptor.open(boost::asio::ip::tcp::v4(), ec);
  20578. if (ec)
  20579. {
  20580. // An error occurred.
  20581. }
  20582. [endsect]
  20583. [endsect]
  20584. [section:operator_eq_ basic_socket_acceptor::operator=]
  20585. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.operator_eq_..operator=..basic_socket_acceptor]
  20586. Move-assign a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] from another.
  20587. basic_socket_acceptor & ``[link boost_asio.reference.basic_socket_acceptor.operator_eq_.overload1 operator=]``(
  20588. basic_socket_acceptor && other);
  20589. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.operator_eq_.overload1 more...]]``
  20590. Move-assign a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] from an acceptor of another protocol type.
  20591. template<
  20592. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  20593. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  20594. enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_socket_acceptor & >::type ``[link boost_asio.reference.basic_socket_acceptor.operator_eq_.overload2 operator=]``(
  20595. basic_socket_acceptor< Protocol1, Executor1 > && other);
  20596. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.operator_eq_.overload2 more...]]``
  20597. [section:overload1 basic_socket_acceptor::operator= (1 of 2 overloads)]
  20598. Move-assign a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] from another.
  20599. basic_socket_acceptor & operator=(
  20600. basic_socket_acceptor && other);
  20601. This assignment operator moves an acceptor from one object to another.
  20602. [heading Parameters]
  20603. [variablelist
  20604. [[other][The other [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] object from which the move will occur.]]
  20605. ]
  20606. [heading Remarks]
  20607. Following the move, the moved-from object is in the same state as if constructed using the `basic_socket_acceptor(const executor_type&)` constructor.
  20608. [endsect]
  20609. [section:overload2 basic_socket_acceptor::operator= (2 of 2 overloads)]
  20610. Move-assign a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] from an acceptor of another protocol type.
  20611. template<
  20612. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  20613. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  20614. enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_socket_acceptor & >::type operator=(
  20615. basic_socket_acceptor< Protocol1, Executor1 > && other);
  20616. This assignment operator moves an acceptor from one object to another.
  20617. [heading Parameters]
  20618. [variablelist
  20619. [[other][The other [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] object from which the move will occur.]]
  20620. ]
  20621. [heading Remarks]
  20622. Following the move, the moved-from object is in the same state as if constructed using the `basic_socket_acceptor(const executor_type&)` constructor.
  20623. [endsect]
  20624. [endsect]
  20625. [section:out_of_band_inline basic_socket_acceptor::out_of_band_inline]
  20626. ['Inherited from socket_base.]
  20627. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.out_of_band_inline..out_of_band_inline..basic_socket_acceptor]
  20628. Socket option for putting received out-of-band data inline.
  20629. typedef implementation_defined out_of_band_inline;
  20630. Implements the SOL\_SOCKET/SO\_OOBINLINE socket option.
  20631. [heading Examples]
  20632. Setting the option:
  20633. boost::asio::ip::tcp::socket socket(my_context);
  20634. ...
  20635. boost::asio::socket_base::out_of_band_inline option(true);
  20636. socket.set_option(option);
  20637. Getting the current option value:
  20638. boost::asio::ip::tcp::socket socket(my_context);
  20639. ...
  20640. boost::asio::socket_base::out_of_band_inline option;
  20641. socket.get_option(option);
  20642. bool value = option.value();
  20643. [heading Requirements]
  20644. ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
  20645. ['Convenience header: ][^boost/asio.hpp]
  20646. [endsect]
  20647. [section:protocol_type basic_socket_acceptor::protocol_type]
  20648. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.protocol_type..protocol_type..basic_socket_acceptor]
  20649. The protocol type.
  20650. typedef Protocol protocol_type;
  20651. [heading Requirements]
  20652. ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
  20653. ['Convenience header: ][^boost/asio.hpp]
  20654. [endsect]
  20655. [section:receive_buffer_size basic_socket_acceptor::receive_buffer_size]
  20656. ['Inherited from socket_base.]
  20657. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.receive_buffer_size..receive_buffer_size..basic_socket_acceptor]
  20658. Socket option for the receive buffer size of a socket.
  20659. typedef implementation_defined receive_buffer_size;
  20660. Implements the SOL\_SOCKET/SO\_RCVBUF socket option.
  20661. [heading Examples]
  20662. Setting the option:
  20663. boost::asio::ip::tcp::socket socket(my_context);
  20664. ...
  20665. boost::asio::socket_base::receive_buffer_size option(8192);
  20666. socket.set_option(option);
  20667. Getting the current option value:
  20668. boost::asio::ip::tcp::socket socket(my_context);
  20669. ...
  20670. boost::asio::socket_base::receive_buffer_size option;
  20671. socket.get_option(option);
  20672. int size = option.value();
  20673. [heading Requirements]
  20674. ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
  20675. ['Convenience header: ][^boost/asio.hpp]
  20676. [endsect]
  20677. [section:receive_low_watermark basic_socket_acceptor::receive_low_watermark]
  20678. ['Inherited from socket_base.]
  20679. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.receive_low_watermark..receive_low_watermark..basic_socket_acceptor]
  20680. Socket option for the receive low watermark.
  20681. typedef implementation_defined receive_low_watermark;
  20682. Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option.
  20683. [heading Examples]
  20684. Setting the option:
  20685. boost::asio::ip::tcp::socket socket(my_context);
  20686. ...
  20687. boost::asio::socket_base::receive_low_watermark option(1024);
  20688. socket.set_option(option);
  20689. Getting the current option value:
  20690. boost::asio::ip::tcp::socket socket(my_context);
  20691. ...
  20692. boost::asio::socket_base::receive_low_watermark option;
  20693. socket.get_option(option);
  20694. int size = option.value();
  20695. [heading Requirements]
  20696. ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
  20697. ['Convenience header: ][^boost/asio.hpp]
  20698. [endsect]
  20699. [section:release basic_socket_acceptor::release]
  20700. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.release..release..basic_socket_acceptor]
  20701. Release ownership of the underlying native acceptor.
  20702. native_handle_type ``[link boost_asio.reference.basic_socket_acceptor.release.overload1 release]``();
  20703. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.release.overload1 more...]]``
  20704. native_handle_type ``[link boost_asio.reference.basic_socket_acceptor.release.overload2 release]``(
  20705. boost::system::error_code & ec);
  20706. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.release.overload2 more...]]``
  20707. [section:overload1 basic_socket_acceptor::release (1 of 2 overloads)]
  20708. Release ownership of the underlying native acceptor.
  20709. native_handle_type release();
  20710. This function causes all outstanding asynchronous accept operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. Ownership of the native acceptor is then transferred to the caller.
  20711. [heading Exceptions]
  20712. [variablelist
  20713. [[boost::system::system_error][Thrown on failure.]]
  20714. ]
  20715. [heading Remarks]
  20716. This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms.
  20717. [endsect]
  20718. [section:overload2 basic_socket_acceptor::release (2 of 2 overloads)]
  20719. Release ownership of the underlying native acceptor.
  20720. native_handle_type release(
  20721. boost::system::error_code & ec);
  20722. This function causes all outstanding asynchronous accept operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. Ownership of the native acceptor is then transferred to the caller.
  20723. [heading Parameters]
  20724. [variablelist
  20725. [[ec][Set to indicate what error occurred, if any.]]
  20726. ]
  20727. [heading Remarks]
  20728. This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms.
  20729. [endsect]
  20730. [endsect]
  20731. [section:reuse_address basic_socket_acceptor::reuse_address]
  20732. ['Inherited from socket_base.]
  20733. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.reuse_address..reuse_address..basic_socket_acceptor]
  20734. Socket option to allow the socket to be bound to an address that is already in use.
  20735. typedef implementation_defined reuse_address;
  20736. Implements the SOL\_SOCKET/SO\_REUSEADDR socket option.
  20737. [heading Examples]
  20738. Setting the option:
  20739. boost::asio::ip::tcp::acceptor acceptor(my_context);
  20740. ...
  20741. boost::asio::socket_base::reuse_address option(true);
  20742. acceptor.set_option(option);
  20743. Getting the current option value:
  20744. boost::asio::ip::tcp::acceptor acceptor(my_context);
  20745. ...
  20746. boost::asio::socket_base::reuse_address option;
  20747. acceptor.get_option(option);
  20748. bool is_set = option.value();
  20749. [heading Requirements]
  20750. ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
  20751. ['Convenience header: ][^boost/asio.hpp]
  20752. [endsect]
  20753. [section:send_buffer_size basic_socket_acceptor::send_buffer_size]
  20754. ['Inherited from socket_base.]
  20755. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.send_buffer_size..send_buffer_size..basic_socket_acceptor]
  20756. Socket option for the send buffer size of a socket.
  20757. typedef implementation_defined send_buffer_size;
  20758. Implements the SOL\_SOCKET/SO\_SNDBUF socket option.
  20759. [heading Examples]
  20760. Setting the option:
  20761. boost::asio::ip::tcp::socket socket(my_context);
  20762. ...
  20763. boost::asio::socket_base::send_buffer_size option(8192);
  20764. socket.set_option(option);
  20765. Getting the current option value:
  20766. boost::asio::ip::tcp::socket socket(my_context);
  20767. ...
  20768. boost::asio::socket_base::send_buffer_size option;
  20769. socket.get_option(option);
  20770. int size = option.value();
  20771. [heading Requirements]
  20772. ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
  20773. ['Convenience header: ][^boost/asio.hpp]
  20774. [endsect]
  20775. [section:send_low_watermark basic_socket_acceptor::send_low_watermark]
  20776. ['Inherited from socket_base.]
  20777. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.send_low_watermark..send_low_watermark..basic_socket_acceptor]
  20778. Socket option for the send low watermark.
  20779. typedef implementation_defined send_low_watermark;
  20780. Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option.
  20781. [heading Examples]
  20782. Setting the option:
  20783. boost::asio::ip::tcp::socket socket(my_context);
  20784. ...
  20785. boost::asio::socket_base::send_low_watermark option(1024);
  20786. socket.set_option(option);
  20787. Getting the current option value:
  20788. boost::asio::ip::tcp::socket socket(my_context);
  20789. ...
  20790. boost::asio::socket_base::send_low_watermark option;
  20791. socket.get_option(option);
  20792. int size = option.value();
  20793. [heading Requirements]
  20794. ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
  20795. ['Convenience header: ][^boost/asio.hpp]
  20796. [endsect]
  20797. [section:set_option basic_socket_acceptor::set_option]
  20798. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.set_option..set_option..basic_socket_acceptor]
  20799. Set an option on the acceptor.
  20800. template<
  20801. typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
  20802. void ``[link boost_asio.reference.basic_socket_acceptor.set_option.overload1 set_option]``(
  20803. const SettableSocketOption & option);
  20804. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.set_option.overload1 more...]]``
  20805. template<
  20806. typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
  20807. void ``[link boost_asio.reference.basic_socket_acceptor.set_option.overload2 set_option]``(
  20808. const SettableSocketOption & option,
  20809. boost::system::error_code & ec);
  20810. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.set_option.overload2 more...]]``
  20811. [section:overload1 basic_socket_acceptor::set_option (1 of 2 overloads)]
  20812. Set an option on the acceptor.
  20813. template<
  20814. typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
  20815. void set_option(
  20816. const SettableSocketOption & option);
  20817. This function is used to set an option on the acceptor.
  20818. [heading Parameters]
  20819. [variablelist
  20820. [[option][The new option value to be set on the acceptor.]]
  20821. ]
  20822. [heading Exceptions]
  20823. [variablelist
  20824. [[boost::system::system_error][Thrown on failure.]]
  20825. ]
  20826. [heading Example]
  20827. Setting the SOL\_SOCKET/SO\_REUSEADDR option:
  20828. boost::asio::ip::tcp::acceptor acceptor(my_context);
  20829. ...
  20830. boost::asio::ip::tcp::acceptor::reuse_address option(true);
  20831. acceptor.set_option(option);
  20832. [endsect]
  20833. [section:overload2 basic_socket_acceptor::set_option (2 of 2 overloads)]
  20834. Set an option on the acceptor.
  20835. template<
  20836. typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
  20837. void set_option(
  20838. const SettableSocketOption & option,
  20839. boost::system::error_code & ec);
  20840. This function is used to set an option on the acceptor.
  20841. [heading Parameters]
  20842. [variablelist
  20843. [[option][The new option value to be set on the acceptor.]]
  20844. [[ec][Set to indicate what error occurred, if any.]]
  20845. ]
  20846. [heading Example]
  20847. Setting the SOL\_SOCKET/SO\_REUSEADDR option:
  20848. boost::asio::ip::tcp::acceptor acceptor(my_context);
  20849. ...
  20850. boost::asio::ip::tcp::acceptor::reuse_address option(true);
  20851. boost::system::error_code ec;
  20852. acceptor.set_option(option, ec);
  20853. if (ec)
  20854. {
  20855. // An error occurred.
  20856. }
  20857. [endsect]
  20858. [endsect]
  20859. [section:shutdown_type basic_socket_acceptor::shutdown_type]
  20860. ['Inherited from socket_base.]
  20861. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.shutdown_type..shutdown_type..basic_socket_acceptor]
  20862. Different ways a socket may be shutdown.
  20863. enum shutdown_type
  20864. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.shutdown_type.shutdown_receive..shutdown_receive..basic_socket_acceptor]
  20865. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.shutdown_type.shutdown_send..shutdown_send..basic_socket_acceptor]
  20866. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.shutdown_type.shutdown_both..shutdown_both..basic_socket_acceptor]
  20867. [heading Values]
  20868. [variablelist
  20869. [
  20870. [shutdown_receive]
  20871. [Shutdown the receive side of the socket. ]
  20872. ]
  20873. [
  20874. [shutdown_send]
  20875. [Shutdown the send side of the socket. ]
  20876. ]
  20877. [
  20878. [shutdown_both]
  20879. [Shutdown both send and receive on the socket. ]
  20880. ]
  20881. ]
  20882. [endsect]
  20883. [section:wait basic_socket_acceptor::wait]
  20884. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.wait..wait..basic_socket_acceptor]
  20885. Wait for the acceptor to become ready to read, ready to write, or to have pending error conditions.
  20886. void ``[link boost_asio.reference.basic_socket_acceptor.wait.overload1 wait]``(
  20887. wait_type w);
  20888. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.wait.overload1 more...]]``
  20889. void ``[link boost_asio.reference.basic_socket_acceptor.wait.overload2 wait]``(
  20890. wait_type w,
  20891. boost::system::error_code & ec);
  20892. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.wait.overload2 more...]]``
  20893. [section:overload1 basic_socket_acceptor::wait (1 of 2 overloads)]
  20894. Wait for the acceptor to become ready to read, ready to write, or to have pending error conditions.
  20895. void wait(
  20896. wait_type w);
  20897. This function is used to perform a blocking wait for an acceptor to enter a ready to read, write or error condition state.
  20898. [heading Parameters]
  20899. [variablelist
  20900. [[w][Specifies the desired acceptor state.]]
  20901. ]
  20902. [heading Example]
  20903. Waiting for an acceptor to become readable.
  20904. boost::asio::ip::tcp::acceptor acceptor(my_context);
  20905. ...
  20906. acceptor.wait(boost::asio::ip::tcp::acceptor::wait_read);
  20907. [endsect]
  20908. [section:overload2 basic_socket_acceptor::wait (2 of 2 overloads)]
  20909. Wait for the acceptor to become ready to read, ready to write, or to have pending error conditions.
  20910. void wait(
  20911. wait_type w,
  20912. boost::system::error_code & ec);
  20913. This function is used to perform a blocking wait for an acceptor to enter a ready to read, write or error condition state.
  20914. [heading Parameters]
  20915. [variablelist
  20916. [[w][Specifies the desired acceptor state.]]
  20917. [[ec][Set to indicate what error occurred, if any.]]
  20918. ]
  20919. [heading Example]
  20920. Waiting for an acceptor to become readable.
  20921. boost::asio::ip::tcp::acceptor acceptor(my_context);
  20922. ...
  20923. boost::system::error_code ec;
  20924. acceptor.wait(boost::asio::ip::tcp::acceptor::wait_read, ec);
  20925. [endsect]
  20926. [endsect]
  20927. [section:wait_type basic_socket_acceptor::wait_type]
  20928. ['Inherited from socket_base.]
  20929. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.wait_type..wait_type..basic_socket_acceptor]
  20930. Wait types.
  20931. enum wait_type
  20932. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.wait_type.wait_read..wait_read..basic_socket_acceptor]
  20933. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.wait_type.wait_write..wait_write..basic_socket_acceptor]
  20934. [indexterm2 boost_asio.indexterm.basic_socket_acceptor.wait_type.wait_error..wait_error..basic_socket_acceptor]
  20935. [heading Values]
  20936. [variablelist
  20937. [
  20938. [wait_read]
  20939. [Wait for a socket to become ready to read. ]
  20940. ]
  20941. [
  20942. [wait_write]
  20943. [Wait for a socket to become ready to write. ]
  20944. ]
  20945. [
  20946. [wait_error]
  20947. [Wait for a socket to have error conditions pending. ]
  20948. ]
  20949. ]
  20950. For use with `basic_socket::wait()` and `basic_socket::async_wait()`.
  20951. [endsect]
  20952. [section:_basic_socket_acceptor basic_socket_acceptor::~basic_socket_acceptor]
  20953. [indexterm2 boost_asio.indexterm.basic_socket_acceptor._basic_socket_acceptor..~basic_socket_acceptor..basic_socket_acceptor]
  20954. Destroys the acceptor.
  20955. ~basic_socket_acceptor();
  20956. This function destroys the acceptor, cancelling any outstanding asynchronous operations associated with the acceptor as if by calling `cancel`.
  20957. [endsect]
  20958. [endsect]
  20959. [section:basic_socket_acceptor__rebind_executor basic_socket_acceptor::rebind_executor]
  20960. Rebinds the acceptor type to another executor.
  20961. template<
  20962. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  20963. struct rebind_executor
  20964. [heading Types]
  20965. [table
  20966. [[Name][Description]]
  20967. [
  20968. [[link boost_asio.reference.basic_socket_acceptor__rebind_executor.other [*other]]]
  20969. [The socket type when rebound to the specified executor. ]
  20970. ]
  20971. ]
  20972. [heading Requirements]
  20973. ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
  20974. ['Convenience header: ][^boost/asio.hpp]
  20975. [section:other basic_socket_acceptor::rebind_executor::other]
  20976. [indexterm2 boost_asio.indexterm.basic_socket_acceptor__rebind_executor.other..other..basic_socket_acceptor::rebind_executor]
  20977. The socket type when rebound to the specified executor.
  20978. typedef basic_socket_acceptor< Protocol, Executor1 > other;
  20979. [heading Types]
  20980. [table
  20981. [[Name][Description]]
  20982. [
  20983. [[link boost_asio.reference.basic_socket_acceptor__rebind_executor [*rebind_executor]]]
  20984. [Rebinds the acceptor type to another executor. ]
  20985. ]
  20986. [
  20987. [[link boost_asio.reference.basic_socket_acceptor.broadcast [*broadcast]]]
  20988. [Socket option to permit sending of broadcast messages. ]
  20989. ]
  20990. [
  20991. [[link boost_asio.reference.basic_socket_acceptor.bytes_readable [*bytes_readable]]]
  20992. [IO control command to get the amount of data that can be read without blocking. ]
  20993. ]
  20994. [
  20995. [[link boost_asio.reference.basic_socket_acceptor.debug [*debug]]]
  20996. [Socket option to enable socket-level debugging. ]
  20997. ]
  20998. [
  20999. [[link boost_asio.reference.basic_socket_acceptor.do_not_route [*do_not_route]]]
  21000. [Socket option to prevent routing, use local interfaces only. ]
  21001. ]
  21002. [
  21003. [[link boost_asio.reference.basic_socket_acceptor.enable_connection_aborted [*enable_connection_aborted]]]
  21004. [Socket option to report aborted connections on accept. ]
  21005. ]
  21006. [
  21007. [[link boost_asio.reference.basic_socket_acceptor.endpoint_type [*endpoint_type]]]
  21008. [The endpoint type. ]
  21009. ]
  21010. [
  21011. [[link boost_asio.reference.basic_socket_acceptor.executor_type [*executor_type]]]
  21012. [The type of the executor associated with the object. ]
  21013. ]
  21014. [
  21015. [[link boost_asio.reference.basic_socket_acceptor.keep_alive [*keep_alive]]]
  21016. [Socket option to send keep-alives. ]
  21017. ]
  21018. [
  21019. [[link boost_asio.reference.basic_socket_acceptor.linger [*linger]]]
  21020. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  21021. ]
  21022. [
  21023. [[link boost_asio.reference.basic_socket_acceptor.message_flags [*message_flags]]]
  21024. [Bitmask type for flags that can be passed to send and receive operations. ]
  21025. ]
  21026. [
  21027. [[link boost_asio.reference.basic_socket_acceptor.native_handle_type [*native_handle_type]]]
  21028. [The native representation of an acceptor. ]
  21029. ]
  21030. [
  21031. [[link boost_asio.reference.basic_socket_acceptor.out_of_band_inline [*out_of_band_inline]]]
  21032. [Socket option for putting received out-of-band data inline. ]
  21033. ]
  21034. [
  21035. [[link boost_asio.reference.basic_socket_acceptor.protocol_type [*protocol_type]]]
  21036. [The protocol type. ]
  21037. ]
  21038. [
  21039. [[link boost_asio.reference.basic_socket_acceptor.receive_buffer_size [*receive_buffer_size]]]
  21040. [Socket option for the receive buffer size of a socket. ]
  21041. ]
  21042. [
  21043. [[link boost_asio.reference.basic_socket_acceptor.receive_low_watermark [*receive_low_watermark]]]
  21044. [Socket option for the receive low watermark. ]
  21045. ]
  21046. [
  21047. [[link boost_asio.reference.basic_socket_acceptor.reuse_address [*reuse_address]]]
  21048. [Socket option to allow the socket to be bound to an address that is already in use. ]
  21049. ]
  21050. [
  21051. [[link boost_asio.reference.basic_socket_acceptor.send_buffer_size [*send_buffer_size]]]
  21052. [Socket option for the send buffer size of a socket. ]
  21053. ]
  21054. [
  21055. [[link boost_asio.reference.basic_socket_acceptor.send_low_watermark [*send_low_watermark]]]
  21056. [Socket option for the send low watermark. ]
  21057. ]
  21058. [
  21059. [[link boost_asio.reference.basic_socket_acceptor.shutdown_type [*shutdown_type]]]
  21060. [Different ways a socket may be shutdown. ]
  21061. ]
  21062. [
  21063. [[link boost_asio.reference.basic_socket_acceptor.wait_type [*wait_type]]]
  21064. [Wait types. ]
  21065. ]
  21066. ]
  21067. [heading Member Functions]
  21068. [table
  21069. [[Name][Description]]
  21070. [
  21071. [[link boost_asio.reference.basic_socket_acceptor.accept [*accept]]]
  21072. [Accept a new connection.
  21073. [hr]
  21074. Accept a new connection and obtain the endpoint of the peer. ]
  21075. ]
  21076. [
  21077. [[link boost_asio.reference.basic_socket_acceptor.assign [*assign]]]
  21078. [Assigns an existing native acceptor to the acceptor. ]
  21079. ]
  21080. [
  21081. [[link boost_asio.reference.basic_socket_acceptor.async_accept [*async_accept]]]
  21082. [Start an asynchronous accept. ]
  21083. ]
  21084. [
  21085. [[link boost_asio.reference.basic_socket_acceptor.async_wait [*async_wait]]]
  21086. [Asynchronously wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. ]
  21087. ]
  21088. [
  21089. [[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor [*basic_socket_acceptor]]]
  21090. [Construct an acceptor without opening it.
  21091. [hr]
  21092. Construct an open acceptor.
  21093. [hr]
  21094. Construct an acceptor opened on the given endpoint.
  21095. [hr]
  21096. Construct a basic_socket_acceptor on an existing native acceptor.
  21097. [hr]
  21098. Move-construct a basic_socket_acceptor from another.
  21099. [hr]
  21100. Move-construct a basic_socket_acceptor from an acceptor of another protocol type. ]
  21101. ]
  21102. [
  21103. [[link boost_asio.reference.basic_socket_acceptor.bind [*bind]]]
  21104. [Bind the acceptor to the given local endpoint. ]
  21105. ]
  21106. [
  21107. [[link boost_asio.reference.basic_socket_acceptor.cancel [*cancel]]]
  21108. [Cancel all asynchronous operations associated with the acceptor. ]
  21109. ]
  21110. [
  21111. [[link boost_asio.reference.basic_socket_acceptor.close [*close]]]
  21112. [Close the acceptor. ]
  21113. ]
  21114. [
  21115. [[link boost_asio.reference.basic_socket_acceptor.get_executor [*get_executor]]]
  21116. [Get the executor associated with the object. ]
  21117. ]
  21118. [
  21119. [[link boost_asio.reference.basic_socket_acceptor.get_option [*get_option]]]
  21120. [Get an option from the acceptor. ]
  21121. ]
  21122. [
  21123. [[link boost_asio.reference.basic_socket_acceptor.io_control [*io_control]]]
  21124. [Perform an IO control command on the acceptor. ]
  21125. ]
  21126. [
  21127. [[link boost_asio.reference.basic_socket_acceptor.is_open [*is_open]]]
  21128. [Determine whether the acceptor is open. ]
  21129. ]
  21130. [
  21131. [[link boost_asio.reference.basic_socket_acceptor.listen [*listen]]]
  21132. [Place the acceptor into the state where it will listen for new connections. ]
  21133. ]
  21134. [
  21135. [[link boost_asio.reference.basic_socket_acceptor.local_endpoint [*local_endpoint]]]
  21136. [Get the local endpoint of the acceptor. ]
  21137. ]
  21138. [
  21139. [[link boost_asio.reference.basic_socket_acceptor.native_handle [*native_handle]]]
  21140. [Get the native acceptor representation. ]
  21141. ]
  21142. [
  21143. [[link boost_asio.reference.basic_socket_acceptor.native_non_blocking [*native_non_blocking]]]
  21144. [Gets the non-blocking mode of the native acceptor implementation.
  21145. [hr]
  21146. Sets the non-blocking mode of the native acceptor implementation. ]
  21147. ]
  21148. [
  21149. [[link boost_asio.reference.basic_socket_acceptor.non_blocking [*non_blocking]]]
  21150. [Gets the non-blocking mode of the acceptor.
  21151. [hr]
  21152. Sets the non-blocking mode of the acceptor. ]
  21153. ]
  21154. [
  21155. [[link boost_asio.reference.basic_socket_acceptor.open [*open]]]
  21156. [Open the acceptor using the specified protocol. ]
  21157. ]
  21158. [
  21159. [[link boost_asio.reference.basic_socket_acceptor.operator_eq_ [*operator=]]]
  21160. [Move-assign a basic_socket_acceptor from another.
  21161. [hr]
  21162. Move-assign a basic_socket_acceptor from an acceptor of another protocol type. ]
  21163. ]
  21164. [
  21165. [[link boost_asio.reference.basic_socket_acceptor.release [*release]]]
  21166. [Release ownership of the underlying native acceptor. ]
  21167. ]
  21168. [
  21169. [[link boost_asio.reference.basic_socket_acceptor.set_option [*set_option]]]
  21170. [Set an option on the acceptor. ]
  21171. ]
  21172. [
  21173. [[link boost_asio.reference.basic_socket_acceptor.wait [*wait]]]
  21174. [Wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. ]
  21175. ]
  21176. [
  21177. [[link boost_asio.reference.basic_socket_acceptor._basic_socket_acceptor [*~basic_socket_acceptor]]]
  21178. [Destroys the acceptor. ]
  21179. ]
  21180. ]
  21181. [heading Data Members]
  21182. [table
  21183. [[Name][Description]]
  21184. [
  21185. [[link boost_asio.reference.basic_socket_acceptor.max_connections [*max_connections]]]
  21186. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  21187. ]
  21188. [
  21189. [[link boost_asio.reference.basic_socket_acceptor.max_listen_connections [*max_listen_connections]]]
  21190. [The maximum length of the queue of pending incoming connections. ]
  21191. ]
  21192. [
  21193. [[link boost_asio.reference.basic_socket_acceptor.message_do_not_route [*message_do_not_route]]]
  21194. [Specify that the data should not be subject to routing. ]
  21195. ]
  21196. [
  21197. [[link boost_asio.reference.basic_socket_acceptor.message_end_of_record [*message_end_of_record]]]
  21198. [Specifies that the data marks the end of a record. ]
  21199. ]
  21200. [
  21201. [[link boost_asio.reference.basic_socket_acceptor.message_out_of_band [*message_out_of_band]]]
  21202. [Process out-of-band data. ]
  21203. ]
  21204. [
  21205. [[link boost_asio.reference.basic_socket_acceptor.message_peek [*message_peek]]]
  21206. [Peek at incoming data without removing it from the input queue. ]
  21207. ]
  21208. ]
  21209. The [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] class template is used for accepting new socket connections.
  21210. [heading Thread Safety]
  21211. ['Distinct] ['objects:] Safe.
  21212. ['Shared] ['objects:] Unsafe.
  21213. [heading Example]
  21214. Opening a socket acceptor with the SO\_REUSEADDR option enabled:
  21215. boost::asio::ip::tcp::acceptor acceptor(my_context);
  21216. boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), port);
  21217. acceptor.open(endpoint.protocol());
  21218. acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
  21219. acceptor.bind(endpoint);
  21220. acceptor.listen();
  21221. [heading Requirements]
  21222. ['Header: ][^boost/asio/basic_socket_acceptor.hpp]
  21223. ['Convenience header: ][^boost/asio.hpp]
  21224. [endsect]
  21225. [endsect]
  21226. [section:basic_socket_iostream basic_socket_iostream]
  21227. Iostream interface for a socket.
  21228. template<
  21229. typename ``[link boost_asio.reference.Protocol Protocol]``,
  21230. typename Clock = chrono::steady_clock,
  21231. typename ``[link boost_asio.reference.WaitTraits WaitTraits]`` = wait_traits<Clock>>
  21232. class basic_socket_iostream
  21233. [heading Types]
  21234. [table
  21235. [[Name][Description]]
  21236. [
  21237. [[link boost_asio.reference.basic_socket_iostream.clock_type [*clock_type]]]
  21238. [The clock type. ]
  21239. ]
  21240. [
  21241. [[link boost_asio.reference.basic_socket_iostream.duration [*duration]]]
  21242. [The duration type. ]
  21243. ]
  21244. [
  21245. [[link boost_asio.reference.basic_socket_iostream.duration_type [*duration_type]]]
  21246. [(Deprecated: Use duration.) The duration type. ]
  21247. ]
  21248. [
  21249. [[link boost_asio.reference.basic_socket_iostream.endpoint_type [*endpoint_type]]]
  21250. [The endpoint type. ]
  21251. ]
  21252. [
  21253. [[link boost_asio.reference.basic_socket_iostream.protocol_type [*protocol_type]]]
  21254. [The protocol type. ]
  21255. ]
  21256. [
  21257. [[link boost_asio.reference.basic_socket_iostream.time_point [*time_point]]]
  21258. [The time type. ]
  21259. ]
  21260. [
  21261. [[link boost_asio.reference.basic_socket_iostream.time_type [*time_type]]]
  21262. [(Deprecated: Use time_point.) The time type. ]
  21263. ]
  21264. ]
  21265. [heading Member Functions]
  21266. [table
  21267. [[Name][Description]]
  21268. [
  21269. [[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream [*basic_socket_iostream]]]
  21270. [Construct a basic_socket_iostream without establishing a connection.
  21271. [hr]
  21272. Construct a basic_socket_iostream from the supplied socket.
  21273. [hr]
  21274. Move-construct a basic_socket_iostream from another.
  21275. [hr]
  21276. Establish a connection to an endpoint corresponding to a resolver query. ]
  21277. ]
  21278. [
  21279. [[link boost_asio.reference.basic_socket_iostream.close [*close]]]
  21280. [Close the connection. ]
  21281. ]
  21282. [
  21283. [[link boost_asio.reference.basic_socket_iostream.connect [*connect]]]
  21284. [Establish a connection to an endpoint corresponding to a resolver query. ]
  21285. ]
  21286. [
  21287. [[link boost_asio.reference.basic_socket_iostream.error [*error]]]
  21288. [Get the last error associated with the stream. ]
  21289. ]
  21290. [
  21291. [[link boost_asio.reference.basic_socket_iostream.expires_after [*expires_after]]]
  21292. [Set the stream's expiry time relative to now. ]
  21293. ]
  21294. [
  21295. [[link boost_asio.reference.basic_socket_iostream.expires_at [*expires_at]]]
  21296. [(Deprecated: Use expiry().) Get the stream's expiry time as an absolute time.
  21297. [hr]
  21298. Set the stream's expiry time as an absolute time. ]
  21299. ]
  21300. [
  21301. [[link boost_asio.reference.basic_socket_iostream.expires_from_now [*expires_from_now]]]
  21302. [(Deprecated: Use expiry().) Get the stream's expiry time relative to now.
  21303. [hr]
  21304. (Deprecated: Use expires_after().) Set the stream's expiry time relative to now. ]
  21305. ]
  21306. [
  21307. [[link boost_asio.reference.basic_socket_iostream.expiry [*expiry]]]
  21308. [Get the stream's expiry time as an absolute time. ]
  21309. ]
  21310. [
  21311. [[link boost_asio.reference.basic_socket_iostream.operator_eq_ [*operator=]]]
  21312. [Move-assign a basic_socket_iostream from another. ]
  21313. ]
  21314. [
  21315. [[link boost_asio.reference.basic_socket_iostream.rdbuf [*rdbuf]]]
  21316. [Return a pointer to the underlying streambuf. ]
  21317. ]
  21318. [
  21319. [[link boost_asio.reference.basic_socket_iostream.socket [*socket]]]
  21320. [Get a reference to the underlying socket. ]
  21321. ]
  21322. ]
  21323. [heading Requirements]
  21324. ['Header: ][^boost/asio/basic_socket_iostream.hpp]
  21325. ['Convenience header: ][^boost/asio.hpp]
  21326. [section:basic_socket_iostream basic_socket_iostream::basic_socket_iostream]
  21327. [indexterm2 boost_asio.indexterm.basic_socket_iostream.basic_socket_iostream..basic_socket_iostream..basic_socket_iostream]
  21328. Construct a [link boost_asio.reference.basic_socket_iostream `basic_socket_iostream`] without establishing a connection.
  21329. ``[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload1 basic_socket_iostream]``();
  21330. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload1 more...]]``
  21331. Construct a [link boost_asio.reference.basic_socket_iostream `basic_socket_iostream`] from the supplied socket.
  21332. explicit ``[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload2 basic_socket_iostream]``(
  21333. basic_stream_socket< protocol_type > s);
  21334. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload2 more...]]``
  21335. Move-construct a [link boost_asio.reference.basic_socket_iostream `basic_socket_iostream`] from another.
  21336. ``[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload3 basic_socket_iostream]``(
  21337. basic_socket_iostream && other);
  21338. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload3 more...]]``
  21339. Establish a connection to an endpoint corresponding to a resolver query.
  21340. template<
  21341. typename T1,
  21342. ... ,
  21343. typename TN>
  21344. explicit ``[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload4 basic_socket_iostream]``(
  21345. T1 t1,
  21346. ... ,
  21347. TN tn);
  21348. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload4 more...]]``
  21349. [section:overload1 basic_socket_iostream::basic_socket_iostream (1 of 4 overloads)]
  21350. Construct a [link boost_asio.reference.basic_socket_iostream `basic_socket_iostream`] without establishing a connection.
  21351. basic_socket_iostream();
  21352. [endsect]
  21353. [section:overload2 basic_socket_iostream::basic_socket_iostream (2 of 4 overloads)]
  21354. Construct a [link boost_asio.reference.basic_socket_iostream `basic_socket_iostream`] from the supplied socket.
  21355. basic_socket_iostream(
  21356. basic_stream_socket< protocol_type > s);
  21357. [endsect]
  21358. [section:overload3 basic_socket_iostream::basic_socket_iostream (3 of 4 overloads)]
  21359. Move-construct a [link boost_asio.reference.basic_socket_iostream `basic_socket_iostream`] from another.
  21360. basic_socket_iostream(
  21361. basic_socket_iostream && other);
  21362. [endsect]
  21363. [section:overload4 basic_socket_iostream::basic_socket_iostream (4 of 4 overloads)]
  21364. Establish a connection to an endpoint corresponding to a resolver query.
  21365. template<
  21366. typename T1,
  21367. ... ,
  21368. typename TN>
  21369. basic_socket_iostream(
  21370. T1 t1,
  21371. ... ,
  21372. TN tn);
  21373. This constructor automatically establishes a connection based on the supplied resolver query parameters. The arguments are used to construct a resolver query object.
  21374. [endsect]
  21375. [endsect]
  21376. [section:clock_type basic_socket_iostream::clock_type]
  21377. [indexterm2 boost_asio.indexterm.basic_socket_iostream.clock_type..clock_type..basic_socket_iostream]
  21378. The clock type.
  21379. typedef Clock clock_type;
  21380. [heading Requirements]
  21381. ['Header: ][^boost/asio/basic_socket_iostream.hpp]
  21382. ['Convenience header: ][^boost/asio.hpp]
  21383. [endsect]
  21384. [section:close basic_socket_iostream::close]
  21385. [indexterm2 boost_asio.indexterm.basic_socket_iostream.close..close..basic_socket_iostream]
  21386. Close the connection.
  21387. void close();
  21388. [endsect]
  21389. [section:connect basic_socket_iostream::connect]
  21390. [indexterm2 boost_asio.indexterm.basic_socket_iostream.connect..connect..basic_socket_iostream]
  21391. Establish a connection to an endpoint corresponding to a resolver query.
  21392. template<
  21393. typename T1,
  21394. ... ,
  21395. typename TN>
  21396. void connect(
  21397. T1 t1,
  21398. ... ,
  21399. TN tn);
  21400. This function automatically establishes a connection based on the supplied resolver query parameters. The arguments are used to construct a resolver query object.
  21401. [endsect]
  21402. [section:duration basic_socket_iostream::duration]
  21403. [indexterm2 boost_asio.indexterm.basic_socket_iostream.duration..duration..basic_socket_iostream]
  21404. The duration type.
  21405. typedef WaitTraits::duration duration;
  21406. [heading Requirements]
  21407. ['Header: ][^boost/asio/basic_socket_iostream.hpp]
  21408. ['Convenience header: ][^boost/asio.hpp]
  21409. [endsect]
  21410. [section:duration_type basic_socket_iostream::duration_type]
  21411. [indexterm2 boost_asio.indexterm.basic_socket_iostream.duration_type..duration_type..basic_socket_iostream]
  21412. (Deprecated: Use duration.) The duration type.
  21413. typedef WaitTraits::duration_type duration_type;
  21414. [heading Requirements]
  21415. ['Header: ][^boost/asio/basic_socket_iostream.hpp]
  21416. ['Convenience header: ][^boost/asio.hpp]
  21417. [endsect]
  21418. [section:endpoint_type basic_socket_iostream::endpoint_type]
  21419. [indexterm2 boost_asio.indexterm.basic_socket_iostream.endpoint_type..endpoint_type..basic_socket_iostream]
  21420. The endpoint type.
  21421. typedef Protocol::endpoint endpoint_type;
  21422. [heading Requirements]
  21423. ['Header: ][^boost/asio/basic_socket_iostream.hpp]
  21424. ['Convenience header: ][^boost/asio.hpp]
  21425. [endsect]
  21426. [section:error basic_socket_iostream::error]
  21427. [indexterm2 boost_asio.indexterm.basic_socket_iostream.error..error..basic_socket_iostream]
  21428. Get the last error associated with the stream.
  21429. const boost::system::error_code & error() const;
  21430. [heading Return Value]
  21431. An `error_code` corresponding to the last error from the stream.
  21432. [heading Example]
  21433. To print the error associated with a failure to establish a connection:
  21434. tcp::iostream s("www.boost.org", "http");
  21435. if (!s)
  21436. {
  21437. std::cout << "Error: " << s.error().message() << std::endl;
  21438. }
  21439. [endsect]
  21440. [section:expires_after basic_socket_iostream::expires_after]
  21441. [indexterm2 boost_asio.indexterm.basic_socket_iostream.expires_after..expires_after..basic_socket_iostream]
  21442. Set the stream's expiry time relative to now.
  21443. void expires_after(
  21444. const duration & expiry_time);
  21445. This function sets the expiry time associated with the stream. Stream operations performed after this time (where the operations cannot be completed using the internal buffers) will fail with the error `boost::asio::error::operation_aborted`.
  21446. [heading Parameters]
  21447. [variablelist
  21448. [[expiry_time][The expiry time to be used for the timer. ]]
  21449. ]
  21450. [endsect]
  21451. [section:expires_at basic_socket_iostream::expires_at]
  21452. [indexterm2 boost_asio.indexterm.basic_socket_iostream.expires_at..expires_at..basic_socket_iostream]
  21453. (Deprecated: Use `expiry()`.) Get the stream's expiry time as an absolute time.
  21454. time_point ``[link boost_asio.reference.basic_socket_iostream.expires_at.overload1 expires_at]``() const;
  21455. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_iostream.expires_at.overload1 more...]]``
  21456. Set the stream's expiry time as an absolute time.
  21457. void ``[link boost_asio.reference.basic_socket_iostream.expires_at.overload2 expires_at]``(
  21458. const time_point & expiry_time);
  21459. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_iostream.expires_at.overload2 more...]]``
  21460. [section:overload1 basic_socket_iostream::expires_at (1 of 2 overloads)]
  21461. (Deprecated: Use `expiry()`.) Get the stream's expiry time as an absolute time.
  21462. time_point expires_at() const;
  21463. [heading Return Value]
  21464. An absolute time value representing the stream's expiry time.
  21465. [endsect]
  21466. [section:overload2 basic_socket_iostream::expires_at (2 of 2 overloads)]
  21467. Set the stream's expiry time as an absolute time.
  21468. void expires_at(
  21469. const time_point & expiry_time);
  21470. This function sets the expiry time associated with the stream. Stream operations performed after this time (where the operations cannot be completed using the internal buffers) will fail with the error `boost::asio::error::operation_aborted`.
  21471. [heading Parameters]
  21472. [variablelist
  21473. [[expiry_time][The expiry time to be used for the stream. ]]
  21474. ]
  21475. [endsect]
  21476. [endsect]
  21477. [section:expires_from_now basic_socket_iostream::expires_from_now]
  21478. [indexterm2 boost_asio.indexterm.basic_socket_iostream.expires_from_now..expires_from_now..basic_socket_iostream]
  21479. (Deprecated: Use `expiry()`.) Get the stream's expiry time relative to now.
  21480. duration ``[link boost_asio.reference.basic_socket_iostream.expires_from_now.overload1 expires_from_now]``() const;
  21481. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_iostream.expires_from_now.overload1 more...]]``
  21482. (Deprecated: Use `expires_after()`.) Set the stream's expiry time relative to now.
  21483. void ``[link boost_asio.reference.basic_socket_iostream.expires_from_now.overload2 expires_from_now]``(
  21484. const duration & expiry_time);
  21485. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_iostream.expires_from_now.overload2 more...]]``
  21486. [section:overload1 basic_socket_iostream::expires_from_now (1 of 2 overloads)]
  21487. (Deprecated: Use `expiry()`.) Get the stream's expiry time relative to now.
  21488. duration expires_from_now() const;
  21489. [heading Return Value]
  21490. A relative time value representing the stream's expiry time.
  21491. [endsect]
  21492. [section:overload2 basic_socket_iostream::expires_from_now (2 of 2 overloads)]
  21493. (Deprecated: Use `expires_after()`.) Set the stream's expiry time relative to now.
  21494. void expires_from_now(
  21495. const duration & expiry_time);
  21496. This function sets the expiry time associated with the stream. Stream operations performed after this time (where the operations cannot be completed using the internal buffers) will fail with the error `boost::asio::error::operation_aborted`.
  21497. [heading Parameters]
  21498. [variablelist
  21499. [[expiry_time][The expiry time to be used for the timer. ]]
  21500. ]
  21501. [endsect]
  21502. [endsect]
  21503. [section:expiry basic_socket_iostream::expiry]
  21504. [indexterm2 boost_asio.indexterm.basic_socket_iostream.expiry..expiry..basic_socket_iostream]
  21505. Get the stream's expiry time as an absolute time.
  21506. time_point expiry() const;
  21507. [heading Return Value]
  21508. An absolute time value representing the stream's expiry time.
  21509. [endsect]
  21510. [section:operator_eq_ basic_socket_iostream::operator=]
  21511. [indexterm2 boost_asio.indexterm.basic_socket_iostream.operator_eq_..operator=..basic_socket_iostream]
  21512. Move-assign a [link boost_asio.reference.basic_socket_iostream `basic_socket_iostream`] from another.
  21513. basic_socket_iostream & operator=(
  21514. basic_socket_iostream && other);
  21515. [endsect]
  21516. [section:protocol_type basic_socket_iostream::protocol_type]
  21517. [indexterm2 boost_asio.indexterm.basic_socket_iostream.protocol_type..protocol_type..basic_socket_iostream]
  21518. The protocol type.
  21519. typedef Protocol protocol_type;
  21520. [heading Requirements]
  21521. ['Header: ][^boost/asio/basic_socket_iostream.hpp]
  21522. ['Convenience header: ][^boost/asio.hpp]
  21523. [endsect]
  21524. [section:rdbuf basic_socket_iostream::rdbuf]
  21525. [indexterm2 boost_asio.indexterm.basic_socket_iostream.rdbuf..rdbuf..basic_socket_iostream]
  21526. Return a pointer to the underlying streambuf.
  21527. basic_socket_streambuf< Protocol, Clock, WaitTraits > * rdbuf() const;
  21528. [endsect]
  21529. [section:socket basic_socket_iostream::socket]
  21530. [indexterm2 boost_asio.indexterm.basic_socket_iostream.socket..socket..basic_socket_iostream]
  21531. Get a reference to the underlying socket.
  21532. basic_socket< Protocol > & socket();
  21533. [endsect]
  21534. [section:time_point basic_socket_iostream::time_point]
  21535. [indexterm2 boost_asio.indexterm.basic_socket_iostream.time_point..time_point..basic_socket_iostream]
  21536. The time type.
  21537. typedef WaitTraits::time_point time_point;
  21538. [heading Requirements]
  21539. ['Header: ][^boost/asio/basic_socket_iostream.hpp]
  21540. ['Convenience header: ][^boost/asio.hpp]
  21541. [endsect]
  21542. [section:time_type basic_socket_iostream::time_type]
  21543. [indexterm2 boost_asio.indexterm.basic_socket_iostream.time_type..time_type..basic_socket_iostream]
  21544. (Deprecated: Use time\_point.) The time type.
  21545. typedef WaitTraits::time_type time_type;
  21546. [heading Requirements]
  21547. ['Header: ][^boost/asio/basic_socket_iostream.hpp]
  21548. ['Convenience header: ][^boost/asio.hpp]
  21549. [endsect]
  21550. [endsect]
  21551. [section:basic_socket_streambuf basic_socket_streambuf]
  21552. Iostream streambuf for a socket.
  21553. template<
  21554. typename ``[link boost_asio.reference.Protocol Protocol]``,
  21555. typename Clock = chrono::steady_clock,
  21556. typename ``[link boost_asio.reference.WaitTraits WaitTraits]`` = wait_traits<Clock>>
  21557. class basic_socket_streambuf :
  21558. basic_socket< Protocol >
  21559. [heading Types]
  21560. [table
  21561. [[Name][Description]]
  21562. [
  21563. [[link boost_asio.reference.basic_socket_streambuf.clock_type [*clock_type]]]
  21564. [The clock type. ]
  21565. ]
  21566. [
  21567. [[link boost_asio.reference.basic_socket_streambuf.duration [*duration]]]
  21568. [The duration type. ]
  21569. ]
  21570. [
  21571. [[link boost_asio.reference.basic_socket_streambuf.duration_type [*duration_type]]]
  21572. [(Deprecated: Use duration.) The duration type. ]
  21573. ]
  21574. [
  21575. [[link boost_asio.reference.basic_socket_streambuf.endpoint_type [*endpoint_type]]]
  21576. [The endpoint type. ]
  21577. ]
  21578. [
  21579. [[link boost_asio.reference.basic_socket_streambuf.protocol_type [*protocol_type]]]
  21580. [The protocol type. ]
  21581. ]
  21582. [
  21583. [[link boost_asio.reference.basic_socket_streambuf.time_point [*time_point]]]
  21584. [The time type. ]
  21585. ]
  21586. [
  21587. [[link boost_asio.reference.basic_socket_streambuf.time_type [*time_type]]]
  21588. [(Deprecated: Use time_point.) The time type. ]
  21589. ]
  21590. ]
  21591. [heading Member Functions]
  21592. [table
  21593. [[Name][Description]]
  21594. [
  21595. [[link boost_asio.reference.basic_socket_streambuf.basic_socket_streambuf [*basic_socket_streambuf]]]
  21596. [Construct a basic_socket_streambuf without establishing a connection.
  21597. [hr]
  21598. Construct a basic_socket_streambuf from the supplied socket.
  21599. [hr]
  21600. Move-construct a basic_socket_streambuf from another. ]
  21601. ]
  21602. [
  21603. [[link boost_asio.reference.basic_socket_streambuf.close [*close]]]
  21604. [Close the connection. ]
  21605. ]
  21606. [
  21607. [[link boost_asio.reference.basic_socket_streambuf.connect [*connect]]]
  21608. [Establish a connection. ]
  21609. ]
  21610. [
  21611. [[link boost_asio.reference.basic_socket_streambuf.error [*error]]]
  21612. [Get the last error associated with the stream buffer. ]
  21613. ]
  21614. [
  21615. [[link boost_asio.reference.basic_socket_streambuf.expires_after [*expires_after]]]
  21616. [Set the stream buffer's expiry time relative to now. ]
  21617. ]
  21618. [
  21619. [[link boost_asio.reference.basic_socket_streambuf.expires_at [*expires_at]]]
  21620. [(Deprecated: Use expiry().) Get the stream buffer's expiry time as an absolute time.
  21621. [hr]
  21622. Set the stream buffer's expiry time as an absolute time. ]
  21623. ]
  21624. [
  21625. [[link boost_asio.reference.basic_socket_streambuf.expires_from_now [*expires_from_now]]]
  21626. [(Deprecated: Use expiry().) Get the stream buffer's expiry time relative to now.
  21627. [hr]
  21628. (Deprecated: Use expires_after().) Set the stream buffer's expiry time relative to now. ]
  21629. ]
  21630. [
  21631. [[link boost_asio.reference.basic_socket_streambuf.expiry [*expiry]]]
  21632. [Get the stream buffer's expiry time as an absolute time. ]
  21633. ]
  21634. [
  21635. [[link boost_asio.reference.basic_socket_streambuf.operator_eq_ [*operator=]]]
  21636. [Move-assign a basic_socket_streambuf from another. ]
  21637. ]
  21638. [
  21639. [[link boost_asio.reference.basic_socket_streambuf.puberror [*puberror]]]
  21640. [(Deprecated: Use error().) Get the last error associated with the stream buffer. ]
  21641. ]
  21642. [
  21643. [[link boost_asio.reference.basic_socket_streambuf.socket [*socket]]]
  21644. [Get a reference to the underlying socket. ]
  21645. ]
  21646. [
  21647. [[link boost_asio.reference.basic_socket_streambuf._basic_socket_streambuf [*~basic_socket_streambuf]]]
  21648. [Destructor flushes buffered data. ]
  21649. ]
  21650. ]
  21651. [heading Protected Member Functions]
  21652. [table
  21653. [[Name][Description]]
  21654. [
  21655. [[link boost_asio.reference.basic_socket_streambuf.overflow [*overflow]]]
  21656. []
  21657. ]
  21658. [
  21659. [[link boost_asio.reference.basic_socket_streambuf.setbuf [*setbuf]]]
  21660. []
  21661. ]
  21662. [
  21663. [[link boost_asio.reference.basic_socket_streambuf.sync [*sync]]]
  21664. []
  21665. ]
  21666. [
  21667. [[link boost_asio.reference.basic_socket_streambuf.underflow [*underflow]]]
  21668. []
  21669. ]
  21670. ]
  21671. [heading Requirements]
  21672. ['Header: ][^boost/asio/basic_socket_streambuf.hpp]
  21673. ['Convenience header: ][^boost/asio.hpp]
  21674. [section:basic_socket_streambuf basic_socket_streambuf::basic_socket_streambuf]
  21675. [indexterm2 boost_asio.indexterm.basic_socket_streambuf.basic_socket_streambuf..basic_socket_streambuf..basic_socket_streambuf]
  21676. Construct a [link boost_asio.reference.basic_socket_streambuf `basic_socket_streambuf`] without establishing a connection.
  21677. ``[link boost_asio.reference.basic_socket_streambuf.basic_socket_streambuf.overload1 basic_socket_streambuf]``();
  21678. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.basic_socket_streambuf.overload1 more...]]``
  21679. Construct a [link boost_asio.reference.basic_socket_streambuf `basic_socket_streambuf`] from the supplied socket.
  21680. explicit ``[link boost_asio.reference.basic_socket_streambuf.basic_socket_streambuf.overload2 basic_socket_streambuf]``(
  21681. basic_stream_socket< protocol_type > s);
  21682. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.basic_socket_streambuf.overload2 more...]]``
  21683. Move-construct a [link boost_asio.reference.basic_socket_streambuf `basic_socket_streambuf`] from another.
  21684. ``[link boost_asio.reference.basic_socket_streambuf.basic_socket_streambuf.overload3 basic_socket_streambuf]``(
  21685. basic_socket_streambuf && other);
  21686. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.basic_socket_streambuf.overload3 more...]]``
  21687. [section:overload1 basic_socket_streambuf::basic_socket_streambuf (1 of 3 overloads)]
  21688. Construct a [link boost_asio.reference.basic_socket_streambuf `basic_socket_streambuf`] without establishing a connection.
  21689. basic_socket_streambuf();
  21690. [endsect]
  21691. [section:overload2 basic_socket_streambuf::basic_socket_streambuf (2 of 3 overloads)]
  21692. Construct a [link boost_asio.reference.basic_socket_streambuf `basic_socket_streambuf`] from the supplied socket.
  21693. basic_socket_streambuf(
  21694. basic_stream_socket< protocol_type > s);
  21695. [endsect]
  21696. [section:overload3 basic_socket_streambuf::basic_socket_streambuf (3 of 3 overloads)]
  21697. Move-construct a [link boost_asio.reference.basic_socket_streambuf `basic_socket_streambuf`] from another.
  21698. basic_socket_streambuf(
  21699. basic_socket_streambuf && other);
  21700. [endsect]
  21701. [endsect]
  21702. [section:clock_type basic_socket_streambuf::clock_type]
  21703. [indexterm2 boost_asio.indexterm.basic_socket_streambuf.clock_type..clock_type..basic_socket_streambuf]
  21704. The clock type.
  21705. typedef Clock clock_type;
  21706. [heading Requirements]
  21707. ['Header: ][^boost/asio/basic_socket_streambuf.hpp]
  21708. ['Convenience header: ][^boost/asio.hpp]
  21709. [endsect]
  21710. [section:close basic_socket_streambuf::close]
  21711. [indexterm2 boost_asio.indexterm.basic_socket_streambuf.close..close..basic_socket_streambuf]
  21712. Close the connection.
  21713. basic_socket_streambuf * close();
  21714. [heading Return Value]
  21715. `this` if a connection was successfully established, a null pointer otherwise.
  21716. [endsect]
  21717. [section:connect basic_socket_streambuf::connect]
  21718. [indexterm2 boost_asio.indexterm.basic_socket_streambuf.connect..connect..basic_socket_streambuf]
  21719. Establish a connection.
  21720. basic_socket_streambuf * ``[link boost_asio.reference.basic_socket_streambuf.connect.overload1 connect]``(
  21721. const endpoint_type & endpoint);
  21722. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.connect.overload1 more...]]``
  21723. template<
  21724. typename T1,
  21725. ... ,
  21726. typename TN>
  21727. basic_socket_streambuf * ``[link boost_asio.reference.basic_socket_streambuf.connect.overload2 connect]``(
  21728. T1 t1,
  21729. ... ,
  21730. TN tn);
  21731. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.connect.overload2 more...]]``
  21732. [section:overload1 basic_socket_streambuf::connect (1 of 2 overloads)]
  21733. Establish a connection.
  21734. basic_socket_streambuf * connect(
  21735. const endpoint_type & endpoint);
  21736. This function establishes a connection to the specified endpoint.
  21737. [heading Return Value]
  21738. `this` if a connection was successfully established, a null pointer otherwise.
  21739. [endsect]
  21740. [section:overload2 basic_socket_streambuf::connect (2 of 2 overloads)]
  21741. Establish a connection.
  21742. template<
  21743. typename T1,
  21744. ... ,
  21745. typename TN>
  21746. basic_socket_streambuf * connect(
  21747. T1 t1,
  21748. ... ,
  21749. TN tn);
  21750. This function automatically establishes a connection based on the supplied resolver query parameters. The arguments are used to construct a resolver query object.
  21751. [heading Return Value]
  21752. `this` if a connection was successfully established, a null pointer otherwise.
  21753. [endsect]
  21754. [endsect]
  21755. [section:duration basic_socket_streambuf::duration]
  21756. [indexterm2 boost_asio.indexterm.basic_socket_streambuf.duration..duration..basic_socket_streambuf]
  21757. The duration type.
  21758. typedef WaitTraits::duration duration;
  21759. [heading Requirements]
  21760. ['Header: ][^boost/asio/basic_socket_streambuf.hpp]
  21761. ['Convenience header: ][^boost/asio.hpp]
  21762. [endsect]
  21763. [section:duration_type basic_socket_streambuf::duration_type]
  21764. [indexterm2 boost_asio.indexterm.basic_socket_streambuf.duration_type..duration_type..basic_socket_streambuf]
  21765. (Deprecated: Use duration.) The duration type.
  21766. typedef WaitTraits::duration_type duration_type;
  21767. [heading Requirements]
  21768. ['Header: ][^boost/asio/basic_socket_streambuf.hpp]
  21769. ['Convenience header: ][^boost/asio.hpp]
  21770. [endsect]
  21771. [section:endpoint_type basic_socket_streambuf::endpoint_type]
  21772. [indexterm2 boost_asio.indexterm.basic_socket_streambuf.endpoint_type..endpoint_type..basic_socket_streambuf]
  21773. The endpoint type.
  21774. typedef Protocol::endpoint endpoint_type;
  21775. [heading Requirements]
  21776. ['Header: ][^boost/asio/basic_socket_streambuf.hpp]
  21777. ['Convenience header: ][^boost/asio.hpp]
  21778. [endsect]
  21779. [section:error basic_socket_streambuf::error]
  21780. [indexterm2 boost_asio.indexterm.basic_socket_streambuf.error..error..basic_socket_streambuf]
  21781. Get the last error associated with the stream buffer.
  21782. const boost::system::error_code & error() const;
  21783. [heading Return Value]
  21784. An `error_code` corresponding to the last error from the stream buffer.
  21785. [endsect]
  21786. [section:expires_after basic_socket_streambuf::expires_after]
  21787. [indexterm2 boost_asio.indexterm.basic_socket_streambuf.expires_after..expires_after..basic_socket_streambuf]
  21788. Set the stream buffer's expiry time relative to now.
  21789. void expires_after(
  21790. const duration & expiry_time);
  21791. This function sets the expiry time associated with the stream. Stream operations performed after this time (where the operations cannot be completed using the internal buffers) will fail with the error `boost::asio::error::operation_aborted`.
  21792. [heading Parameters]
  21793. [variablelist
  21794. [[expiry_time][The expiry time to be used for the timer. ]]
  21795. ]
  21796. [endsect]
  21797. [section:expires_at basic_socket_streambuf::expires_at]
  21798. [indexterm2 boost_asio.indexterm.basic_socket_streambuf.expires_at..expires_at..basic_socket_streambuf]
  21799. (Deprecated: Use `expiry()`.) Get the stream buffer's expiry time as an absolute time.
  21800. time_point ``[link boost_asio.reference.basic_socket_streambuf.expires_at.overload1 expires_at]``() const;
  21801. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.expires_at.overload1 more...]]``
  21802. Set the stream buffer's expiry time as an absolute time.
  21803. void ``[link boost_asio.reference.basic_socket_streambuf.expires_at.overload2 expires_at]``(
  21804. const time_point & expiry_time);
  21805. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.expires_at.overload2 more...]]``
  21806. [section:overload1 basic_socket_streambuf::expires_at (1 of 2 overloads)]
  21807. (Deprecated: Use `expiry()`.) Get the stream buffer's expiry time as an absolute time.
  21808. time_point expires_at() const;
  21809. [heading Return Value]
  21810. An absolute time value representing the stream buffer's expiry time.
  21811. [endsect]
  21812. [section:overload2 basic_socket_streambuf::expires_at (2 of 2 overloads)]
  21813. Set the stream buffer's expiry time as an absolute time.
  21814. void expires_at(
  21815. const time_point & expiry_time);
  21816. This function sets the expiry time associated with the stream. Stream operations performed after this time (where the operations cannot be completed using the internal buffers) will fail with the error `boost::asio::error::operation_aborted`.
  21817. [heading Parameters]
  21818. [variablelist
  21819. [[expiry_time][The expiry time to be used for the stream. ]]
  21820. ]
  21821. [endsect]
  21822. [endsect]
  21823. [section:expires_from_now basic_socket_streambuf::expires_from_now]
  21824. [indexterm2 boost_asio.indexterm.basic_socket_streambuf.expires_from_now..expires_from_now..basic_socket_streambuf]
  21825. (Deprecated: Use `expiry()`.) Get the stream buffer's expiry time relative to now.
  21826. duration ``[link boost_asio.reference.basic_socket_streambuf.expires_from_now.overload1 expires_from_now]``() const;
  21827. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.expires_from_now.overload1 more...]]``
  21828. (Deprecated: Use `expires_after()`.) Set the stream buffer's expiry time relative to now.
  21829. void ``[link boost_asio.reference.basic_socket_streambuf.expires_from_now.overload2 expires_from_now]``(
  21830. const duration & expiry_time);
  21831. `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.expires_from_now.overload2 more...]]``
  21832. [section:overload1 basic_socket_streambuf::expires_from_now (1 of 2 overloads)]
  21833. (Deprecated: Use `expiry()`.) Get the stream buffer's expiry time relative to now.
  21834. duration expires_from_now() const;
  21835. [heading Return Value]
  21836. A relative time value representing the stream buffer's expiry time.
  21837. [endsect]
  21838. [section:overload2 basic_socket_streambuf::expires_from_now (2 of 2 overloads)]
  21839. (Deprecated: Use `expires_after()`.) Set the stream buffer's expiry time relative to now.
  21840. void expires_from_now(
  21841. const duration & expiry_time);
  21842. This function sets the expiry time associated with the stream. Stream operations performed after this time (where the operations cannot be completed using the internal buffers) will fail with the error `boost::asio::error::operation_aborted`.
  21843. [heading Parameters]
  21844. [variablelist
  21845. [[expiry_time][The expiry time to be used for the timer. ]]
  21846. ]
  21847. [endsect]
  21848. [endsect]
  21849. [section:expiry basic_socket_streambuf::expiry]
  21850. [indexterm2 boost_asio.indexterm.basic_socket_streambuf.expiry..expiry..basic_socket_streambuf]
  21851. Get the stream buffer's expiry time as an absolute time.
  21852. time_point expiry() const;
  21853. [heading Return Value]
  21854. An absolute time value representing the stream buffer's expiry time.
  21855. [endsect]
  21856. [section:operator_eq_ basic_socket_streambuf::operator=]
  21857. [indexterm2 boost_asio.indexterm.basic_socket_streambuf.operator_eq_..operator=..basic_socket_streambuf]
  21858. Move-assign a [link boost_asio.reference.basic_socket_streambuf `basic_socket_streambuf`] from another.
  21859. basic_socket_streambuf & operator=(
  21860. basic_socket_streambuf && other);
  21861. [endsect]
  21862. [section:overflow basic_socket_streambuf::overflow]
  21863. [indexterm2 boost_asio.indexterm.basic_socket_streambuf.overflow..overflow..basic_socket_streambuf]
  21864. int_type overflow(
  21865. int_type c);
  21866. [endsect]
  21867. [section:protocol_type basic_socket_streambuf::protocol_type]
  21868. [indexterm2 boost_asio.indexterm.basic_socket_streambuf.protocol_type..protocol_type..basic_socket_streambuf]
  21869. The protocol type.
  21870. typedef Protocol protocol_type;
  21871. [heading Requirements]
  21872. ['Header: ][^boost/asio/basic_socket_streambuf.hpp]
  21873. ['Convenience header: ][^boost/asio.hpp]
  21874. [endsect]
  21875. [section:puberror basic_socket_streambuf::puberror]
  21876. [indexterm2 boost_asio.indexterm.basic_socket_streambuf.puberror..puberror..basic_socket_streambuf]
  21877. (Deprecated: Use `error()`.) Get the last error associated with the stream buffer.
  21878. const boost::system::error_code & puberror() const;
  21879. [heading Return Value]
  21880. An `error_code` corresponding to the last error from the stream buffer.
  21881. [endsect]
  21882. [section:setbuf basic_socket_streambuf::setbuf]
  21883. [indexterm2 boost_asio.indexterm.basic_socket_streambuf.setbuf..setbuf..basic_socket_streambuf]
  21884. std::streambuf * setbuf(
  21885. char_type * s,
  21886. std::streamsize n);
  21887. [endsect]
  21888. [section:socket basic_socket_streambuf::socket]
  21889. [indexterm2 boost_asio.indexterm.basic_socket_streambuf.socket..socket..basic_socket_streambuf]
  21890. Get a reference to the underlying socket.
  21891. basic_socket< Protocol > & socket();
  21892. [endsect]
  21893. [section:sync basic_socket_streambuf::sync]
  21894. [indexterm2 boost_asio.indexterm.basic_socket_streambuf.sync..sync..basic_socket_streambuf]
  21895. int sync();
  21896. [endsect]
  21897. [section:time_point basic_socket_streambuf::time_point]
  21898. [indexterm2 boost_asio.indexterm.basic_socket_streambuf.time_point..time_point..basic_socket_streambuf]
  21899. The time type.
  21900. typedef WaitTraits::time_point time_point;
  21901. [heading Requirements]
  21902. ['Header: ][^boost/asio/basic_socket_streambuf.hpp]
  21903. ['Convenience header: ][^boost/asio.hpp]
  21904. [endsect]
  21905. [section:time_type basic_socket_streambuf::time_type]
  21906. [indexterm2 boost_asio.indexterm.basic_socket_streambuf.time_type..time_type..basic_socket_streambuf]
  21907. (Deprecated: Use time\_point.) The time type.
  21908. typedef WaitTraits::time_type time_type;
  21909. [heading Requirements]
  21910. ['Header: ][^boost/asio/basic_socket_streambuf.hpp]
  21911. ['Convenience header: ][^boost/asio.hpp]
  21912. [endsect]
  21913. [section:underflow basic_socket_streambuf::underflow]
  21914. [indexterm2 boost_asio.indexterm.basic_socket_streambuf.underflow..underflow..basic_socket_streambuf]
  21915. int_type underflow();
  21916. [endsect]
  21917. [section:_basic_socket_streambuf basic_socket_streambuf::~basic_socket_streambuf]
  21918. [indexterm2 boost_asio.indexterm.basic_socket_streambuf._basic_socket_streambuf..~basic_socket_streambuf..basic_socket_streambuf]
  21919. Destructor flushes buffered data.
  21920. virtual ~basic_socket_streambuf();
  21921. [endsect]
  21922. [endsect]
  21923. [section:basic_stream_socket basic_stream_socket]
  21924. Provides stream-oriented socket functionality.
  21925. template<
  21926. typename ``[link boost_asio.reference.Protocol Protocol]``,
  21927. typename ``[link boost_asio.reference.Executor1 Executor]``>
  21928. class basic_stream_socket :
  21929. public basic_socket< Protocol, Executor >
  21930. [heading Types]
  21931. [table
  21932. [[Name][Description]]
  21933. [
  21934. [[link boost_asio.reference.basic_stream_socket__rebind_executor [*rebind_executor]]]
  21935. [Rebinds the socket type to another executor. ]
  21936. ]
  21937. [
  21938. [[link boost_asio.reference.basic_stream_socket.broadcast [*broadcast]]]
  21939. [Socket option to permit sending of broadcast messages. ]
  21940. ]
  21941. [
  21942. [[link boost_asio.reference.basic_stream_socket.bytes_readable [*bytes_readable]]]
  21943. [IO control command to get the amount of data that can be read without blocking. ]
  21944. ]
  21945. [
  21946. [[link boost_asio.reference.basic_stream_socket.debug [*debug]]]
  21947. [Socket option to enable socket-level debugging. ]
  21948. ]
  21949. [
  21950. [[link boost_asio.reference.basic_stream_socket.do_not_route [*do_not_route]]]
  21951. [Socket option to prevent routing, use local interfaces only. ]
  21952. ]
  21953. [
  21954. [[link boost_asio.reference.basic_stream_socket.enable_connection_aborted [*enable_connection_aborted]]]
  21955. [Socket option to report aborted connections on accept. ]
  21956. ]
  21957. [
  21958. [[link boost_asio.reference.basic_stream_socket.endpoint_type [*endpoint_type]]]
  21959. [The endpoint type. ]
  21960. ]
  21961. [
  21962. [[link boost_asio.reference.basic_stream_socket.executor_type [*executor_type]]]
  21963. [The type of the executor associated with the object. ]
  21964. ]
  21965. [
  21966. [[link boost_asio.reference.basic_stream_socket.keep_alive [*keep_alive]]]
  21967. [Socket option to send keep-alives. ]
  21968. ]
  21969. [
  21970. [[link boost_asio.reference.basic_stream_socket.linger [*linger]]]
  21971. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  21972. ]
  21973. [
  21974. [[link boost_asio.reference.basic_stream_socket.lowest_layer_type [*lowest_layer_type]]]
  21975. [A basic_socket is always the lowest layer. ]
  21976. ]
  21977. [
  21978. [[link boost_asio.reference.basic_stream_socket.message_flags [*message_flags]]]
  21979. [Bitmask type for flags that can be passed to send and receive operations. ]
  21980. ]
  21981. [
  21982. [[link boost_asio.reference.basic_stream_socket.native_handle_type [*native_handle_type]]]
  21983. [The native representation of a socket. ]
  21984. ]
  21985. [
  21986. [[link boost_asio.reference.basic_stream_socket.out_of_band_inline [*out_of_band_inline]]]
  21987. [Socket option for putting received out-of-band data inline. ]
  21988. ]
  21989. [
  21990. [[link boost_asio.reference.basic_stream_socket.protocol_type [*protocol_type]]]
  21991. [The protocol type. ]
  21992. ]
  21993. [
  21994. [[link boost_asio.reference.basic_stream_socket.receive_buffer_size [*receive_buffer_size]]]
  21995. [Socket option for the receive buffer size of a socket. ]
  21996. ]
  21997. [
  21998. [[link boost_asio.reference.basic_stream_socket.receive_low_watermark [*receive_low_watermark]]]
  21999. [Socket option for the receive low watermark. ]
  22000. ]
  22001. [
  22002. [[link boost_asio.reference.basic_stream_socket.reuse_address [*reuse_address]]]
  22003. [Socket option to allow the socket to be bound to an address that is already in use. ]
  22004. ]
  22005. [
  22006. [[link boost_asio.reference.basic_stream_socket.send_buffer_size [*send_buffer_size]]]
  22007. [Socket option for the send buffer size of a socket. ]
  22008. ]
  22009. [
  22010. [[link boost_asio.reference.basic_stream_socket.send_low_watermark [*send_low_watermark]]]
  22011. [Socket option for the send low watermark. ]
  22012. ]
  22013. [
  22014. [[link boost_asio.reference.basic_stream_socket.shutdown_type [*shutdown_type]]]
  22015. [Different ways a socket may be shutdown. ]
  22016. ]
  22017. [
  22018. [[link boost_asio.reference.basic_stream_socket.wait_type [*wait_type]]]
  22019. [Wait types. ]
  22020. ]
  22021. ]
  22022. [heading Member Functions]
  22023. [table
  22024. [[Name][Description]]
  22025. [
  22026. [[link boost_asio.reference.basic_stream_socket.assign [*assign]]]
  22027. [Assign an existing native socket to the socket. ]
  22028. ]
  22029. [
  22030. [[link boost_asio.reference.basic_stream_socket.async_connect [*async_connect]]]
  22031. [Start an asynchronous connect. ]
  22032. ]
  22033. [
  22034. [[link boost_asio.reference.basic_stream_socket.async_read_some [*async_read_some]]]
  22035. [Start an asynchronous read. ]
  22036. ]
  22037. [
  22038. [[link boost_asio.reference.basic_stream_socket.async_receive [*async_receive]]]
  22039. [Start an asynchronous receive. ]
  22040. ]
  22041. [
  22042. [[link boost_asio.reference.basic_stream_socket.async_send [*async_send]]]
  22043. [Start an asynchronous send. ]
  22044. ]
  22045. [
  22046. [[link boost_asio.reference.basic_stream_socket.async_wait [*async_wait]]]
  22047. [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  22048. ]
  22049. [
  22050. [[link boost_asio.reference.basic_stream_socket.async_write_some [*async_write_some]]]
  22051. [Start an asynchronous write. ]
  22052. ]
  22053. [
  22054. [[link boost_asio.reference.basic_stream_socket.at_mark [*at_mark]]]
  22055. [Determine whether the socket is at the out-of-band data mark. ]
  22056. ]
  22057. [
  22058. [[link boost_asio.reference.basic_stream_socket.available [*available]]]
  22059. [Determine the number of bytes available for reading. ]
  22060. ]
  22061. [
  22062. [[link boost_asio.reference.basic_stream_socket.basic_stream_socket [*basic_stream_socket]]]
  22063. [Construct a basic_stream_socket without opening it.
  22064. [hr]
  22065. Construct and open a basic_stream_socket.
  22066. [hr]
  22067. Construct a basic_stream_socket, opening it and binding it to the given local endpoint.
  22068. [hr]
  22069. Construct a basic_stream_socket on an existing native socket.
  22070. [hr]
  22071. Move-construct a basic_stream_socket from another.
  22072. [hr]
  22073. Move-construct a basic_stream_socket from a socket of another protocol type. ]
  22074. ]
  22075. [
  22076. [[link boost_asio.reference.basic_stream_socket.bind [*bind]]]
  22077. [Bind the socket to the given local endpoint. ]
  22078. ]
  22079. [
  22080. [[link boost_asio.reference.basic_stream_socket.cancel [*cancel]]]
  22081. [Cancel all asynchronous operations associated with the socket. ]
  22082. ]
  22083. [
  22084. [[link boost_asio.reference.basic_stream_socket.close [*close]]]
  22085. [Close the socket. ]
  22086. ]
  22087. [
  22088. [[link boost_asio.reference.basic_stream_socket.connect [*connect]]]
  22089. [Connect the socket to the specified endpoint. ]
  22090. ]
  22091. [
  22092. [[link boost_asio.reference.basic_stream_socket.get_executor [*get_executor]]]
  22093. [Get the executor associated with the object. ]
  22094. ]
  22095. [
  22096. [[link boost_asio.reference.basic_stream_socket.get_option [*get_option]]]
  22097. [Get an option from the socket. ]
  22098. ]
  22099. [
  22100. [[link boost_asio.reference.basic_stream_socket.io_control [*io_control]]]
  22101. [Perform an IO control command on the socket. ]
  22102. ]
  22103. [
  22104. [[link boost_asio.reference.basic_stream_socket.is_open [*is_open]]]
  22105. [Determine whether the socket is open. ]
  22106. ]
  22107. [
  22108. [[link boost_asio.reference.basic_stream_socket.local_endpoint [*local_endpoint]]]
  22109. [Get the local endpoint of the socket. ]
  22110. ]
  22111. [
  22112. [[link boost_asio.reference.basic_stream_socket.lowest_layer [*lowest_layer]]]
  22113. [Get a reference to the lowest layer.
  22114. [hr]
  22115. Get a const reference to the lowest layer. ]
  22116. ]
  22117. [
  22118. [[link boost_asio.reference.basic_stream_socket.native_handle [*native_handle]]]
  22119. [Get the native socket representation. ]
  22120. ]
  22121. [
  22122. [[link boost_asio.reference.basic_stream_socket.native_non_blocking [*native_non_blocking]]]
  22123. [Gets the non-blocking mode of the native socket implementation.
  22124. [hr]
  22125. Sets the non-blocking mode of the native socket implementation. ]
  22126. ]
  22127. [
  22128. [[link boost_asio.reference.basic_stream_socket.non_blocking [*non_blocking]]]
  22129. [Gets the non-blocking mode of the socket.
  22130. [hr]
  22131. Sets the non-blocking mode of the socket. ]
  22132. ]
  22133. [
  22134. [[link boost_asio.reference.basic_stream_socket.open [*open]]]
  22135. [Open the socket using the specified protocol. ]
  22136. ]
  22137. [
  22138. [[link boost_asio.reference.basic_stream_socket.operator_eq_ [*operator=]]]
  22139. [Move-assign a basic_stream_socket from another.
  22140. [hr]
  22141. Move-assign a basic_stream_socket from a socket of another protocol type. ]
  22142. ]
  22143. [
  22144. [[link boost_asio.reference.basic_stream_socket.read_some [*read_some]]]
  22145. [Read some data from the socket. ]
  22146. ]
  22147. [
  22148. [[link boost_asio.reference.basic_stream_socket.receive [*receive]]]
  22149. [Receive some data on the socket.
  22150. [hr]
  22151. Receive some data on a connected socket. ]
  22152. ]
  22153. [
  22154. [[link boost_asio.reference.basic_stream_socket.release [*release]]]
  22155. [Release ownership of the underlying native socket. ]
  22156. ]
  22157. [
  22158. [[link boost_asio.reference.basic_stream_socket.remote_endpoint [*remote_endpoint]]]
  22159. [Get the remote endpoint of the socket. ]
  22160. ]
  22161. [
  22162. [[link boost_asio.reference.basic_stream_socket.send [*send]]]
  22163. [Send some data on the socket. ]
  22164. ]
  22165. [
  22166. [[link boost_asio.reference.basic_stream_socket.set_option [*set_option]]]
  22167. [Set an option on the socket. ]
  22168. ]
  22169. [
  22170. [[link boost_asio.reference.basic_stream_socket.shutdown [*shutdown]]]
  22171. [Disable sends or receives on the socket. ]
  22172. ]
  22173. [
  22174. [[link boost_asio.reference.basic_stream_socket.wait [*wait]]]
  22175. [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  22176. ]
  22177. [
  22178. [[link boost_asio.reference.basic_stream_socket.write_some [*write_some]]]
  22179. [Write some data to the socket. ]
  22180. ]
  22181. [
  22182. [[link boost_asio.reference.basic_stream_socket._basic_stream_socket [*~basic_stream_socket]]]
  22183. [Destroys the socket. ]
  22184. ]
  22185. ]
  22186. [heading Data Members]
  22187. [table
  22188. [[Name][Description]]
  22189. [
  22190. [[link boost_asio.reference.basic_stream_socket.max_connections [*max_connections]]]
  22191. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  22192. ]
  22193. [
  22194. [[link boost_asio.reference.basic_stream_socket.max_listen_connections [*max_listen_connections]]]
  22195. [The maximum length of the queue of pending incoming connections. ]
  22196. ]
  22197. [
  22198. [[link boost_asio.reference.basic_stream_socket.message_do_not_route [*message_do_not_route]]]
  22199. [Specify that the data should not be subject to routing. ]
  22200. ]
  22201. [
  22202. [[link boost_asio.reference.basic_stream_socket.message_end_of_record [*message_end_of_record]]]
  22203. [Specifies that the data marks the end of a record. ]
  22204. ]
  22205. [
  22206. [[link boost_asio.reference.basic_stream_socket.message_out_of_band [*message_out_of_band]]]
  22207. [Process out-of-band data. ]
  22208. ]
  22209. [
  22210. [[link boost_asio.reference.basic_stream_socket.message_peek [*message_peek]]]
  22211. [Peek at incoming data without removing it from the input queue. ]
  22212. ]
  22213. ]
  22214. [heading Protected Data Members]
  22215. [table
  22216. [[Name][Description]]
  22217. [
  22218. [[link boost_asio.reference.basic_stream_socket.impl_ [*impl_]]]
  22219. []
  22220. ]
  22221. ]
  22222. The [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] class template provides asynchronous and blocking stream-oriented socket functionality.
  22223. [heading Thread Safety]
  22224. ['Distinct] ['objects:] Safe.
  22225. ['Shared] ['objects:] Unsafe.
  22226. [heading Requirements]
  22227. ['Header: ][^boost/asio/basic_stream_socket.hpp]
  22228. ['Convenience header: ][^boost/asio.hpp]
  22229. [section:assign basic_stream_socket::assign]
  22230. [indexterm2 boost_asio.indexterm.basic_stream_socket.assign..assign..basic_stream_socket]
  22231. Assign an existing native socket to the socket.
  22232. void ``[link boost_asio.reference.basic_stream_socket.assign.overload1 assign]``(
  22233. const protocol_type & protocol,
  22234. const native_handle_type & native_socket);
  22235. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.assign.overload1 more...]]``
  22236. void ``[link boost_asio.reference.basic_stream_socket.assign.overload2 assign]``(
  22237. const protocol_type & protocol,
  22238. const native_handle_type & native_socket,
  22239. boost::system::error_code & ec);
  22240. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.assign.overload2 more...]]``
  22241. [section:overload1 basic_stream_socket::assign (1 of 2 overloads)]
  22242. ['Inherited from basic_socket.]
  22243. Assign an existing native socket to the socket.
  22244. void assign(
  22245. const protocol_type & protocol,
  22246. const native_handle_type & native_socket);
  22247. [endsect]
  22248. [section:overload2 basic_stream_socket::assign (2 of 2 overloads)]
  22249. ['Inherited from basic_socket.]
  22250. Assign an existing native socket to the socket.
  22251. void assign(
  22252. const protocol_type & protocol,
  22253. const native_handle_type & native_socket,
  22254. boost::system::error_code & ec);
  22255. [endsect]
  22256. [endsect]
  22257. [section:async_connect basic_stream_socket::async_connect]
  22258. ['Inherited from basic_socket.]
  22259. [indexterm2 boost_asio.indexterm.basic_stream_socket.async_connect..async_connect..basic_stream_socket]
  22260. Start an asynchronous connect.
  22261. template<
  22262. typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  22263. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect(
  22264. const endpoint_type & peer_endpoint,
  22265. ConnectHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  22266. This function is used to asynchronously connect a socket to the specified remote endpoint. The function call always returns immediately.
  22267. The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
  22268. [heading Parameters]
  22269. [variablelist
  22270. [[peer_endpoint][The remote endpoint to which the socket will be connected. Copies will be made of the endpoint object as required.]]
  22271. [[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:
  22272. ``
  22273. void handler(
  22274. const boost::system::error_code& error // Result of operation
  22275. );
  22276. ``
  22277. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  22278. ]
  22279. [heading Example]
  22280. void connect_handler(const boost::system::error_code& error)
  22281. {
  22282. if (!error)
  22283. {
  22284. // Connect succeeded.
  22285. }
  22286. }
  22287. ...
  22288. boost::asio::ip::tcp::socket socket(my_context);
  22289. boost::asio::ip::tcp::endpoint endpoint(
  22290. boost::asio::ip::address::from_string("1.2.3.4"), 12345);
  22291. socket.async_connect(endpoint, connect_handler);
  22292. [endsect]
  22293. [section:async_read_some basic_stream_socket::async_read_some]
  22294. [indexterm2 boost_asio.indexterm.basic_stream_socket.async_read_some..async_read_some..basic_stream_socket]
  22295. Start an asynchronous read.
  22296. template<
  22297. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  22298. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  22299. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_some(
  22300. const MutableBufferSequence & buffers,
  22301. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  22302. This function is used to asynchronously read data from the stream socket. The function call always returns immediately.
  22303. [heading Parameters]
  22304. [variablelist
  22305. [[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.]]
  22306. [[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:
  22307. ``
  22308. void handler(
  22309. const boost::system::error_code& error, // Result of operation.
  22310. std::size_t bytes_transferred // Number of bytes read.
  22311. );
  22312. ``
  22313. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  22314. ]
  22315. [heading Remarks]
  22316. The read operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.async_read `async_read`] function if you need to ensure that the requested amount of data is read before the asynchronous operation completes.
  22317. [heading Example]
  22318. To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  22319. socket.async_read_some(boost::asio::buffer(data, size), handler);
  22320. See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  22321. [endsect]
  22322. [section:async_receive basic_stream_socket::async_receive]
  22323. [indexterm2 boost_asio.indexterm.basic_stream_socket.async_receive..async_receive..basic_stream_socket]
  22324. Start an asynchronous receive.
  22325. template<
  22326. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  22327. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  22328. ``[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]``(
  22329. const MutableBufferSequence & buffers,
  22330. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  22331. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.async_receive.overload1 more...]]``
  22332. template<
  22333. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  22334. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  22335. ``[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]``(
  22336. const MutableBufferSequence & buffers,
  22337. socket_base::message_flags flags,
  22338. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  22339. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.async_receive.overload2 more...]]``
  22340. [section:overload1 basic_stream_socket::async_receive (1 of 2 overloads)]
  22341. Start an asynchronous receive.
  22342. template<
  22343. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  22344. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  22345. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive(
  22346. const MutableBufferSequence & buffers,
  22347. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  22348. This function is used to asynchronously receive data from the stream socket. The function call always returns immediately.
  22349. [heading Parameters]
  22350. [variablelist
  22351. [[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.]]
  22352. [[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:
  22353. ``
  22354. void handler(
  22355. const boost::system::error_code& error, // Result of operation.
  22356. std::size_t bytes_transferred // Number of bytes received.
  22357. );
  22358. ``
  22359. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  22360. ]
  22361. [heading Remarks]
  22362. The receive operation may not receive all of the requested number of bytes. Consider using the [link boost_asio.reference.async_read `async_read`] function if you need to ensure that the requested amount of data is received before the asynchronous operation completes.
  22363. [heading Example]
  22364. To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  22365. socket.async_receive(boost::asio::buffer(data, size), handler);
  22366. See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  22367. [endsect]
  22368. [section:overload2 basic_stream_socket::async_receive (2 of 2 overloads)]
  22369. Start an asynchronous receive.
  22370. template<
  22371. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  22372. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  22373. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive(
  22374. const MutableBufferSequence & buffers,
  22375. socket_base::message_flags flags,
  22376. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  22377. This function is used to asynchronously receive data from the stream socket. The function call always returns immediately.
  22378. [heading Parameters]
  22379. [variablelist
  22380. [[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.]]
  22381. [[flags][Flags specifying how the receive call is to be made.]]
  22382. [[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:
  22383. ``
  22384. void handler(
  22385. const boost::system::error_code& error, // Result of operation.
  22386. std::size_t bytes_transferred // Number of bytes received.
  22387. );
  22388. ``
  22389. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  22390. ]
  22391. [heading Remarks]
  22392. The receive operation may not receive all of the requested number of bytes. Consider using the [link boost_asio.reference.async_read `async_read`] function if you need to ensure that the requested amount of data is received before the asynchronous operation completes.
  22393. [heading Example]
  22394. To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  22395. socket.async_receive(boost::asio::buffer(data, size), 0, handler);
  22396. See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  22397. [endsect]
  22398. [endsect]
  22399. [section:async_send basic_stream_socket::async_send]
  22400. [indexterm2 boost_asio.indexterm.basic_stream_socket.async_send..async_send..basic_stream_socket]
  22401. Start an asynchronous send.
  22402. template<
  22403. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  22404. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  22405. ``[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]``(
  22406. const ConstBufferSequence & buffers,
  22407. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  22408. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.async_send.overload1 more...]]``
  22409. template<
  22410. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  22411. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  22412. ``[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]``(
  22413. const ConstBufferSequence & buffers,
  22414. socket_base::message_flags flags,
  22415. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  22416. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.async_send.overload2 more...]]``
  22417. [section:overload1 basic_stream_socket::async_send (1 of 2 overloads)]
  22418. Start an asynchronous send.
  22419. template<
  22420. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  22421. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  22422. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send(
  22423. const ConstBufferSequence & buffers,
  22424. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  22425. This function is used to asynchronously send data on the stream socket. The function call always returns immediately.
  22426. [heading Parameters]
  22427. [variablelist
  22428. [[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.]]
  22429. [[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:
  22430. ``
  22431. void handler(
  22432. const boost::system::error_code& error, // Result of operation.
  22433. std::size_t bytes_transferred // Number of bytes sent.
  22434. );
  22435. ``
  22436. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  22437. ]
  22438. [heading Remarks]
  22439. The send operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.async_write `async_write`] function if you need to ensure that all data is written before the asynchronous operation completes.
  22440. [heading Example]
  22441. To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  22442. socket.async_send(boost::asio::buffer(data, size), handler);
  22443. See the [link boost_asio.reference.buffer `buffer`] documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  22444. [endsect]
  22445. [section:overload2 basic_stream_socket::async_send (2 of 2 overloads)]
  22446. Start an asynchronous send.
  22447. template<
  22448. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  22449. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  22450. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send(
  22451. const ConstBufferSequence & buffers,
  22452. socket_base::message_flags flags,
  22453. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  22454. This function is used to asynchronously send data on the stream socket. The function call always returns immediately.
  22455. [heading Parameters]
  22456. [variablelist
  22457. [[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.]]
  22458. [[flags][Flags specifying how the send call is to be made.]]
  22459. [[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:
  22460. ``
  22461. void handler(
  22462. const boost::system::error_code& error, // Result of operation.
  22463. std::size_t bytes_transferred // Number of bytes sent.
  22464. );
  22465. ``
  22466. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  22467. ]
  22468. [heading Remarks]
  22469. The send operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.async_write `async_write`] function if you need to ensure that all data is written before the asynchronous operation completes.
  22470. [heading Example]
  22471. To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  22472. socket.async_send(boost::asio::buffer(data, size), 0, handler);
  22473. See the [link boost_asio.reference.buffer `buffer`] documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  22474. [endsect]
  22475. [endsect]
  22476. [section:async_wait basic_stream_socket::async_wait]
  22477. ['Inherited from basic_socket.]
  22478. [indexterm2 boost_asio.indexterm.basic_stream_socket.async_wait..async_wait..basic_stream_socket]
  22479. Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions.
  22480. template<
  22481. typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  22482. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait(
  22483. wait_type w,
  22484. WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  22485. This function is used to perform an asynchronous wait for a socket to enter a ready to read, write or error condition state.
  22486. [heading Parameters]
  22487. [variablelist
  22488. [[w][Specifies the desired socket state.]]
  22489. [[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:
  22490. ``
  22491. void handler(
  22492. const boost::system::error_code& error // Result of operation
  22493. );
  22494. ``
  22495. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  22496. ]
  22497. [heading Example]
  22498. void wait_handler(const boost::system::error_code& error)
  22499. {
  22500. if (!error)
  22501. {
  22502. // Wait succeeded.
  22503. }
  22504. }
  22505. ...
  22506. boost::asio::ip::tcp::socket socket(my_context);
  22507. ...
  22508. socket.async_wait(boost::asio::ip::tcp::socket::wait_read, wait_handler);
  22509. [endsect]
  22510. [section:async_write_some basic_stream_socket::async_write_some]
  22511. [indexterm2 boost_asio.indexterm.basic_stream_socket.async_write_some..async_write_some..basic_stream_socket]
  22512. Start an asynchronous write.
  22513. template<
  22514. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  22515. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  22516. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_some(
  22517. const ConstBufferSequence & buffers,
  22518. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  22519. This function is used to asynchronously write data to the stream socket. The function call always returns immediately.
  22520. [heading Parameters]
  22521. [variablelist
  22522. [[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.]]
  22523. [[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:
  22524. ``
  22525. void handler(
  22526. const boost::system::error_code& error, // Result of operation.
  22527. std::size_t bytes_transferred // Number of bytes written.
  22528. );
  22529. ``
  22530. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  22531. ]
  22532. [heading Remarks]
  22533. The write operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.async_write `async_write`] function if you need to ensure that all data is written before the asynchronous operation completes.
  22534. [heading Example]
  22535. To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  22536. socket.async_write_some(boost::asio::buffer(data, size), handler);
  22537. See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  22538. [endsect]
  22539. [section:at_mark basic_stream_socket::at_mark]
  22540. [indexterm2 boost_asio.indexterm.basic_stream_socket.at_mark..at_mark..basic_stream_socket]
  22541. Determine whether the socket is at the out-of-band data mark.
  22542. bool ``[link boost_asio.reference.basic_stream_socket.at_mark.overload1 at_mark]``() const;
  22543. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.at_mark.overload1 more...]]``
  22544. bool ``[link boost_asio.reference.basic_stream_socket.at_mark.overload2 at_mark]``(
  22545. boost::system::error_code & ec) const;
  22546. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.at_mark.overload2 more...]]``
  22547. [section:overload1 basic_stream_socket::at_mark (1 of 2 overloads)]
  22548. ['Inherited from basic_socket.]
  22549. Determine whether the socket is at the out-of-band data mark.
  22550. bool at_mark() const;
  22551. This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
  22552. [heading Return Value]
  22553. A bool indicating whether the socket is at the out-of-band data mark.
  22554. [heading Exceptions]
  22555. [variablelist
  22556. [[boost::system::system_error][Thrown on failure. ]]
  22557. ]
  22558. [endsect]
  22559. [section:overload2 basic_stream_socket::at_mark (2 of 2 overloads)]
  22560. ['Inherited from basic_socket.]
  22561. Determine whether the socket is at the out-of-band data mark.
  22562. bool at_mark(
  22563. boost::system::error_code & ec) const;
  22564. This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
  22565. [heading Parameters]
  22566. [variablelist
  22567. [[ec][Set to indicate what error occurred, if any.]]
  22568. ]
  22569. [heading Return Value]
  22570. A bool indicating whether the socket is at the out-of-band data mark.
  22571. [endsect]
  22572. [endsect]
  22573. [section:available basic_stream_socket::available]
  22574. [indexterm2 boost_asio.indexterm.basic_stream_socket.available..available..basic_stream_socket]
  22575. Determine the number of bytes available for reading.
  22576. std::size_t ``[link boost_asio.reference.basic_stream_socket.available.overload1 available]``() const;
  22577. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.available.overload1 more...]]``
  22578. std::size_t ``[link boost_asio.reference.basic_stream_socket.available.overload2 available]``(
  22579. boost::system::error_code & ec) const;
  22580. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.available.overload2 more...]]``
  22581. [section:overload1 basic_stream_socket::available (1 of 2 overloads)]
  22582. ['Inherited from basic_socket.]
  22583. Determine the number of bytes available for reading.
  22584. std::size_t available() const;
  22585. This function is used to determine the number of bytes that may be read without blocking.
  22586. [heading Return Value]
  22587. The number of bytes that may be read without blocking, or 0 if an error occurs.
  22588. [heading Exceptions]
  22589. [variablelist
  22590. [[boost::system::system_error][Thrown on failure. ]]
  22591. ]
  22592. [endsect]
  22593. [section:overload2 basic_stream_socket::available (2 of 2 overloads)]
  22594. ['Inherited from basic_socket.]
  22595. Determine the number of bytes available for reading.
  22596. std::size_t available(
  22597. boost::system::error_code & ec) const;
  22598. This function is used to determine the number of bytes that may be read without blocking.
  22599. [heading Parameters]
  22600. [variablelist
  22601. [[ec][Set to indicate what error occurred, if any.]]
  22602. ]
  22603. [heading Return Value]
  22604. The number of bytes that may be read without blocking, or 0 if an error occurs.
  22605. [endsect]
  22606. [endsect]
  22607. [section:basic_stream_socket basic_stream_socket::basic_stream_socket]
  22608. [indexterm2 boost_asio.indexterm.basic_stream_socket.basic_stream_socket..basic_stream_socket..basic_stream_socket]
  22609. Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] without opening it.
  22610. explicit ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload1 basic_stream_socket]``(
  22611. const executor_type & ex);
  22612. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload1 more...]]``
  22613. template<
  22614. typename ExecutionContext>
  22615. explicit ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload2 basic_stream_socket]``(
  22616. ExecutionContext & context,
  22617. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  22618. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload2 more...]]``
  22619. Construct and open a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`].
  22620. ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload3 basic_stream_socket]``(
  22621. const executor_type & ex,
  22622. const protocol_type & protocol);
  22623. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload3 more...]]``
  22624. template<
  22625. typename ExecutionContext>
  22626. ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload4 basic_stream_socket]``(
  22627. ExecutionContext & context,
  22628. const protocol_type & protocol,
  22629. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  22630. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload4 more...]]``
  22631. Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`], opening it and binding it to the given local endpoint.
  22632. ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload5 basic_stream_socket]``(
  22633. const executor_type & ex,
  22634. const endpoint_type & endpoint);
  22635. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload5 more...]]``
  22636. template<
  22637. typename ExecutionContext>
  22638. ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload6 basic_stream_socket]``(
  22639. ExecutionContext & context,
  22640. const endpoint_type & endpoint,
  22641. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  22642. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload6 more...]]``
  22643. Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] on an existing native socket.
  22644. ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload7 basic_stream_socket]``(
  22645. const executor_type & ex,
  22646. const protocol_type & protocol,
  22647. const native_handle_type & native_socket);
  22648. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload7 more...]]``
  22649. template<
  22650. typename ExecutionContext>
  22651. ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload8 basic_stream_socket]``(
  22652. ExecutionContext & context,
  22653. const protocol_type & protocol,
  22654. const native_handle_type & native_socket,
  22655. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  22656. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload8 more...]]``
  22657. Move-construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] from another.
  22658. ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload9 basic_stream_socket]``(
  22659. basic_stream_socket && other);
  22660. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload9 more...]]``
  22661. Move-construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] from a socket of another protocol type.
  22662. template<
  22663. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  22664. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  22665. ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload10 basic_stream_socket]``(
  22666. basic_stream_socket< Protocol1, Executor1 > && other,
  22667. typename enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type * = 0);
  22668. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload10 more...]]``
  22669. [section:overload1 basic_stream_socket::basic_stream_socket (1 of 10 overloads)]
  22670. Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] without opening it.
  22671. basic_stream_socket(
  22672. const executor_type & ex);
  22673. This constructor creates a stream socket without opening it. The socket needs to be opened and then connected or accepted before data can be sent or received on it.
  22674. [heading Parameters]
  22675. [variablelist
  22676. [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket. ]]
  22677. ]
  22678. [endsect]
  22679. [section:overload2 basic_stream_socket::basic_stream_socket (2 of 10 overloads)]
  22680. Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] without opening it.
  22681. template<
  22682. typename ExecutionContext>
  22683. basic_stream_socket(
  22684. ExecutionContext & context,
  22685. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  22686. This constructor creates a stream socket without opening it. The socket needs to be opened and then connected or accepted before data can be sent or received on it.
  22687. [heading Parameters]
  22688. [variablelist
  22689. [[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. ]]
  22690. ]
  22691. [endsect]
  22692. [section:overload3 basic_stream_socket::basic_stream_socket (3 of 10 overloads)]
  22693. Construct and open a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`].
  22694. basic_stream_socket(
  22695. const executor_type & ex,
  22696. const protocol_type & protocol);
  22697. This constructor creates and opens a stream socket. The socket needs to be connected or accepted before data can be sent or received on it.
  22698. [heading Parameters]
  22699. [variablelist
  22700. [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
  22701. [[protocol][An object specifying protocol parameters to be used.]]
  22702. ]
  22703. [heading Exceptions]
  22704. [variablelist
  22705. [[boost::system::system_error][Thrown on failure. ]]
  22706. ]
  22707. [endsect]
  22708. [section:overload4 basic_stream_socket::basic_stream_socket (4 of 10 overloads)]
  22709. Construct and open a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`].
  22710. template<
  22711. typename ExecutionContext>
  22712. basic_stream_socket(
  22713. ExecutionContext & context,
  22714. const protocol_type & protocol,
  22715. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  22716. This constructor creates and opens a stream socket. The socket needs to be connected or accepted before data can be sent or received on it.
  22717. [heading Parameters]
  22718. [variablelist
  22719. [[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.]]
  22720. [[protocol][An object specifying protocol parameters to be used.]]
  22721. ]
  22722. [heading Exceptions]
  22723. [variablelist
  22724. [[boost::system::system_error][Thrown on failure. ]]
  22725. ]
  22726. [endsect]
  22727. [section:overload5 basic_stream_socket::basic_stream_socket (5 of 10 overloads)]
  22728. Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`], opening it and binding it to the given local endpoint.
  22729. basic_stream_socket(
  22730. const executor_type & ex,
  22731. const endpoint_type & endpoint);
  22732. This constructor creates a stream socket and automatically opens it bound to the specified endpoint on the local machine. The protocol used is the protocol associated with the given endpoint.
  22733. [heading Parameters]
  22734. [variablelist
  22735. [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
  22736. [[endpoint][An endpoint on the local machine to which the stream socket will be bound.]]
  22737. ]
  22738. [heading Exceptions]
  22739. [variablelist
  22740. [[boost::system::system_error][Thrown on failure. ]]
  22741. ]
  22742. [endsect]
  22743. [section:overload6 basic_stream_socket::basic_stream_socket (6 of 10 overloads)]
  22744. Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`], opening it and binding it to the given local endpoint.
  22745. template<
  22746. typename ExecutionContext>
  22747. basic_stream_socket(
  22748. ExecutionContext & context,
  22749. const endpoint_type & endpoint,
  22750. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  22751. This constructor creates a stream socket and automatically opens it bound to the specified endpoint on the local machine. The protocol used is the protocol associated with the given endpoint.
  22752. [heading Parameters]
  22753. [variablelist
  22754. [[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.]]
  22755. [[endpoint][An endpoint on the local machine to which the stream socket will be bound.]]
  22756. ]
  22757. [heading Exceptions]
  22758. [variablelist
  22759. [[boost::system::system_error][Thrown on failure. ]]
  22760. ]
  22761. [endsect]
  22762. [section:overload7 basic_stream_socket::basic_stream_socket (7 of 10 overloads)]
  22763. Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] on an existing native socket.
  22764. basic_stream_socket(
  22765. const executor_type & ex,
  22766. const protocol_type & protocol,
  22767. const native_handle_type & native_socket);
  22768. This constructor creates a stream socket object to hold an existing native socket.
  22769. [heading Parameters]
  22770. [variablelist
  22771. [[ex][The I/O executor that the socket will use, by default, to dispatch handlers for any asynchronous operations performed on the socket.]]
  22772. [[protocol][An object specifying protocol parameters to be used.]]
  22773. [[native_socket][The new underlying socket implementation.]]
  22774. ]
  22775. [heading Exceptions]
  22776. [variablelist
  22777. [[boost::system::system_error][Thrown on failure. ]]
  22778. ]
  22779. [endsect]
  22780. [section:overload8 basic_stream_socket::basic_stream_socket (8 of 10 overloads)]
  22781. Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] on an existing native socket.
  22782. template<
  22783. typename ExecutionContext>
  22784. basic_stream_socket(
  22785. ExecutionContext & context,
  22786. const protocol_type & protocol,
  22787. const native_handle_type & native_socket,
  22788. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  22789. This constructor creates a stream socket object to hold an existing native socket.
  22790. [heading Parameters]
  22791. [variablelist
  22792. [[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.]]
  22793. [[protocol][An object specifying protocol parameters to be used.]]
  22794. [[native_socket][The new underlying socket implementation.]]
  22795. ]
  22796. [heading Exceptions]
  22797. [variablelist
  22798. [[boost::system::system_error][Thrown on failure. ]]
  22799. ]
  22800. [endsect]
  22801. [section:overload9 basic_stream_socket::basic_stream_socket (9 of 10 overloads)]
  22802. Move-construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] from another.
  22803. basic_stream_socket(
  22804. basic_stream_socket && other);
  22805. This constructor moves a stream socket from one object to another.
  22806. [heading Parameters]
  22807. [variablelist
  22808. [[other][The other [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] object from which the move will occur.]]
  22809. ]
  22810. [heading Remarks]
  22811. Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_socket(const executor_type&)` constructor.
  22812. [endsect]
  22813. [section:overload10 basic_stream_socket::basic_stream_socket (10 of 10 overloads)]
  22814. Move-construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] from a socket of another protocol type.
  22815. template<
  22816. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  22817. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  22818. basic_stream_socket(
  22819. basic_stream_socket< Protocol1, Executor1 > && other,
  22820. typename enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value >::type * = 0);
  22821. This constructor moves a stream socket from one object to another.
  22822. [heading Parameters]
  22823. [variablelist
  22824. [[other][The other [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] object from which the move will occur.]]
  22825. ]
  22826. [heading Remarks]
  22827. Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_socket(const executor_type&)` constructor.
  22828. [endsect]
  22829. [endsect]
  22830. [section:bind basic_stream_socket::bind]
  22831. [indexterm2 boost_asio.indexterm.basic_stream_socket.bind..bind..basic_stream_socket]
  22832. Bind the socket to the given local endpoint.
  22833. void ``[link boost_asio.reference.basic_stream_socket.bind.overload1 bind]``(
  22834. const endpoint_type & endpoint);
  22835. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.bind.overload1 more...]]``
  22836. void ``[link boost_asio.reference.basic_stream_socket.bind.overload2 bind]``(
  22837. const endpoint_type & endpoint,
  22838. boost::system::error_code & ec);
  22839. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.bind.overload2 more...]]``
  22840. [section:overload1 basic_stream_socket::bind (1 of 2 overloads)]
  22841. ['Inherited from basic_socket.]
  22842. Bind the socket to the given local endpoint.
  22843. void bind(
  22844. const endpoint_type & endpoint);
  22845. This function binds the socket to the specified endpoint on the local machine.
  22846. [heading Parameters]
  22847. [variablelist
  22848. [[endpoint][An endpoint on the local machine to which the socket will be bound.]]
  22849. ]
  22850. [heading Exceptions]
  22851. [variablelist
  22852. [[boost::system::system_error][Thrown on failure.]]
  22853. ]
  22854. [heading Example]
  22855. boost::asio::ip::tcp::socket socket(my_context);
  22856. socket.open(boost::asio::ip::tcp::v4());
  22857. socket.bind(boost::asio::ip::tcp::endpoint(
  22858. boost::asio::ip::tcp::v4(), 12345));
  22859. [endsect]
  22860. [section:overload2 basic_stream_socket::bind (2 of 2 overloads)]
  22861. ['Inherited from basic_socket.]
  22862. Bind the socket to the given local endpoint.
  22863. void bind(
  22864. const endpoint_type & endpoint,
  22865. boost::system::error_code & ec);
  22866. This function binds the socket to the specified endpoint on the local machine.
  22867. [heading Parameters]
  22868. [variablelist
  22869. [[endpoint][An endpoint on the local machine to which the socket will be bound.]]
  22870. [[ec][Set to indicate what error occurred, if any.]]
  22871. ]
  22872. [heading Example]
  22873. boost::asio::ip::tcp::socket socket(my_context);
  22874. socket.open(boost::asio::ip::tcp::v4());
  22875. boost::system::error_code ec;
  22876. socket.bind(boost::asio::ip::tcp::endpoint(
  22877. boost::asio::ip::tcp::v4(), 12345), ec);
  22878. if (ec)
  22879. {
  22880. // An error occurred.
  22881. }
  22882. [endsect]
  22883. [endsect]
  22884. [section:broadcast basic_stream_socket::broadcast]
  22885. ['Inherited from socket_base.]
  22886. [indexterm2 boost_asio.indexterm.basic_stream_socket.broadcast..broadcast..basic_stream_socket]
  22887. Socket option to permit sending of broadcast messages.
  22888. typedef implementation_defined broadcast;
  22889. Implements the SOL\_SOCKET/SO\_BROADCAST socket option.
  22890. [heading Examples]
  22891. Setting the option:
  22892. boost::asio::ip::udp::socket socket(my_context);
  22893. ...
  22894. boost::asio::socket_base::broadcast option(true);
  22895. socket.set_option(option);
  22896. Getting the current option value:
  22897. boost::asio::ip::udp::socket socket(my_context);
  22898. ...
  22899. boost::asio::socket_base::broadcast option;
  22900. socket.get_option(option);
  22901. bool is_set = option.value();
  22902. [heading Requirements]
  22903. ['Header: ][^boost/asio/basic_stream_socket.hpp]
  22904. ['Convenience header: ][^boost/asio.hpp]
  22905. [endsect]
  22906. [section:bytes_readable basic_stream_socket::bytes_readable]
  22907. ['Inherited from socket_base.]
  22908. [indexterm2 boost_asio.indexterm.basic_stream_socket.bytes_readable..bytes_readable..basic_stream_socket]
  22909. IO control command to get the amount of data that can be read without blocking.
  22910. typedef implementation_defined bytes_readable;
  22911. Implements the FIONREAD IO control command.
  22912. [heading Example]
  22913. boost::asio::ip::tcp::socket socket(my_context);
  22914. ...
  22915. boost::asio::socket_base::bytes_readable command(true);
  22916. socket.io_control(command);
  22917. std::size_t bytes_readable = command.get();
  22918. [heading Requirements]
  22919. ['Header: ][^boost/asio/basic_stream_socket.hpp]
  22920. ['Convenience header: ][^boost/asio.hpp]
  22921. [endsect]
  22922. [section:cancel basic_stream_socket::cancel]
  22923. [indexterm2 boost_asio.indexterm.basic_stream_socket.cancel..cancel..basic_stream_socket]
  22924. Cancel all asynchronous operations associated with the socket.
  22925. void ``[link boost_asio.reference.basic_stream_socket.cancel.overload1 cancel]``();
  22926. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.cancel.overload1 more...]]``
  22927. void ``[link boost_asio.reference.basic_stream_socket.cancel.overload2 cancel]``(
  22928. boost::system::error_code & ec);
  22929. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.cancel.overload2 more...]]``
  22930. [section:overload1 basic_stream_socket::cancel (1 of 2 overloads)]
  22931. ['Inherited from basic_socket.]
  22932. Cancel all asynchronous operations associated with the socket.
  22933. void cancel();
  22934. This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
  22935. [heading Exceptions]
  22936. [variablelist
  22937. [[boost::system::system_error][Thrown on failure.]]
  22938. ]
  22939. [heading Remarks]
  22940. Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
  22941. * It will only cancel asynchronous operations that were initiated in the current thread.
  22942. * 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.
  22943. For portable cancellation, consider using one of the following alternatives:
  22944. * Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
  22945. * Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
  22946. When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above.
  22947. [endsect]
  22948. [section:overload2 basic_stream_socket::cancel (2 of 2 overloads)]
  22949. ['Inherited from basic_socket.]
  22950. Cancel all asynchronous operations associated with the socket.
  22951. void cancel(
  22952. boost::system::error_code & ec);
  22953. This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
  22954. [heading Parameters]
  22955. [variablelist
  22956. [[ec][Set to indicate what error occurred, if any.]]
  22957. ]
  22958. [heading Remarks]
  22959. Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
  22960. * It will only cancel asynchronous operations that were initiated in the current thread.
  22961. * 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.
  22962. For portable cancellation, consider using one of the following alternatives:
  22963. * Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
  22964. * Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
  22965. When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above.
  22966. [endsect]
  22967. [endsect]
  22968. [section:close basic_stream_socket::close]
  22969. [indexterm2 boost_asio.indexterm.basic_stream_socket.close..close..basic_stream_socket]
  22970. Close the socket.
  22971. void ``[link boost_asio.reference.basic_stream_socket.close.overload1 close]``();
  22972. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.close.overload1 more...]]``
  22973. void ``[link boost_asio.reference.basic_stream_socket.close.overload2 close]``(
  22974. boost::system::error_code & ec);
  22975. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.close.overload2 more...]]``
  22976. [section:overload1 basic_stream_socket::close (1 of 2 overloads)]
  22977. ['Inherited from basic_socket.]
  22978. Close the socket.
  22979. void close();
  22980. This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
  22981. [heading Exceptions]
  22982. [variablelist
  22983. [[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
  22984. ]
  22985. [heading Remarks]
  22986. For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket.
  22987. [endsect]
  22988. [section:overload2 basic_stream_socket::close (2 of 2 overloads)]
  22989. ['Inherited from basic_socket.]
  22990. Close the socket.
  22991. void close(
  22992. boost::system::error_code & ec);
  22993. This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
  22994. [heading Parameters]
  22995. [variablelist
  22996. [[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
  22997. ]
  22998. [heading Example]
  22999. boost::asio::ip::tcp::socket socket(my_context);
  23000. ...
  23001. boost::system::error_code ec;
  23002. socket.close(ec);
  23003. if (ec)
  23004. {
  23005. // An error occurred.
  23006. }
  23007. [heading Remarks]
  23008. For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket.
  23009. [endsect]
  23010. [endsect]
  23011. [section:connect basic_stream_socket::connect]
  23012. [indexterm2 boost_asio.indexterm.basic_stream_socket.connect..connect..basic_stream_socket]
  23013. Connect the socket to the specified endpoint.
  23014. void ``[link boost_asio.reference.basic_stream_socket.connect.overload1 connect]``(
  23015. const endpoint_type & peer_endpoint);
  23016. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.connect.overload1 more...]]``
  23017. void ``[link boost_asio.reference.basic_stream_socket.connect.overload2 connect]``(
  23018. const endpoint_type & peer_endpoint,
  23019. boost::system::error_code & ec);
  23020. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.connect.overload2 more...]]``
  23021. [section:overload1 basic_stream_socket::connect (1 of 2 overloads)]
  23022. ['Inherited from basic_socket.]
  23023. Connect the socket to the specified endpoint.
  23024. void connect(
  23025. const endpoint_type & peer_endpoint);
  23026. This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
  23027. The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
  23028. [heading Parameters]
  23029. [variablelist
  23030. [[peer_endpoint][The remote endpoint to which the socket will be connected.]]
  23031. ]
  23032. [heading Exceptions]
  23033. [variablelist
  23034. [[boost::system::system_error][Thrown on failure.]]
  23035. ]
  23036. [heading Example]
  23037. boost::asio::ip::tcp::socket socket(my_context);
  23038. boost::asio::ip::tcp::endpoint endpoint(
  23039. boost::asio::ip::address::from_string("1.2.3.4"), 12345);
  23040. socket.connect(endpoint);
  23041. [endsect]
  23042. [section:overload2 basic_stream_socket::connect (2 of 2 overloads)]
  23043. ['Inherited from basic_socket.]
  23044. Connect the socket to the specified endpoint.
  23045. void connect(
  23046. const endpoint_type & peer_endpoint,
  23047. boost::system::error_code & ec);
  23048. This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
  23049. The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
  23050. [heading Parameters]
  23051. [variablelist
  23052. [[peer_endpoint][The remote endpoint to which the socket will be connected.]]
  23053. [[ec][Set to indicate what error occurred, if any.]]
  23054. ]
  23055. [heading Example]
  23056. boost::asio::ip::tcp::socket socket(my_context);
  23057. boost::asio::ip::tcp::endpoint endpoint(
  23058. boost::asio::ip::address::from_string("1.2.3.4"), 12345);
  23059. boost::system::error_code ec;
  23060. socket.connect(endpoint, ec);
  23061. if (ec)
  23062. {
  23063. // An error occurred.
  23064. }
  23065. [endsect]
  23066. [endsect]
  23067. [section:debug basic_stream_socket::debug]
  23068. ['Inherited from socket_base.]
  23069. [indexterm2 boost_asio.indexterm.basic_stream_socket.debug..debug..basic_stream_socket]
  23070. Socket option to enable socket-level debugging.
  23071. typedef implementation_defined debug;
  23072. Implements the SOL\_SOCKET/SO\_DEBUG socket option.
  23073. [heading Examples]
  23074. Setting the option:
  23075. boost::asio::ip::tcp::socket socket(my_context);
  23076. ...
  23077. boost::asio::socket_base::debug option(true);
  23078. socket.set_option(option);
  23079. Getting the current option value:
  23080. boost::asio::ip::tcp::socket socket(my_context);
  23081. ...
  23082. boost::asio::socket_base::debug option;
  23083. socket.get_option(option);
  23084. bool is_set = option.value();
  23085. [heading Requirements]
  23086. ['Header: ][^boost/asio/basic_stream_socket.hpp]
  23087. ['Convenience header: ][^boost/asio.hpp]
  23088. [endsect]
  23089. [section:do_not_route basic_stream_socket::do_not_route]
  23090. ['Inherited from socket_base.]
  23091. [indexterm2 boost_asio.indexterm.basic_stream_socket.do_not_route..do_not_route..basic_stream_socket]
  23092. Socket option to prevent routing, use local interfaces only.
  23093. typedef implementation_defined do_not_route;
  23094. Implements the SOL\_SOCKET/SO\_DONTROUTE socket option.
  23095. [heading Examples]
  23096. Setting the option:
  23097. boost::asio::ip::udp::socket socket(my_context);
  23098. ...
  23099. boost::asio::socket_base::do_not_route option(true);
  23100. socket.set_option(option);
  23101. Getting the current option value:
  23102. boost::asio::ip::udp::socket socket(my_context);
  23103. ...
  23104. boost::asio::socket_base::do_not_route option;
  23105. socket.get_option(option);
  23106. bool is_set = option.value();
  23107. [heading Requirements]
  23108. ['Header: ][^boost/asio/basic_stream_socket.hpp]
  23109. ['Convenience header: ][^boost/asio.hpp]
  23110. [endsect]
  23111. [section:enable_connection_aborted basic_stream_socket::enable_connection_aborted]
  23112. ['Inherited from socket_base.]
  23113. [indexterm2 boost_asio.indexterm.basic_stream_socket.enable_connection_aborted..enable_connection_aborted..basic_stream_socket]
  23114. Socket option to report aborted connections on accept.
  23115. typedef implementation_defined enable_connection_aborted;
  23116. Implements a custom socket option that determines whether or not an accept operation is permitted to fail with `boost::asio::error::connection_aborted`. By default the option is false.
  23117. [heading Examples]
  23118. Setting the option:
  23119. boost::asio::ip::tcp::acceptor acceptor(my_context);
  23120. ...
  23121. boost::asio::socket_base::enable_connection_aborted option(true);
  23122. acceptor.set_option(option);
  23123. Getting the current option value:
  23124. boost::asio::ip::tcp::acceptor acceptor(my_context);
  23125. ...
  23126. boost::asio::socket_base::enable_connection_aborted option;
  23127. acceptor.get_option(option);
  23128. bool is_set = option.value();
  23129. [heading Requirements]
  23130. ['Header: ][^boost/asio/basic_stream_socket.hpp]
  23131. ['Convenience header: ][^boost/asio.hpp]
  23132. [endsect]
  23133. [section:endpoint_type basic_stream_socket::endpoint_type]
  23134. [indexterm2 boost_asio.indexterm.basic_stream_socket.endpoint_type..endpoint_type..basic_stream_socket]
  23135. The endpoint type.
  23136. typedef Protocol::endpoint endpoint_type;
  23137. [heading Requirements]
  23138. ['Header: ][^boost/asio/basic_stream_socket.hpp]
  23139. ['Convenience header: ][^boost/asio.hpp]
  23140. [endsect]
  23141. [section:executor_type basic_stream_socket::executor_type]
  23142. [indexterm2 boost_asio.indexterm.basic_stream_socket.executor_type..executor_type..basic_stream_socket]
  23143. The type of the executor associated with the object.
  23144. typedef Executor executor_type;
  23145. [heading Requirements]
  23146. ['Header: ][^boost/asio/basic_stream_socket.hpp]
  23147. ['Convenience header: ][^boost/asio.hpp]
  23148. [endsect]
  23149. [section:get_executor basic_stream_socket::get_executor]
  23150. ['Inherited from basic_socket.]
  23151. [indexterm2 boost_asio.indexterm.basic_stream_socket.get_executor..get_executor..basic_stream_socket]
  23152. Get the executor associated with the object.
  23153. executor_type get_executor();
  23154. [endsect]
  23155. [section:get_option basic_stream_socket::get_option]
  23156. [indexterm2 boost_asio.indexterm.basic_stream_socket.get_option..get_option..basic_stream_socket]
  23157. Get an option from the socket.
  23158. template<
  23159. typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
  23160. void ``[link boost_asio.reference.basic_stream_socket.get_option.overload1 get_option]``(
  23161. GettableSocketOption & option) const;
  23162. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.get_option.overload1 more...]]``
  23163. template<
  23164. typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
  23165. void ``[link boost_asio.reference.basic_stream_socket.get_option.overload2 get_option]``(
  23166. GettableSocketOption & option,
  23167. boost::system::error_code & ec) const;
  23168. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.get_option.overload2 more...]]``
  23169. [section:overload1 basic_stream_socket::get_option (1 of 2 overloads)]
  23170. ['Inherited from basic_socket.]
  23171. Get an option from the socket.
  23172. template<
  23173. typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
  23174. void get_option(
  23175. GettableSocketOption & option) const;
  23176. This function is used to get the current value of an option on the socket.
  23177. [heading Parameters]
  23178. [variablelist
  23179. [[option][The option value to be obtained from the socket.]]
  23180. ]
  23181. [heading Exceptions]
  23182. [variablelist
  23183. [[boost::system::system_error][Thrown on failure.]]
  23184. ]
  23185. [heading Example]
  23186. Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option:
  23187. boost::asio::ip::tcp::socket socket(my_context);
  23188. ...
  23189. boost::asio::ip::tcp::socket::keep_alive option;
  23190. socket.get_option(option);
  23191. bool is_set = option.value();
  23192. [endsect]
  23193. [section:overload2 basic_stream_socket::get_option (2 of 2 overloads)]
  23194. ['Inherited from basic_socket.]
  23195. Get an option from the socket.
  23196. template<
  23197. typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
  23198. void get_option(
  23199. GettableSocketOption & option,
  23200. boost::system::error_code & ec) const;
  23201. This function is used to get the current value of an option on the socket.
  23202. [heading Parameters]
  23203. [variablelist
  23204. [[option][The option value to be obtained from the socket.]]
  23205. [[ec][Set to indicate what error occurred, if any.]]
  23206. ]
  23207. [heading Example]
  23208. Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option:
  23209. boost::asio::ip::tcp::socket socket(my_context);
  23210. ...
  23211. boost::asio::ip::tcp::socket::keep_alive option;
  23212. boost::system::error_code ec;
  23213. socket.get_option(option, ec);
  23214. if (ec)
  23215. {
  23216. // An error occurred.
  23217. }
  23218. bool is_set = option.value();
  23219. [endsect]
  23220. [endsect]
  23221. [section:impl_ basic_stream_socket::impl_]
  23222. ['Inherited from basic_socket.]
  23223. [indexterm2 boost_asio.indexterm.basic_stream_socket.impl_..impl_..basic_stream_socket]
  23224. detail::io_object_impl< detail::reactive_socket_service< Protocol >, Executor > impl_;
  23225. [endsect]
  23226. [section:io_control basic_stream_socket::io_control]
  23227. [indexterm2 boost_asio.indexterm.basic_stream_socket.io_control..io_control..basic_stream_socket]
  23228. Perform an IO control command on the socket.
  23229. template<
  23230. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  23231. void ``[link boost_asio.reference.basic_stream_socket.io_control.overload1 io_control]``(
  23232. IoControlCommand & command);
  23233. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.io_control.overload1 more...]]``
  23234. template<
  23235. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  23236. void ``[link boost_asio.reference.basic_stream_socket.io_control.overload2 io_control]``(
  23237. IoControlCommand & command,
  23238. boost::system::error_code & ec);
  23239. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.io_control.overload2 more...]]``
  23240. [section:overload1 basic_stream_socket::io_control (1 of 2 overloads)]
  23241. ['Inherited from basic_socket.]
  23242. Perform an IO control command on the socket.
  23243. template<
  23244. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  23245. void io_control(
  23246. IoControlCommand & command);
  23247. This function is used to execute an IO control command on the socket.
  23248. [heading Parameters]
  23249. [variablelist
  23250. [[command][The IO control command to be performed on the socket.]]
  23251. ]
  23252. [heading Exceptions]
  23253. [variablelist
  23254. [[boost::system::system_error][Thrown on failure.]]
  23255. ]
  23256. [heading Example]
  23257. Getting the number of bytes ready to read:
  23258. boost::asio::ip::tcp::socket socket(my_context);
  23259. ...
  23260. boost::asio::ip::tcp::socket::bytes_readable command;
  23261. socket.io_control(command);
  23262. std::size_t bytes_readable = command.get();
  23263. [endsect]
  23264. [section:overload2 basic_stream_socket::io_control (2 of 2 overloads)]
  23265. ['Inherited from basic_socket.]
  23266. Perform an IO control command on the socket.
  23267. template<
  23268. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  23269. void io_control(
  23270. IoControlCommand & command,
  23271. boost::system::error_code & ec);
  23272. This function is used to execute an IO control command on the socket.
  23273. [heading Parameters]
  23274. [variablelist
  23275. [[command][The IO control command to be performed on the socket.]]
  23276. [[ec][Set to indicate what error occurred, if any.]]
  23277. ]
  23278. [heading Example]
  23279. Getting the number of bytes ready to read:
  23280. boost::asio::ip::tcp::socket socket(my_context);
  23281. ...
  23282. boost::asio::ip::tcp::socket::bytes_readable command;
  23283. boost::system::error_code ec;
  23284. socket.io_control(command, ec);
  23285. if (ec)
  23286. {
  23287. // An error occurred.
  23288. }
  23289. std::size_t bytes_readable = command.get();
  23290. [endsect]
  23291. [endsect]
  23292. [section:is_open basic_stream_socket::is_open]
  23293. ['Inherited from basic_socket.]
  23294. [indexterm2 boost_asio.indexterm.basic_stream_socket.is_open..is_open..basic_stream_socket]
  23295. Determine whether the socket is open.
  23296. bool is_open() const;
  23297. [endsect]
  23298. [section:keep_alive basic_stream_socket::keep_alive]
  23299. ['Inherited from socket_base.]
  23300. [indexterm2 boost_asio.indexterm.basic_stream_socket.keep_alive..keep_alive..basic_stream_socket]
  23301. Socket option to send keep-alives.
  23302. typedef implementation_defined keep_alive;
  23303. Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option.
  23304. [heading Examples]
  23305. Setting the option:
  23306. boost::asio::ip::tcp::socket socket(my_context);
  23307. ...
  23308. boost::asio::socket_base::keep_alive option(true);
  23309. socket.set_option(option);
  23310. Getting the current option value:
  23311. boost::asio::ip::tcp::socket socket(my_context);
  23312. ...
  23313. boost::asio::socket_base::keep_alive option;
  23314. socket.get_option(option);
  23315. bool is_set = option.value();
  23316. [heading Requirements]
  23317. ['Header: ][^boost/asio/basic_stream_socket.hpp]
  23318. ['Convenience header: ][^boost/asio.hpp]
  23319. [endsect]
  23320. [section:linger basic_stream_socket::linger]
  23321. ['Inherited from socket_base.]
  23322. [indexterm2 boost_asio.indexterm.basic_stream_socket.linger..linger..basic_stream_socket]
  23323. Socket option to specify whether the socket lingers on close if unsent data is present.
  23324. typedef implementation_defined linger;
  23325. Implements the SOL\_SOCKET/SO\_LINGER socket option.
  23326. [heading Examples]
  23327. Setting the option:
  23328. boost::asio::ip::tcp::socket socket(my_context);
  23329. ...
  23330. boost::asio::socket_base::linger option(true, 30);
  23331. socket.set_option(option);
  23332. Getting the current option value:
  23333. boost::asio::ip::tcp::socket socket(my_context);
  23334. ...
  23335. boost::asio::socket_base::linger option;
  23336. socket.get_option(option);
  23337. bool is_set = option.enabled();
  23338. unsigned short timeout = option.timeout();
  23339. [heading Requirements]
  23340. ['Header: ][^boost/asio/basic_stream_socket.hpp]
  23341. ['Convenience header: ][^boost/asio.hpp]
  23342. [endsect]
  23343. [section:local_endpoint basic_stream_socket::local_endpoint]
  23344. [indexterm2 boost_asio.indexterm.basic_stream_socket.local_endpoint..local_endpoint..basic_stream_socket]
  23345. Get the local endpoint of the socket.
  23346. endpoint_type ``[link boost_asio.reference.basic_stream_socket.local_endpoint.overload1 local_endpoint]``() const;
  23347. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.local_endpoint.overload1 more...]]``
  23348. endpoint_type ``[link boost_asio.reference.basic_stream_socket.local_endpoint.overload2 local_endpoint]``(
  23349. boost::system::error_code & ec) const;
  23350. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.local_endpoint.overload2 more...]]``
  23351. [section:overload1 basic_stream_socket::local_endpoint (1 of 2 overloads)]
  23352. ['Inherited from basic_socket.]
  23353. Get the local endpoint of the socket.
  23354. endpoint_type local_endpoint() const;
  23355. This function is used to obtain the locally bound endpoint of the socket.
  23356. [heading Return Value]
  23357. An object that represents the local endpoint of the socket.
  23358. [heading Exceptions]
  23359. [variablelist
  23360. [[boost::system::system_error][Thrown on failure.]]
  23361. ]
  23362. [heading Example]
  23363. boost::asio::ip::tcp::socket socket(my_context);
  23364. ...
  23365. boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint();
  23366. [endsect]
  23367. [section:overload2 basic_stream_socket::local_endpoint (2 of 2 overloads)]
  23368. ['Inherited from basic_socket.]
  23369. Get the local endpoint of the socket.
  23370. endpoint_type local_endpoint(
  23371. boost::system::error_code & ec) const;
  23372. This function is used to obtain the locally bound endpoint of the socket.
  23373. [heading Parameters]
  23374. [variablelist
  23375. [[ec][Set to indicate what error occurred, if any.]]
  23376. ]
  23377. [heading Return Value]
  23378. An object that represents the local endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
  23379. [heading Example]
  23380. boost::asio::ip::tcp::socket socket(my_context);
  23381. ...
  23382. boost::system::error_code ec;
  23383. boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(ec);
  23384. if (ec)
  23385. {
  23386. // An error occurred.
  23387. }
  23388. [endsect]
  23389. [endsect]
  23390. [section:lowest_layer basic_stream_socket::lowest_layer]
  23391. [indexterm2 boost_asio.indexterm.basic_stream_socket.lowest_layer..lowest_layer..basic_stream_socket]
  23392. Get a reference to the lowest layer.
  23393. lowest_layer_type & ``[link boost_asio.reference.basic_stream_socket.lowest_layer.overload1 lowest_layer]``();
  23394. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.lowest_layer.overload1 more...]]``
  23395. Get a const reference to the lowest layer.
  23396. const lowest_layer_type & ``[link boost_asio.reference.basic_stream_socket.lowest_layer.overload2 lowest_layer]``() const;
  23397. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.lowest_layer.overload2 more...]]``
  23398. [section:overload1 basic_stream_socket::lowest_layer (1 of 2 overloads)]
  23399. ['Inherited from basic_socket.]
  23400. Get a reference to the lowest layer.
  23401. lowest_layer_type & lowest_layer();
  23402. This function returns a reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
  23403. [heading Return Value]
  23404. A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
  23405. [endsect]
  23406. [section:overload2 basic_stream_socket::lowest_layer (2 of 2 overloads)]
  23407. ['Inherited from basic_socket.]
  23408. Get a const reference to the lowest layer.
  23409. const lowest_layer_type & lowest_layer() const;
  23410. This function returns a const reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
  23411. [heading Return Value]
  23412. A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
  23413. [endsect]
  23414. [endsect]
  23415. [section:lowest_layer_type basic_stream_socket::lowest_layer_type]
  23416. ['Inherited from basic_socket.]
  23417. [indexterm2 boost_asio.indexterm.basic_stream_socket.lowest_layer_type..lowest_layer_type..basic_stream_socket]
  23418. A [link boost_asio.reference.basic_socket `basic_socket`] is always the lowest layer.
  23419. typedef basic_socket< Protocol, Executor > lowest_layer_type;
  23420. [heading Types]
  23421. [table
  23422. [[Name][Description]]
  23423. [
  23424. [[link boost_asio.reference.basic_socket__rebind_executor [*rebind_executor]]]
  23425. [Rebinds the socket type to another executor. ]
  23426. ]
  23427. [
  23428. [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]]
  23429. [Socket option to permit sending of broadcast messages. ]
  23430. ]
  23431. [
  23432. [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]]
  23433. [IO control command to get the amount of data that can be read without blocking. ]
  23434. ]
  23435. [
  23436. [[link boost_asio.reference.basic_socket.debug [*debug]]]
  23437. [Socket option to enable socket-level debugging. ]
  23438. ]
  23439. [
  23440. [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]]
  23441. [Socket option to prevent routing, use local interfaces only. ]
  23442. ]
  23443. [
  23444. [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]]
  23445. [Socket option to report aborted connections on accept. ]
  23446. ]
  23447. [
  23448. [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]]
  23449. [The endpoint type. ]
  23450. ]
  23451. [
  23452. [[link boost_asio.reference.basic_socket.executor_type [*executor_type]]]
  23453. [The type of the executor associated with the object. ]
  23454. ]
  23455. [
  23456. [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]]
  23457. [Socket option to send keep-alives. ]
  23458. ]
  23459. [
  23460. [[link boost_asio.reference.basic_socket.linger [*linger]]]
  23461. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  23462. ]
  23463. [
  23464. [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]]
  23465. [A basic_socket is always the lowest layer. ]
  23466. ]
  23467. [
  23468. [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]]
  23469. [Bitmask type for flags that can be passed to send and receive operations. ]
  23470. ]
  23471. [
  23472. [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]]
  23473. [The native representation of a socket. ]
  23474. ]
  23475. [
  23476. [[link boost_asio.reference.basic_socket.out_of_band_inline [*out_of_band_inline]]]
  23477. [Socket option for putting received out-of-band data inline. ]
  23478. ]
  23479. [
  23480. [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]]
  23481. [The protocol type. ]
  23482. ]
  23483. [
  23484. [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]]
  23485. [Socket option for the receive buffer size of a socket. ]
  23486. ]
  23487. [
  23488. [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]]
  23489. [Socket option for the receive low watermark. ]
  23490. ]
  23491. [
  23492. [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]]
  23493. [Socket option to allow the socket to be bound to an address that is already in use. ]
  23494. ]
  23495. [
  23496. [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]]
  23497. [Socket option for the send buffer size of a socket. ]
  23498. ]
  23499. [
  23500. [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]]
  23501. [Socket option for the send low watermark. ]
  23502. ]
  23503. [
  23504. [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]]
  23505. [Different ways a socket may be shutdown. ]
  23506. ]
  23507. [
  23508. [[link boost_asio.reference.basic_socket.wait_type [*wait_type]]]
  23509. [Wait types. ]
  23510. ]
  23511. ]
  23512. [heading Member Functions]
  23513. [table
  23514. [[Name][Description]]
  23515. [
  23516. [[link boost_asio.reference.basic_socket.assign [*assign]]]
  23517. [Assign an existing native socket to the socket. ]
  23518. ]
  23519. [
  23520. [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]]
  23521. [Start an asynchronous connect. ]
  23522. ]
  23523. [
  23524. [[link boost_asio.reference.basic_socket.async_wait [*async_wait]]]
  23525. [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  23526. ]
  23527. [
  23528. [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]]
  23529. [Determine whether the socket is at the out-of-band data mark. ]
  23530. ]
  23531. [
  23532. [[link boost_asio.reference.basic_socket.available [*available]]]
  23533. [Determine the number of bytes available for reading. ]
  23534. ]
  23535. [
  23536. [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]]]
  23537. [Construct a basic_socket without opening it.
  23538. [hr]
  23539. Construct and open a basic_socket.
  23540. [hr]
  23541. Construct a basic_socket, opening it and binding it to the given local endpoint.
  23542. [hr]
  23543. Construct a basic_socket on an existing native socket.
  23544. [hr]
  23545. Move-construct a basic_socket from another.
  23546. [hr]
  23547. Move-construct a basic_socket from a socket of another protocol type. ]
  23548. ]
  23549. [
  23550. [[link boost_asio.reference.basic_socket.bind [*bind]]]
  23551. [Bind the socket to the given local endpoint. ]
  23552. ]
  23553. [
  23554. [[link boost_asio.reference.basic_socket.cancel [*cancel]]]
  23555. [Cancel all asynchronous operations associated with the socket. ]
  23556. ]
  23557. [
  23558. [[link boost_asio.reference.basic_socket.close [*close]]]
  23559. [Close the socket. ]
  23560. ]
  23561. [
  23562. [[link boost_asio.reference.basic_socket.connect [*connect]]]
  23563. [Connect the socket to the specified endpoint. ]
  23564. ]
  23565. [
  23566. [[link boost_asio.reference.basic_socket.get_executor [*get_executor]]]
  23567. [Get the executor associated with the object. ]
  23568. ]
  23569. [
  23570. [[link boost_asio.reference.basic_socket.get_option [*get_option]]]
  23571. [Get an option from the socket. ]
  23572. ]
  23573. [
  23574. [[link boost_asio.reference.basic_socket.io_control [*io_control]]]
  23575. [Perform an IO control command on the socket. ]
  23576. ]
  23577. [
  23578. [[link boost_asio.reference.basic_socket.is_open [*is_open]]]
  23579. [Determine whether the socket is open. ]
  23580. ]
  23581. [
  23582. [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]]
  23583. [Get the local endpoint of the socket. ]
  23584. ]
  23585. [
  23586. [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]]
  23587. [Get a reference to the lowest layer.
  23588. [hr]
  23589. Get a const reference to the lowest layer. ]
  23590. ]
  23591. [
  23592. [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]]
  23593. [Get the native socket representation. ]
  23594. ]
  23595. [
  23596. [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]]
  23597. [Gets the non-blocking mode of the native socket implementation.
  23598. [hr]
  23599. Sets the non-blocking mode of the native socket implementation. ]
  23600. ]
  23601. [
  23602. [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]]
  23603. [Gets the non-blocking mode of the socket.
  23604. [hr]
  23605. Sets the non-blocking mode of the socket. ]
  23606. ]
  23607. [
  23608. [[link boost_asio.reference.basic_socket.open [*open]]]
  23609. [Open the socket using the specified protocol. ]
  23610. ]
  23611. [
  23612. [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]]
  23613. [Move-assign a basic_socket from another.
  23614. [hr]
  23615. Move-assign a basic_socket from a socket of another protocol type. ]
  23616. ]
  23617. [
  23618. [[link boost_asio.reference.basic_socket.release [*release]]]
  23619. [Release ownership of the underlying native socket. ]
  23620. ]
  23621. [
  23622. [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]]
  23623. [Get the remote endpoint of the socket. ]
  23624. ]
  23625. [
  23626. [[link boost_asio.reference.basic_socket.set_option [*set_option]]]
  23627. [Set an option on the socket. ]
  23628. ]
  23629. [
  23630. [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]]
  23631. [Disable sends or receives on the socket. ]
  23632. ]
  23633. [
  23634. [[link boost_asio.reference.basic_socket.wait [*wait]]]
  23635. [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  23636. ]
  23637. ]
  23638. [heading Protected Member Functions]
  23639. [table
  23640. [[Name][Description]]
  23641. [
  23642. [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]]]
  23643. [Protected destructor to prevent deletion through this type. ]
  23644. ]
  23645. ]
  23646. [heading Data Members]
  23647. [table
  23648. [[Name][Description]]
  23649. [
  23650. [[link boost_asio.reference.basic_socket.max_connections [*max_connections]]]
  23651. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  23652. ]
  23653. [
  23654. [[link boost_asio.reference.basic_socket.max_listen_connections [*max_listen_connections]]]
  23655. [The maximum length of the queue of pending incoming connections. ]
  23656. ]
  23657. [
  23658. [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]]]
  23659. [Specify that the data should not be subject to routing. ]
  23660. ]
  23661. [
  23662. [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]]]
  23663. [Specifies that the data marks the end of a record. ]
  23664. ]
  23665. [
  23666. [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]]]
  23667. [Process out-of-band data. ]
  23668. ]
  23669. [
  23670. [[link boost_asio.reference.basic_socket.message_peek [*message_peek]]]
  23671. [Peek at incoming data without removing it from the input queue. ]
  23672. ]
  23673. ]
  23674. [heading Protected Data Members]
  23675. [table
  23676. [[Name][Description]]
  23677. [
  23678. [[link boost_asio.reference.basic_socket.impl_ [*impl_]]]
  23679. []
  23680. ]
  23681. ]
  23682. The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
  23683. [heading Thread Safety]
  23684. ['Distinct] ['objects:] Safe.
  23685. ['Shared] ['objects:] Unsafe.
  23686. [heading Requirements]
  23687. ['Header: ][^boost/asio/basic_stream_socket.hpp]
  23688. ['Convenience header: ][^boost/asio.hpp]
  23689. [endsect]
  23690. [section:max_connections basic_stream_socket::max_connections]
  23691. ['Inherited from socket_base.]
  23692. [indexterm2 boost_asio.indexterm.basic_stream_socket.max_connections..max_connections..basic_stream_socket]
  23693. (Deprecated: Use max\_listen\_connections.) The maximum length of the queue of pending incoming connections.
  23694. static const int max_connections = implementation_defined;
  23695. [endsect]
  23696. [section:max_listen_connections basic_stream_socket::max_listen_connections]
  23697. ['Inherited from socket_base.]
  23698. [indexterm2 boost_asio.indexterm.basic_stream_socket.max_listen_connections..max_listen_connections..basic_stream_socket]
  23699. The maximum length of the queue of pending incoming connections.
  23700. static const int max_listen_connections = implementation_defined;
  23701. [endsect]
  23702. [section:message_do_not_route basic_stream_socket::message_do_not_route]
  23703. ['Inherited from socket_base.]
  23704. [indexterm2 boost_asio.indexterm.basic_stream_socket.message_do_not_route..message_do_not_route..basic_stream_socket]
  23705. Specify that the data should not be subject to routing.
  23706. static const int message_do_not_route = implementation_defined;
  23707. [endsect]
  23708. [section:message_end_of_record basic_stream_socket::message_end_of_record]
  23709. ['Inherited from socket_base.]
  23710. [indexterm2 boost_asio.indexterm.basic_stream_socket.message_end_of_record..message_end_of_record..basic_stream_socket]
  23711. Specifies that the data marks the end of a record.
  23712. static const int message_end_of_record = implementation_defined;
  23713. [endsect]
  23714. [section:message_flags basic_stream_socket::message_flags]
  23715. ['Inherited from socket_base.]
  23716. [indexterm2 boost_asio.indexterm.basic_stream_socket.message_flags..message_flags..basic_stream_socket]
  23717. Bitmask type for flags that can be passed to send and receive operations.
  23718. typedef int message_flags;
  23719. [heading Requirements]
  23720. ['Header: ][^boost/asio/basic_stream_socket.hpp]
  23721. ['Convenience header: ][^boost/asio.hpp]
  23722. [endsect]
  23723. [section:message_out_of_band basic_stream_socket::message_out_of_band]
  23724. ['Inherited from socket_base.]
  23725. [indexterm2 boost_asio.indexterm.basic_stream_socket.message_out_of_band..message_out_of_band..basic_stream_socket]
  23726. Process out-of-band data.
  23727. static const int message_out_of_band = implementation_defined;
  23728. [endsect]
  23729. [section:message_peek basic_stream_socket::message_peek]
  23730. ['Inherited from socket_base.]
  23731. [indexterm2 boost_asio.indexterm.basic_stream_socket.message_peek..message_peek..basic_stream_socket]
  23732. Peek at incoming data without removing it from the input queue.
  23733. static const int message_peek = implementation_defined;
  23734. [endsect]
  23735. [section:native_handle basic_stream_socket::native_handle]
  23736. ['Inherited from basic_socket.]
  23737. [indexterm2 boost_asio.indexterm.basic_stream_socket.native_handle..native_handle..basic_stream_socket]
  23738. Get the native socket representation.
  23739. native_handle_type native_handle();
  23740. This function may be used to obtain the underlying representation of the socket. This is intended to allow access to native socket functionality that is not otherwise provided.
  23741. [endsect]
  23742. [section:native_handle_type basic_stream_socket::native_handle_type]
  23743. [indexterm2 boost_asio.indexterm.basic_stream_socket.native_handle_type..native_handle_type..basic_stream_socket]
  23744. The native representation of a socket.
  23745. typedef implementation_defined native_handle_type;
  23746. [heading Requirements]
  23747. ['Header: ][^boost/asio/basic_stream_socket.hpp]
  23748. ['Convenience header: ][^boost/asio.hpp]
  23749. [endsect]
  23750. [section:native_non_blocking basic_stream_socket::native_non_blocking]
  23751. [indexterm2 boost_asio.indexterm.basic_stream_socket.native_non_blocking..native_non_blocking..basic_stream_socket]
  23752. Gets the non-blocking mode of the native socket implementation.
  23753. bool ``[link boost_asio.reference.basic_stream_socket.native_non_blocking.overload1 native_non_blocking]``() const;
  23754. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.native_non_blocking.overload1 more...]]``
  23755. Sets the non-blocking mode of the native socket implementation.
  23756. void ``[link boost_asio.reference.basic_stream_socket.native_non_blocking.overload2 native_non_blocking]``(
  23757. bool mode);
  23758. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.native_non_blocking.overload2 more...]]``
  23759. void ``[link boost_asio.reference.basic_stream_socket.native_non_blocking.overload3 native_non_blocking]``(
  23760. bool mode,
  23761. boost::system::error_code & ec);
  23762. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.native_non_blocking.overload3 more...]]``
  23763. [section:overload1 basic_stream_socket::native_non_blocking (1 of 3 overloads)]
  23764. ['Inherited from basic_socket.]
  23765. Gets the non-blocking mode of the native socket implementation.
  23766. bool native_non_blocking() const;
  23767. This function is used to retrieve the non-blocking mode of the underlying native socket. This mode has no effect on the behaviour of the socket object's synchronous operations.
  23768. [heading Return Value]
  23769. `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).
  23770. [heading Remarks]
  23771. The current non-blocking mode is cached by the socket object. Consequently, the return value may be incorrect if the non-blocking mode was set directly on the native socket.
  23772. [heading Example]
  23773. This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
  23774. template <typename Handler>
  23775. struct sendfile_op
  23776. {
  23777. tcp::socket& sock_;
  23778. int fd_;
  23779. Handler handler_;
  23780. off_t offset_;
  23781. std::size_t total_bytes_transferred_;
  23782. // Function call operator meeting WriteHandler requirements.
  23783. // Used as the handler for the async_write_some operation.
  23784. void operator()(boost::system::error_code ec, std::size_t)
  23785. {
  23786. // Put the underlying socket into non-blocking mode.
  23787. if (!ec)
  23788. if (!sock_.native_non_blocking())
  23789. sock_.native_non_blocking(true, ec);
  23790. if (!ec)
  23791. {
  23792. for (;;)
  23793. {
  23794. // Try the system call.
  23795. errno = 0;
  23796. int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
  23797. ec = boost::system::error_code(n < 0 ? errno : 0,
  23798. boost::asio::error::get_system_category());
  23799. total_bytes_transferred_ += ec ? 0 : n;
  23800. // Retry operation immediately if interrupted by signal.
  23801. if (ec == boost::asio::error::interrupted)
  23802. continue;
  23803. // Check if we need to run the operation again.
  23804. if (ec == boost::asio::error::would_block
  23805. || ec == boost::asio::error::try_again)
  23806. {
  23807. // We have to wait for the socket to become ready again.
  23808. sock_.async_wait(tcp::socket::wait_write, *this);
  23809. return;
  23810. }
  23811. if (ec || n == 0)
  23812. {
  23813. // An error occurred, or we have reached the end of the file.
  23814. // Either way we must exit the loop so we can call the handler.
  23815. break;
  23816. }
  23817. // Loop around to try calling sendfile again.
  23818. }
  23819. }
  23820. // Pass result back to user's handler.
  23821. handler_(ec, total_bytes_transferred_);
  23822. }
  23823. };
  23824. template <typename Handler>
  23825. void async_sendfile(tcp::socket& sock, int fd, Handler h)
  23826. {
  23827. sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
  23828. sock.async_wait(tcp::socket::wait_write, op);
  23829. }
  23830. [endsect]
  23831. [section:overload2 basic_stream_socket::native_non_blocking (2 of 3 overloads)]
  23832. ['Inherited from basic_socket.]
  23833. Sets the non-blocking mode of the native socket implementation.
  23834. void native_non_blocking(
  23835. bool mode);
  23836. This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
  23837. [heading Parameters]
  23838. [variablelist
  23839. [[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).]]
  23840. ]
  23841. [heading Exceptions]
  23842. [variablelist
  23843. [[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.]]
  23844. ]
  23845. [heading Example]
  23846. This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
  23847. template <typename Handler>
  23848. struct sendfile_op
  23849. {
  23850. tcp::socket& sock_;
  23851. int fd_;
  23852. Handler handler_;
  23853. off_t offset_;
  23854. std::size_t total_bytes_transferred_;
  23855. // Function call operator meeting WriteHandler requirements.
  23856. // Used as the handler for the async_write_some operation.
  23857. void operator()(boost::system::error_code ec, std::size_t)
  23858. {
  23859. // Put the underlying socket into non-blocking mode.
  23860. if (!ec)
  23861. if (!sock_.native_non_blocking())
  23862. sock_.native_non_blocking(true, ec);
  23863. if (!ec)
  23864. {
  23865. for (;;)
  23866. {
  23867. // Try the system call.
  23868. errno = 0;
  23869. int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
  23870. ec = boost::system::error_code(n < 0 ? errno : 0,
  23871. boost::asio::error::get_system_category());
  23872. total_bytes_transferred_ += ec ? 0 : n;
  23873. // Retry operation immediately if interrupted by signal.
  23874. if (ec == boost::asio::error::interrupted)
  23875. continue;
  23876. // Check if we need to run the operation again.
  23877. if (ec == boost::asio::error::would_block
  23878. || ec == boost::asio::error::try_again)
  23879. {
  23880. // We have to wait for the socket to become ready again.
  23881. sock_.async_wait(tcp::socket::wait_write, *this);
  23882. return;
  23883. }
  23884. if (ec || n == 0)
  23885. {
  23886. // An error occurred, or we have reached the end of the file.
  23887. // Either way we must exit the loop so we can call the handler.
  23888. break;
  23889. }
  23890. // Loop around to try calling sendfile again.
  23891. }
  23892. }
  23893. // Pass result back to user's handler.
  23894. handler_(ec, total_bytes_transferred_);
  23895. }
  23896. };
  23897. template <typename Handler>
  23898. void async_sendfile(tcp::socket& sock, int fd, Handler h)
  23899. {
  23900. sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
  23901. sock.async_wait(tcp::socket::wait_write, op);
  23902. }
  23903. [endsect]
  23904. [section:overload3 basic_stream_socket::native_non_blocking (3 of 3 overloads)]
  23905. ['Inherited from basic_socket.]
  23906. Sets the non-blocking mode of the native socket implementation.
  23907. void native_non_blocking(
  23908. bool mode,
  23909. boost::system::error_code & ec);
  23910. This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
  23911. [heading Parameters]
  23912. [variablelist
  23913. [[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).]]
  23914. [[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.]]
  23915. ]
  23916. [heading Example]
  23917. This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
  23918. template <typename Handler>
  23919. struct sendfile_op
  23920. {
  23921. tcp::socket& sock_;
  23922. int fd_;
  23923. Handler handler_;
  23924. off_t offset_;
  23925. std::size_t total_bytes_transferred_;
  23926. // Function call operator meeting WriteHandler requirements.
  23927. // Used as the handler for the async_write_some operation.
  23928. void operator()(boost::system::error_code ec, std::size_t)
  23929. {
  23930. // Put the underlying socket into non-blocking mode.
  23931. if (!ec)
  23932. if (!sock_.native_non_blocking())
  23933. sock_.native_non_blocking(true, ec);
  23934. if (!ec)
  23935. {
  23936. for (;;)
  23937. {
  23938. // Try the system call.
  23939. errno = 0;
  23940. int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
  23941. ec = boost::system::error_code(n < 0 ? errno : 0,
  23942. boost::asio::error::get_system_category());
  23943. total_bytes_transferred_ += ec ? 0 : n;
  23944. // Retry operation immediately if interrupted by signal.
  23945. if (ec == boost::asio::error::interrupted)
  23946. continue;
  23947. // Check if we need to run the operation again.
  23948. if (ec == boost::asio::error::would_block
  23949. || ec == boost::asio::error::try_again)
  23950. {
  23951. // We have to wait for the socket to become ready again.
  23952. sock_.async_wait(tcp::socket::wait_write, *this);
  23953. return;
  23954. }
  23955. if (ec || n == 0)
  23956. {
  23957. // An error occurred, or we have reached the end of the file.
  23958. // Either way we must exit the loop so we can call the handler.
  23959. break;
  23960. }
  23961. // Loop around to try calling sendfile again.
  23962. }
  23963. }
  23964. // Pass result back to user's handler.
  23965. handler_(ec, total_bytes_transferred_);
  23966. }
  23967. };
  23968. template <typename Handler>
  23969. void async_sendfile(tcp::socket& sock, int fd, Handler h)
  23970. {
  23971. sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
  23972. sock.async_wait(tcp::socket::wait_write, op);
  23973. }
  23974. [endsect]
  23975. [endsect]
  23976. [section:non_blocking basic_stream_socket::non_blocking]
  23977. [indexterm2 boost_asio.indexterm.basic_stream_socket.non_blocking..non_blocking..basic_stream_socket]
  23978. Gets the non-blocking mode of the socket.
  23979. bool ``[link boost_asio.reference.basic_stream_socket.non_blocking.overload1 non_blocking]``() const;
  23980. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.non_blocking.overload1 more...]]``
  23981. Sets the non-blocking mode of the socket.
  23982. void ``[link boost_asio.reference.basic_stream_socket.non_blocking.overload2 non_blocking]``(
  23983. bool mode);
  23984. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.non_blocking.overload2 more...]]``
  23985. void ``[link boost_asio.reference.basic_stream_socket.non_blocking.overload3 non_blocking]``(
  23986. bool mode,
  23987. boost::system::error_code & ec);
  23988. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.non_blocking.overload3 more...]]``
  23989. [section:overload1 basic_stream_socket::non_blocking (1 of 3 overloads)]
  23990. ['Inherited from basic_socket.]
  23991. Gets the non-blocking mode of the socket.
  23992. bool non_blocking() const;
  23993. [heading Return Value]
  23994. `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.
  23995. [heading Remarks]
  23996. The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
  23997. [endsect]
  23998. [section:overload2 basic_stream_socket::non_blocking (2 of 3 overloads)]
  23999. ['Inherited from basic_socket.]
  24000. Sets the non-blocking mode of the socket.
  24001. void non_blocking(
  24002. bool mode);
  24003. [heading Parameters]
  24004. [variablelist
  24005. [[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.]]
  24006. ]
  24007. [heading Exceptions]
  24008. [variablelist
  24009. [[boost::system::system_error][Thrown on failure.]]
  24010. ]
  24011. [heading Remarks]
  24012. The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
  24013. [endsect]
  24014. [section:overload3 basic_stream_socket::non_blocking (3 of 3 overloads)]
  24015. ['Inherited from basic_socket.]
  24016. Sets the non-blocking mode of the socket.
  24017. void non_blocking(
  24018. bool mode,
  24019. boost::system::error_code & ec);
  24020. [heading Parameters]
  24021. [variablelist
  24022. [[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.]]
  24023. [[ec][Set to indicate what error occurred, if any.]]
  24024. ]
  24025. [heading Remarks]
  24026. The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
  24027. [endsect]
  24028. [endsect]
  24029. [section:open basic_stream_socket::open]
  24030. [indexterm2 boost_asio.indexterm.basic_stream_socket.open..open..basic_stream_socket]
  24031. Open the socket using the specified protocol.
  24032. void ``[link boost_asio.reference.basic_stream_socket.open.overload1 open]``(
  24033. const protocol_type & protocol = protocol_type());
  24034. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.open.overload1 more...]]``
  24035. void ``[link boost_asio.reference.basic_stream_socket.open.overload2 open]``(
  24036. const protocol_type & protocol,
  24037. boost::system::error_code & ec);
  24038. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.open.overload2 more...]]``
  24039. [section:overload1 basic_stream_socket::open (1 of 2 overloads)]
  24040. ['Inherited from basic_socket.]
  24041. Open the socket using the specified protocol.
  24042. void open(
  24043. const protocol_type & protocol = protocol_type());
  24044. This function opens the socket so that it will use the specified protocol.
  24045. [heading Parameters]
  24046. [variablelist
  24047. [[protocol][An object specifying protocol parameters to be used.]]
  24048. ]
  24049. [heading Exceptions]
  24050. [variablelist
  24051. [[boost::system::system_error][Thrown on failure.]]
  24052. ]
  24053. [heading Example]
  24054. boost::asio::ip::tcp::socket socket(my_context);
  24055. socket.open(boost::asio::ip::tcp::v4());
  24056. [endsect]
  24057. [section:overload2 basic_stream_socket::open (2 of 2 overloads)]
  24058. ['Inherited from basic_socket.]
  24059. Open the socket using the specified protocol.
  24060. void open(
  24061. const protocol_type & protocol,
  24062. boost::system::error_code & ec);
  24063. This function opens the socket so that it will use the specified protocol.
  24064. [heading Parameters]
  24065. [variablelist
  24066. [[protocol][An object specifying which protocol is to be used.]]
  24067. [[ec][Set to indicate what error occurred, if any.]]
  24068. ]
  24069. [heading Example]
  24070. boost::asio::ip::tcp::socket socket(my_context);
  24071. boost::system::error_code ec;
  24072. socket.open(boost::asio::ip::tcp::v4(), ec);
  24073. if (ec)
  24074. {
  24075. // An error occurred.
  24076. }
  24077. [endsect]
  24078. [endsect]
  24079. [section:operator_eq_ basic_stream_socket::operator=]
  24080. [indexterm2 boost_asio.indexterm.basic_stream_socket.operator_eq_..operator=..basic_stream_socket]
  24081. Move-assign a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] from another.
  24082. basic_stream_socket & ``[link boost_asio.reference.basic_stream_socket.operator_eq_.overload1 operator=]``(
  24083. basic_stream_socket && other);
  24084. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.operator_eq_.overload1 more...]]``
  24085. Move-assign a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] from a socket of another protocol type.
  24086. template<
  24087. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  24088. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  24089. enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_stream_socket & >::type ``[link boost_asio.reference.basic_stream_socket.operator_eq_.overload2 operator=]``(
  24090. basic_stream_socket< Protocol1, Executor1 > && other);
  24091. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.operator_eq_.overload2 more...]]``
  24092. [section:overload1 basic_stream_socket::operator= (1 of 2 overloads)]
  24093. Move-assign a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] from another.
  24094. basic_stream_socket & operator=(
  24095. basic_stream_socket && other);
  24096. This assignment operator moves a stream socket from one object to another.
  24097. [heading Parameters]
  24098. [variablelist
  24099. [[other][The other [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] object from which the move will occur.]]
  24100. ]
  24101. [heading Remarks]
  24102. Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_socket(const executor_type&)` constructor.
  24103. [endsect]
  24104. [section:overload2 basic_stream_socket::operator= (2 of 2 overloads)]
  24105. Move-assign a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] from a socket of another protocol type.
  24106. template<
  24107. typename ``[link boost_asio.reference.Protocol Protocol1]``,
  24108. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  24109. enable_if< is_convertible< Protocol1, Protocol >::value &&is_convertible< Executor1, Executor >::value, basic_stream_socket & >::type operator=(
  24110. basic_stream_socket< Protocol1, Executor1 > && other);
  24111. This assignment operator moves a stream socket from one object to another.
  24112. [heading Parameters]
  24113. [variablelist
  24114. [[other][The other [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] object from which the move will occur.]]
  24115. ]
  24116. [heading Remarks]
  24117. Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_socket(const executor_type&)` constructor.
  24118. [endsect]
  24119. [endsect]
  24120. [section:out_of_band_inline basic_stream_socket::out_of_band_inline]
  24121. ['Inherited from socket_base.]
  24122. [indexterm2 boost_asio.indexterm.basic_stream_socket.out_of_band_inline..out_of_band_inline..basic_stream_socket]
  24123. Socket option for putting received out-of-band data inline.
  24124. typedef implementation_defined out_of_band_inline;
  24125. Implements the SOL\_SOCKET/SO\_OOBINLINE socket option.
  24126. [heading Examples]
  24127. Setting the option:
  24128. boost::asio::ip::tcp::socket socket(my_context);
  24129. ...
  24130. boost::asio::socket_base::out_of_band_inline option(true);
  24131. socket.set_option(option);
  24132. Getting the current option value:
  24133. boost::asio::ip::tcp::socket socket(my_context);
  24134. ...
  24135. boost::asio::socket_base::out_of_band_inline option;
  24136. socket.get_option(option);
  24137. bool value = option.value();
  24138. [heading Requirements]
  24139. ['Header: ][^boost/asio/basic_stream_socket.hpp]
  24140. ['Convenience header: ][^boost/asio.hpp]
  24141. [endsect]
  24142. [section:protocol_type basic_stream_socket::protocol_type]
  24143. [indexterm2 boost_asio.indexterm.basic_stream_socket.protocol_type..protocol_type..basic_stream_socket]
  24144. The protocol type.
  24145. typedef Protocol protocol_type;
  24146. [heading Requirements]
  24147. ['Header: ][^boost/asio/basic_stream_socket.hpp]
  24148. ['Convenience header: ][^boost/asio.hpp]
  24149. [endsect]
  24150. [section:read_some basic_stream_socket::read_some]
  24151. [indexterm2 boost_asio.indexterm.basic_stream_socket.read_some..read_some..basic_stream_socket]
  24152. Read some data from the socket.
  24153. template<
  24154. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  24155. std::size_t ``[link boost_asio.reference.basic_stream_socket.read_some.overload1 read_some]``(
  24156. const MutableBufferSequence & buffers);
  24157. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.read_some.overload1 more...]]``
  24158. template<
  24159. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  24160. std::size_t ``[link boost_asio.reference.basic_stream_socket.read_some.overload2 read_some]``(
  24161. const MutableBufferSequence & buffers,
  24162. boost::system::error_code & ec);
  24163. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.read_some.overload2 more...]]``
  24164. [section:overload1 basic_stream_socket::read_some (1 of 2 overloads)]
  24165. Read some data from the socket.
  24166. template<
  24167. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  24168. std::size_t read_some(
  24169. const MutableBufferSequence & buffers);
  24170. This function is used to read data from the stream socket. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
  24171. [heading Parameters]
  24172. [variablelist
  24173. [[buffers][One or more buffers into which the data will be read.]]
  24174. ]
  24175. [heading Return Value]
  24176. The number of bytes read.
  24177. [heading Exceptions]
  24178. [variablelist
  24179. [[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
  24180. ]
  24181. [heading Remarks]
  24182. The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
  24183. [heading Example]
  24184. To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  24185. socket.read_some(boost::asio::buffer(data, size));
  24186. See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  24187. [endsect]
  24188. [section:overload2 basic_stream_socket::read_some (2 of 2 overloads)]
  24189. Read some data from the socket.
  24190. template<
  24191. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  24192. std::size_t read_some(
  24193. const MutableBufferSequence & buffers,
  24194. boost::system::error_code & ec);
  24195. This function is used to read data from the stream socket. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
  24196. [heading Parameters]
  24197. [variablelist
  24198. [[buffers][One or more buffers into which the data will be read.]]
  24199. [[ec][Set to indicate what error occurred, if any.]]
  24200. ]
  24201. [heading Return Value]
  24202. The number of bytes read. Returns 0 if an error occurred.
  24203. [heading Remarks]
  24204. The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
  24205. [endsect]
  24206. [endsect]
  24207. [section:receive basic_stream_socket::receive]
  24208. [indexterm2 boost_asio.indexterm.basic_stream_socket.receive..receive..basic_stream_socket]
  24209. Receive some data on the socket.
  24210. template<
  24211. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  24212. std::size_t ``[link boost_asio.reference.basic_stream_socket.receive.overload1 receive]``(
  24213. const MutableBufferSequence & buffers);
  24214. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.receive.overload1 more...]]``
  24215. template<
  24216. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  24217. std::size_t ``[link boost_asio.reference.basic_stream_socket.receive.overload2 receive]``(
  24218. const MutableBufferSequence & buffers,
  24219. socket_base::message_flags flags);
  24220. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.receive.overload2 more...]]``
  24221. Receive some data on a connected socket.
  24222. template<
  24223. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  24224. std::size_t ``[link boost_asio.reference.basic_stream_socket.receive.overload3 receive]``(
  24225. const MutableBufferSequence & buffers,
  24226. socket_base::message_flags flags,
  24227. boost::system::error_code & ec);
  24228. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.receive.overload3 more...]]``
  24229. [section:overload1 basic_stream_socket::receive (1 of 3 overloads)]
  24230. Receive some data on the socket.
  24231. template<
  24232. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  24233. std::size_t receive(
  24234. const MutableBufferSequence & buffers);
  24235. This function is used to receive data on the stream socket. The function call will block until one or more bytes of data has been received successfully, or until an error occurs.
  24236. [heading Parameters]
  24237. [variablelist
  24238. [[buffers][One or more buffers into which the data will be received.]]
  24239. ]
  24240. [heading Return Value]
  24241. The number of bytes received.
  24242. [heading Exceptions]
  24243. [variablelist
  24244. [[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
  24245. ]
  24246. [heading Remarks]
  24247. The receive operation may not receive all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
  24248. [heading Example]
  24249. To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  24250. socket.receive(boost::asio::buffer(data, size));
  24251. See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  24252. [endsect]
  24253. [section:overload2 basic_stream_socket::receive (2 of 3 overloads)]
  24254. Receive some data on the socket.
  24255. template<
  24256. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  24257. std::size_t receive(
  24258. const MutableBufferSequence & buffers,
  24259. socket_base::message_flags flags);
  24260. This function is used to receive data on the stream socket. The function call will block until one or more bytes of data has been received successfully, or until an error occurs.
  24261. [heading Parameters]
  24262. [variablelist
  24263. [[buffers][One or more buffers into which the data will be received.]]
  24264. [[flags][Flags specifying how the receive call is to be made.]]
  24265. ]
  24266. [heading Return Value]
  24267. The number of bytes received.
  24268. [heading Exceptions]
  24269. [variablelist
  24270. [[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
  24271. ]
  24272. [heading Remarks]
  24273. The receive operation may not receive all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
  24274. [heading Example]
  24275. To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  24276. socket.receive(boost::asio::buffer(data, size), 0);
  24277. See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  24278. [endsect]
  24279. [section:overload3 basic_stream_socket::receive (3 of 3 overloads)]
  24280. Receive some data on a connected socket.
  24281. template<
  24282. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  24283. std::size_t receive(
  24284. const MutableBufferSequence & buffers,
  24285. socket_base::message_flags flags,
  24286. boost::system::error_code & ec);
  24287. This function is used to receive data on the stream socket. The function call will block until one or more bytes of data has been received successfully, or until an error occurs.
  24288. [heading Parameters]
  24289. [variablelist
  24290. [[buffers][One or more buffers into which the data will be received.]]
  24291. [[flags][Flags specifying how the receive call is to be made.]]
  24292. [[ec][Set to indicate what error occurred, if any.]]
  24293. ]
  24294. [heading Return Value]
  24295. The number of bytes received. Returns 0 if an error occurred.
  24296. [heading Remarks]
  24297. The receive operation may not receive all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
  24298. [endsect]
  24299. [endsect]
  24300. [section:receive_buffer_size basic_stream_socket::receive_buffer_size]
  24301. ['Inherited from socket_base.]
  24302. [indexterm2 boost_asio.indexterm.basic_stream_socket.receive_buffer_size..receive_buffer_size..basic_stream_socket]
  24303. Socket option for the receive buffer size of a socket.
  24304. typedef implementation_defined receive_buffer_size;
  24305. Implements the SOL\_SOCKET/SO\_RCVBUF socket option.
  24306. [heading Examples]
  24307. Setting the option:
  24308. boost::asio::ip::tcp::socket socket(my_context);
  24309. ...
  24310. boost::asio::socket_base::receive_buffer_size option(8192);
  24311. socket.set_option(option);
  24312. Getting the current option value:
  24313. boost::asio::ip::tcp::socket socket(my_context);
  24314. ...
  24315. boost::asio::socket_base::receive_buffer_size option;
  24316. socket.get_option(option);
  24317. int size = option.value();
  24318. [heading Requirements]
  24319. ['Header: ][^boost/asio/basic_stream_socket.hpp]
  24320. ['Convenience header: ][^boost/asio.hpp]
  24321. [endsect]
  24322. [section:receive_low_watermark basic_stream_socket::receive_low_watermark]
  24323. ['Inherited from socket_base.]
  24324. [indexterm2 boost_asio.indexterm.basic_stream_socket.receive_low_watermark..receive_low_watermark..basic_stream_socket]
  24325. Socket option for the receive low watermark.
  24326. typedef implementation_defined receive_low_watermark;
  24327. Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option.
  24328. [heading Examples]
  24329. Setting the option:
  24330. boost::asio::ip::tcp::socket socket(my_context);
  24331. ...
  24332. boost::asio::socket_base::receive_low_watermark option(1024);
  24333. socket.set_option(option);
  24334. Getting the current option value:
  24335. boost::asio::ip::tcp::socket socket(my_context);
  24336. ...
  24337. boost::asio::socket_base::receive_low_watermark option;
  24338. socket.get_option(option);
  24339. int size = option.value();
  24340. [heading Requirements]
  24341. ['Header: ][^boost/asio/basic_stream_socket.hpp]
  24342. ['Convenience header: ][^boost/asio.hpp]
  24343. [endsect]
  24344. [section:release basic_stream_socket::release]
  24345. [indexterm2 boost_asio.indexterm.basic_stream_socket.release..release..basic_stream_socket]
  24346. Release ownership of the underlying native socket.
  24347. native_handle_type ``[link boost_asio.reference.basic_stream_socket.release.overload1 release]``();
  24348. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.release.overload1 more...]]``
  24349. native_handle_type ``[link boost_asio.reference.basic_stream_socket.release.overload2 release]``(
  24350. boost::system::error_code & ec);
  24351. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.release.overload2 more...]]``
  24352. [section:overload1 basic_stream_socket::release (1 of 2 overloads)]
  24353. ['Inherited from basic_socket.]
  24354. Release ownership of the underlying native socket.
  24355. native_handle_type release();
  24356. This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. Ownership of the native socket is then transferred to the caller.
  24357. [heading Exceptions]
  24358. [variablelist
  24359. [[boost::system::system_error][Thrown on failure.]]
  24360. ]
  24361. [heading Remarks]
  24362. This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms.
  24363. [endsect]
  24364. [section:overload2 basic_stream_socket::release (2 of 2 overloads)]
  24365. ['Inherited from basic_socket.]
  24366. Release ownership of the underlying native socket.
  24367. native_handle_type release(
  24368. boost::system::error_code & ec);
  24369. This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. Ownership of the native socket is then transferred to the caller.
  24370. [heading Parameters]
  24371. [variablelist
  24372. [[ec][Set to indicate what error occurred, if any.]]
  24373. ]
  24374. [heading Remarks]
  24375. This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms.
  24376. [endsect]
  24377. [endsect]
  24378. [section:remote_endpoint basic_stream_socket::remote_endpoint]
  24379. [indexterm2 boost_asio.indexterm.basic_stream_socket.remote_endpoint..remote_endpoint..basic_stream_socket]
  24380. Get the remote endpoint of the socket.
  24381. endpoint_type ``[link boost_asio.reference.basic_stream_socket.remote_endpoint.overload1 remote_endpoint]``() const;
  24382. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.remote_endpoint.overload1 more...]]``
  24383. endpoint_type ``[link boost_asio.reference.basic_stream_socket.remote_endpoint.overload2 remote_endpoint]``(
  24384. boost::system::error_code & ec) const;
  24385. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.remote_endpoint.overload2 more...]]``
  24386. [section:overload1 basic_stream_socket::remote_endpoint (1 of 2 overloads)]
  24387. ['Inherited from basic_socket.]
  24388. Get the remote endpoint of the socket.
  24389. endpoint_type remote_endpoint() const;
  24390. This function is used to obtain the remote endpoint of the socket.
  24391. [heading Return Value]
  24392. An object that represents the remote endpoint of the socket.
  24393. [heading Exceptions]
  24394. [variablelist
  24395. [[boost::system::system_error][Thrown on failure.]]
  24396. ]
  24397. [heading Example]
  24398. boost::asio::ip::tcp::socket socket(my_context);
  24399. ...
  24400. boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint();
  24401. [endsect]
  24402. [section:overload2 basic_stream_socket::remote_endpoint (2 of 2 overloads)]
  24403. ['Inherited from basic_socket.]
  24404. Get the remote endpoint of the socket.
  24405. endpoint_type remote_endpoint(
  24406. boost::system::error_code & ec) const;
  24407. This function is used to obtain the remote endpoint of the socket.
  24408. [heading Parameters]
  24409. [variablelist
  24410. [[ec][Set to indicate what error occurred, if any.]]
  24411. ]
  24412. [heading Return Value]
  24413. An object that represents the remote endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
  24414. [heading Example]
  24415. boost::asio::ip::tcp::socket socket(my_context);
  24416. ...
  24417. boost::system::error_code ec;
  24418. boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(ec);
  24419. if (ec)
  24420. {
  24421. // An error occurred.
  24422. }
  24423. [endsect]
  24424. [endsect]
  24425. [section:reuse_address basic_stream_socket::reuse_address]
  24426. ['Inherited from socket_base.]
  24427. [indexterm2 boost_asio.indexterm.basic_stream_socket.reuse_address..reuse_address..basic_stream_socket]
  24428. Socket option to allow the socket to be bound to an address that is already in use.
  24429. typedef implementation_defined reuse_address;
  24430. Implements the SOL\_SOCKET/SO\_REUSEADDR socket option.
  24431. [heading Examples]
  24432. Setting the option:
  24433. boost::asio::ip::tcp::acceptor acceptor(my_context);
  24434. ...
  24435. boost::asio::socket_base::reuse_address option(true);
  24436. acceptor.set_option(option);
  24437. Getting the current option value:
  24438. boost::asio::ip::tcp::acceptor acceptor(my_context);
  24439. ...
  24440. boost::asio::socket_base::reuse_address option;
  24441. acceptor.get_option(option);
  24442. bool is_set = option.value();
  24443. [heading Requirements]
  24444. ['Header: ][^boost/asio/basic_stream_socket.hpp]
  24445. ['Convenience header: ][^boost/asio.hpp]
  24446. [endsect]
  24447. [section:send basic_stream_socket::send]
  24448. [indexterm2 boost_asio.indexterm.basic_stream_socket.send..send..basic_stream_socket]
  24449. Send some data on the socket.
  24450. template<
  24451. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  24452. std::size_t ``[link boost_asio.reference.basic_stream_socket.send.overload1 send]``(
  24453. const ConstBufferSequence & buffers);
  24454. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.send.overload1 more...]]``
  24455. template<
  24456. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  24457. std::size_t ``[link boost_asio.reference.basic_stream_socket.send.overload2 send]``(
  24458. const ConstBufferSequence & buffers,
  24459. socket_base::message_flags flags);
  24460. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.send.overload2 more...]]``
  24461. template<
  24462. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  24463. std::size_t ``[link boost_asio.reference.basic_stream_socket.send.overload3 send]``(
  24464. const ConstBufferSequence & buffers,
  24465. socket_base::message_flags flags,
  24466. boost::system::error_code & ec);
  24467. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.send.overload3 more...]]``
  24468. [section:overload1 basic_stream_socket::send (1 of 3 overloads)]
  24469. Send some data on the socket.
  24470. template<
  24471. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  24472. std::size_t send(
  24473. const ConstBufferSequence & buffers);
  24474. This function is used to send data on the stream socket. The function call will block until one or more bytes of the data has been sent successfully, or an until error occurs.
  24475. [heading Parameters]
  24476. [variablelist
  24477. [[buffers][One or more data buffers to be sent on the socket.]]
  24478. ]
  24479. [heading Return Value]
  24480. The number of bytes sent.
  24481. [heading Exceptions]
  24482. [variablelist
  24483. [[boost::system::system_error][Thrown on failure.]]
  24484. ]
  24485. [heading Remarks]
  24486. The send operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
  24487. [heading Example]
  24488. To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  24489. socket.send(boost::asio::buffer(data, size));
  24490. See the [link boost_asio.reference.buffer `buffer`] documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  24491. [endsect]
  24492. [section:overload2 basic_stream_socket::send (2 of 3 overloads)]
  24493. Send some data on the socket.
  24494. template<
  24495. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  24496. std::size_t send(
  24497. const ConstBufferSequence & buffers,
  24498. socket_base::message_flags flags);
  24499. This function is used to send data on the stream socket. The function call will block until one or more bytes of the data has been sent successfully, or an until error occurs.
  24500. [heading Parameters]
  24501. [variablelist
  24502. [[buffers][One or more data buffers to be sent on the socket.]]
  24503. [[flags][Flags specifying how the send call is to be made.]]
  24504. ]
  24505. [heading Return Value]
  24506. The number of bytes sent.
  24507. [heading Exceptions]
  24508. [variablelist
  24509. [[boost::system::system_error][Thrown on failure.]]
  24510. ]
  24511. [heading Remarks]
  24512. The send operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
  24513. [heading Example]
  24514. To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  24515. socket.send(boost::asio::buffer(data, size), 0);
  24516. See the [link boost_asio.reference.buffer `buffer`] documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  24517. [endsect]
  24518. [section:overload3 basic_stream_socket::send (3 of 3 overloads)]
  24519. Send some data on the socket.
  24520. template<
  24521. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  24522. std::size_t send(
  24523. const ConstBufferSequence & buffers,
  24524. socket_base::message_flags flags,
  24525. boost::system::error_code & ec);
  24526. This function is used to send data on the stream socket. The function call will block until one or more bytes of the data has been sent successfully, or an until error occurs.
  24527. [heading Parameters]
  24528. [variablelist
  24529. [[buffers][One or more data buffers to be sent on the socket.]]
  24530. [[flags][Flags specifying how the send call is to be made.]]
  24531. [[ec][Set to indicate what error occurred, if any.]]
  24532. ]
  24533. [heading Return Value]
  24534. The number of bytes sent. Returns 0 if an error occurred.
  24535. [heading Remarks]
  24536. The send operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
  24537. [endsect]
  24538. [endsect]
  24539. [section:send_buffer_size basic_stream_socket::send_buffer_size]
  24540. ['Inherited from socket_base.]
  24541. [indexterm2 boost_asio.indexterm.basic_stream_socket.send_buffer_size..send_buffer_size..basic_stream_socket]
  24542. Socket option for the send buffer size of a socket.
  24543. typedef implementation_defined send_buffer_size;
  24544. Implements the SOL\_SOCKET/SO\_SNDBUF socket option.
  24545. [heading Examples]
  24546. Setting the option:
  24547. boost::asio::ip::tcp::socket socket(my_context);
  24548. ...
  24549. boost::asio::socket_base::send_buffer_size option(8192);
  24550. socket.set_option(option);
  24551. Getting the current option value:
  24552. boost::asio::ip::tcp::socket socket(my_context);
  24553. ...
  24554. boost::asio::socket_base::send_buffer_size option;
  24555. socket.get_option(option);
  24556. int size = option.value();
  24557. [heading Requirements]
  24558. ['Header: ][^boost/asio/basic_stream_socket.hpp]
  24559. ['Convenience header: ][^boost/asio.hpp]
  24560. [endsect]
  24561. [section:send_low_watermark basic_stream_socket::send_low_watermark]
  24562. ['Inherited from socket_base.]
  24563. [indexterm2 boost_asio.indexterm.basic_stream_socket.send_low_watermark..send_low_watermark..basic_stream_socket]
  24564. Socket option for the send low watermark.
  24565. typedef implementation_defined send_low_watermark;
  24566. Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option.
  24567. [heading Examples]
  24568. Setting the option:
  24569. boost::asio::ip::tcp::socket socket(my_context);
  24570. ...
  24571. boost::asio::socket_base::send_low_watermark option(1024);
  24572. socket.set_option(option);
  24573. Getting the current option value:
  24574. boost::asio::ip::tcp::socket socket(my_context);
  24575. ...
  24576. boost::asio::socket_base::send_low_watermark option;
  24577. socket.get_option(option);
  24578. int size = option.value();
  24579. [heading Requirements]
  24580. ['Header: ][^boost/asio/basic_stream_socket.hpp]
  24581. ['Convenience header: ][^boost/asio.hpp]
  24582. [endsect]
  24583. [section:set_option basic_stream_socket::set_option]
  24584. [indexterm2 boost_asio.indexterm.basic_stream_socket.set_option..set_option..basic_stream_socket]
  24585. Set an option on the socket.
  24586. template<
  24587. typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
  24588. void ``[link boost_asio.reference.basic_stream_socket.set_option.overload1 set_option]``(
  24589. const SettableSocketOption & option);
  24590. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.set_option.overload1 more...]]``
  24591. template<
  24592. typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
  24593. void ``[link boost_asio.reference.basic_stream_socket.set_option.overload2 set_option]``(
  24594. const SettableSocketOption & option,
  24595. boost::system::error_code & ec);
  24596. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.set_option.overload2 more...]]``
  24597. [section:overload1 basic_stream_socket::set_option (1 of 2 overloads)]
  24598. ['Inherited from basic_socket.]
  24599. Set an option on the socket.
  24600. template<
  24601. typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
  24602. void set_option(
  24603. const SettableSocketOption & option);
  24604. This function is used to set an option on the socket.
  24605. [heading Parameters]
  24606. [variablelist
  24607. [[option][The new option value to be set on the socket.]]
  24608. ]
  24609. [heading Exceptions]
  24610. [variablelist
  24611. [[boost::system::system_error][Thrown on failure.]]
  24612. ]
  24613. [heading Example]
  24614. Setting the IPPROTO\_TCP/TCP\_NODELAY option:
  24615. boost::asio::ip::tcp::socket socket(my_context);
  24616. ...
  24617. boost::asio::ip::tcp::no_delay option(true);
  24618. socket.set_option(option);
  24619. [endsect]
  24620. [section:overload2 basic_stream_socket::set_option (2 of 2 overloads)]
  24621. ['Inherited from basic_socket.]
  24622. Set an option on the socket.
  24623. template<
  24624. typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
  24625. void set_option(
  24626. const SettableSocketOption & option,
  24627. boost::system::error_code & ec);
  24628. This function is used to set an option on the socket.
  24629. [heading Parameters]
  24630. [variablelist
  24631. [[option][The new option value to be set on the socket.]]
  24632. [[ec][Set to indicate what error occurred, if any.]]
  24633. ]
  24634. [heading Example]
  24635. Setting the IPPROTO\_TCP/TCP\_NODELAY option:
  24636. boost::asio::ip::tcp::socket socket(my_context);
  24637. ...
  24638. boost::asio::ip::tcp::no_delay option(true);
  24639. boost::system::error_code ec;
  24640. socket.set_option(option, ec);
  24641. if (ec)
  24642. {
  24643. // An error occurred.
  24644. }
  24645. [endsect]
  24646. [endsect]
  24647. [section:shutdown basic_stream_socket::shutdown]
  24648. [indexterm2 boost_asio.indexterm.basic_stream_socket.shutdown..shutdown..basic_stream_socket]
  24649. Disable sends or receives on the socket.
  24650. void ``[link boost_asio.reference.basic_stream_socket.shutdown.overload1 shutdown]``(
  24651. shutdown_type what);
  24652. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.shutdown.overload1 more...]]``
  24653. void ``[link boost_asio.reference.basic_stream_socket.shutdown.overload2 shutdown]``(
  24654. shutdown_type what,
  24655. boost::system::error_code & ec);
  24656. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.shutdown.overload2 more...]]``
  24657. [section:overload1 basic_stream_socket::shutdown (1 of 2 overloads)]
  24658. ['Inherited from basic_socket.]
  24659. Disable sends or receives on the socket.
  24660. void shutdown(
  24661. shutdown_type what);
  24662. This function is used to disable send operations, receive operations, or both.
  24663. [heading Parameters]
  24664. [variablelist
  24665. [[what][Determines what types of operation will no longer be allowed.]]
  24666. ]
  24667. [heading Exceptions]
  24668. [variablelist
  24669. [[boost::system::system_error][Thrown on failure.]]
  24670. ]
  24671. [heading Example]
  24672. Shutting down the send side of the socket:
  24673. boost::asio::ip::tcp::socket socket(my_context);
  24674. ...
  24675. socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send);
  24676. [endsect]
  24677. [section:overload2 basic_stream_socket::shutdown (2 of 2 overloads)]
  24678. ['Inherited from basic_socket.]
  24679. Disable sends or receives on the socket.
  24680. void shutdown(
  24681. shutdown_type what,
  24682. boost::system::error_code & ec);
  24683. This function is used to disable send operations, receive operations, or both.
  24684. [heading Parameters]
  24685. [variablelist
  24686. [[what][Determines what types of operation will no longer be allowed.]]
  24687. [[ec][Set to indicate what error occurred, if any.]]
  24688. ]
  24689. [heading Example]
  24690. Shutting down the send side of the socket:
  24691. boost::asio::ip::tcp::socket socket(my_context);
  24692. ...
  24693. boost::system::error_code ec;
  24694. socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ec);
  24695. if (ec)
  24696. {
  24697. // An error occurred.
  24698. }
  24699. [endsect]
  24700. [endsect]
  24701. [section:shutdown_type basic_stream_socket::shutdown_type]
  24702. ['Inherited from socket_base.]
  24703. [indexterm2 boost_asio.indexterm.basic_stream_socket.shutdown_type..shutdown_type..basic_stream_socket]
  24704. Different ways a socket may be shutdown.
  24705. enum shutdown_type
  24706. [indexterm2 boost_asio.indexterm.basic_stream_socket.shutdown_type.shutdown_receive..shutdown_receive..basic_stream_socket]
  24707. [indexterm2 boost_asio.indexterm.basic_stream_socket.shutdown_type.shutdown_send..shutdown_send..basic_stream_socket]
  24708. [indexterm2 boost_asio.indexterm.basic_stream_socket.shutdown_type.shutdown_both..shutdown_both..basic_stream_socket]
  24709. [heading Values]
  24710. [variablelist
  24711. [
  24712. [shutdown_receive]
  24713. [Shutdown the receive side of the socket. ]
  24714. ]
  24715. [
  24716. [shutdown_send]
  24717. [Shutdown the send side of the socket. ]
  24718. ]
  24719. [
  24720. [shutdown_both]
  24721. [Shutdown both send and receive on the socket. ]
  24722. ]
  24723. ]
  24724. [endsect]
  24725. [section:wait basic_stream_socket::wait]
  24726. [indexterm2 boost_asio.indexterm.basic_stream_socket.wait..wait..basic_stream_socket]
  24727. Wait for the socket to become ready to read, ready to write, or to have pending error conditions.
  24728. void ``[link boost_asio.reference.basic_stream_socket.wait.overload1 wait]``(
  24729. wait_type w);
  24730. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.wait.overload1 more...]]``
  24731. void ``[link boost_asio.reference.basic_stream_socket.wait.overload2 wait]``(
  24732. wait_type w,
  24733. boost::system::error_code & ec);
  24734. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.wait.overload2 more...]]``
  24735. [section:overload1 basic_stream_socket::wait (1 of 2 overloads)]
  24736. ['Inherited from basic_socket.]
  24737. Wait for the socket to become ready to read, ready to write, or to have pending error conditions.
  24738. void wait(
  24739. wait_type w);
  24740. This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state.
  24741. [heading Parameters]
  24742. [variablelist
  24743. [[w][Specifies the desired socket state.]]
  24744. ]
  24745. [heading Example]
  24746. Waiting for a socket to become readable.
  24747. boost::asio::ip::tcp::socket socket(my_context);
  24748. ...
  24749. socket.wait(boost::asio::ip::tcp::socket::wait_read);
  24750. [endsect]
  24751. [section:overload2 basic_stream_socket::wait (2 of 2 overloads)]
  24752. ['Inherited from basic_socket.]
  24753. Wait for the socket to become ready to read, ready to write, or to have pending error conditions.
  24754. void wait(
  24755. wait_type w,
  24756. boost::system::error_code & ec);
  24757. This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state.
  24758. [heading Parameters]
  24759. [variablelist
  24760. [[w][Specifies the desired socket state.]]
  24761. [[ec][Set to indicate what error occurred, if any.]]
  24762. ]
  24763. [heading Example]
  24764. Waiting for a socket to become readable.
  24765. boost::asio::ip::tcp::socket socket(my_context);
  24766. ...
  24767. boost::system::error_code ec;
  24768. socket.wait(boost::asio::ip::tcp::socket::wait_read, ec);
  24769. [endsect]
  24770. [endsect]
  24771. [section:wait_type basic_stream_socket::wait_type]
  24772. ['Inherited from socket_base.]
  24773. [indexterm2 boost_asio.indexterm.basic_stream_socket.wait_type..wait_type..basic_stream_socket]
  24774. Wait types.
  24775. enum wait_type
  24776. [indexterm2 boost_asio.indexterm.basic_stream_socket.wait_type.wait_read..wait_read..basic_stream_socket]
  24777. [indexterm2 boost_asio.indexterm.basic_stream_socket.wait_type.wait_write..wait_write..basic_stream_socket]
  24778. [indexterm2 boost_asio.indexterm.basic_stream_socket.wait_type.wait_error..wait_error..basic_stream_socket]
  24779. [heading Values]
  24780. [variablelist
  24781. [
  24782. [wait_read]
  24783. [Wait for a socket to become ready to read. ]
  24784. ]
  24785. [
  24786. [wait_write]
  24787. [Wait for a socket to become ready to write. ]
  24788. ]
  24789. [
  24790. [wait_error]
  24791. [Wait for a socket to have error conditions pending. ]
  24792. ]
  24793. ]
  24794. For use with `basic_socket::wait()` and `basic_socket::async_wait()`.
  24795. [endsect]
  24796. [section:write_some basic_stream_socket::write_some]
  24797. [indexterm2 boost_asio.indexterm.basic_stream_socket.write_some..write_some..basic_stream_socket]
  24798. Write some data to the socket.
  24799. template<
  24800. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  24801. std::size_t ``[link boost_asio.reference.basic_stream_socket.write_some.overload1 write_some]``(
  24802. const ConstBufferSequence & buffers);
  24803. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.write_some.overload1 more...]]``
  24804. template<
  24805. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  24806. std::size_t ``[link boost_asio.reference.basic_stream_socket.write_some.overload2 write_some]``(
  24807. const ConstBufferSequence & buffers,
  24808. boost::system::error_code & ec);
  24809. `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.write_some.overload2 more...]]``
  24810. [section:overload1 basic_stream_socket::write_some (1 of 2 overloads)]
  24811. Write some data to the socket.
  24812. template<
  24813. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  24814. std::size_t write_some(
  24815. const ConstBufferSequence & buffers);
  24816. This function is used to write data to the stream socket. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
  24817. [heading Parameters]
  24818. [variablelist
  24819. [[buffers][One or more data buffers to be written to the socket.]]
  24820. ]
  24821. [heading Return Value]
  24822. The number of bytes written.
  24823. [heading Exceptions]
  24824. [variablelist
  24825. [[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
  24826. ]
  24827. [heading Remarks]
  24828. The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
  24829. [heading Example]
  24830. To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  24831. socket.write_some(boost::asio::buffer(data, size));
  24832. See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  24833. [endsect]
  24834. [section:overload2 basic_stream_socket::write_some (2 of 2 overloads)]
  24835. Write some data to the socket.
  24836. template<
  24837. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  24838. std::size_t write_some(
  24839. const ConstBufferSequence & buffers,
  24840. boost::system::error_code & ec);
  24841. This function is used to write data to the stream socket. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
  24842. [heading Parameters]
  24843. [variablelist
  24844. [[buffers][One or more data buffers to be written to the socket.]]
  24845. [[ec][Set to indicate what error occurred, if any.]]
  24846. ]
  24847. [heading Return Value]
  24848. The number of bytes written. Returns 0 if an error occurred.
  24849. [heading Remarks]
  24850. The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
  24851. [endsect]
  24852. [endsect]
  24853. [section:_basic_stream_socket basic_stream_socket::~basic_stream_socket]
  24854. [indexterm2 boost_asio.indexterm.basic_stream_socket._basic_stream_socket..~basic_stream_socket..basic_stream_socket]
  24855. Destroys the socket.
  24856. ~basic_stream_socket();
  24857. This function destroys the socket, cancelling any outstanding asynchronous operations associated with the socket as if by calling `cancel`.
  24858. [endsect]
  24859. [endsect]
  24860. [section:basic_stream_socket__rebind_executor basic_stream_socket::rebind_executor]
  24861. Rebinds the socket type to another executor.
  24862. template<
  24863. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  24864. struct rebind_executor
  24865. [heading Types]
  24866. [table
  24867. [[Name][Description]]
  24868. [
  24869. [[link boost_asio.reference.basic_stream_socket__rebind_executor.other [*other]]]
  24870. [The socket type when rebound to the specified executor. ]
  24871. ]
  24872. ]
  24873. [heading Requirements]
  24874. ['Header: ][^boost/asio/basic_stream_socket.hpp]
  24875. ['Convenience header: ][^boost/asio.hpp]
  24876. [section:other basic_stream_socket::rebind_executor::other]
  24877. [indexterm2 boost_asio.indexterm.basic_stream_socket__rebind_executor.other..other..basic_stream_socket::rebind_executor]
  24878. The socket type when rebound to the specified executor.
  24879. typedef basic_stream_socket< Protocol, Executor1 > other;
  24880. [heading Types]
  24881. [table
  24882. [[Name][Description]]
  24883. [
  24884. [[link boost_asio.reference.basic_stream_socket__rebind_executor [*rebind_executor]]]
  24885. [Rebinds the socket type to another executor. ]
  24886. ]
  24887. [
  24888. [[link boost_asio.reference.basic_stream_socket.broadcast [*broadcast]]]
  24889. [Socket option to permit sending of broadcast messages. ]
  24890. ]
  24891. [
  24892. [[link boost_asio.reference.basic_stream_socket.bytes_readable [*bytes_readable]]]
  24893. [IO control command to get the amount of data that can be read without blocking. ]
  24894. ]
  24895. [
  24896. [[link boost_asio.reference.basic_stream_socket.debug [*debug]]]
  24897. [Socket option to enable socket-level debugging. ]
  24898. ]
  24899. [
  24900. [[link boost_asio.reference.basic_stream_socket.do_not_route [*do_not_route]]]
  24901. [Socket option to prevent routing, use local interfaces only. ]
  24902. ]
  24903. [
  24904. [[link boost_asio.reference.basic_stream_socket.enable_connection_aborted [*enable_connection_aborted]]]
  24905. [Socket option to report aborted connections on accept. ]
  24906. ]
  24907. [
  24908. [[link boost_asio.reference.basic_stream_socket.endpoint_type [*endpoint_type]]]
  24909. [The endpoint type. ]
  24910. ]
  24911. [
  24912. [[link boost_asio.reference.basic_stream_socket.executor_type [*executor_type]]]
  24913. [The type of the executor associated with the object. ]
  24914. ]
  24915. [
  24916. [[link boost_asio.reference.basic_stream_socket.keep_alive [*keep_alive]]]
  24917. [Socket option to send keep-alives. ]
  24918. ]
  24919. [
  24920. [[link boost_asio.reference.basic_stream_socket.linger [*linger]]]
  24921. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  24922. ]
  24923. [
  24924. [[link boost_asio.reference.basic_stream_socket.lowest_layer_type [*lowest_layer_type]]]
  24925. [A basic_socket is always the lowest layer. ]
  24926. ]
  24927. [
  24928. [[link boost_asio.reference.basic_stream_socket.message_flags [*message_flags]]]
  24929. [Bitmask type for flags that can be passed to send and receive operations. ]
  24930. ]
  24931. [
  24932. [[link boost_asio.reference.basic_stream_socket.native_handle_type [*native_handle_type]]]
  24933. [The native representation of a socket. ]
  24934. ]
  24935. [
  24936. [[link boost_asio.reference.basic_stream_socket.out_of_band_inline [*out_of_band_inline]]]
  24937. [Socket option for putting received out-of-band data inline. ]
  24938. ]
  24939. [
  24940. [[link boost_asio.reference.basic_stream_socket.protocol_type [*protocol_type]]]
  24941. [The protocol type. ]
  24942. ]
  24943. [
  24944. [[link boost_asio.reference.basic_stream_socket.receive_buffer_size [*receive_buffer_size]]]
  24945. [Socket option for the receive buffer size of a socket. ]
  24946. ]
  24947. [
  24948. [[link boost_asio.reference.basic_stream_socket.receive_low_watermark [*receive_low_watermark]]]
  24949. [Socket option for the receive low watermark. ]
  24950. ]
  24951. [
  24952. [[link boost_asio.reference.basic_stream_socket.reuse_address [*reuse_address]]]
  24953. [Socket option to allow the socket to be bound to an address that is already in use. ]
  24954. ]
  24955. [
  24956. [[link boost_asio.reference.basic_stream_socket.send_buffer_size [*send_buffer_size]]]
  24957. [Socket option for the send buffer size of a socket. ]
  24958. ]
  24959. [
  24960. [[link boost_asio.reference.basic_stream_socket.send_low_watermark [*send_low_watermark]]]
  24961. [Socket option for the send low watermark. ]
  24962. ]
  24963. [
  24964. [[link boost_asio.reference.basic_stream_socket.shutdown_type [*shutdown_type]]]
  24965. [Different ways a socket may be shutdown. ]
  24966. ]
  24967. [
  24968. [[link boost_asio.reference.basic_stream_socket.wait_type [*wait_type]]]
  24969. [Wait types. ]
  24970. ]
  24971. ]
  24972. [heading Member Functions]
  24973. [table
  24974. [[Name][Description]]
  24975. [
  24976. [[link boost_asio.reference.basic_stream_socket.assign [*assign]]]
  24977. [Assign an existing native socket to the socket. ]
  24978. ]
  24979. [
  24980. [[link boost_asio.reference.basic_stream_socket.async_connect [*async_connect]]]
  24981. [Start an asynchronous connect. ]
  24982. ]
  24983. [
  24984. [[link boost_asio.reference.basic_stream_socket.async_read_some [*async_read_some]]]
  24985. [Start an asynchronous read. ]
  24986. ]
  24987. [
  24988. [[link boost_asio.reference.basic_stream_socket.async_receive [*async_receive]]]
  24989. [Start an asynchronous receive. ]
  24990. ]
  24991. [
  24992. [[link boost_asio.reference.basic_stream_socket.async_send [*async_send]]]
  24993. [Start an asynchronous send. ]
  24994. ]
  24995. [
  24996. [[link boost_asio.reference.basic_stream_socket.async_wait [*async_wait]]]
  24997. [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  24998. ]
  24999. [
  25000. [[link boost_asio.reference.basic_stream_socket.async_write_some [*async_write_some]]]
  25001. [Start an asynchronous write. ]
  25002. ]
  25003. [
  25004. [[link boost_asio.reference.basic_stream_socket.at_mark [*at_mark]]]
  25005. [Determine whether the socket is at the out-of-band data mark. ]
  25006. ]
  25007. [
  25008. [[link boost_asio.reference.basic_stream_socket.available [*available]]]
  25009. [Determine the number of bytes available for reading. ]
  25010. ]
  25011. [
  25012. [[link boost_asio.reference.basic_stream_socket.basic_stream_socket [*basic_stream_socket]]]
  25013. [Construct a basic_stream_socket without opening it.
  25014. [hr]
  25015. Construct and open a basic_stream_socket.
  25016. [hr]
  25017. Construct a basic_stream_socket, opening it and binding it to the given local endpoint.
  25018. [hr]
  25019. Construct a basic_stream_socket on an existing native socket.
  25020. [hr]
  25021. Move-construct a basic_stream_socket from another.
  25022. [hr]
  25023. Move-construct a basic_stream_socket from a socket of another protocol type. ]
  25024. ]
  25025. [
  25026. [[link boost_asio.reference.basic_stream_socket.bind [*bind]]]
  25027. [Bind the socket to the given local endpoint. ]
  25028. ]
  25029. [
  25030. [[link boost_asio.reference.basic_stream_socket.cancel [*cancel]]]
  25031. [Cancel all asynchronous operations associated with the socket. ]
  25032. ]
  25033. [
  25034. [[link boost_asio.reference.basic_stream_socket.close [*close]]]
  25035. [Close the socket. ]
  25036. ]
  25037. [
  25038. [[link boost_asio.reference.basic_stream_socket.connect [*connect]]]
  25039. [Connect the socket to the specified endpoint. ]
  25040. ]
  25041. [
  25042. [[link boost_asio.reference.basic_stream_socket.get_executor [*get_executor]]]
  25043. [Get the executor associated with the object. ]
  25044. ]
  25045. [
  25046. [[link boost_asio.reference.basic_stream_socket.get_option [*get_option]]]
  25047. [Get an option from the socket. ]
  25048. ]
  25049. [
  25050. [[link boost_asio.reference.basic_stream_socket.io_control [*io_control]]]
  25051. [Perform an IO control command on the socket. ]
  25052. ]
  25053. [
  25054. [[link boost_asio.reference.basic_stream_socket.is_open [*is_open]]]
  25055. [Determine whether the socket is open. ]
  25056. ]
  25057. [
  25058. [[link boost_asio.reference.basic_stream_socket.local_endpoint [*local_endpoint]]]
  25059. [Get the local endpoint of the socket. ]
  25060. ]
  25061. [
  25062. [[link boost_asio.reference.basic_stream_socket.lowest_layer [*lowest_layer]]]
  25063. [Get a reference to the lowest layer.
  25064. [hr]
  25065. Get a const reference to the lowest layer. ]
  25066. ]
  25067. [
  25068. [[link boost_asio.reference.basic_stream_socket.native_handle [*native_handle]]]
  25069. [Get the native socket representation. ]
  25070. ]
  25071. [
  25072. [[link boost_asio.reference.basic_stream_socket.native_non_blocking [*native_non_blocking]]]
  25073. [Gets the non-blocking mode of the native socket implementation.
  25074. [hr]
  25075. Sets the non-blocking mode of the native socket implementation. ]
  25076. ]
  25077. [
  25078. [[link boost_asio.reference.basic_stream_socket.non_blocking [*non_blocking]]]
  25079. [Gets the non-blocking mode of the socket.
  25080. [hr]
  25081. Sets the non-blocking mode of the socket. ]
  25082. ]
  25083. [
  25084. [[link boost_asio.reference.basic_stream_socket.open [*open]]]
  25085. [Open the socket using the specified protocol. ]
  25086. ]
  25087. [
  25088. [[link boost_asio.reference.basic_stream_socket.operator_eq_ [*operator=]]]
  25089. [Move-assign a basic_stream_socket from another.
  25090. [hr]
  25091. Move-assign a basic_stream_socket from a socket of another protocol type. ]
  25092. ]
  25093. [
  25094. [[link boost_asio.reference.basic_stream_socket.read_some [*read_some]]]
  25095. [Read some data from the socket. ]
  25096. ]
  25097. [
  25098. [[link boost_asio.reference.basic_stream_socket.receive [*receive]]]
  25099. [Receive some data on the socket.
  25100. [hr]
  25101. Receive some data on a connected socket. ]
  25102. ]
  25103. [
  25104. [[link boost_asio.reference.basic_stream_socket.release [*release]]]
  25105. [Release ownership of the underlying native socket. ]
  25106. ]
  25107. [
  25108. [[link boost_asio.reference.basic_stream_socket.remote_endpoint [*remote_endpoint]]]
  25109. [Get the remote endpoint of the socket. ]
  25110. ]
  25111. [
  25112. [[link boost_asio.reference.basic_stream_socket.send [*send]]]
  25113. [Send some data on the socket. ]
  25114. ]
  25115. [
  25116. [[link boost_asio.reference.basic_stream_socket.set_option [*set_option]]]
  25117. [Set an option on the socket. ]
  25118. ]
  25119. [
  25120. [[link boost_asio.reference.basic_stream_socket.shutdown [*shutdown]]]
  25121. [Disable sends or receives on the socket. ]
  25122. ]
  25123. [
  25124. [[link boost_asio.reference.basic_stream_socket.wait [*wait]]]
  25125. [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  25126. ]
  25127. [
  25128. [[link boost_asio.reference.basic_stream_socket.write_some [*write_some]]]
  25129. [Write some data to the socket. ]
  25130. ]
  25131. [
  25132. [[link boost_asio.reference.basic_stream_socket._basic_stream_socket [*~basic_stream_socket]]]
  25133. [Destroys the socket. ]
  25134. ]
  25135. ]
  25136. [heading Data Members]
  25137. [table
  25138. [[Name][Description]]
  25139. [
  25140. [[link boost_asio.reference.basic_stream_socket.max_connections [*max_connections]]]
  25141. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  25142. ]
  25143. [
  25144. [[link boost_asio.reference.basic_stream_socket.max_listen_connections [*max_listen_connections]]]
  25145. [The maximum length of the queue of pending incoming connections. ]
  25146. ]
  25147. [
  25148. [[link boost_asio.reference.basic_stream_socket.message_do_not_route [*message_do_not_route]]]
  25149. [Specify that the data should not be subject to routing. ]
  25150. ]
  25151. [
  25152. [[link boost_asio.reference.basic_stream_socket.message_end_of_record [*message_end_of_record]]]
  25153. [Specifies that the data marks the end of a record. ]
  25154. ]
  25155. [
  25156. [[link boost_asio.reference.basic_stream_socket.message_out_of_band [*message_out_of_band]]]
  25157. [Process out-of-band data. ]
  25158. ]
  25159. [
  25160. [[link boost_asio.reference.basic_stream_socket.message_peek [*message_peek]]]
  25161. [Peek at incoming data without removing it from the input queue. ]
  25162. ]
  25163. ]
  25164. [heading Protected Data Members]
  25165. [table
  25166. [[Name][Description]]
  25167. [
  25168. [[link boost_asio.reference.basic_stream_socket.impl_ [*impl_]]]
  25169. []
  25170. ]
  25171. ]
  25172. The [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] class template provides asynchronous and blocking stream-oriented socket functionality.
  25173. [heading Thread Safety]
  25174. ['Distinct] ['objects:] Safe.
  25175. ['Shared] ['objects:] Unsafe.
  25176. [heading Requirements]
  25177. ['Header: ][^boost/asio/basic_stream_socket.hpp]
  25178. ['Convenience header: ][^boost/asio.hpp]
  25179. [endsect]
  25180. [endsect]
  25181. [section:basic_streambuf basic_streambuf]
  25182. Automatically resizable buffer class based on std::streambuf.
  25183. template<
  25184. typename Allocator = std::allocator<char>>
  25185. class basic_streambuf :
  25186. noncopyable
  25187. [heading Types]
  25188. [table
  25189. [[Name][Description]]
  25190. [
  25191. [[link boost_asio.reference.basic_streambuf.const_buffers_type [*const_buffers_type]]]
  25192. [The type used to represent the input sequence as a list of buffers. ]
  25193. ]
  25194. [
  25195. [[link boost_asio.reference.basic_streambuf.mutable_buffers_type [*mutable_buffers_type]]]
  25196. [The type used to represent the output sequence as a list of buffers. ]
  25197. ]
  25198. ]
  25199. [heading Member Functions]
  25200. [table
  25201. [[Name][Description]]
  25202. [
  25203. [[link boost_asio.reference.basic_streambuf.basic_streambuf [*basic_streambuf]]]
  25204. [Construct a basic_streambuf object. ]
  25205. ]
  25206. [
  25207. [[link boost_asio.reference.basic_streambuf.capacity [*capacity]]]
  25208. [Get the current capacity of the basic_streambuf. ]
  25209. ]
  25210. [
  25211. [[link boost_asio.reference.basic_streambuf.commit [*commit]]]
  25212. [Move characters from the output sequence to the input sequence. ]
  25213. ]
  25214. [
  25215. [[link boost_asio.reference.basic_streambuf.consume [*consume]]]
  25216. [Remove characters from the input sequence. ]
  25217. ]
  25218. [
  25219. [[link boost_asio.reference.basic_streambuf.data [*data]]]
  25220. [Get a list of buffers that represents the input sequence. ]
  25221. ]
  25222. [
  25223. [[link boost_asio.reference.basic_streambuf.max_size [*max_size]]]
  25224. [Get the maximum size of the basic_streambuf. ]
  25225. ]
  25226. [
  25227. [[link boost_asio.reference.basic_streambuf.prepare [*prepare]]]
  25228. [Get a list of buffers that represents the output sequence, with the given size. ]
  25229. ]
  25230. [
  25231. [[link boost_asio.reference.basic_streambuf.size [*size]]]
  25232. [Get the size of the input sequence. ]
  25233. ]
  25234. ]
  25235. [heading Protected Member Functions]
  25236. [table
  25237. [[Name][Description]]
  25238. [
  25239. [[link boost_asio.reference.basic_streambuf.overflow [*overflow]]]
  25240. [Override std::streambuf behaviour. ]
  25241. ]
  25242. [
  25243. [[link boost_asio.reference.basic_streambuf.reserve [*reserve]]]
  25244. []
  25245. ]
  25246. [
  25247. [[link boost_asio.reference.basic_streambuf.underflow [*underflow]]]
  25248. [Override std::streambuf behaviour. ]
  25249. ]
  25250. ]
  25251. The `basic_streambuf` class is derived from `std::streambuf` to associate the streambuf's input and output sequences with one or more character arrays. These character arrays are internal to the `basic_streambuf` object, but direct access to the array elements is provided to permit them to be used efficiently with I/O operations. Characters written to the output sequence of a `basic_streambuf` object are appended to the input sequence of the same object.
  25252. The `basic_streambuf` class's public interface is intended to permit the following implementation strategies:
  25253. * 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.
  25254. * 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.
  25255. * 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.
  25256. The constructor for [link boost_asio.reference.basic_streambuf `basic_streambuf`] accepts a `size_t` argument specifying the maximum of the sum of the sizes of the input sequence and output sequence. During the lifetime of the `basic_streambuf` object, the following invariant holds:
  25257. size() <= max_size()
  25258. Any member function that would, if successful, cause the invariant to be violated shall throw an exception of class `std::length_error`.
  25259. The constructor for `basic_streambuf` takes an Allocator argument. A copy of this argument is used for any memory allocation performed, by the constructor and by all member functions, during the lifetime of each `basic_streambuf` object.
  25260. [heading Examples]
  25261. Writing directly from an streambuf to a socket:
  25262. boost::asio::streambuf b;
  25263. std::ostream os(&b);
  25264. os << "Hello, World!\n";
  25265. // try sending some data in input sequence
  25266. size_t n = sock.send(b.data());
  25267. b.consume(n); // sent data is removed from input sequence
  25268. Reading from a socket directly into a streambuf:
  25269. boost::asio::streambuf b;
  25270. // reserve 512 bytes in output sequence
  25271. boost::asio::streambuf::mutable_buffers_type bufs = b.prepare(512);
  25272. size_t n = sock.receive(bufs);
  25273. // received data is "committed" from output sequence to input sequence
  25274. b.commit(n);
  25275. std::istream is(&b);
  25276. std::string s;
  25277. is >> s;
  25278. [heading Requirements]
  25279. ['Header: ][^boost/asio/basic_streambuf.hpp]
  25280. ['Convenience header: ][^boost/asio.hpp]
  25281. [section:basic_streambuf basic_streambuf::basic_streambuf]
  25282. [indexterm2 boost_asio.indexterm.basic_streambuf.basic_streambuf..basic_streambuf..basic_streambuf]
  25283. Construct a [link boost_asio.reference.basic_streambuf `basic_streambuf`] object.
  25284. basic_streambuf(
  25285. std::size_t maximum_size = (std::numeric_limits< std::size_t >::max)(),
  25286. const Allocator & allocator = Allocator());
  25287. Constructs a streambuf with the specified maximum size. The initial size of the streambuf's input sequence is 0.
  25288. [endsect]
  25289. [section:capacity basic_streambuf::capacity]
  25290. [indexterm2 boost_asio.indexterm.basic_streambuf.capacity..capacity..basic_streambuf]
  25291. Get the current capacity of the [link boost_asio.reference.basic_streambuf `basic_streambuf`].
  25292. std::size_t capacity() const;
  25293. [heading Return Value]
  25294. The current total capacity of the streambuf, i.e. for both the input sequence and output sequence.
  25295. [endsect]
  25296. [section:commit basic_streambuf::commit]
  25297. [indexterm2 boost_asio.indexterm.basic_streambuf.commit..commit..basic_streambuf]
  25298. Move characters from the output sequence to the input sequence.
  25299. void commit(
  25300. std::size_t n);
  25301. Appends `n` characters from the start of the output sequence to the input sequence. The beginning of the output sequence is advanced by `n` characters.
  25302. Requires a preceding call `prepare(x)` where `x >= n`, and no intervening operations that modify the input or output sequence.
  25303. [heading Remarks]
  25304. If `n` is greater than the size of the output sequence, the entire output sequence is moved to the input sequence and no error is issued.
  25305. [endsect]
  25306. [section:const_buffers_type basic_streambuf::const_buffers_type]
  25307. [indexterm2 boost_asio.indexterm.basic_streambuf.const_buffers_type..const_buffers_type..basic_streambuf]
  25308. The type used to represent the input sequence as a list of buffers.
  25309. typedef implementation_defined const_buffers_type;
  25310. [heading Requirements]
  25311. ['Header: ][^boost/asio/basic_streambuf.hpp]
  25312. ['Convenience header: ][^boost/asio.hpp]
  25313. [endsect]
  25314. [section:consume basic_streambuf::consume]
  25315. [indexterm2 boost_asio.indexterm.basic_streambuf.consume..consume..basic_streambuf]
  25316. Remove characters from the input sequence.
  25317. void consume(
  25318. std::size_t n);
  25319. Removes `n` characters from the beginning of the input sequence.
  25320. [heading Remarks]
  25321. If `n` is greater than the size of the input sequence, the entire input sequence is consumed and no error is issued.
  25322. [endsect]
  25323. [section:data basic_streambuf::data]
  25324. [indexterm2 boost_asio.indexterm.basic_streambuf.data..data..basic_streambuf]
  25325. Get a list of buffers that represents the input sequence.
  25326. const_buffers_type data() const;
  25327. [heading Return Value]
  25328. An object of type `const_buffers_type` that satisfies ConstBufferSequence requirements, representing all character arrays in the input sequence.
  25329. [heading Remarks]
  25330. The returned object is invalidated by any `basic_streambuf` member function that modifies the input sequence or output sequence.
  25331. [endsect]
  25332. [section:max_size basic_streambuf::max_size]
  25333. [indexterm2 boost_asio.indexterm.basic_streambuf.max_size..max_size..basic_streambuf]
  25334. Get the maximum size of the [link boost_asio.reference.basic_streambuf `basic_streambuf`].
  25335. std::size_t max_size() const;
  25336. [heading Return Value]
  25337. The allowed maximum of the sum of the sizes of the input sequence and output sequence.
  25338. [endsect]
  25339. [section:mutable_buffers_type basic_streambuf::mutable_buffers_type]
  25340. [indexterm2 boost_asio.indexterm.basic_streambuf.mutable_buffers_type..mutable_buffers_type..basic_streambuf]
  25341. The type used to represent the output sequence as a list of buffers.
  25342. typedef implementation_defined mutable_buffers_type;
  25343. [heading Requirements]
  25344. ['Header: ][^boost/asio/basic_streambuf.hpp]
  25345. ['Convenience header: ][^boost/asio.hpp]
  25346. [endsect]
  25347. [section:overflow basic_streambuf::overflow]
  25348. [indexterm2 boost_asio.indexterm.basic_streambuf.overflow..overflow..basic_streambuf]
  25349. Override std::streambuf behaviour.
  25350. int_type overflow(
  25351. int_type c);
  25352. Behaves according to the specification of `std::streambuf::overflow()`, with the specialisation that `std::length_error` is thrown if appending the character to the input sequence would require the condition `size() > max_size()` to be true.
  25353. [endsect]
  25354. [section:prepare basic_streambuf::prepare]
  25355. [indexterm2 boost_asio.indexterm.basic_streambuf.prepare..prepare..basic_streambuf]
  25356. Get a list of buffers that represents the output sequence, with the given size.
  25357. mutable_buffers_type prepare(
  25358. std::size_t n);
  25359. Ensures that the output sequence can accommodate `n` characters, reallocating character array objects as necessary.
  25360. [heading Return Value]
  25361. An object of type `mutable_buffers_type` that satisfies MutableBufferSequence requirements, representing character array objects at the start of the output sequence such that the sum of the buffer sizes is `n`.
  25362. [heading Exceptions]
  25363. [variablelist
  25364. [[std::length_error][If `size() + n > max_size()`.]]
  25365. ]
  25366. [heading Remarks]
  25367. The returned object is invalidated by any `basic_streambuf` member function that modifies the input sequence or output sequence.
  25368. [endsect]
  25369. [section:reserve basic_streambuf::reserve]
  25370. [indexterm2 boost_asio.indexterm.basic_streambuf.reserve..reserve..basic_streambuf]
  25371. void reserve(
  25372. std::size_t n);
  25373. [endsect]
  25374. [section:size basic_streambuf::size]
  25375. [indexterm2 boost_asio.indexterm.basic_streambuf.size..size..basic_streambuf]
  25376. Get the size of the input sequence.
  25377. std::size_t size() const;
  25378. [heading Return Value]
  25379. The size of the input sequence. The value is equal to that calculated for `s` in the following code:
  25380. size_t s = 0;
  25381. const_buffers_type bufs = data();
  25382. const_buffers_type::const_iterator i = bufs.begin();
  25383. while (i != bufs.end())
  25384. {
  25385. const_buffer buf(*i++);
  25386. s += buf.size();
  25387. }
  25388. [endsect]
  25389. [section:underflow basic_streambuf::underflow]
  25390. [indexterm2 boost_asio.indexterm.basic_streambuf.underflow..underflow..basic_streambuf]
  25391. Override std::streambuf behaviour.
  25392. int_type underflow();
  25393. Behaves according to the specification of `std::streambuf::underflow()`.
  25394. [endsect]
  25395. [endsect]
  25396. [section:basic_streambuf_ref basic_streambuf_ref]
  25397. Adapts [link boost_asio.reference.basic_streambuf `basic_streambuf`] to the dynamic buffer sequence type requirements.
  25398. template<
  25399. typename Allocator = std::allocator<char>>
  25400. class basic_streambuf_ref
  25401. [heading Types]
  25402. [table
  25403. [[Name][Description]]
  25404. [
  25405. [[link boost_asio.reference.basic_streambuf_ref.const_buffers_type [*const_buffers_type]]]
  25406. [The type used to represent the input sequence as a list of buffers. ]
  25407. ]
  25408. [
  25409. [[link boost_asio.reference.basic_streambuf_ref.mutable_buffers_type [*mutable_buffers_type]]]
  25410. [The type used to represent the output sequence as a list of buffers. ]
  25411. ]
  25412. ]
  25413. [heading Member Functions]
  25414. [table
  25415. [[Name][Description]]
  25416. [
  25417. [[link boost_asio.reference.basic_streambuf_ref.basic_streambuf_ref [*basic_streambuf_ref]]]
  25418. [Construct a basic_streambuf_ref for the given basic_streambuf object.
  25419. [hr]
  25420. Copy construct a basic_streambuf_ref.
  25421. [hr]
  25422. Move construct a basic_streambuf_ref. ]
  25423. ]
  25424. [
  25425. [[link boost_asio.reference.basic_streambuf_ref.capacity [*capacity]]]
  25426. [Get the current capacity of the dynamic buffer. ]
  25427. ]
  25428. [
  25429. [[link boost_asio.reference.basic_streambuf_ref.commit [*commit]]]
  25430. [Move bytes from the output sequence to the input sequence. ]
  25431. ]
  25432. [
  25433. [[link boost_asio.reference.basic_streambuf_ref.consume [*consume]]]
  25434. [Remove characters from the input sequence. ]
  25435. ]
  25436. [
  25437. [[link boost_asio.reference.basic_streambuf_ref.data [*data]]]
  25438. [Get a list of buffers that represents the input sequence. ]
  25439. ]
  25440. [
  25441. [[link boost_asio.reference.basic_streambuf_ref.max_size [*max_size]]]
  25442. [Get the maximum size of the dynamic buffer. ]
  25443. ]
  25444. [
  25445. [[link boost_asio.reference.basic_streambuf_ref.prepare [*prepare]]]
  25446. [Get a list of buffers that represents the output sequence, with the given size. ]
  25447. ]
  25448. [
  25449. [[link boost_asio.reference.basic_streambuf_ref.size [*size]]]
  25450. [Get the size of the input sequence. ]
  25451. ]
  25452. ]
  25453. [heading Requirements]
  25454. ['Header: ][^boost/asio/basic_streambuf.hpp]
  25455. ['Convenience header: ][^boost/asio.hpp]
  25456. [section:basic_streambuf_ref basic_streambuf_ref::basic_streambuf_ref]
  25457. [indexterm2 boost_asio.indexterm.basic_streambuf_ref.basic_streambuf_ref..basic_streambuf_ref..basic_streambuf_ref]
  25458. Construct a [link boost_asio.reference.basic_streambuf_ref `basic_streambuf_ref`] for the given [link boost_asio.reference.basic_streambuf `basic_streambuf`] object.
  25459. explicit ``[link boost_asio.reference.basic_streambuf_ref.basic_streambuf_ref.overload1 basic_streambuf_ref]``(
  25460. basic_streambuf< Allocator > & sb);
  25461. `` [''''&raquo;''' [link boost_asio.reference.basic_streambuf_ref.basic_streambuf_ref.overload1 more...]]``
  25462. Copy construct a [link boost_asio.reference.basic_streambuf_ref `basic_streambuf_ref`].
  25463. ``[link boost_asio.reference.basic_streambuf_ref.basic_streambuf_ref.overload2 basic_streambuf_ref]``(
  25464. const basic_streambuf_ref & other);
  25465. `` [''''&raquo;''' [link boost_asio.reference.basic_streambuf_ref.basic_streambuf_ref.overload2 more...]]``
  25466. Move construct a [link boost_asio.reference.basic_streambuf_ref `basic_streambuf_ref`].
  25467. ``[link boost_asio.reference.basic_streambuf_ref.basic_streambuf_ref.overload3 basic_streambuf_ref]``(
  25468. basic_streambuf_ref && other);
  25469. `` [''''&raquo;''' [link boost_asio.reference.basic_streambuf_ref.basic_streambuf_ref.overload3 more...]]``
  25470. [section:overload1 basic_streambuf_ref::basic_streambuf_ref (1 of 3 overloads)]
  25471. Construct a [link boost_asio.reference.basic_streambuf_ref `basic_streambuf_ref`] for the given [link boost_asio.reference.basic_streambuf `basic_streambuf`] object.
  25472. basic_streambuf_ref(
  25473. basic_streambuf< Allocator > & sb);
  25474. [endsect]
  25475. [section:overload2 basic_streambuf_ref::basic_streambuf_ref (2 of 3 overloads)]
  25476. Copy construct a [link boost_asio.reference.basic_streambuf_ref `basic_streambuf_ref`].
  25477. basic_streambuf_ref(
  25478. const basic_streambuf_ref & other);
  25479. [endsect]
  25480. [section:overload3 basic_streambuf_ref::basic_streambuf_ref (3 of 3 overloads)]
  25481. Move construct a [link boost_asio.reference.basic_streambuf_ref `basic_streambuf_ref`].
  25482. basic_streambuf_ref(
  25483. basic_streambuf_ref && other);
  25484. [endsect]
  25485. [endsect]
  25486. [section:capacity basic_streambuf_ref::capacity]
  25487. [indexterm2 boost_asio.indexterm.basic_streambuf_ref.capacity..capacity..basic_streambuf_ref]
  25488. Get the current capacity of the dynamic buffer.
  25489. std::size_t capacity() const;
  25490. [endsect]
  25491. [section:commit basic_streambuf_ref::commit]
  25492. [indexterm2 boost_asio.indexterm.basic_streambuf_ref.commit..commit..basic_streambuf_ref]
  25493. Move bytes from the output sequence to the input sequence.
  25494. void commit(
  25495. std::size_t n);
  25496. [endsect]
  25497. [section:const_buffers_type basic_streambuf_ref::const_buffers_type]
  25498. [indexterm2 boost_asio.indexterm.basic_streambuf_ref.const_buffers_type..const_buffers_type..basic_streambuf_ref]
  25499. The type used to represent the input sequence as a list of buffers.
  25500. typedef basic_streambuf< Allocator >::const_buffers_type const_buffers_type;
  25501. [heading Types]
  25502. [table
  25503. [[Name][Description]]
  25504. [
  25505. [[link boost_asio.reference.basic_streambuf.const_buffers_type [*const_buffers_type]]]
  25506. [The type used to represent the input sequence as a list of buffers. ]
  25507. ]
  25508. [
  25509. [[link boost_asio.reference.basic_streambuf.mutable_buffers_type [*mutable_buffers_type]]]
  25510. [The type used to represent the output sequence as a list of buffers. ]
  25511. ]
  25512. ]
  25513. [heading Member Functions]
  25514. [table
  25515. [[Name][Description]]
  25516. [
  25517. [[link boost_asio.reference.basic_streambuf.basic_streambuf [*basic_streambuf]]]
  25518. [Construct a basic_streambuf object. ]
  25519. ]
  25520. [
  25521. [[link boost_asio.reference.basic_streambuf.capacity [*capacity]]]
  25522. [Get the current capacity of the basic_streambuf. ]
  25523. ]
  25524. [
  25525. [[link boost_asio.reference.basic_streambuf.commit [*commit]]]
  25526. [Move characters from the output sequence to the input sequence. ]
  25527. ]
  25528. [
  25529. [[link boost_asio.reference.basic_streambuf.consume [*consume]]]
  25530. [Remove characters from the input sequence. ]
  25531. ]
  25532. [
  25533. [[link boost_asio.reference.basic_streambuf.data [*data]]]
  25534. [Get a list of buffers that represents the input sequence. ]
  25535. ]
  25536. [
  25537. [[link boost_asio.reference.basic_streambuf.max_size [*max_size]]]
  25538. [Get the maximum size of the basic_streambuf. ]
  25539. ]
  25540. [
  25541. [[link boost_asio.reference.basic_streambuf.prepare [*prepare]]]
  25542. [Get a list of buffers that represents the output sequence, with the given size. ]
  25543. ]
  25544. [
  25545. [[link boost_asio.reference.basic_streambuf.size [*size]]]
  25546. [Get the size of the input sequence. ]
  25547. ]
  25548. ]
  25549. [heading Protected Member Functions]
  25550. [table
  25551. [[Name][Description]]
  25552. [
  25553. [[link boost_asio.reference.basic_streambuf.overflow [*overflow]]]
  25554. [Override std::streambuf behaviour. ]
  25555. ]
  25556. [
  25557. [[link boost_asio.reference.basic_streambuf.reserve [*reserve]]]
  25558. []
  25559. ]
  25560. [
  25561. [[link boost_asio.reference.basic_streambuf.underflow [*underflow]]]
  25562. [Override std::streambuf behaviour. ]
  25563. ]
  25564. ]
  25565. The `basic_streambuf` class is derived from `std::streambuf` to associate the streambuf's input and output sequences with one or more character arrays. These character arrays are internal to the `basic_streambuf` object, but direct access to the array elements is provided to permit them to be used efficiently with I/O operations. Characters written to the output sequence of a `basic_streambuf` object are appended to the input sequence of the same object.
  25566. The `basic_streambuf` class's public interface is intended to permit the following implementation strategies:
  25567. * 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.
  25568. * 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.
  25569. * 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.
  25570. The constructor for [link boost_asio.reference.basic_streambuf `basic_streambuf`] accepts a `size_t` argument specifying the maximum of the sum of the sizes of the input sequence and output sequence. During the lifetime of the `basic_streambuf` object, the following invariant holds:
  25571. size() <= max_size()
  25572. Any member function that would, if successful, cause the invariant to be violated shall throw an exception of class `std::length_error`.
  25573. The constructor for `basic_streambuf` takes an Allocator argument. A copy of this argument is used for any memory allocation performed, by the constructor and by all member functions, during the lifetime of each `basic_streambuf` object.
  25574. [heading Examples]
  25575. Writing directly from an streambuf to a socket:
  25576. boost::asio::streambuf b;
  25577. std::ostream os(&b);
  25578. os << "Hello, World!\n";
  25579. // try sending some data in input sequence
  25580. size_t n = sock.send(b.data());
  25581. b.consume(n); // sent data is removed from input sequence
  25582. Reading from a socket directly into a streambuf:
  25583. boost::asio::streambuf b;
  25584. // reserve 512 bytes in output sequence
  25585. boost::asio::streambuf::mutable_buffers_type bufs = b.prepare(512);
  25586. size_t n = sock.receive(bufs);
  25587. // received data is "committed" from output sequence to input sequence
  25588. b.commit(n);
  25589. std::istream is(&b);
  25590. std::string s;
  25591. is >> s;
  25592. [heading Requirements]
  25593. ['Header: ][^boost/asio/basic_streambuf.hpp]
  25594. ['Convenience header: ][^boost/asio.hpp]
  25595. [endsect]
  25596. [section:consume basic_streambuf_ref::consume]
  25597. [indexterm2 boost_asio.indexterm.basic_streambuf_ref.consume..consume..basic_streambuf_ref]
  25598. Remove characters from the input sequence.
  25599. void consume(
  25600. std::size_t n);
  25601. [endsect]
  25602. [section:data basic_streambuf_ref::data]
  25603. [indexterm2 boost_asio.indexterm.basic_streambuf_ref.data..data..basic_streambuf_ref]
  25604. Get a list of buffers that represents the input sequence.
  25605. const_buffers_type data() const;
  25606. [endsect]
  25607. [section:max_size basic_streambuf_ref::max_size]
  25608. [indexterm2 boost_asio.indexterm.basic_streambuf_ref.max_size..max_size..basic_streambuf_ref]
  25609. Get the maximum size of the dynamic buffer.
  25610. std::size_t max_size() const;
  25611. [endsect]
  25612. [section:mutable_buffers_type basic_streambuf_ref::mutable_buffers_type]
  25613. [indexterm2 boost_asio.indexterm.basic_streambuf_ref.mutable_buffers_type..mutable_buffers_type..basic_streambuf_ref]
  25614. The type used to represent the output sequence as a list of buffers.
  25615. typedef basic_streambuf< Allocator >::mutable_buffers_type mutable_buffers_type;
  25616. [heading Types]
  25617. [table
  25618. [[Name][Description]]
  25619. [
  25620. [[link boost_asio.reference.basic_streambuf.const_buffers_type [*const_buffers_type]]]
  25621. [The type used to represent the input sequence as a list of buffers. ]
  25622. ]
  25623. [
  25624. [[link boost_asio.reference.basic_streambuf.mutable_buffers_type [*mutable_buffers_type]]]
  25625. [The type used to represent the output sequence as a list of buffers. ]
  25626. ]
  25627. ]
  25628. [heading Member Functions]
  25629. [table
  25630. [[Name][Description]]
  25631. [
  25632. [[link boost_asio.reference.basic_streambuf.basic_streambuf [*basic_streambuf]]]
  25633. [Construct a basic_streambuf object. ]
  25634. ]
  25635. [
  25636. [[link boost_asio.reference.basic_streambuf.capacity [*capacity]]]
  25637. [Get the current capacity of the basic_streambuf. ]
  25638. ]
  25639. [
  25640. [[link boost_asio.reference.basic_streambuf.commit [*commit]]]
  25641. [Move characters from the output sequence to the input sequence. ]
  25642. ]
  25643. [
  25644. [[link boost_asio.reference.basic_streambuf.consume [*consume]]]
  25645. [Remove characters from the input sequence. ]
  25646. ]
  25647. [
  25648. [[link boost_asio.reference.basic_streambuf.data [*data]]]
  25649. [Get a list of buffers that represents the input sequence. ]
  25650. ]
  25651. [
  25652. [[link boost_asio.reference.basic_streambuf.max_size [*max_size]]]
  25653. [Get the maximum size of the basic_streambuf. ]
  25654. ]
  25655. [
  25656. [[link boost_asio.reference.basic_streambuf.prepare [*prepare]]]
  25657. [Get a list of buffers that represents the output sequence, with the given size. ]
  25658. ]
  25659. [
  25660. [[link boost_asio.reference.basic_streambuf.size [*size]]]
  25661. [Get the size of the input sequence. ]
  25662. ]
  25663. ]
  25664. [heading Protected Member Functions]
  25665. [table
  25666. [[Name][Description]]
  25667. [
  25668. [[link boost_asio.reference.basic_streambuf.overflow [*overflow]]]
  25669. [Override std::streambuf behaviour. ]
  25670. ]
  25671. [
  25672. [[link boost_asio.reference.basic_streambuf.reserve [*reserve]]]
  25673. []
  25674. ]
  25675. [
  25676. [[link boost_asio.reference.basic_streambuf.underflow [*underflow]]]
  25677. [Override std::streambuf behaviour. ]
  25678. ]
  25679. ]
  25680. The `basic_streambuf` class is derived from `std::streambuf` to associate the streambuf's input and output sequences with one or more character arrays. These character arrays are internal to the `basic_streambuf` object, but direct access to the array elements is provided to permit them to be used efficiently with I/O operations. Characters written to the output sequence of a `basic_streambuf` object are appended to the input sequence of the same object.
  25681. The `basic_streambuf` class's public interface is intended to permit the following implementation strategies:
  25682. * 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.
  25683. * 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.
  25684. * 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.
  25685. The constructor for [link boost_asio.reference.basic_streambuf `basic_streambuf`] accepts a `size_t` argument specifying the maximum of the sum of the sizes of the input sequence and output sequence. During the lifetime of the `basic_streambuf` object, the following invariant holds:
  25686. size() <= max_size()
  25687. Any member function that would, if successful, cause the invariant to be violated shall throw an exception of class `std::length_error`.
  25688. The constructor for `basic_streambuf` takes an Allocator argument. A copy of this argument is used for any memory allocation performed, by the constructor and by all member functions, during the lifetime of each `basic_streambuf` object.
  25689. [heading Examples]
  25690. Writing directly from an streambuf to a socket:
  25691. boost::asio::streambuf b;
  25692. std::ostream os(&b);
  25693. os << "Hello, World!\n";
  25694. // try sending some data in input sequence
  25695. size_t n = sock.send(b.data());
  25696. b.consume(n); // sent data is removed from input sequence
  25697. Reading from a socket directly into a streambuf:
  25698. boost::asio::streambuf b;
  25699. // reserve 512 bytes in output sequence
  25700. boost::asio::streambuf::mutable_buffers_type bufs = b.prepare(512);
  25701. size_t n = sock.receive(bufs);
  25702. // received data is "committed" from output sequence to input sequence
  25703. b.commit(n);
  25704. std::istream is(&b);
  25705. std::string s;
  25706. is >> s;
  25707. [heading Requirements]
  25708. ['Header: ][^boost/asio/basic_streambuf.hpp]
  25709. ['Convenience header: ][^boost/asio.hpp]
  25710. [endsect]
  25711. [section:prepare basic_streambuf_ref::prepare]
  25712. [indexterm2 boost_asio.indexterm.basic_streambuf_ref.prepare..prepare..basic_streambuf_ref]
  25713. Get a list of buffers that represents the output sequence, with the given size.
  25714. mutable_buffers_type prepare(
  25715. std::size_t n);
  25716. [endsect]
  25717. [section:size basic_streambuf_ref::size]
  25718. [indexterm2 boost_asio.indexterm.basic_streambuf_ref.size..size..basic_streambuf_ref]
  25719. Get the size of the input sequence.
  25720. std::size_t size() const;
  25721. [endsect]
  25722. [endsect]
  25723. [section:basic_waitable_timer basic_waitable_timer]
  25724. Provides waitable timer functionality.
  25725. template<
  25726. typename Clock,
  25727. typename ``[link boost_asio.reference.WaitTraits WaitTraits]``,
  25728. typename ``[link boost_asio.reference.Executor1 Executor]``>
  25729. class basic_waitable_timer
  25730. [heading Types]
  25731. [table
  25732. [[Name][Description]]
  25733. [
  25734. [[link boost_asio.reference.basic_waitable_timer__rebind_executor [*rebind_executor]]]
  25735. [Rebinds the timer type to another executor. ]
  25736. ]
  25737. [
  25738. [[link boost_asio.reference.basic_waitable_timer.clock_type [*clock_type]]]
  25739. [The clock type. ]
  25740. ]
  25741. [
  25742. [[link boost_asio.reference.basic_waitable_timer.duration [*duration]]]
  25743. [The duration type of the clock. ]
  25744. ]
  25745. [
  25746. [[link boost_asio.reference.basic_waitable_timer.executor_type [*executor_type]]]
  25747. [The type of the executor associated with the object. ]
  25748. ]
  25749. [
  25750. [[link boost_asio.reference.basic_waitable_timer.time_point [*time_point]]]
  25751. [The time point type of the clock. ]
  25752. ]
  25753. [
  25754. [[link boost_asio.reference.basic_waitable_timer.traits_type [*traits_type]]]
  25755. [The wait traits type. ]
  25756. ]
  25757. ]
  25758. [heading Member Functions]
  25759. [table
  25760. [[Name][Description]]
  25761. [
  25762. [[link boost_asio.reference.basic_waitable_timer.async_wait [*async_wait]]]
  25763. [Start an asynchronous wait on the timer. ]
  25764. ]
  25765. [
  25766. [[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer [*basic_waitable_timer]]]
  25767. [Constructor.
  25768. [hr]
  25769. Constructor to set a particular expiry time as an absolute time.
  25770. [hr]
  25771. Constructor to set a particular expiry time relative to now.
  25772. [hr]
  25773. Move-construct a basic_waitable_timer from another. ]
  25774. ]
  25775. [
  25776. [[link boost_asio.reference.basic_waitable_timer.cancel [*cancel]]]
  25777. [Cancel any asynchronous operations that are waiting on the timer.
  25778. [hr]
  25779. (Deprecated: Use non-error_code overload.) Cancel any asynchronous operations that are waiting on the timer. ]
  25780. ]
  25781. [
  25782. [[link boost_asio.reference.basic_waitable_timer.cancel_one [*cancel_one]]]
  25783. [Cancels one asynchronous operation that is waiting on the timer.
  25784. [hr]
  25785. (Deprecated: Use non-error_code overload.) Cancels one asynchronous operation that is waiting on the timer. ]
  25786. ]
  25787. [
  25788. [[link boost_asio.reference.basic_waitable_timer.expires_after [*expires_after]]]
  25789. [Set the timer's expiry time relative to now. ]
  25790. ]
  25791. [
  25792. [[link boost_asio.reference.basic_waitable_timer.expires_at [*expires_at]]]
  25793. [(Deprecated: Use expiry().) Get the timer's expiry time as an absolute time.
  25794. [hr]
  25795. Set the timer's expiry time as an absolute time.
  25796. [hr]
  25797. (Deprecated: Use non-error_code overload.) Set the timer's expiry time as an absolute time. ]
  25798. ]
  25799. [
  25800. [[link boost_asio.reference.basic_waitable_timer.expires_from_now [*expires_from_now]]]
  25801. [(Deprecated: Use expiry().) Get the timer's expiry time relative to now.
  25802. [hr]
  25803. (Deprecated: Use expires_after().) Set the timer's expiry time relative to now. ]
  25804. ]
  25805. [
  25806. [[link boost_asio.reference.basic_waitable_timer.expiry [*expiry]]]
  25807. [Get the timer's expiry time as an absolute time. ]
  25808. ]
  25809. [
  25810. [[link boost_asio.reference.basic_waitable_timer.get_executor [*get_executor]]]
  25811. [Get the executor associated with the object. ]
  25812. ]
  25813. [
  25814. [[link boost_asio.reference.basic_waitable_timer.operator_eq_ [*operator=]]]
  25815. [Move-assign a basic_waitable_timer from another. ]
  25816. ]
  25817. [
  25818. [[link boost_asio.reference.basic_waitable_timer.wait [*wait]]]
  25819. [Perform a blocking wait on the timer. ]
  25820. ]
  25821. [
  25822. [[link boost_asio.reference.basic_waitable_timer._basic_waitable_timer [*~basic_waitable_timer]]]
  25823. [Destroys the timer. ]
  25824. ]
  25825. ]
  25826. The [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] class template provides the ability to perform a blocking or asynchronous wait for a timer to expire.
  25827. A waitable timer is always in one of two states: "expired" or "not expired". If the `wait()` or `async_wait()` function is called on an expired timer, the wait operation will complete immediately.
  25828. Most applications will use one of the [link boost_asio.reference.steady_timer `steady_timer`], [link boost_asio.reference.system_timer `system_timer`] or [link boost_asio.reference.high_resolution_timer `high_resolution_timer`] typedefs.
  25829. [heading Remarks]
  25830. This waitable timer functionality is for use with the C++11 standard library's `<chrono>` facility, or with the Boost.Chrono library.
  25831. [heading Thread Safety]
  25832. ['Distinct] ['objects:] Safe.
  25833. ['Shared] ['objects:] Unsafe.
  25834. [heading Examples]
  25835. Performing a blocking wait (C++11):
  25836. // Construct a timer without setting an expiry time.
  25837. boost::asio::steady_timer timer(my_context);
  25838. // Set an expiry time relative to now.
  25839. timer.expires_after(std::chrono::seconds(5));
  25840. // Wait for the timer to expire.
  25841. timer.wait();
  25842. Performing an asynchronous wait (C++11):
  25843. void handler(const boost::system::error_code& error)
  25844. {
  25845. if (!error)
  25846. {
  25847. // Timer expired.
  25848. }
  25849. }
  25850. ...
  25851. // Construct a timer with an absolute expiry time.
  25852. boost::asio::steady_timer timer(my_context,
  25853. std::chrono::steady_clock::now() + std::chrono::seconds(60));
  25854. // Start an asynchronous wait.
  25855. timer.async_wait(handler);
  25856. [heading Changing an active waitable timer's expiry time]
  25857. Changing the expiry time of a timer while there are pending asynchronous waits causes those wait operations to be cancelled. To ensure that the action associated with the timer is performed only once, use something like this: used:
  25858. void on_some_event()
  25859. {
  25860. if (my_timer.expires_after(seconds(5)) > 0)
  25861. {
  25862. // We managed to cancel the timer. Start new asynchronous wait.
  25863. my_timer.async_wait(on_timeout);
  25864. }
  25865. else
  25866. {
  25867. // Too late, timer has already expired!
  25868. }
  25869. }
  25870. void on_timeout(const boost::system::error_code& e)
  25871. {
  25872. if (e != boost::asio::error::operation_aborted)
  25873. {
  25874. // Timer was not cancelled, take necessary action.
  25875. }
  25876. }
  25877. * 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.
  25878. * If a wait handler is cancelled, the boost::system::error\_code passed to it contains the value `boost::asio::error::operation_aborted`.
  25879. [heading Requirements]
  25880. ['Header: ][^boost/asio/basic_waitable_timer.hpp]
  25881. ['Convenience header: ][^boost/asio.hpp]
  25882. [section:async_wait basic_waitable_timer::async_wait]
  25883. [indexterm2 boost_asio.indexterm.basic_waitable_timer.async_wait..async_wait..basic_waitable_timer]
  25884. Start an asynchronous wait on the timer.
  25885. template<
  25886. typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  25887. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait(
  25888. WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  25889. This function may be used to initiate an asynchronous wait against the timer. It always returns immediately.
  25890. For each call to `async_wait()`, the supplied handler will be called exactly once. The handler will be called when:
  25891. * The timer has expired.
  25892. * The timer was cancelled, in which case the handler is passed the error code `boost::asio::error::operation_aborted`.
  25893. [heading Parameters]
  25894. [variablelist
  25895. [[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:
  25896. ``
  25897. void handler(
  25898. const boost::system::error_code& error // Result of operation.
  25899. );
  25900. ``
  25901. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
  25902. ]
  25903. [endsect]
  25904. [section:basic_waitable_timer basic_waitable_timer::basic_waitable_timer]
  25905. [indexterm2 boost_asio.indexterm.basic_waitable_timer.basic_waitable_timer..basic_waitable_timer..basic_waitable_timer]
  25906. Constructor.
  25907. explicit ``[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload1 basic_waitable_timer]``(
  25908. const executor_type & ex);
  25909. `` [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload1 more...]]``
  25910. template<
  25911. typename ExecutionContext>
  25912. explicit ``[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload2 basic_waitable_timer]``(
  25913. ExecutionContext & context,
  25914. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  25915. `` [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload2 more...]]``
  25916. Constructor to set a particular expiry time as an absolute time.
  25917. ``[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload3 basic_waitable_timer]``(
  25918. const executor_type & ex,
  25919. const time_point & expiry_time);
  25920. `` [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload3 more...]]``
  25921. template<
  25922. typename ExecutionContext>
  25923. explicit ``[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload4 basic_waitable_timer]``(
  25924. ExecutionContext & context,
  25925. const time_point & expiry_time,
  25926. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  25927. `` [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload4 more...]]``
  25928. Constructor to set a particular expiry time relative to now.
  25929. ``[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload5 basic_waitable_timer]``(
  25930. const executor_type & ex,
  25931. const duration & expiry_time);
  25932. `` [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload5 more...]]``
  25933. template<
  25934. typename ExecutionContext>
  25935. explicit ``[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload6 basic_waitable_timer]``(
  25936. ExecutionContext & context,
  25937. const duration & expiry_time,
  25938. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  25939. `` [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload6 more...]]``
  25940. Move-construct a [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] from another.
  25941. ``[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload7 basic_waitable_timer]``(
  25942. basic_waitable_timer && other);
  25943. `` [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.basic_waitable_timer.overload7 more...]]``
  25944. [section:overload1 basic_waitable_timer::basic_waitable_timer (1 of 7 overloads)]
  25945. Constructor.
  25946. basic_waitable_timer(
  25947. const executor_type & ex);
  25948. This constructor creates a timer without setting an expiry time. The `expires_at()` or `expires_after()` functions must be called to set an expiry time before the timer can be waited on.
  25949. [heading Parameters]
  25950. [variablelist
  25951. [[ex][The I/O executor that the timer will use, by default, to dispatch handlers for any asynchronous operations performed on the timer. ]]
  25952. ]
  25953. [endsect]
  25954. [section:overload2 basic_waitable_timer::basic_waitable_timer (2 of 7 overloads)]
  25955. Constructor.
  25956. template<
  25957. typename ExecutionContext>
  25958. basic_waitable_timer(
  25959. ExecutionContext & context,
  25960. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  25961. This constructor creates a timer without setting an expiry time. The `expires_at()` or `expires_after()` functions must be called to set an expiry time before the timer can be waited on.
  25962. [heading Parameters]
  25963. [variablelist
  25964. [[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. ]]
  25965. ]
  25966. [endsect]
  25967. [section:overload3 basic_waitable_timer::basic_waitable_timer (3 of 7 overloads)]
  25968. Constructor to set a particular expiry time as an absolute time.
  25969. basic_waitable_timer(
  25970. const executor_type & ex,
  25971. const time_point & expiry_time);
  25972. This constructor creates a timer and sets the expiry time.
  25973. [heading Parameters]
  25974. [variablelist
  25975. [[ex][The I/O executor object that the timer will use, by default, to dispatch handlers for any asynchronous operations performed on the timer.]]
  25976. [[expiry_time][The expiry time to be used for the timer, expressed as an absolute time. ]]
  25977. ]
  25978. [endsect]
  25979. [section:overload4 basic_waitable_timer::basic_waitable_timer (4 of 7 overloads)]
  25980. Constructor to set a particular expiry time as an absolute time.
  25981. template<
  25982. typename ExecutionContext>
  25983. basic_waitable_timer(
  25984. ExecutionContext & context,
  25985. const time_point & expiry_time,
  25986. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  25987. This constructor creates a timer and sets the expiry time.
  25988. [heading Parameters]
  25989. [variablelist
  25990. [[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.]]
  25991. [[expiry_time][The expiry time to be used for the timer, expressed as an absolute time. ]]
  25992. ]
  25993. [endsect]
  25994. [section:overload5 basic_waitable_timer::basic_waitable_timer (5 of 7 overloads)]
  25995. Constructor to set a particular expiry time relative to now.
  25996. basic_waitable_timer(
  25997. const executor_type & ex,
  25998. const duration & expiry_time);
  25999. This constructor creates a timer and sets the expiry time.
  26000. [heading Parameters]
  26001. [variablelist
  26002. [[ex][The I/O executor that the timer will use, by default, to dispatch handlers for any asynchronous operations performed on the timer.]]
  26003. [[expiry_time][The expiry time to be used for the timer, relative to now. ]]
  26004. ]
  26005. [endsect]
  26006. [section:overload6 basic_waitable_timer::basic_waitable_timer (6 of 7 overloads)]
  26007. Constructor to set a particular expiry time relative to now.
  26008. template<
  26009. typename ExecutionContext>
  26010. basic_waitable_timer(
  26011. ExecutionContext & context,
  26012. const duration & expiry_time,
  26013. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  26014. This constructor creates a timer and sets the expiry time.
  26015. [heading Parameters]
  26016. [variablelist
  26017. [[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.]]
  26018. [[expiry_time][The expiry time to be used for the timer, relative to now. ]]
  26019. ]
  26020. [endsect]
  26021. [section:overload7 basic_waitable_timer::basic_waitable_timer (7 of 7 overloads)]
  26022. Move-construct a [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] from another.
  26023. basic_waitable_timer(
  26024. basic_waitable_timer && other);
  26025. This constructor moves a timer from one object to another.
  26026. [heading Parameters]
  26027. [variablelist
  26028. [[other][The other [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] object from which the move will occur.]]
  26029. ]
  26030. [heading Remarks]
  26031. Following the move, the moved-from object is in the same state as if constructed using the `basic_waitable_timer(const executor_type&)` constructor.
  26032. [endsect]
  26033. [endsect]
  26034. [section:cancel basic_waitable_timer::cancel]
  26035. [indexterm2 boost_asio.indexterm.basic_waitable_timer.cancel..cancel..basic_waitable_timer]
  26036. Cancel any asynchronous operations that are waiting on the timer.
  26037. std::size_t ``[link boost_asio.reference.basic_waitable_timer.cancel.overload1 cancel]``();
  26038. `` [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.cancel.overload1 more...]]``
  26039. (Deprecated: Use non-error\_code overload.) Cancel any asynchronous operations that are waiting on the timer.
  26040. std::size_t ``[link boost_asio.reference.basic_waitable_timer.cancel.overload2 cancel]``(
  26041. boost::system::error_code & ec);
  26042. `` [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.cancel.overload2 more...]]``
  26043. [section:overload1 basic_waitable_timer::cancel (1 of 2 overloads)]
  26044. Cancel any asynchronous operations that are waiting on the timer.
  26045. std::size_t cancel();
  26046. This function forces the completion of any pending asynchronous wait operations against the timer. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
  26047. Cancelling the timer does not change the expiry time.
  26048. [heading Return Value]
  26049. The number of asynchronous operations that were cancelled.
  26050. [heading Exceptions]
  26051. [variablelist
  26052. [[boost::system::system_error][Thrown on failure.]]
  26053. ]
  26054. [heading Remarks]
  26055. If the timer has already expired when `cancel()` is called, then the handlers for asynchronous wait operations will:
  26056. * have already been invoked; or
  26057. * have been queued for invocation in the near future.
  26058. These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation.
  26059. [endsect]
  26060. [section:overload2 basic_waitable_timer::cancel (2 of 2 overloads)]
  26061. (Deprecated: Use non-error\_code overload.) Cancel any asynchronous operations that are waiting on the timer.
  26062. std::size_t cancel(
  26063. boost::system::error_code & ec);
  26064. This function forces the completion of any pending asynchronous wait operations against the timer. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
  26065. Cancelling the timer does not change the expiry time.
  26066. [heading Parameters]
  26067. [variablelist
  26068. [[ec][Set to indicate what error occurred, if any.]]
  26069. ]
  26070. [heading Return Value]
  26071. The number of asynchronous operations that were cancelled.
  26072. [heading Remarks]
  26073. If the timer has already expired when `cancel()` is called, then the handlers for asynchronous wait operations will:
  26074. * have already been invoked; or
  26075. * have been queued for invocation in the near future.
  26076. These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation.
  26077. [endsect]
  26078. [endsect]
  26079. [section:cancel_one basic_waitable_timer::cancel_one]
  26080. [indexterm2 boost_asio.indexterm.basic_waitable_timer.cancel_one..cancel_one..basic_waitable_timer]
  26081. Cancels one asynchronous operation that is waiting on the timer.
  26082. std::size_t ``[link boost_asio.reference.basic_waitable_timer.cancel_one.overload1 cancel_one]``();
  26083. `` [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.cancel_one.overload1 more...]]``
  26084. (Deprecated: Use non-error\_code overload.) Cancels one asynchronous operation that is waiting on the timer.
  26085. std::size_t ``[link boost_asio.reference.basic_waitable_timer.cancel_one.overload2 cancel_one]``(
  26086. boost::system::error_code & ec);
  26087. `` [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.cancel_one.overload2 more...]]``
  26088. [section:overload1 basic_waitable_timer::cancel_one (1 of 2 overloads)]
  26089. Cancels one asynchronous operation that is waiting on the timer.
  26090. std::size_t cancel_one();
  26091. This function forces the completion of one pending asynchronous wait operation against the timer. Handlers are cancelled in FIFO order. The handler for the cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
  26092. Cancelling the timer does not change the expiry time.
  26093. [heading Return Value]
  26094. The number of asynchronous operations that were cancelled. That is, either 0 or 1.
  26095. [heading Exceptions]
  26096. [variablelist
  26097. [[boost::system::system_error][Thrown on failure.]]
  26098. ]
  26099. [heading Remarks]
  26100. If the timer has already expired when `cancel_one()` is called, then the handlers for asynchronous wait operations will:
  26101. * have already been invoked; or
  26102. * have been queued for invocation in the near future.
  26103. These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation.
  26104. [endsect]
  26105. [section:overload2 basic_waitable_timer::cancel_one (2 of 2 overloads)]
  26106. (Deprecated: Use non-error\_code overload.) Cancels one asynchronous operation that is waiting on the timer.
  26107. std::size_t cancel_one(
  26108. boost::system::error_code & ec);
  26109. This function forces the completion of one pending asynchronous wait operation against the timer. Handlers are cancelled in FIFO order. The handler for the cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
  26110. Cancelling the timer does not change the expiry time.
  26111. [heading Parameters]
  26112. [variablelist
  26113. [[ec][Set to indicate what error occurred, if any.]]
  26114. ]
  26115. [heading Return Value]
  26116. The number of asynchronous operations that were cancelled. That is, either 0 or 1.
  26117. [heading Remarks]
  26118. If the timer has already expired when `cancel_one()` is called, then the handlers for asynchronous wait operations will:
  26119. * have already been invoked; or
  26120. * have been queued for invocation in the near future.
  26121. These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation.
  26122. [endsect]
  26123. [endsect]
  26124. [section:clock_type basic_waitable_timer::clock_type]
  26125. [indexterm2 boost_asio.indexterm.basic_waitable_timer.clock_type..clock_type..basic_waitable_timer]
  26126. The clock type.
  26127. typedef Clock clock_type;
  26128. [heading Requirements]
  26129. ['Header: ][^boost/asio/basic_waitable_timer.hpp]
  26130. ['Convenience header: ][^boost/asio.hpp]
  26131. [endsect]
  26132. [section:duration basic_waitable_timer::duration]
  26133. [indexterm2 boost_asio.indexterm.basic_waitable_timer.duration..duration..basic_waitable_timer]
  26134. The duration type of the clock.
  26135. typedef clock_type::duration duration;
  26136. [heading Requirements]
  26137. ['Header: ][^boost/asio/basic_waitable_timer.hpp]
  26138. ['Convenience header: ][^boost/asio.hpp]
  26139. [endsect]
  26140. [section:executor_type basic_waitable_timer::executor_type]
  26141. [indexterm2 boost_asio.indexterm.basic_waitable_timer.executor_type..executor_type..basic_waitable_timer]
  26142. The type of the executor associated with the object.
  26143. typedef Executor executor_type;
  26144. [heading Requirements]
  26145. ['Header: ][^boost/asio/basic_waitable_timer.hpp]
  26146. ['Convenience header: ][^boost/asio.hpp]
  26147. [endsect]
  26148. [section:expires_after basic_waitable_timer::expires_after]
  26149. [indexterm2 boost_asio.indexterm.basic_waitable_timer.expires_after..expires_after..basic_waitable_timer]
  26150. Set the timer's expiry time relative to now.
  26151. std::size_t expires_after(
  26152. const duration & expiry_time);
  26153. This function sets the expiry time. Any pending asynchronous wait operations will be cancelled. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
  26154. [heading Parameters]
  26155. [variablelist
  26156. [[expiry_time][The expiry time to be used for the timer.]]
  26157. ]
  26158. [heading Return Value]
  26159. The number of asynchronous operations that were cancelled.
  26160. [heading Exceptions]
  26161. [variablelist
  26162. [[boost::system::system_error][Thrown on failure.]]
  26163. ]
  26164. [heading Remarks]
  26165. If the timer has already expired when `expires_after()` is called, then the handlers for asynchronous wait operations will:
  26166. * have already been invoked; or
  26167. * have been queued for invocation in the near future.
  26168. These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation.
  26169. [endsect]
  26170. [section:expires_at basic_waitable_timer::expires_at]
  26171. [indexterm2 boost_asio.indexterm.basic_waitable_timer.expires_at..expires_at..basic_waitable_timer]
  26172. (Deprecated: Use `expiry()`.) Get the timer's expiry time as an absolute time.
  26173. time_point ``[link boost_asio.reference.basic_waitable_timer.expires_at.overload1 expires_at]``() const;
  26174. `` [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.expires_at.overload1 more...]]``
  26175. Set the timer's expiry time as an absolute time.
  26176. std::size_t ``[link boost_asio.reference.basic_waitable_timer.expires_at.overload2 expires_at]``(
  26177. const time_point & expiry_time);
  26178. `` [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.expires_at.overload2 more...]]``
  26179. (Deprecated: Use non-error\_code overload.) Set the timer's expiry time as an absolute time.
  26180. std::size_t ``[link boost_asio.reference.basic_waitable_timer.expires_at.overload3 expires_at]``(
  26181. const time_point & expiry_time,
  26182. boost::system::error_code & ec);
  26183. `` [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.expires_at.overload3 more...]]``
  26184. [section:overload1 basic_waitable_timer::expires_at (1 of 3 overloads)]
  26185. (Deprecated: Use `expiry()`.) Get the timer's expiry time as an absolute time.
  26186. time_point expires_at() const;
  26187. This function may be used to obtain the timer's current expiry time. Whether the timer has expired or not does not affect this value.
  26188. [endsect]
  26189. [section:overload2 basic_waitable_timer::expires_at (2 of 3 overloads)]
  26190. Set the timer's expiry time as an absolute time.
  26191. std::size_t expires_at(
  26192. const time_point & expiry_time);
  26193. This function sets the expiry time. Any pending asynchronous wait operations will be cancelled. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
  26194. [heading Parameters]
  26195. [variablelist
  26196. [[expiry_time][The expiry time to be used for the timer.]]
  26197. ]
  26198. [heading Return Value]
  26199. The number of asynchronous operations that were cancelled.
  26200. [heading Exceptions]
  26201. [variablelist
  26202. [[boost::system::system_error][Thrown on failure.]]
  26203. ]
  26204. [heading Remarks]
  26205. If the timer has already expired when `expires_at()` is called, then the handlers for asynchronous wait operations will:
  26206. * have already been invoked; or
  26207. * have been queued for invocation in the near future.
  26208. These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation.
  26209. [endsect]
  26210. [section:overload3 basic_waitable_timer::expires_at (3 of 3 overloads)]
  26211. (Deprecated: Use non-error\_code overload.) Set the timer's expiry time as an absolute time.
  26212. std::size_t expires_at(
  26213. const time_point & expiry_time,
  26214. boost::system::error_code & ec);
  26215. This function sets the expiry time. Any pending asynchronous wait operations will be cancelled. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
  26216. [heading Parameters]
  26217. [variablelist
  26218. [[expiry_time][The expiry time to be used for the timer.]]
  26219. [[ec][Set to indicate what error occurred, if any.]]
  26220. ]
  26221. [heading Return Value]
  26222. The number of asynchronous operations that were cancelled.
  26223. [heading Remarks]
  26224. If the timer has already expired when `expires_at()` is called, then the handlers for asynchronous wait operations will:
  26225. * have already been invoked; or
  26226. * have been queued for invocation in the near future.
  26227. These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation.
  26228. [endsect]
  26229. [endsect]
  26230. [section:expires_from_now basic_waitable_timer::expires_from_now]
  26231. [indexterm2 boost_asio.indexterm.basic_waitable_timer.expires_from_now..expires_from_now..basic_waitable_timer]
  26232. (Deprecated: Use `expiry()`.) Get the timer's expiry time relative to now.
  26233. duration ``[link boost_asio.reference.basic_waitable_timer.expires_from_now.overload1 expires_from_now]``() const;
  26234. `` [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.expires_from_now.overload1 more...]]``
  26235. (Deprecated: Use `expires_after()`.) Set the timer's expiry time relative to now.
  26236. std::size_t ``[link boost_asio.reference.basic_waitable_timer.expires_from_now.overload2 expires_from_now]``(
  26237. const duration & expiry_time);
  26238. `` [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.expires_from_now.overload2 more...]]``
  26239. std::size_t ``[link boost_asio.reference.basic_waitable_timer.expires_from_now.overload3 expires_from_now]``(
  26240. const duration & expiry_time,
  26241. boost::system::error_code & ec);
  26242. `` [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.expires_from_now.overload3 more...]]``
  26243. [section:overload1 basic_waitable_timer::expires_from_now (1 of 3 overloads)]
  26244. (Deprecated: Use `expiry()`.) Get the timer's expiry time relative to now.
  26245. duration expires_from_now() const;
  26246. This function may be used to obtain the timer's current expiry time. Whether the timer has expired or not does not affect this value.
  26247. [endsect]
  26248. [section:overload2 basic_waitable_timer::expires_from_now (2 of 3 overloads)]
  26249. (Deprecated: Use `expires_after()`.) Set the timer's expiry time relative to now.
  26250. std::size_t expires_from_now(
  26251. const duration & expiry_time);
  26252. This function sets the expiry time. Any pending asynchronous wait operations will be cancelled. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
  26253. [heading Parameters]
  26254. [variablelist
  26255. [[expiry_time][The expiry time to be used for the timer.]]
  26256. ]
  26257. [heading Return Value]
  26258. The number of asynchronous operations that were cancelled.
  26259. [heading Exceptions]
  26260. [variablelist
  26261. [[boost::system::system_error][Thrown on failure.]]
  26262. ]
  26263. [heading Remarks]
  26264. If the timer has already expired when `expires_from_now()` is called, then the handlers for asynchronous wait operations will:
  26265. * have already been invoked; or
  26266. * have been queued for invocation in the near future.
  26267. These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation.
  26268. [endsect]
  26269. [section:overload3 basic_waitable_timer::expires_from_now (3 of 3 overloads)]
  26270. (Deprecated: Use `expires_after()`.) Set the timer's expiry time relative to now.
  26271. std::size_t expires_from_now(
  26272. const duration & expiry_time,
  26273. boost::system::error_code & ec);
  26274. This function sets the expiry time. Any pending asynchronous wait operations will be cancelled. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
  26275. [heading Parameters]
  26276. [variablelist
  26277. [[expiry_time][The expiry time to be used for the timer.]]
  26278. [[ec][Set to indicate what error occurred, if any.]]
  26279. ]
  26280. [heading Return Value]
  26281. The number of asynchronous operations that were cancelled.
  26282. [heading Remarks]
  26283. If the timer has already expired when `expires_from_now()` is called, then the handlers for asynchronous wait operations will:
  26284. * have already been invoked; or
  26285. * have been queued for invocation in the near future.
  26286. These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation.
  26287. [endsect]
  26288. [endsect]
  26289. [section:expiry basic_waitable_timer::expiry]
  26290. [indexterm2 boost_asio.indexterm.basic_waitable_timer.expiry..expiry..basic_waitable_timer]
  26291. Get the timer's expiry time as an absolute time.
  26292. time_point expiry() const;
  26293. This function may be used to obtain the timer's current expiry time. Whether the timer has expired or not does not affect this value.
  26294. [endsect]
  26295. [section:get_executor basic_waitable_timer::get_executor]
  26296. [indexterm2 boost_asio.indexterm.basic_waitable_timer.get_executor..get_executor..basic_waitable_timer]
  26297. Get the executor associated with the object.
  26298. executor_type get_executor();
  26299. [endsect]
  26300. [section:operator_eq_ basic_waitable_timer::operator=]
  26301. [indexterm2 boost_asio.indexterm.basic_waitable_timer.operator_eq_..operator=..basic_waitable_timer]
  26302. Move-assign a [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] from another.
  26303. basic_waitable_timer & operator=(
  26304. basic_waitable_timer && other);
  26305. This assignment operator moves a timer from one object to another. Cancels any outstanding asynchronous operations associated with the target object.
  26306. [heading Parameters]
  26307. [variablelist
  26308. [[other][The other [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] object from which the move will occur.]]
  26309. ]
  26310. [heading Remarks]
  26311. Following the move, the moved-from object is in the same state as if constructed using the `basic_waitable_timer(const executor_type&)` constructor.
  26312. [endsect]
  26313. [section:time_point basic_waitable_timer::time_point]
  26314. [indexterm2 boost_asio.indexterm.basic_waitable_timer.time_point..time_point..basic_waitable_timer]
  26315. The time point type of the clock.
  26316. typedef clock_type::time_point time_point;
  26317. [heading Requirements]
  26318. ['Header: ][^boost/asio/basic_waitable_timer.hpp]
  26319. ['Convenience header: ][^boost/asio.hpp]
  26320. [endsect]
  26321. [section:traits_type basic_waitable_timer::traits_type]
  26322. [indexterm2 boost_asio.indexterm.basic_waitable_timer.traits_type..traits_type..basic_waitable_timer]
  26323. The wait traits type.
  26324. typedef WaitTraits traits_type;
  26325. [heading Requirements]
  26326. ['Header: ][^boost/asio/basic_waitable_timer.hpp]
  26327. ['Convenience header: ][^boost/asio.hpp]
  26328. [endsect]
  26329. [section:wait basic_waitable_timer::wait]
  26330. [indexterm2 boost_asio.indexterm.basic_waitable_timer.wait..wait..basic_waitable_timer]
  26331. Perform a blocking wait on the timer.
  26332. void ``[link boost_asio.reference.basic_waitable_timer.wait.overload1 wait]``();
  26333. `` [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.wait.overload1 more...]]``
  26334. void ``[link boost_asio.reference.basic_waitable_timer.wait.overload2 wait]``(
  26335. boost::system::error_code & ec);
  26336. `` [''''&raquo;''' [link boost_asio.reference.basic_waitable_timer.wait.overload2 more...]]``
  26337. [section:overload1 basic_waitable_timer::wait (1 of 2 overloads)]
  26338. Perform a blocking wait on the timer.
  26339. void wait();
  26340. This function is used to wait for the timer to expire. This function blocks and does not return until the timer has expired.
  26341. [heading Exceptions]
  26342. [variablelist
  26343. [[boost::system::system_error][Thrown on failure. ]]
  26344. ]
  26345. [endsect]
  26346. [section:overload2 basic_waitable_timer::wait (2 of 2 overloads)]
  26347. Perform a blocking wait on the timer.
  26348. void wait(
  26349. boost::system::error_code & ec);
  26350. This function is used to wait for the timer to expire. This function blocks and does not return until the timer has expired.
  26351. [heading Parameters]
  26352. [variablelist
  26353. [[ec][Set to indicate what error occurred, if any. ]]
  26354. ]
  26355. [endsect]
  26356. [endsect]
  26357. [section:_basic_waitable_timer basic_waitable_timer::~basic_waitable_timer]
  26358. [indexterm2 boost_asio.indexterm.basic_waitable_timer._basic_waitable_timer..~basic_waitable_timer..basic_waitable_timer]
  26359. Destroys the timer.
  26360. ~basic_waitable_timer();
  26361. This function destroys the timer, cancelling any outstanding asynchronous wait operations associated with the timer as if by calling `cancel`.
  26362. [endsect]
  26363. [endsect]
  26364. [section:basic_waitable_timer__rebind_executor basic_waitable_timer::rebind_executor]
  26365. Rebinds the timer type to another executor.
  26366. template<
  26367. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  26368. struct rebind_executor
  26369. [heading Types]
  26370. [table
  26371. [[Name][Description]]
  26372. [
  26373. [[link boost_asio.reference.basic_waitable_timer__rebind_executor.other [*other]]]
  26374. [The timer type when rebound to the specified executor. ]
  26375. ]
  26376. ]
  26377. [heading Requirements]
  26378. ['Header: ][^boost/asio/basic_waitable_timer.hpp]
  26379. ['Convenience header: ][^boost/asio.hpp]
  26380. [section:other basic_waitable_timer::rebind_executor::other]
  26381. [indexterm2 boost_asio.indexterm.basic_waitable_timer__rebind_executor.other..other..basic_waitable_timer::rebind_executor]
  26382. The timer type when rebound to the specified executor.
  26383. typedef basic_waitable_timer< Clock, WaitTraits, Executor1 > other;
  26384. [heading Types]
  26385. [table
  26386. [[Name][Description]]
  26387. [
  26388. [[link boost_asio.reference.basic_waitable_timer__rebind_executor [*rebind_executor]]]
  26389. [Rebinds the timer type to another executor. ]
  26390. ]
  26391. [
  26392. [[link boost_asio.reference.basic_waitable_timer.clock_type [*clock_type]]]
  26393. [The clock type. ]
  26394. ]
  26395. [
  26396. [[link boost_asio.reference.basic_waitable_timer.duration [*duration]]]
  26397. [The duration type of the clock. ]
  26398. ]
  26399. [
  26400. [[link boost_asio.reference.basic_waitable_timer.executor_type [*executor_type]]]
  26401. [The type of the executor associated with the object. ]
  26402. ]
  26403. [
  26404. [[link boost_asio.reference.basic_waitable_timer.time_point [*time_point]]]
  26405. [The time point type of the clock. ]
  26406. ]
  26407. [
  26408. [[link boost_asio.reference.basic_waitable_timer.traits_type [*traits_type]]]
  26409. [The wait traits type. ]
  26410. ]
  26411. ]
  26412. [heading Member Functions]
  26413. [table
  26414. [[Name][Description]]
  26415. [
  26416. [[link boost_asio.reference.basic_waitable_timer.async_wait [*async_wait]]]
  26417. [Start an asynchronous wait on the timer. ]
  26418. ]
  26419. [
  26420. [[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer [*basic_waitable_timer]]]
  26421. [Constructor.
  26422. [hr]
  26423. Constructor to set a particular expiry time as an absolute time.
  26424. [hr]
  26425. Constructor to set a particular expiry time relative to now.
  26426. [hr]
  26427. Move-construct a basic_waitable_timer from another. ]
  26428. ]
  26429. [
  26430. [[link boost_asio.reference.basic_waitable_timer.cancel [*cancel]]]
  26431. [Cancel any asynchronous operations that are waiting on the timer.
  26432. [hr]
  26433. (Deprecated: Use non-error_code overload.) Cancel any asynchronous operations that are waiting on the timer. ]
  26434. ]
  26435. [
  26436. [[link boost_asio.reference.basic_waitable_timer.cancel_one [*cancel_one]]]
  26437. [Cancels one asynchronous operation that is waiting on the timer.
  26438. [hr]
  26439. (Deprecated: Use non-error_code overload.) Cancels one asynchronous operation that is waiting on the timer. ]
  26440. ]
  26441. [
  26442. [[link boost_asio.reference.basic_waitable_timer.expires_after [*expires_after]]]
  26443. [Set the timer's expiry time relative to now. ]
  26444. ]
  26445. [
  26446. [[link boost_asio.reference.basic_waitable_timer.expires_at [*expires_at]]]
  26447. [(Deprecated: Use expiry().) Get the timer's expiry time as an absolute time.
  26448. [hr]
  26449. Set the timer's expiry time as an absolute time.
  26450. [hr]
  26451. (Deprecated: Use non-error_code overload.) Set the timer's expiry time as an absolute time. ]
  26452. ]
  26453. [
  26454. [[link boost_asio.reference.basic_waitable_timer.expires_from_now [*expires_from_now]]]
  26455. [(Deprecated: Use expiry().) Get the timer's expiry time relative to now.
  26456. [hr]
  26457. (Deprecated: Use expires_after().) Set the timer's expiry time relative to now. ]
  26458. ]
  26459. [
  26460. [[link boost_asio.reference.basic_waitable_timer.expiry [*expiry]]]
  26461. [Get the timer's expiry time as an absolute time. ]
  26462. ]
  26463. [
  26464. [[link boost_asio.reference.basic_waitable_timer.get_executor [*get_executor]]]
  26465. [Get the executor associated with the object. ]
  26466. ]
  26467. [
  26468. [[link boost_asio.reference.basic_waitable_timer.operator_eq_ [*operator=]]]
  26469. [Move-assign a basic_waitable_timer from another. ]
  26470. ]
  26471. [
  26472. [[link boost_asio.reference.basic_waitable_timer.wait [*wait]]]
  26473. [Perform a blocking wait on the timer. ]
  26474. ]
  26475. [
  26476. [[link boost_asio.reference.basic_waitable_timer._basic_waitable_timer [*~basic_waitable_timer]]]
  26477. [Destroys the timer. ]
  26478. ]
  26479. ]
  26480. The [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] class template provides the ability to perform a blocking or asynchronous wait for a timer to expire.
  26481. A waitable timer is always in one of two states: "expired" or "not expired". If the `wait()` or `async_wait()` function is called on an expired timer, the wait operation will complete immediately.
  26482. Most applications will use one of the [link boost_asio.reference.steady_timer `steady_timer`], [link boost_asio.reference.system_timer `system_timer`] or [link boost_asio.reference.high_resolution_timer `high_resolution_timer`] typedefs.
  26483. [heading Remarks]
  26484. This waitable timer functionality is for use with the C++11 standard library's `<chrono>` facility, or with the Boost.Chrono library.
  26485. [heading Thread Safety]
  26486. ['Distinct] ['objects:] Safe.
  26487. ['Shared] ['objects:] Unsafe.
  26488. [heading Examples]
  26489. Performing a blocking wait (C++11):
  26490. // Construct a timer without setting an expiry time.
  26491. boost::asio::steady_timer timer(my_context);
  26492. // Set an expiry time relative to now.
  26493. timer.expires_after(std::chrono::seconds(5));
  26494. // Wait for the timer to expire.
  26495. timer.wait();
  26496. Performing an asynchronous wait (C++11):
  26497. void handler(const boost::system::error_code& error)
  26498. {
  26499. if (!error)
  26500. {
  26501. // Timer expired.
  26502. }
  26503. }
  26504. ...
  26505. // Construct a timer with an absolute expiry time.
  26506. boost::asio::steady_timer timer(my_context,
  26507. std::chrono::steady_clock::now() + std::chrono::seconds(60));
  26508. // Start an asynchronous wait.
  26509. timer.async_wait(handler);
  26510. [heading Changing an active waitable timer's expiry time]
  26511. Changing the expiry time of a timer while there are pending asynchronous waits causes those wait operations to be cancelled. To ensure that the action associated with the timer is performed only once, use something like this: used:
  26512. void on_some_event()
  26513. {
  26514. if (my_timer.expires_after(seconds(5)) > 0)
  26515. {
  26516. // We managed to cancel the timer. Start new asynchronous wait.
  26517. my_timer.async_wait(on_timeout);
  26518. }
  26519. else
  26520. {
  26521. // Too late, timer has already expired!
  26522. }
  26523. }
  26524. void on_timeout(const boost::system::error_code& e)
  26525. {
  26526. if (e != boost::asio::error::operation_aborted)
  26527. {
  26528. // Timer was not cancelled, take necessary action.
  26529. }
  26530. }
  26531. * 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.
  26532. * If a wait handler is cancelled, the boost::system::error\_code passed to it contains the value `boost::asio::error::operation_aborted`.
  26533. [heading Requirements]
  26534. ['Header: ][^boost/asio/basic_waitable_timer.hpp]
  26535. ['Convenience header: ][^boost/asio.hpp]
  26536. [endsect]
  26537. [endsect]
  26538. [section:basic_yield_context basic_yield_context]
  26539. Context object the represents the currently executing coroutine.
  26540. template<
  26541. typename ``[link boost_asio.reference.Handler Handler]``>
  26542. class basic_yield_context
  26543. [heading Types]
  26544. [table
  26545. [[Name][Description]]
  26546. [
  26547. [[link boost_asio.reference.basic_yield_context.callee_type [*callee_type]]]
  26548. [The coroutine callee type, used by the implementation. ]
  26549. ]
  26550. [
  26551. [[link boost_asio.reference.basic_yield_context.caller_type [*caller_type]]]
  26552. [The coroutine caller type, used by the implementation. ]
  26553. ]
  26554. ]
  26555. [heading Member Functions]
  26556. [table
  26557. [[Name][Description]]
  26558. [
  26559. [[link boost_asio.reference.basic_yield_context.basic_yield_context [*basic_yield_context]]]
  26560. [Construct a yield context to represent the specified coroutine.
  26561. [hr]
  26562. Construct a yield context from another yield context type. ]
  26563. ]
  26564. [
  26565. [[link boost_asio.reference.basic_yield_context.operator_lb__rb_ [*operator\[\]]]]
  26566. [Return a yield context that sets the specified error_code. ]
  26567. ]
  26568. ]
  26569. The [link boost_asio.reference.basic_yield_context `basic_yield_context`] class is used to represent the currently executing stackful coroutine. A [link boost_asio.reference.basic_yield_context `basic_yield_context`] may be passed as a handler to an asynchronous operation. For example:
  26570. template <typename Handler>
  26571. void my_coroutine(basic_yield_context<Handler> yield)
  26572. {
  26573. ...
  26574. std::size_t n = my_socket.async_read_some(buffer, yield);
  26575. ...
  26576. }
  26577. 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.
  26578. [heading Requirements]
  26579. ['Header: ][^boost/asio/spawn.hpp]
  26580. ['Convenience header: ]None
  26581. [section:basic_yield_context basic_yield_context::basic_yield_context]
  26582. [indexterm2 boost_asio.indexterm.basic_yield_context.basic_yield_context..basic_yield_context..basic_yield_context]
  26583. Construct a yield context to represent the specified coroutine.
  26584. ``[link boost_asio.reference.basic_yield_context.basic_yield_context.overload1 basic_yield_context]``(
  26585. const detail::weak_ptr< callee_type > & coro,
  26586. caller_type & ca,
  26587. Handler & handler);
  26588. `` [''''&raquo;''' [link boost_asio.reference.basic_yield_context.basic_yield_context.overload1 more...]]``
  26589. Construct a yield context from another yield context type.
  26590. template<
  26591. typename OtherHandler>
  26592. ``[link boost_asio.reference.basic_yield_context.basic_yield_context.overload2 basic_yield_context]``(
  26593. const basic_yield_context< OtherHandler > & other);
  26594. `` [''''&raquo;''' [link boost_asio.reference.basic_yield_context.basic_yield_context.overload2 more...]]``
  26595. [section:overload1 basic_yield_context::basic_yield_context (1 of 2 overloads)]
  26596. Construct a yield context to represent the specified coroutine.
  26597. basic_yield_context(
  26598. const detail::weak_ptr< callee_type > & coro,
  26599. caller_type & ca,
  26600. Handler & handler);
  26601. Most applications do not need to use this constructor. Instead, the `spawn()` function passes a yield context as an argument to the coroutine function.
  26602. [endsect]
  26603. [section:overload2 basic_yield_context::basic_yield_context (2 of 2 overloads)]
  26604. Construct a yield context from another yield context type.
  26605. template<
  26606. typename OtherHandler>
  26607. basic_yield_context(
  26608. const basic_yield_context< OtherHandler > & other);
  26609. Requires that OtherHandler be convertible to Handler.
  26610. [endsect]
  26611. [endsect]
  26612. [section:callee_type basic_yield_context::callee_type]
  26613. [indexterm2 boost_asio.indexterm.basic_yield_context.callee_type..callee_type..basic_yield_context]
  26614. The coroutine callee type, used by the implementation.
  26615. typedef implementation_defined callee_type;
  26616. When using Boost.Coroutine v1, this type is:
  26617. typename coroutine<void()>
  26618. When using Boost.Coroutine v2 (unidirectional coroutines), this type is:
  26619. push_coroutine<void>
  26620. [heading Requirements]
  26621. ['Header: ][^boost/asio/spawn.hpp]
  26622. ['Convenience header: ]None
  26623. [endsect]
  26624. [section:caller_type basic_yield_context::caller_type]
  26625. [indexterm2 boost_asio.indexterm.basic_yield_context.caller_type..caller_type..basic_yield_context]
  26626. The coroutine caller type, used by the implementation.
  26627. typedef implementation_defined caller_type;
  26628. When using Boost.Coroutine v1, this type is:
  26629. typename coroutine<void()>::caller_type
  26630. When using Boost.Coroutine v2 (unidirectional coroutines), this type is:
  26631. pull_coroutine<void>
  26632. [heading Requirements]
  26633. ['Header: ][^boost/asio/spawn.hpp]
  26634. ['Convenience header: ]None
  26635. [endsect]
  26636. [section:operator_lb__rb_ basic_yield_context::operator\[\]]
  26637. [indexterm2 boost_asio.indexterm.basic_yield_context.operator_lb__rb_..operator\[\]..basic_yield_context]
  26638. Return a yield context that sets the specified error\_code.
  26639. basic_yield_context operator[](
  26640. boost::system::error_code & ec) const;
  26641. By default, when a yield context is used with an asynchronous operation, a non-success error\_code is converted to system\_error and thrown. This operator may be used to specify an error\_code object that should instead be set with the asynchronous operation's result. For example:
  26642. template <typename Handler>
  26643. void my_coroutine(basic_yield_context<Handler> yield)
  26644. {
  26645. ...
  26646. std::size_t n = my_socket.async_read_some(buffer, yield[ec]);
  26647. if (ec)
  26648. {
  26649. // An error occurred.
  26650. }
  26651. ...
  26652. }
  26653. [endsect]
  26654. [endsect]
  26655. [section:bind_executor bind_executor]
  26656. [indexterm1 boost_asio.indexterm.bind_executor..bind_executor]
  26657. Associate an object of type `T` with an executor of type `Executor`.
  26658. template<
  26659. typename ``[link boost_asio.reference.Executor1 Executor]``,
  26660. typename T>
  26661. executor_binder< typename decay< T >::type, Executor > ``[link boost_asio.reference.bind_executor.overload1 bind_executor]``(
  26662. const Executor & ex,
  26663. T && t,
  26664. typename enable_if< is_executor< Executor >::value >::type * = 0);
  26665. `` [''''&raquo;''' [link boost_asio.reference.bind_executor.overload1 more...]]``
  26666. Associate an object of type `T` with an execution context's executor.
  26667. template<
  26668. typename ExecutionContext,
  26669. typename T>
  26670. executor_binder< typename decay< T >::type, typename ExecutionContext::executor_type > ``[link boost_asio.reference.bind_executor.overload2 bind_executor]``(
  26671. ExecutionContext & ctx,
  26672. T && t,
  26673. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  26674. `` [''''&raquo;''' [link boost_asio.reference.bind_executor.overload2 more...]]``
  26675. [heading Requirements]
  26676. ['Header: ][^boost/asio/bind_executor.hpp]
  26677. ['Convenience header: ][^boost/asio.hpp]
  26678. [section:overload1 bind_executor (1 of 2 overloads)]
  26679. Associate an object of type `T` with an executor of type `Executor`.
  26680. template<
  26681. typename ``[link boost_asio.reference.Executor1 Executor]``,
  26682. typename T>
  26683. executor_binder< typename decay< T >::type, Executor > bind_executor(
  26684. const Executor & ex,
  26685. T && t,
  26686. typename enable_if< is_executor< Executor >::value >::type * = 0);
  26687. [endsect]
  26688. [section:overload2 bind_executor (2 of 2 overloads)]
  26689. Associate an object of type `T` with an execution context's executor.
  26690. template<
  26691. typename ExecutionContext,
  26692. typename T>
  26693. executor_binder< typename decay< T >::type, typename ExecutionContext::executor_type > bind_executor(
  26694. ExecutionContext & ctx,
  26695. T && t,
  26696. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  26697. [endsect]
  26698. [endsect]
  26699. [section:buffer buffer]
  26700. [indexterm1 boost_asio.indexterm.buffer..buffer]
  26701. The `boost::asio::buffer` function is used to create a buffer object to represent raw memory, an array of POD elements, a vector of POD elements, or a std::string.
  26702. Create a new modifiable buffer from an existing buffer.
  26703. mutable_buffer ``[link boost_asio.reference.buffer.overload1 buffer]``(
  26704. const mutable_buffer & b);
  26705. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload1 more...]]``
  26706. mutable_buffer ``[link boost_asio.reference.buffer.overload2 buffer]``(
  26707. const mutable_buffer & b,
  26708. std::size_t max_size_in_bytes);
  26709. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload2 more...]]``
  26710. Create a new non-modifiable buffer from an existing buffer.
  26711. const_buffer ``[link boost_asio.reference.buffer.overload3 buffer]``(
  26712. const const_buffer & b);
  26713. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload3 more...]]``
  26714. const_buffer ``[link boost_asio.reference.buffer.overload4 buffer]``(
  26715. const const_buffer & b,
  26716. std::size_t max_size_in_bytes);
  26717. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload4 more...]]``
  26718. Create a new modifiable buffer that represents the given memory range.
  26719. mutable_buffer ``[link boost_asio.reference.buffer.overload5 buffer]``(
  26720. void * data,
  26721. std::size_t size_in_bytes);
  26722. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload5 more...]]``
  26723. Create a new non-modifiable buffer that represents the given memory range.
  26724. const_buffer ``[link boost_asio.reference.buffer.overload6 buffer]``(
  26725. const void * data,
  26726. std::size_t size_in_bytes);
  26727. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload6 more...]]``
  26728. Create a new modifiable buffer that represents the given POD array.
  26729. template<
  26730. typename PodType,
  26731. std::size_t N>
  26732. mutable_buffer ``[link boost_asio.reference.buffer.overload7 buffer]``(
  26733. PodType (&data)[N]);
  26734. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload7 more...]]``
  26735. template<
  26736. typename PodType,
  26737. std::size_t N>
  26738. mutable_buffer ``[link boost_asio.reference.buffer.overload8 buffer]``(
  26739. PodType (&data)[N],
  26740. std::size_t max_size_in_bytes);
  26741. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload8 more...]]``
  26742. Create a new non-modifiable buffer that represents the given POD array.
  26743. template<
  26744. typename PodType,
  26745. std::size_t N>
  26746. const_buffer ``[link boost_asio.reference.buffer.overload9 buffer]``(
  26747. const PodType (&data)[N]);
  26748. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload9 more...]]``
  26749. template<
  26750. typename PodType,
  26751. std::size_t N>
  26752. const_buffer ``[link boost_asio.reference.buffer.overload10 buffer]``(
  26753. const PodType (&data)[N],
  26754. std::size_t max_size_in_bytes);
  26755. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload10 more...]]``
  26756. Create a new modifiable buffer that represents the given POD array.
  26757. template<
  26758. typename PodType,
  26759. std::size_t N>
  26760. mutable_buffer ``[link boost_asio.reference.buffer.overload11 buffer]``(
  26761. boost::array< PodType, N > & data);
  26762. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload11 more...]]``
  26763. template<
  26764. typename PodType,
  26765. std::size_t N>
  26766. mutable_buffer ``[link boost_asio.reference.buffer.overload12 buffer]``(
  26767. boost::array< PodType, N > & data,
  26768. std::size_t max_size_in_bytes);
  26769. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload12 more...]]``
  26770. Create a new non-modifiable buffer that represents the given POD array.
  26771. template<
  26772. typename PodType,
  26773. std::size_t N>
  26774. const_buffer ``[link boost_asio.reference.buffer.overload13 buffer]``(
  26775. boost::array< const PodType, N > & data);
  26776. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload13 more...]]``
  26777. template<
  26778. typename PodType,
  26779. std::size_t N>
  26780. const_buffer ``[link boost_asio.reference.buffer.overload14 buffer]``(
  26781. boost::array< const PodType, N > & data,
  26782. std::size_t max_size_in_bytes);
  26783. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload14 more...]]``
  26784. template<
  26785. typename PodType,
  26786. std::size_t N>
  26787. const_buffer ``[link boost_asio.reference.buffer.overload15 buffer]``(
  26788. const boost::array< PodType, N > & data);
  26789. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload15 more...]]``
  26790. template<
  26791. typename PodType,
  26792. std::size_t N>
  26793. const_buffer ``[link boost_asio.reference.buffer.overload16 buffer]``(
  26794. const boost::array< PodType, N > & data,
  26795. std::size_t max_size_in_bytes);
  26796. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload16 more...]]``
  26797. Create a new modifiable buffer that represents the given POD array.
  26798. template<
  26799. typename PodType,
  26800. std::size_t N>
  26801. mutable_buffer ``[link boost_asio.reference.buffer.overload17 buffer]``(
  26802. std::array< PodType, N > & data);
  26803. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload17 more...]]``
  26804. template<
  26805. typename PodType,
  26806. std::size_t N>
  26807. mutable_buffer ``[link boost_asio.reference.buffer.overload18 buffer]``(
  26808. std::array< PodType, N > & data,
  26809. std::size_t max_size_in_bytes);
  26810. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload18 more...]]``
  26811. Create a new non-modifiable buffer that represents the given POD array.
  26812. template<
  26813. typename PodType,
  26814. std::size_t N>
  26815. const_buffer ``[link boost_asio.reference.buffer.overload19 buffer]``(
  26816. std::array< const PodType, N > & data);
  26817. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload19 more...]]``
  26818. template<
  26819. typename PodType,
  26820. std::size_t N>
  26821. const_buffer ``[link boost_asio.reference.buffer.overload20 buffer]``(
  26822. std::array< const PodType, N > & data,
  26823. std::size_t max_size_in_bytes);
  26824. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload20 more...]]``
  26825. template<
  26826. typename PodType,
  26827. std::size_t N>
  26828. const_buffer ``[link boost_asio.reference.buffer.overload21 buffer]``(
  26829. const std::array< PodType, N > & data);
  26830. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload21 more...]]``
  26831. template<
  26832. typename PodType,
  26833. std::size_t N>
  26834. const_buffer ``[link boost_asio.reference.buffer.overload22 buffer]``(
  26835. const std::array< PodType, N > & data,
  26836. std::size_t max_size_in_bytes);
  26837. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload22 more...]]``
  26838. Create a new modifiable buffer that represents the given POD vector.
  26839. template<
  26840. typename PodType,
  26841. typename Allocator>
  26842. mutable_buffer ``[link boost_asio.reference.buffer.overload23 buffer]``(
  26843. std::vector< PodType, Allocator > & data);
  26844. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload23 more...]]``
  26845. template<
  26846. typename PodType,
  26847. typename Allocator>
  26848. mutable_buffer ``[link boost_asio.reference.buffer.overload24 buffer]``(
  26849. std::vector< PodType, Allocator > & data,
  26850. std::size_t max_size_in_bytes);
  26851. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload24 more...]]``
  26852. Create a new non-modifiable buffer that represents the given POD vector.
  26853. template<
  26854. typename PodType,
  26855. typename Allocator>
  26856. const_buffer ``[link boost_asio.reference.buffer.overload25 buffer]``(
  26857. const std::vector< PodType, Allocator > & data);
  26858. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload25 more...]]``
  26859. template<
  26860. typename PodType,
  26861. typename Allocator>
  26862. const_buffer ``[link boost_asio.reference.buffer.overload26 buffer]``(
  26863. const std::vector< PodType, Allocator > & data,
  26864. std::size_t max_size_in_bytes);
  26865. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload26 more...]]``
  26866. Create a new modifiable buffer that represents the given string.
  26867. template<
  26868. typename Elem,
  26869. typename Traits,
  26870. typename Allocator>
  26871. mutable_buffer ``[link boost_asio.reference.buffer.overload27 buffer]``(
  26872. std::basic_string< Elem, Traits, Allocator > & data);
  26873. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload27 more...]]``
  26874. template<
  26875. typename Elem,
  26876. typename Traits,
  26877. typename Allocator>
  26878. mutable_buffer ``[link boost_asio.reference.buffer.overload28 buffer]``(
  26879. std::basic_string< Elem, Traits, Allocator > & data,
  26880. std::size_t max_size_in_bytes);
  26881. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload28 more...]]``
  26882. Create a new non-modifiable buffer that represents the given string.
  26883. template<
  26884. typename Elem,
  26885. typename Traits,
  26886. typename Allocator>
  26887. const_buffer ``[link boost_asio.reference.buffer.overload29 buffer]``(
  26888. const std::basic_string< Elem, Traits, Allocator > & data);
  26889. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload29 more...]]``
  26890. template<
  26891. typename Elem,
  26892. typename Traits,
  26893. typename Allocator>
  26894. const_buffer ``[link boost_asio.reference.buffer.overload30 buffer]``(
  26895. const std::basic_string< Elem, Traits, Allocator > & data,
  26896. std::size_t max_size_in_bytes);
  26897. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload30 more...]]``
  26898. Create a new modifiable buffer that represents the given string\_view.
  26899. template<
  26900. typename Elem,
  26901. typename Traits>
  26902. const_buffer ``[link boost_asio.reference.buffer.overload31 buffer]``(
  26903. basic_string_view< Elem, Traits > data);
  26904. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload31 more...]]``
  26905. Create a new non-modifiable buffer that represents the given string.
  26906. template<
  26907. typename Elem,
  26908. typename Traits>
  26909. const_buffer ``[link boost_asio.reference.buffer.overload32 buffer]``(
  26910. basic_string_view< Elem, Traits > data,
  26911. std::size_t max_size_in_bytes);
  26912. `` [''''&raquo;''' [link boost_asio.reference.buffer.overload32 more...]]``
  26913. A buffer object represents a contiguous region of memory as a 2-tuple consisting of a pointer and size in bytes. A tuple of the form `{void*, size_t}` specifies a mutable (modifiable) region of memory. Similarly, a tuple of the form `{const void*, size_t}` specifies a const (non-modifiable) region of memory. These two forms correspond to the classes [link boost_asio.reference.mutable_buffer `mutable_buffer`] and [link boost_asio.reference.const_buffer `const_buffer`], respectively. To mirror C++'s conversion rules, a [link boost_asio.reference.mutable_buffer `mutable_buffer`] is implicitly convertible to a [link boost_asio.reference.const_buffer `const_buffer`], and the opposite conversion is not permitted.
  26914. The simplest use case involves reading or writing a single buffer of a specified size:
  26915. sock.send(boost::asio::buffer(data, size));
  26916. In the above example, the return value of `boost::asio::buffer` meets the requirements of the ConstBufferSequence concept so that it may be directly passed to the socket's write function. A buffer created for modifiable memory also meets the requirements of the MutableBufferSequence concept.
  26917. An individual buffer may be created from a builtin array, std::vector, std::array or boost::array of POD elements. This helps prevent buffer overruns by automatically determining the size of the buffer:
  26918. char d1[128];
  26919. size_t bytes_transferred = sock.receive(boost::asio::buffer(d1));
  26920. std::vector<char> d2(128);
  26921. bytes_transferred = sock.receive(boost::asio::buffer(d2));
  26922. std::array<char, 128> d3;
  26923. bytes_transferred = sock.receive(boost::asio::buffer(d3));
  26924. boost::array<char, 128> d4;
  26925. bytes_transferred = sock.receive(boost::asio::buffer(d4));
  26926. In all three cases above, the buffers created are exactly 128 bytes long. Note that a vector is ['never] automatically resized when creating or using a buffer. The buffer size is determined using the vector's `size()` member function, and not its capacity.
  26927. [heading Accessing Buffer Contents]
  26928. The contents of a buffer may be accessed using the `data()` and `size()` member functions:
  26929. boost::asio::mutable_buffer b1 = ...;
  26930. std::size_t s1 = b1.size();
  26931. unsigned char* p1 = static_cast<unsigned char*>(b1.data());
  26932. boost::asio::const_buffer b2 = ...;
  26933. std::size_t s2 = b2.size();
  26934. const void* p2 = b2.data();
  26935. The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered.
  26936. For convenience, a [link boost_asio.reference.buffer_size `buffer_size`] function is provided that works with both buffers and buffer sequences (that is, types meeting the ConstBufferSequence or MutableBufferSequence type requirements). In this case, the function returns the total size of all buffers in the sequence.
  26937. [heading Buffer Copying]
  26938. The [link boost_asio.reference.buffer_copy `buffer_copy`] function may be used to copy raw bytes between individual buffers and buffer sequences.
  26939. In particular, when used with the [link boost_asio.reference.buffer_size `buffer_size`] function, the [link boost_asio.reference.buffer_copy `buffer_copy`] function can be used to linearise a sequence of buffers. For example:
  26940. vector<const_buffer> buffers = ...;
  26941. vector<unsigned char> data(boost::asio::buffer_size(buffers));
  26942. boost::asio::buffer_copy(boost::asio::buffer(data), buffers);
  26943. Note that [link boost_asio.reference.buffer_copy `buffer_copy`] is implemented in terms of `memcpy`, and consequently it cannot be used to copy between overlapping memory regions.
  26944. [heading Buffer Invalidation]
  26945. A buffer object does not have any ownership of the memory it refers to. It is the responsibility of the application to ensure the memory region remains valid until it is no longer required for an I/O operation. When the memory is no longer available, the buffer is said to have been invalidated.
  26946. For the `boost::asio::buffer` overloads that accept an argument of type std::vector, the buffer objects returned are invalidated by any vector operation that also invalidates all references, pointers and iterators referring to the elements in the sequence (C++ Std, 23.2.4)
  26947. For the `boost::asio::buffer` overloads that accept an argument of type std::basic\_string, the buffer objects returned are invalidated according to the rules defined for invalidation of references, pointers and iterators referring to elements of the sequence (C++ Std, 21.3).
  26948. [heading Buffer Arithmetic]
  26949. Buffer objects may be manipulated using simple arithmetic in a safe way which helps prevent buffer overruns. Consider an array initialised as follows:
  26950. boost::array<char, 6> a = { 'a', 'b', 'c', 'd', 'e' };
  26951. A buffer object `b1` created using:
  26952. b1 = boost::asio::buffer(a);
  26953. represents the entire array, `{ 'a', 'b', 'c', 'd', 'e' }`. An optional second argument to the `boost::asio::buffer` function may be used to limit the size, in bytes, of the buffer:
  26954. b2 = boost::asio::buffer(a, 3);
  26955. such that `b2` represents the data `{ 'a', 'b', 'c' }`. Even if the size argument exceeds the actual size of the array, the size of the buffer object created will be limited to the array size.
  26956. An offset may be applied to an existing buffer to create a new one:
  26957. b3 = b1 + 2;
  26958. where `b3` will set to represent `{ 'c', 'd', 'e' }`. If the offset exceeds the size of the existing buffer, the newly created buffer will be empty.
  26959. Both an offset and size may be specified to create a buffer that corresponds to a specific range of bytes within an existing buffer:
  26960. b4 = boost::asio::buffer(b1 + 1, 3);
  26961. so that `b4` will refer to the bytes `{ 'b', 'c', 'd' }`.
  26962. [heading Buffers and Scatter-Gather I/O]
  26963. To read or write using multiple buffers (i.e. scatter-gather I/O), multiple buffer objects may be assigned into a container that supports the MutableBufferSequence (for read) or ConstBufferSequence (for write) concepts:
  26964. char d1[128];
  26965. std::vector<char> d2(128);
  26966. boost::array<char, 128> d3;
  26967. boost::array<mutable_buffer, 3> bufs1 = {
  26968. boost::asio::buffer(d1),
  26969. boost::asio::buffer(d2),
  26970. boost::asio::buffer(d3) };
  26971. bytes_transferred = sock.receive(bufs1);
  26972. std::vector<const_buffer> bufs2;
  26973. bufs2.push_back(boost::asio::buffer(d1));
  26974. bufs2.push_back(boost::asio::buffer(d2));
  26975. bufs2.push_back(boost::asio::buffer(d3));
  26976. bytes_transferred = sock.send(bufs2);
  26977. [heading Requirements]
  26978. ['Header: ][^boost/asio/buffer.hpp]
  26979. ['Convenience header: ][^boost/asio.hpp]
  26980. [section:overload1 buffer (1 of 32 overloads)]
  26981. Create a new modifiable buffer from an existing buffer.
  26982. mutable_buffer buffer(
  26983. const mutable_buffer & b);
  26984. [heading Return Value]
  26985. `mutable_buffer(b)`.
  26986. [endsect]
  26987. [section:overload2 buffer (2 of 32 overloads)]
  26988. Create a new modifiable buffer from an existing buffer.
  26989. mutable_buffer buffer(
  26990. const mutable_buffer & b,
  26991. std::size_t max_size_in_bytes);
  26992. [heading Return Value]
  26993. A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to:
  26994. mutable_buffer(
  26995. b.data(),
  26996. min(b.size(), max_size_in_bytes));
  26997. [endsect]
  26998. [section:overload3 buffer (3 of 32 overloads)]
  26999. Create a new non-modifiable buffer from an existing buffer.
  27000. const_buffer buffer(
  27001. const const_buffer & b);
  27002. [heading Return Value]
  27003. `const_buffer(b)`.
  27004. [endsect]
  27005. [section:overload4 buffer (4 of 32 overloads)]
  27006. Create a new non-modifiable buffer from an existing buffer.
  27007. const_buffer buffer(
  27008. const const_buffer & b,
  27009. std::size_t max_size_in_bytes);
  27010. [heading Return Value]
  27011. A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to:
  27012. const_buffer(
  27013. b.data(),
  27014. min(b.size(), max_size_in_bytes));
  27015. [endsect]
  27016. [section:overload5 buffer (5 of 32 overloads)]
  27017. Create a new modifiable buffer that represents the given memory range.
  27018. mutable_buffer buffer(
  27019. void * data,
  27020. std::size_t size_in_bytes);
  27021. [heading Return Value]
  27022. `mutable_buffer(data, size_in_bytes)`.
  27023. [endsect]
  27024. [section:overload6 buffer (6 of 32 overloads)]
  27025. Create a new non-modifiable buffer that represents the given memory range.
  27026. const_buffer buffer(
  27027. const void * data,
  27028. std::size_t size_in_bytes);
  27029. [heading Return Value]
  27030. `const_buffer(data, size_in_bytes)`.
  27031. [endsect]
  27032. [section:overload7 buffer (7 of 32 overloads)]
  27033. Create a new modifiable buffer that represents the given POD array.
  27034. template<
  27035. typename PodType,
  27036. std::size_t N>
  27037. mutable_buffer buffer(
  27038. PodType (&data)[N]);
  27039. [heading Return Value]
  27040. A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to:
  27041. mutable_buffer(
  27042. static_cast<void*>(data),
  27043. N * sizeof(PodType));
  27044. [endsect]
  27045. [section:overload8 buffer (8 of 32 overloads)]
  27046. Create a new modifiable buffer that represents the given POD array.
  27047. template<
  27048. typename PodType,
  27049. std::size_t N>
  27050. mutable_buffer buffer(
  27051. PodType (&data)[N],
  27052. std::size_t max_size_in_bytes);
  27053. [heading Return Value]
  27054. A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to:
  27055. mutable_buffer(
  27056. static_cast<void*>(data),
  27057. min(N * sizeof(PodType), max_size_in_bytes));
  27058. [endsect]
  27059. [section:overload9 buffer (9 of 32 overloads)]
  27060. Create a new non-modifiable buffer that represents the given POD array.
  27061. template<
  27062. typename PodType,
  27063. std::size_t N>
  27064. const_buffer buffer(
  27065. const PodType (&data)[N]);
  27066. [heading Return Value]
  27067. A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to:
  27068. const_buffer(
  27069. static_cast<const void*>(data),
  27070. N * sizeof(PodType));
  27071. [endsect]
  27072. [section:overload10 buffer (10 of 32 overloads)]
  27073. Create a new non-modifiable buffer that represents the given POD array.
  27074. template<
  27075. typename PodType,
  27076. std::size_t N>
  27077. const_buffer buffer(
  27078. const PodType (&data)[N],
  27079. std::size_t max_size_in_bytes);
  27080. [heading Return Value]
  27081. A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to:
  27082. const_buffer(
  27083. static_cast<const void*>(data),
  27084. min(N * sizeof(PodType), max_size_in_bytes));
  27085. [endsect]
  27086. [section:overload11 buffer (11 of 32 overloads)]
  27087. Create a new modifiable buffer that represents the given POD array.
  27088. template<
  27089. typename PodType,
  27090. std::size_t N>
  27091. mutable_buffer buffer(
  27092. boost::array< PodType, N > & data);
  27093. [heading Return Value]
  27094. A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to:
  27095. mutable_buffer(
  27096. data.data(),
  27097. data.size() * sizeof(PodType));
  27098. [endsect]
  27099. [section:overload12 buffer (12 of 32 overloads)]
  27100. Create a new modifiable buffer that represents the given POD array.
  27101. template<
  27102. typename PodType,
  27103. std::size_t N>
  27104. mutable_buffer buffer(
  27105. boost::array< PodType, N > & data,
  27106. std::size_t max_size_in_bytes);
  27107. [heading Return Value]
  27108. A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to:
  27109. mutable_buffer(
  27110. data.data(),
  27111. min(data.size() * sizeof(PodType), max_size_in_bytes));
  27112. [endsect]
  27113. [section:overload13 buffer (13 of 32 overloads)]
  27114. Create a new non-modifiable buffer that represents the given POD array.
  27115. template<
  27116. typename PodType,
  27117. std::size_t N>
  27118. const_buffer buffer(
  27119. boost::array< const PodType, N > & data);
  27120. [heading Return Value]
  27121. A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to:
  27122. const_buffer(
  27123. data.data(),
  27124. data.size() * sizeof(PodType));
  27125. [endsect]
  27126. [section:overload14 buffer (14 of 32 overloads)]
  27127. Create a new non-modifiable buffer that represents the given POD array.
  27128. template<
  27129. typename PodType,
  27130. std::size_t N>
  27131. const_buffer buffer(
  27132. boost::array< const PodType, N > & data,
  27133. std::size_t max_size_in_bytes);
  27134. [heading Return Value]
  27135. A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to:
  27136. const_buffer(
  27137. data.data(),
  27138. min(data.size() * sizeof(PodType), max_size_in_bytes));
  27139. [endsect]
  27140. [section:overload15 buffer (15 of 32 overloads)]
  27141. Create a new non-modifiable buffer that represents the given POD array.
  27142. template<
  27143. typename PodType,
  27144. std::size_t N>
  27145. const_buffer buffer(
  27146. const boost::array< PodType, N > & data);
  27147. [heading Return Value]
  27148. A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to:
  27149. const_buffer(
  27150. data.data(),
  27151. data.size() * sizeof(PodType));
  27152. [endsect]
  27153. [section:overload16 buffer (16 of 32 overloads)]
  27154. Create a new non-modifiable buffer that represents the given POD array.
  27155. template<
  27156. typename PodType,
  27157. std::size_t N>
  27158. const_buffer buffer(
  27159. const boost::array< PodType, N > & data,
  27160. std::size_t max_size_in_bytes);
  27161. [heading Return Value]
  27162. A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to:
  27163. const_buffer(
  27164. data.data(),
  27165. min(data.size() * sizeof(PodType), max_size_in_bytes));
  27166. [endsect]
  27167. [section:overload17 buffer (17 of 32 overloads)]
  27168. Create a new modifiable buffer that represents the given POD array.
  27169. template<
  27170. typename PodType,
  27171. std::size_t N>
  27172. mutable_buffer buffer(
  27173. std::array< PodType, N > & data);
  27174. [heading Return Value]
  27175. A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to:
  27176. mutable_buffer(
  27177. data.data(),
  27178. data.size() * sizeof(PodType));
  27179. [endsect]
  27180. [section:overload18 buffer (18 of 32 overloads)]
  27181. Create a new modifiable buffer that represents the given POD array.
  27182. template<
  27183. typename PodType,
  27184. std::size_t N>
  27185. mutable_buffer buffer(
  27186. std::array< PodType, N > & data,
  27187. std::size_t max_size_in_bytes);
  27188. [heading Return Value]
  27189. A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to:
  27190. mutable_buffer(
  27191. data.data(),
  27192. min(data.size() * sizeof(PodType), max_size_in_bytes));
  27193. [endsect]
  27194. [section:overload19 buffer (19 of 32 overloads)]
  27195. Create a new non-modifiable buffer that represents the given POD array.
  27196. template<
  27197. typename PodType,
  27198. std::size_t N>
  27199. const_buffer buffer(
  27200. std::array< const PodType, N > & data);
  27201. [heading Return Value]
  27202. A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to:
  27203. const_buffer(
  27204. data.data(),
  27205. data.size() * sizeof(PodType));
  27206. [endsect]
  27207. [section:overload20 buffer (20 of 32 overloads)]
  27208. Create a new non-modifiable buffer that represents the given POD array.
  27209. template<
  27210. typename PodType,
  27211. std::size_t N>
  27212. const_buffer buffer(
  27213. std::array< const PodType, N > & data,
  27214. std::size_t max_size_in_bytes);
  27215. [heading Return Value]
  27216. A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to:
  27217. const_buffer(
  27218. data.data(),
  27219. min(data.size() * sizeof(PodType), max_size_in_bytes));
  27220. [endsect]
  27221. [section:overload21 buffer (21 of 32 overloads)]
  27222. Create a new non-modifiable buffer that represents the given POD array.
  27223. template<
  27224. typename PodType,
  27225. std::size_t N>
  27226. const_buffer buffer(
  27227. const std::array< PodType, N > & data);
  27228. [heading Return Value]
  27229. A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to:
  27230. const_buffer(
  27231. data.data(),
  27232. data.size() * sizeof(PodType));
  27233. [endsect]
  27234. [section:overload22 buffer (22 of 32 overloads)]
  27235. Create a new non-modifiable buffer that represents the given POD array.
  27236. template<
  27237. typename PodType,
  27238. std::size_t N>
  27239. const_buffer buffer(
  27240. const std::array< PodType, N > & data,
  27241. std::size_t max_size_in_bytes);
  27242. [heading Return Value]
  27243. A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to:
  27244. const_buffer(
  27245. data.data(),
  27246. min(data.size() * sizeof(PodType), max_size_in_bytes));
  27247. [endsect]
  27248. [section:overload23 buffer (23 of 32 overloads)]
  27249. Create a new modifiable buffer that represents the given POD vector.
  27250. template<
  27251. typename PodType,
  27252. typename Allocator>
  27253. mutable_buffer buffer(
  27254. std::vector< PodType, Allocator > & data);
  27255. [heading Return Value]
  27256. A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to:
  27257. mutable_buffer(
  27258. data.size() ? &data[0] : 0,
  27259. data.size() * sizeof(PodType));
  27260. [heading Remarks]
  27261. The buffer is invalidated by any vector operation that would also invalidate iterators.
  27262. [endsect]
  27263. [section:overload24 buffer (24 of 32 overloads)]
  27264. Create a new modifiable buffer that represents the given POD vector.
  27265. template<
  27266. typename PodType,
  27267. typename Allocator>
  27268. mutable_buffer buffer(
  27269. std::vector< PodType, Allocator > & data,
  27270. std::size_t max_size_in_bytes);
  27271. [heading Return Value]
  27272. A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to:
  27273. mutable_buffer(
  27274. data.size() ? &data[0] : 0,
  27275. min(data.size() * sizeof(PodType), max_size_in_bytes));
  27276. [heading Remarks]
  27277. The buffer is invalidated by any vector operation that would also invalidate iterators.
  27278. [endsect]
  27279. [section:overload25 buffer (25 of 32 overloads)]
  27280. Create a new non-modifiable buffer that represents the given POD vector.
  27281. template<
  27282. typename PodType,
  27283. typename Allocator>
  27284. const_buffer buffer(
  27285. const std::vector< PodType, Allocator > & data);
  27286. [heading Return Value]
  27287. A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to:
  27288. const_buffer(
  27289. data.size() ? &data[0] : 0,
  27290. data.size() * sizeof(PodType));
  27291. [heading Remarks]
  27292. The buffer is invalidated by any vector operation that would also invalidate iterators.
  27293. [endsect]
  27294. [section:overload26 buffer (26 of 32 overloads)]
  27295. Create a new non-modifiable buffer that represents the given POD vector.
  27296. template<
  27297. typename PodType,
  27298. typename Allocator>
  27299. const_buffer buffer(
  27300. const std::vector< PodType, Allocator > & data,
  27301. std::size_t max_size_in_bytes);
  27302. [heading Return Value]
  27303. A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to:
  27304. const_buffer(
  27305. data.size() ? &data[0] : 0,
  27306. min(data.size() * sizeof(PodType), max_size_in_bytes));
  27307. [heading Remarks]
  27308. The buffer is invalidated by any vector operation that would also invalidate iterators.
  27309. [endsect]
  27310. [section:overload27 buffer (27 of 32 overloads)]
  27311. Create a new modifiable buffer that represents the given string.
  27312. template<
  27313. typename Elem,
  27314. typename Traits,
  27315. typename Allocator>
  27316. mutable_buffer buffer(
  27317. std::basic_string< Elem, Traits, Allocator > & data);
  27318. [heading Return Value]
  27319. `mutable_buffer(data.size() ? &data[0] : 0, data.size() * sizeof(Elem))`.
  27320. [heading Remarks]
  27321. The buffer is invalidated by any non-const operation called on the given string object.
  27322. [endsect]
  27323. [section:overload28 buffer (28 of 32 overloads)]
  27324. Create a new modifiable buffer that represents the given string.
  27325. template<
  27326. typename Elem,
  27327. typename Traits,
  27328. typename Allocator>
  27329. mutable_buffer buffer(
  27330. std::basic_string< Elem, Traits, Allocator > & data,
  27331. std::size_t max_size_in_bytes);
  27332. [heading Return Value]
  27333. A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to:
  27334. mutable_buffer(
  27335. data.size() ? &data[0] : 0,
  27336. min(data.size() * sizeof(Elem), max_size_in_bytes));
  27337. [heading Remarks]
  27338. The buffer is invalidated by any non-const operation called on the given string object.
  27339. [endsect]
  27340. [section:overload29 buffer (29 of 32 overloads)]
  27341. Create a new non-modifiable buffer that represents the given string.
  27342. template<
  27343. typename Elem,
  27344. typename Traits,
  27345. typename Allocator>
  27346. const_buffer buffer(
  27347. const std::basic_string< Elem, Traits, Allocator > & data);
  27348. [heading Return Value]
  27349. `const_buffer(data.data(), data.size() * sizeof(Elem))`.
  27350. [heading Remarks]
  27351. The buffer is invalidated by any non-const operation called on the given string object.
  27352. [endsect]
  27353. [section:overload30 buffer (30 of 32 overloads)]
  27354. Create a new non-modifiable buffer that represents the given string.
  27355. template<
  27356. typename Elem,
  27357. typename Traits,
  27358. typename Allocator>
  27359. const_buffer buffer(
  27360. const std::basic_string< Elem, Traits, Allocator > & data,
  27361. std::size_t max_size_in_bytes);
  27362. [heading Return Value]
  27363. A [link boost_asio.reference.const_buffer `const_buffer`] value equivalent to:
  27364. const_buffer(
  27365. data.data(),
  27366. min(data.size() * sizeof(Elem), max_size_in_bytes));
  27367. [heading Remarks]
  27368. The buffer is invalidated by any non-const operation called on the given string object.
  27369. [endsect]
  27370. [section:overload31 buffer (31 of 32 overloads)]
  27371. Create a new modifiable buffer that represents the given string\_view.
  27372. template<
  27373. typename Elem,
  27374. typename Traits>
  27375. const_buffer buffer(
  27376. basic_string_view< Elem, Traits > data);
  27377. [heading Return Value]
  27378. `mutable_buffer(data.size() ? &data[0] : 0, data.size() * sizeof(Elem))`.
  27379. [endsect]
  27380. [section:overload32 buffer (32 of 32 overloads)]
  27381. Create a new non-modifiable buffer that represents the given string.
  27382. template<
  27383. typename Elem,
  27384. typename Traits>
  27385. const_buffer buffer(
  27386. basic_string_view< Elem, Traits > data,
  27387. std::size_t max_size_in_bytes);
  27388. [heading Return Value]
  27389. A [link boost_asio.reference.mutable_buffer `mutable_buffer`] value equivalent to:
  27390. mutable_buffer(
  27391. data.size() ? &data[0] : 0,
  27392. min(data.size() * sizeof(Elem), max_size_in_bytes));
  27393. [endsect]
  27394. [endsect]
  27395. [section:buffer_cast buffer_cast]
  27396. [indexterm1 boost_asio.indexterm.buffer_cast..buffer_cast]
  27397. (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.
  27398. Cast a non-modifiable buffer to a specified pointer to POD type.
  27399. template<
  27400. typename PointerToPodType>
  27401. PointerToPodType ``[link boost_asio.reference.buffer_cast.overload1 buffer_cast]``(
  27402. const mutable_buffer & b);
  27403. `` [''''&raquo;''' [link boost_asio.reference.buffer_cast.overload1 more...]]``
  27404. template<
  27405. typename PointerToPodType>
  27406. PointerToPodType ``[link boost_asio.reference.buffer_cast.overload2 buffer_cast]``(
  27407. const const_buffer & b);
  27408. `` [''''&raquo;''' [link boost_asio.reference.buffer_cast.overload2 more...]]``
  27409. [heading Examples:]
  27410. To access the memory of a non-modifiable buffer, use:
  27411. boost::asio::const_buffer b1 = ...;
  27412. const unsigned char* p1 = boost::asio::buffer_cast<const unsigned char*>(b1);
  27413. To access the memory of a modifiable buffer, use:
  27414. boost::asio::mutable_buffer b2 = ...;
  27415. unsigned char* p2 = boost::asio::buffer_cast<unsigned char*>(b2);
  27416. The `boost::asio::buffer_cast` function permits violations of type safety, so uses of it in application code should be carefully considered.
  27417. [heading Requirements]
  27418. ['Header: ][^boost/asio/buffer.hpp]
  27419. ['Convenience header: ][^boost/asio.hpp]
  27420. [section:overload1 buffer_cast (1 of 2 overloads)]
  27421. Cast a non-modifiable buffer to a specified pointer to POD type.
  27422. template<
  27423. typename PointerToPodType>
  27424. PointerToPodType buffer_cast(
  27425. const mutable_buffer & b);
  27426. [endsect]
  27427. [section:overload2 buffer_cast (2 of 2 overloads)]
  27428. Cast a non-modifiable buffer to a specified pointer to POD type.
  27429. template<
  27430. typename PointerToPodType>
  27431. PointerToPodType buffer_cast(
  27432. const const_buffer & b);
  27433. [endsect]
  27434. [endsect]
  27435. [section:buffer_copy buffer_copy]
  27436. [indexterm1 boost_asio.indexterm.buffer_copy..buffer_copy]
  27437. The `boost::asio::buffer_copy` function is used to copy bytes from a source buffer (or buffer sequence) to a target buffer (or buffer sequence).
  27438. Copies bytes from a source buffer sequence to a target buffer sequence.
  27439. template<
  27440. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  27441. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  27442. std::size_t ``[link boost_asio.reference.buffer_copy.overload1 buffer_copy]``(
  27443. const MutableBufferSequence & target,
  27444. const ConstBufferSequence & source);
  27445. `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload1 more...]]``
  27446. Copies a limited number of bytes from a source buffer sequence to a target buffer sequence.
  27447. template<
  27448. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  27449. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  27450. std::size_t ``[link boost_asio.reference.buffer_copy.overload2 buffer_copy]``(
  27451. const MutableBufferSequence & target,
  27452. const ConstBufferSequence & source,
  27453. std::size_t max_bytes_to_copy);
  27454. `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload2 more...]]``
  27455. The `buffer_copy` function is available in two forms:
  27456. * A 2-argument form: `buffer_copy(target, source)`
  27457. * A 3-argument form: `buffer_copy(target, source, max_bytes_to_copy)`
  27458. Both forms return the number of bytes actually copied. The number of bytes copied is the lesser of:
  27459. * `buffer_size(target)`
  27460. * `buffer_size(source)`
  27461. * `If` specified, `max_bytes_to_copy`.
  27462. This prevents buffer overflow, regardless of the buffer sizes used in the copy operation.
  27463. Note that [link boost_asio.reference.buffer_copy `buffer_copy`] is implemented in terms of `memcpy`, and consequently it cannot be used to copy between overlapping memory regions.
  27464. [heading Requirements]
  27465. ['Header: ][^boost/asio/buffer.hpp]
  27466. ['Convenience header: ][^boost/asio.hpp]
  27467. [section:overload1 buffer_copy (1 of 2 overloads)]
  27468. Copies bytes from a source buffer sequence to a target buffer sequence.
  27469. template<
  27470. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  27471. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  27472. std::size_t buffer_copy(
  27473. const MutableBufferSequence & target,
  27474. const ConstBufferSequence & source);
  27475. [heading Parameters]
  27476. [variablelist
  27477. [[target][A modifiable buffer sequence representing the memory regions to which the bytes will be copied.]]
  27478. [[source][A non-modifiable buffer sequence representing the memory regions from which the bytes will be copied.]]
  27479. ]
  27480. [heading Return Value]
  27481. The number of bytes copied.
  27482. [heading Remarks]
  27483. The number of bytes copied is the lesser of:
  27484. * `buffer_size(target)`
  27485. * `buffer_size(source)`
  27486. This function is implemented in terms of `memcpy`, and consequently it cannot be used to copy between overlapping memory regions.
  27487. [endsect]
  27488. [section:overload2 buffer_copy (2 of 2 overloads)]
  27489. Copies a limited number of bytes from a source buffer sequence to a target buffer sequence.
  27490. template<
  27491. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  27492. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  27493. std::size_t buffer_copy(
  27494. const MutableBufferSequence & target,
  27495. const ConstBufferSequence & source,
  27496. std::size_t max_bytes_to_copy);
  27497. [heading Parameters]
  27498. [variablelist
  27499. [[target][A modifiable buffer sequence representing the memory regions to which the bytes will be copied.]]
  27500. [[source][A non-modifiable buffer sequence representing the memory regions from which the bytes will be copied.]]
  27501. [[max_bytes_to_copy][The maximum number of bytes to be copied.]]
  27502. ]
  27503. [heading Return Value]
  27504. The number of bytes copied.
  27505. [heading Remarks]
  27506. The number of bytes copied is the lesser of:
  27507. * `buffer_size(target)`
  27508. * `buffer_size(source)`
  27509. * `max_bytes_to_copy`
  27510. This function is implemented in terms of `memcpy`, and consequently it cannot be used to copy between overlapping memory regions.
  27511. [endsect]
  27512. [endsect]
  27513. [section:buffer_sequence_begin buffer_sequence_begin]
  27514. [indexterm1 boost_asio.indexterm.buffer_sequence_begin..buffer_sequence_begin]
  27515. The `boost::asio::buffer_sequence_begin` function returns an iterator pointing to the first element in a buffer sequence.
  27516. Get an iterator to the first element in a buffer sequence.
  27517. template<
  27518. typename MutableBuffer>
  27519. const mutable_buffer * ``[link boost_asio.reference.buffer_sequence_begin.overload1 buffer_sequence_begin]``(
  27520. const MutableBuffer & b,
  27521. typename enable_if< is_convertible< const MutableBuffer *, const mutable_buffer * >::value >::type * = 0);
  27522. `` [''''&raquo;''' [link boost_asio.reference.buffer_sequence_begin.overload1 more...]]``
  27523. template<
  27524. typename ConstBuffer>
  27525. const const_buffer * ``[link boost_asio.reference.buffer_sequence_begin.overload2 buffer_sequence_begin]``(
  27526. const ConstBuffer & b,
  27527. typename enable_if< is_convertible< const ConstBuffer *, const const_buffer * >::value >::type * = 0);
  27528. `` [''''&raquo;''' [link boost_asio.reference.buffer_sequence_begin.overload2 more...]]``
  27529. template<
  27530. typename C>
  27531. auto ``[link boost_asio.reference.buffer_sequence_begin.overload3 buffer_sequence_begin]``(
  27532. C & c,
  27533. typename enable_if< !is_convertible< const C *, const mutable_buffer * >::value &&!is_convertible< const C *, const const_buffer * >::value >::type * = 0);
  27534. `` [''''&raquo;''' [link boost_asio.reference.buffer_sequence_begin.overload3 more...]]``
  27535. template<
  27536. typename C>
  27537. auto ``[link boost_asio.reference.buffer_sequence_begin.overload4 buffer_sequence_begin]``(
  27538. const C & c,
  27539. typename enable_if< !is_convertible< const C *, const mutable_buffer * >::value &&!is_convertible< const C *, const const_buffer * >::value >::type * = 0);
  27540. `` [''''&raquo;''' [link boost_asio.reference.buffer_sequence_begin.overload4 more...]]``
  27541. [heading Requirements]
  27542. ['Header: ][^boost/asio/buffer.hpp]
  27543. ['Convenience header: ][^boost/asio.hpp]
  27544. [section:overload1 buffer_sequence_begin (1 of 4 overloads)]
  27545. Get an iterator to the first element in a buffer sequence.
  27546. template<
  27547. typename MutableBuffer>
  27548. const mutable_buffer * buffer_sequence_begin(
  27549. const MutableBuffer & b,
  27550. typename enable_if< is_convertible< const MutableBuffer *, const mutable_buffer * >::value >::type * = 0);
  27551. [endsect]
  27552. [section:overload2 buffer_sequence_begin (2 of 4 overloads)]
  27553. Get an iterator to the first element in a buffer sequence.
  27554. template<
  27555. typename ConstBuffer>
  27556. const const_buffer * buffer_sequence_begin(
  27557. const ConstBuffer & b,
  27558. typename enable_if< is_convertible< const ConstBuffer *, const const_buffer * >::value >::type * = 0);
  27559. [endsect]
  27560. [section:overload3 buffer_sequence_begin (3 of 4 overloads)]
  27561. Get an iterator to the first element in a buffer sequence.
  27562. template<
  27563. typename C>
  27564. auto buffer_sequence_begin(
  27565. C & c,
  27566. typename enable_if< !is_convertible< const C *, const mutable_buffer * >::value &&!is_convertible< const C *, const const_buffer * >::value >::type * = 0);
  27567. [endsect]
  27568. [section:overload4 buffer_sequence_begin (4 of 4 overloads)]
  27569. Get an iterator to the first element in a buffer sequence.
  27570. template<
  27571. typename C>
  27572. auto buffer_sequence_begin(
  27573. const C & c,
  27574. typename enable_if< !is_convertible< const C *, const mutable_buffer * >::value &&!is_convertible< const C *, const const_buffer * >::value >::type * = 0);
  27575. [endsect]
  27576. [endsect]
  27577. [section:buffer_sequence_end buffer_sequence_end]
  27578. [indexterm1 boost_asio.indexterm.buffer_sequence_end..buffer_sequence_end]
  27579. The `boost::asio::buffer_sequence_end` function returns an iterator pointing to one past the end element in a buffer sequence.
  27580. Get an iterator to one past the end element in a buffer sequence.
  27581. template<
  27582. typename MutableBuffer>
  27583. const mutable_buffer * ``[link boost_asio.reference.buffer_sequence_end.overload1 buffer_sequence_end]``(
  27584. const MutableBuffer & b,
  27585. typename enable_if< is_convertible< const MutableBuffer *, const mutable_buffer * >::value >::type * = 0);
  27586. `` [''''&raquo;''' [link boost_asio.reference.buffer_sequence_end.overload1 more...]]``
  27587. template<
  27588. typename ConstBuffer>
  27589. const const_buffer * ``[link boost_asio.reference.buffer_sequence_end.overload2 buffer_sequence_end]``(
  27590. const ConstBuffer & b,
  27591. typename enable_if< is_convertible< const ConstBuffer *, const const_buffer * >::value >::type * = 0);
  27592. `` [''''&raquo;''' [link boost_asio.reference.buffer_sequence_end.overload2 more...]]``
  27593. template<
  27594. typename C>
  27595. auto ``[link boost_asio.reference.buffer_sequence_end.overload3 buffer_sequence_end]``(
  27596. C & c,
  27597. typename enable_if< !is_convertible< const C *, const mutable_buffer * >::value &&!is_convertible< const C *, const const_buffer * >::value >::type * = 0);
  27598. `` [''''&raquo;''' [link boost_asio.reference.buffer_sequence_end.overload3 more...]]``
  27599. template<
  27600. typename C>
  27601. auto ``[link boost_asio.reference.buffer_sequence_end.overload4 buffer_sequence_end]``(
  27602. const C & c,
  27603. typename enable_if< !is_convertible< const C *, const mutable_buffer * >::value &&!is_convertible< const C *, const const_buffer * >::value >::type * = 0);
  27604. `` [''''&raquo;''' [link boost_asio.reference.buffer_sequence_end.overload4 more...]]``
  27605. [heading Requirements]
  27606. ['Header: ][^boost/asio/buffer.hpp]
  27607. ['Convenience header: ][^boost/asio.hpp]
  27608. [section:overload1 buffer_sequence_end (1 of 4 overloads)]
  27609. Get an iterator to one past the end element in a buffer sequence.
  27610. template<
  27611. typename MutableBuffer>
  27612. const mutable_buffer * buffer_sequence_end(
  27613. const MutableBuffer & b,
  27614. typename enable_if< is_convertible< const MutableBuffer *, const mutable_buffer * >::value >::type * = 0);
  27615. [endsect]
  27616. [section:overload2 buffer_sequence_end (2 of 4 overloads)]
  27617. Get an iterator to one past the end element in a buffer sequence.
  27618. template<
  27619. typename ConstBuffer>
  27620. const const_buffer * buffer_sequence_end(
  27621. const ConstBuffer & b,
  27622. typename enable_if< is_convertible< const ConstBuffer *, const const_buffer * >::value >::type * = 0);
  27623. [endsect]
  27624. [section:overload3 buffer_sequence_end (3 of 4 overloads)]
  27625. Get an iterator to one past the end element in a buffer sequence.
  27626. template<
  27627. typename C>
  27628. auto buffer_sequence_end(
  27629. C & c,
  27630. typename enable_if< !is_convertible< const C *, const mutable_buffer * >::value &&!is_convertible< const C *, const const_buffer * >::value >::type * = 0);
  27631. [endsect]
  27632. [section:overload4 buffer_sequence_end (4 of 4 overloads)]
  27633. Get an iterator to one past the end element in a buffer sequence.
  27634. template<
  27635. typename C>
  27636. auto buffer_sequence_end(
  27637. const C & c,
  27638. typename enable_if< !is_convertible< const C *, const mutable_buffer * >::value &&!is_convertible< const C *, const const_buffer * >::value >::type * = 0);
  27639. [endsect]
  27640. [endsect]
  27641. [section:buffer_size buffer_size]
  27642. [indexterm1 boost_asio.indexterm.buffer_size..buffer_size]
  27643. Get the total number of bytes in a buffer sequence.
  27644. template<
  27645. typename BufferSequence>
  27646. std::size_t buffer_size(
  27647. const BufferSequence & b);
  27648. The `buffer_size` function determines the total size of all buffers in the buffer sequence, as if computed as follows:
  27649. size_t total_size = 0;
  27650. auto i = boost::asio::buffer_sequence_begin(buffers);
  27651. auto end = boost::asio::buffer_sequence_end(buffers);
  27652. for (; i != end; ++i)
  27653. {
  27654. const_buffer b(*i);
  27655. total_size += b.size();
  27656. }
  27657. return total_size;
  27658. The `BufferSequence` template parameter may meet either of the `ConstBufferSequence` or `MutableBufferSequence` type requirements.
  27659. [heading Requirements]
  27660. ['Header: ][^boost/asio/buffer.hpp]
  27661. ['Convenience header: ][^boost/asio.hpp]
  27662. [endsect]
  27663. [section:buffered_read_stream buffered_read_stream]
  27664. Adds buffering to the read-related operations of a stream.
  27665. template<
  27666. typename Stream>
  27667. class buffered_read_stream :
  27668. noncopyable
  27669. [heading Types]
  27670. [table
  27671. [[Name][Description]]
  27672. [
  27673. [[link boost_asio.reference.buffered_read_stream.executor_type [*executor_type]]]
  27674. [The type of the executor associated with the object. ]
  27675. ]
  27676. [
  27677. [[link boost_asio.reference.buffered_read_stream.lowest_layer_type [*lowest_layer_type]]]
  27678. [The type of the lowest layer. ]
  27679. ]
  27680. [
  27681. [[link boost_asio.reference.buffered_read_stream.next_layer_type [*next_layer_type]]]
  27682. [The type of the next layer. ]
  27683. ]
  27684. ]
  27685. [heading Member Functions]
  27686. [table
  27687. [[Name][Description]]
  27688. [
  27689. [[link boost_asio.reference.buffered_read_stream.async_fill [*async_fill]]]
  27690. [Start an asynchronous fill. ]
  27691. ]
  27692. [
  27693. [[link boost_asio.reference.buffered_read_stream.async_read_some [*async_read_some]]]
  27694. [Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation. ]
  27695. ]
  27696. [
  27697. [[link boost_asio.reference.buffered_read_stream.async_write_some [*async_write_some]]]
  27698. [Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation. ]
  27699. ]
  27700. [
  27701. [[link boost_asio.reference.buffered_read_stream.buffered_read_stream [*buffered_read_stream]]]
  27702. [Construct, passing the specified argument to initialise the next layer. ]
  27703. ]
  27704. [
  27705. [[link boost_asio.reference.buffered_read_stream.close [*close]]]
  27706. [Close the stream. ]
  27707. ]
  27708. [
  27709. [[link boost_asio.reference.buffered_read_stream.fill [*fill]]]
  27710. [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.
  27711. [hr]
  27712. 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. ]
  27713. ]
  27714. [
  27715. [[link boost_asio.reference.buffered_read_stream.get_executor [*get_executor]]]
  27716. [Get the executor associated with the object. ]
  27717. ]
  27718. [
  27719. [[link boost_asio.reference.buffered_read_stream.in_avail [*in_avail]]]
  27720. [Determine the amount of data that may be read without blocking. ]
  27721. ]
  27722. [
  27723. [[link boost_asio.reference.buffered_read_stream.lowest_layer [*lowest_layer]]]
  27724. [Get a reference to the lowest layer.
  27725. [hr]
  27726. Get a const reference to the lowest layer. ]
  27727. ]
  27728. [
  27729. [[link boost_asio.reference.buffered_read_stream.next_layer [*next_layer]]]
  27730. [Get a reference to the next layer. ]
  27731. ]
  27732. [
  27733. [[link boost_asio.reference.buffered_read_stream.peek [*peek]]]
  27734. [Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
  27735. [hr]
  27736. Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred. ]
  27737. ]
  27738. [
  27739. [[link boost_asio.reference.buffered_read_stream.read_some [*read_some]]]
  27740. [Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
  27741. [hr]
  27742. Read some data from the stream. Returns the number of bytes read or 0 if an error occurred. ]
  27743. ]
  27744. [
  27745. [[link boost_asio.reference.buffered_read_stream.write_some [*write_some]]]
  27746. [Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
  27747. [hr]
  27748. Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred. ]
  27749. ]
  27750. ]
  27751. [heading Data Members]
  27752. [table
  27753. [[Name][Description]]
  27754. [
  27755. [[link boost_asio.reference.buffered_read_stream.default_buffer_size [*default_buffer_size]]]
  27756. [The default buffer size. ]
  27757. ]
  27758. ]
  27759. The [link boost_asio.reference.buffered_read_stream `buffered_read_stream`] class template can be used to add buffering to the synchronous and asynchronous read operations of a stream.
  27760. [heading Thread Safety]
  27761. ['Distinct] ['objects:] Safe.
  27762. ['Shared] ['objects:] Unsafe.
  27763. [heading Requirements]
  27764. ['Header: ][^boost/asio/buffered_read_stream.hpp]
  27765. ['Convenience header: ][^boost/asio.hpp]
  27766. [section:async_fill buffered_read_stream::async_fill]
  27767. [indexterm2 boost_asio.indexterm.buffered_read_stream.async_fill..async_fill..buffered_read_stream]
  27768. Start an asynchronous fill.
  27769. template<
  27770. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  27771. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_fill(
  27772. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  27773. [endsect]
  27774. [section:async_read_some buffered_read_stream::async_read_some]
  27775. [indexterm2 boost_asio.indexterm.buffered_read_stream.async_read_some..async_read_some..buffered_read_stream]
  27776. Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation.
  27777. template<
  27778. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  27779. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  27780. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_some(
  27781. const MutableBufferSequence & buffers,
  27782. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  27783. [endsect]
  27784. [section:async_write_some buffered_read_stream::async_write_some]
  27785. [indexterm2 boost_asio.indexterm.buffered_read_stream.async_write_some..async_write_some..buffered_read_stream]
  27786. Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation.
  27787. template<
  27788. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  27789. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  27790. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_some(
  27791. const ConstBufferSequence & buffers,
  27792. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  27793. [endsect]
  27794. [section:buffered_read_stream buffered_read_stream::buffered_read_stream]
  27795. [indexterm2 boost_asio.indexterm.buffered_read_stream.buffered_read_stream..buffered_read_stream..buffered_read_stream]
  27796. Construct, passing the specified argument to initialise the next layer.
  27797. template<
  27798. typename Arg>
  27799. explicit ``[link boost_asio.reference.buffered_read_stream.buffered_read_stream.overload1 buffered_read_stream]``(
  27800. Arg & a);
  27801. `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.buffered_read_stream.overload1 more...]]``
  27802. template<
  27803. typename Arg>
  27804. ``[link boost_asio.reference.buffered_read_stream.buffered_read_stream.overload2 buffered_read_stream]``(
  27805. Arg & a,
  27806. std::size_t buffer_size);
  27807. `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.buffered_read_stream.overload2 more...]]``
  27808. [section:overload1 buffered_read_stream::buffered_read_stream (1 of 2 overloads)]
  27809. Construct, passing the specified argument to initialise the next layer.
  27810. template<
  27811. typename Arg>
  27812. buffered_read_stream(
  27813. Arg & a);
  27814. [endsect]
  27815. [section:overload2 buffered_read_stream::buffered_read_stream (2 of 2 overloads)]
  27816. Construct, passing the specified argument to initialise the next layer.
  27817. template<
  27818. typename Arg>
  27819. buffered_read_stream(
  27820. Arg & a,
  27821. std::size_t buffer_size);
  27822. [endsect]
  27823. [endsect]
  27824. [section:close buffered_read_stream::close]
  27825. [indexterm2 boost_asio.indexterm.buffered_read_stream.close..close..buffered_read_stream]
  27826. Close the stream.
  27827. void ``[link boost_asio.reference.buffered_read_stream.close.overload1 close]``();
  27828. `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.close.overload1 more...]]``
  27829. void ``[link boost_asio.reference.buffered_read_stream.close.overload2 close]``(
  27830. boost::system::error_code & ec);
  27831. `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.close.overload2 more...]]``
  27832. [section:overload1 buffered_read_stream::close (1 of 2 overloads)]
  27833. Close the stream.
  27834. void close();
  27835. [endsect]
  27836. [section:overload2 buffered_read_stream::close (2 of 2 overloads)]
  27837. Close the stream.
  27838. void close(
  27839. boost::system::error_code & ec);
  27840. [endsect]
  27841. [endsect]
  27842. [section:default_buffer_size buffered_read_stream::default_buffer_size]
  27843. [indexterm2 boost_asio.indexterm.buffered_read_stream.default_buffer_size..default_buffer_size..buffered_read_stream]
  27844. The default buffer size.
  27845. static const std::size_t default_buffer_size = implementation_defined;
  27846. [endsect]
  27847. [section:executor_type buffered_read_stream::executor_type]
  27848. [indexterm2 boost_asio.indexterm.buffered_read_stream.executor_type..executor_type..buffered_read_stream]
  27849. The type of the executor associated with the object.
  27850. typedef lowest_layer_type::executor_type executor_type;
  27851. [heading Requirements]
  27852. ['Header: ][^boost/asio/buffered_read_stream.hpp]
  27853. ['Convenience header: ][^boost/asio.hpp]
  27854. [endsect]
  27855. [section:fill buffered_read_stream::fill]
  27856. [indexterm2 boost_asio.indexterm.buffered_read_stream.fill..fill..buffered_read_stream]
  27857. 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.
  27858. std::size_t ``[link boost_asio.reference.buffered_read_stream.fill.overload1 fill]``();
  27859. `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.fill.overload1 more...]]``
  27860. 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.
  27861. std::size_t ``[link boost_asio.reference.buffered_read_stream.fill.overload2 fill]``(
  27862. boost::system::error_code & ec);
  27863. `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.fill.overload2 more...]]``
  27864. [section:overload1 buffered_read_stream::fill (1 of 2 overloads)]
  27865. 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.
  27866. std::size_t fill();
  27867. [endsect]
  27868. [section:overload2 buffered_read_stream::fill (2 of 2 overloads)]
  27869. 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.
  27870. std::size_t fill(
  27871. boost::system::error_code & ec);
  27872. [endsect]
  27873. [endsect]
  27874. [section:get_executor buffered_read_stream::get_executor]
  27875. [indexterm2 boost_asio.indexterm.buffered_read_stream.get_executor..get_executor..buffered_read_stream]
  27876. Get the executor associated with the object.
  27877. executor_type get_executor();
  27878. [endsect]
  27879. [section:in_avail buffered_read_stream::in_avail]
  27880. [indexterm2 boost_asio.indexterm.buffered_read_stream.in_avail..in_avail..buffered_read_stream]
  27881. Determine the amount of data that may be read without blocking.
  27882. std::size_t ``[link boost_asio.reference.buffered_read_stream.in_avail.overload1 in_avail]``();
  27883. `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.in_avail.overload1 more...]]``
  27884. std::size_t ``[link boost_asio.reference.buffered_read_stream.in_avail.overload2 in_avail]``(
  27885. boost::system::error_code & ec);
  27886. `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.in_avail.overload2 more...]]``
  27887. [section:overload1 buffered_read_stream::in_avail (1 of 2 overloads)]
  27888. Determine the amount of data that may be read without blocking.
  27889. std::size_t in_avail();
  27890. [endsect]
  27891. [section:overload2 buffered_read_stream::in_avail (2 of 2 overloads)]
  27892. Determine the amount of data that may be read without blocking.
  27893. std::size_t in_avail(
  27894. boost::system::error_code & ec);
  27895. [endsect]
  27896. [endsect]
  27897. [section:lowest_layer buffered_read_stream::lowest_layer]
  27898. [indexterm2 boost_asio.indexterm.buffered_read_stream.lowest_layer..lowest_layer..buffered_read_stream]
  27899. Get a reference to the lowest layer.
  27900. lowest_layer_type & ``[link boost_asio.reference.buffered_read_stream.lowest_layer.overload1 lowest_layer]``();
  27901. `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.lowest_layer.overload1 more...]]``
  27902. Get a const reference to the lowest layer.
  27903. const lowest_layer_type & ``[link boost_asio.reference.buffered_read_stream.lowest_layer.overload2 lowest_layer]``() const;
  27904. `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.lowest_layer.overload2 more...]]``
  27905. [section:overload1 buffered_read_stream::lowest_layer (1 of 2 overloads)]
  27906. Get a reference to the lowest layer.
  27907. lowest_layer_type & lowest_layer();
  27908. [endsect]
  27909. [section:overload2 buffered_read_stream::lowest_layer (2 of 2 overloads)]
  27910. Get a const reference to the lowest layer.
  27911. const lowest_layer_type & lowest_layer() const;
  27912. [endsect]
  27913. [endsect]
  27914. [section:lowest_layer_type buffered_read_stream::lowest_layer_type]
  27915. [indexterm2 boost_asio.indexterm.buffered_read_stream.lowest_layer_type..lowest_layer_type..buffered_read_stream]
  27916. The type of the lowest layer.
  27917. typedef next_layer_type::lowest_layer_type lowest_layer_type;
  27918. [heading Requirements]
  27919. ['Header: ][^boost/asio/buffered_read_stream.hpp]
  27920. ['Convenience header: ][^boost/asio.hpp]
  27921. [endsect]
  27922. [section:next_layer buffered_read_stream::next_layer]
  27923. [indexterm2 boost_asio.indexterm.buffered_read_stream.next_layer..next_layer..buffered_read_stream]
  27924. Get a reference to the next layer.
  27925. next_layer_type & next_layer();
  27926. [endsect]
  27927. [section:next_layer_type buffered_read_stream::next_layer_type]
  27928. [indexterm2 boost_asio.indexterm.buffered_read_stream.next_layer_type..next_layer_type..buffered_read_stream]
  27929. The type of the next layer.
  27930. typedef remove_reference< Stream >::type next_layer_type;
  27931. [heading Requirements]
  27932. ['Header: ][^boost/asio/buffered_read_stream.hpp]
  27933. ['Convenience header: ][^boost/asio.hpp]
  27934. [endsect]
  27935. [section:peek buffered_read_stream::peek]
  27936. [indexterm2 boost_asio.indexterm.buffered_read_stream.peek..peek..buffered_read_stream]
  27937. Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
  27938. template<
  27939. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  27940. std::size_t ``[link boost_asio.reference.buffered_read_stream.peek.overload1 peek]``(
  27941. const MutableBufferSequence & buffers);
  27942. `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.peek.overload1 more...]]``
  27943. Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred.
  27944. template<
  27945. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  27946. std::size_t ``[link boost_asio.reference.buffered_read_stream.peek.overload2 peek]``(
  27947. const MutableBufferSequence & buffers,
  27948. boost::system::error_code & ec);
  27949. `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.peek.overload2 more...]]``
  27950. [section:overload1 buffered_read_stream::peek (1 of 2 overloads)]
  27951. Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
  27952. template<
  27953. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  27954. std::size_t peek(
  27955. const MutableBufferSequence & buffers);
  27956. [endsect]
  27957. [section:overload2 buffered_read_stream::peek (2 of 2 overloads)]
  27958. Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred.
  27959. template<
  27960. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  27961. std::size_t peek(
  27962. const MutableBufferSequence & buffers,
  27963. boost::system::error_code & ec);
  27964. [endsect]
  27965. [endsect]
  27966. [section:read_some buffered_read_stream::read_some]
  27967. [indexterm2 boost_asio.indexterm.buffered_read_stream.read_some..read_some..buffered_read_stream]
  27968. Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
  27969. template<
  27970. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  27971. std::size_t ``[link boost_asio.reference.buffered_read_stream.read_some.overload1 read_some]``(
  27972. const MutableBufferSequence & buffers);
  27973. `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.read_some.overload1 more...]]``
  27974. Read some data from the stream. Returns the number of bytes read or 0 if an error occurred.
  27975. template<
  27976. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  27977. std::size_t ``[link boost_asio.reference.buffered_read_stream.read_some.overload2 read_some]``(
  27978. const MutableBufferSequence & buffers,
  27979. boost::system::error_code & ec);
  27980. `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.read_some.overload2 more...]]``
  27981. [section:overload1 buffered_read_stream::read_some (1 of 2 overloads)]
  27982. Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
  27983. template<
  27984. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  27985. std::size_t read_some(
  27986. const MutableBufferSequence & buffers);
  27987. [endsect]
  27988. [section:overload2 buffered_read_stream::read_some (2 of 2 overloads)]
  27989. Read some data from the stream. Returns the number of bytes read or 0 if an error occurred.
  27990. template<
  27991. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  27992. std::size_t read_some(
  27993. const MutableBufferSequence & buffers,
  27994. boost::system::error_code & ec);
  27995. [endsect]
  27996. [endsect]
  27997. [section:write_some buffered_read_stream::write_some]
  27998. [indexterm2 boost_asio.indexterm.buffered_read_stream.write_some..write_some..buffered_read_stream]
  27999. Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
  28000. template<
  28001. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  28002. std::size_t ``[link boost_asio.reference.buffered_read_stream.write_some.overload1 write_some]``(
  28003. const ConstBufferSequence & buffers);
  28004. `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.write_some.overload1 more...]]``
  28005. Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred.
  28006. template<
  28007. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  28008. std::size_t ``[link boost_asio.reference.buffered_read_stream.write_some.overload2 write_some]``(
  28009. const ConstBufferSequence & buffers,
  28010. boost::system::error_code & ec);
  28011. `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.write_some.overload2 more...]]``
  28012. [section:overload1 buffered_read_stream::write_some (1 of 2 overloads)]
  28013. Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
  28014. template<
  28015. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  28016. std::size_t write_some(
  28017. const ConstBufferSequence & buffers);
  28018. [endsect]
  28019. [section:overload2 buffered_read_stream::write_some (2 of 2 overloads)]
  28020. Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred.
  28021. template<
  28022. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  28023. std::size_t write_some(
  28024. const ConstBufferSequence & buffers,
  28025. boost::system::error_code & ec);
  28026. [endsect]
  28027. [endsect]
  28028. [endsect]
  28029. [section:buffered_stream buffered_stream]
  28030. Adds buffering to the read- and write-related operations of a stream.
  28031. template<
  28032. typename Stream>
  28033. class buffered_stream :
  28034. noncopyable
  28035. [heading Types]
  28036. [table
  28037. [[Name][Description]]
  28038. [
  28039. [[link boost_asio.reference.buffered_stream.executor_type [*executor_type]]]
  28040. [The type of the executor associated with the object. ]
  28041. ]
  28042. [
  28043. [[link boost_asio.reference.buffered_stream.lowest_layer_type [*lowest_layer_type]]]
  28044. [The type of the lowest layer. ]
  28045. ]
  28046. [
  28047. [[link boost_asio.reference.buffered_stream.next_layer_type [*next_layer_type]]]
  28048. [The type of the next layer. ]
  28049. ]
  28050. ]
  28051. [heading Member Functions]
  28052. [table
  28053. [[Name][Description]]
  28054. [
  28055. [[link boost_asio.reference.buffered_stream.async_fill [*async_fill]]]
  28056. [Start an asynchronous fill. ]
  28057. ]
  28058. [
  28059. [[link boost_asio.reference.buffered_stream.async_flush [*async_flush]]]
  28060. [Start an asynchronous flush. ]
  28061. ]
  28062. [
  28063. [[link boost_asio.reference.buffered_stream.async_read_some [*async_read_some]]]
  28064. [Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation. ]
  28065. ]
  28066. [
  28067. [[link boost_asio.reference.buffered_stream.async_write_some [*async_write_some]]]
  28068. [Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation. ]
  28069. ]
  28070. [
  28071. [[link boost_asio.reference.buffered_stream.buffered_stream [*buffered_stream]]]
  28072. [Construct, passing the specified argument to initialise the next layer. ]
  28073. ]
  28074. [
  28075. [[link boost_asio.reference.buffered_stream.close [*close]]]
  28076. [Close the stream. ]
  28077. ]
  28078. [
  28079. [[link boost_asio.reference.buffered_stream.fill [*fill]]]
  28080. [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.
  28081. [hr]
  28082. 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. ]
  28083. ]
  28084. [
  28085. [[link boost_asio.reference.buffered_stream.flush [*flush]]]
  28086. [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.
  28087. [hr]
  28088. 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. ]
  28089. ]
  28090. [
  28091. [[link boost_asio.reference.buffered_stream.get_executor [*get_executor]]]
  28092. [Get the executor associated with the object. ]
  28093. ]
  28094. [
  28095. [[link boost_asio.reference.buffered_stream.in_avail [*in_avail]]]
  28096. [Determine the amount of data that may be read without blocking. ]
  28097. ]
  28098. [
  28099. [[link boost_asio.reference.buffered_stream.lowest_layer [*lowest_layer]]]
  28100. [Get a reference to the lowest layer.
  28101. [hr]
  28102. Get a const reference to the lowest layer. ]
  28103. ]
  28104. [
  28105. [[link boost_asio.reference.buffered_stream.next_layer [*next_layer]]]
  28106. [Get a reference to the next layer. ]
  28107. ]
  28108. [
  28109. [[link boost_asio.reference.buffered_stream.peek [*peek]]]
  28110. [Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
  28111. [hr]
  28112. Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred. ]
  28113. ]
  28114. [
  28115. [[link boost_asio.reference.buffered_stream.read_some [*read_some]]]
  28116. [Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
  28117. [hr]
  28118. Read some data from the stream. Returns the number of bytes read or 0 if an error occurred. ]
  28119. ]
  28120. [
  28121. [[link boost_asio.reference.buffered_stream.write_some [*write_some]]]
  28122. [Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
  28123. [hr]
  28124. Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred. ]
  28125. ]
  28126. ]
  28127. The [link boost_asio.reference.buffered_stream `buffered_stream`] class template can be used to add buffering to the synchronous and asynchronous read and write operations of a stream.
  28128. [heading Thread Safety]
  28129. ['Distinct] ['objects:] Safe.
  28130. ['Shared] ['objects:] Unsafe.
  28131. [heading Requirements]
  28132. ['Header: ][^boost/asio/buffered_stream.hpp]
  28133. ['Convenience header: ][^boost/asio.hpp]
  28134. [section:async_fill buffered_stream::async_fill]
  28135. [indexterm2 boost_asio.indexterm.buffered_stream.async_fill..async_fill..buffered_stream]
  28136. Start an asynchronous fill.
  28137. template<
  28138. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  28139. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_fill(
  28140. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  28141. [endsect]
  28142. [section:async_flush buffered_stream::async_flush]
  28143. [indexterm2 boost_asio.indexterm.buffered_stream.async_flush..async_flush..buffered_stream]
  28144. Start an asynchronous flush.
  28145. template<
  28146. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  28147. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_flush(
  28148. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  28149. [endsect]
  28150. [section:async_read_some buffered_stream::async_read_some]
  28151. [indexterm2 boost_asio.indexterm.buffered_stream.async_read_some..async_read_some..buffered_stream]
  28152. Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation.
  28153. template<
  28154. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  28155. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  28156. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_some(
  28157. const MutableBufferSequence & buffers,
  28158. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  28159. [endsect]
  28160. [section:async_write_some buffered_stream::async_write_some]
  28161. [indexterm2 boost_asio.indexterm.buffered_stream.async_write_some..async_write_some..buffered_stream]
  28162. Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation.
  28163. template<
  28164. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  28165. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  28166. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_some(
  28167. const ConstBufferSequence & buffers,
  28168. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  28169. [endsect]
  28170. [section:buffered_stream buffered_stream::buffered_stream]
  28171. [indexterm2 boost_asio.indexterm.buffered_stream.buffered_stream..buffered_stream..buffered_stream]
  28172. Construct, passing the specified argument to initialise the next layer.
  28173. template<
  28174. typename Arg>
  28175. explicit ``[link boost_asio.reference.buffered_stream.buffered_stream.overload1 buffered_stream]``(
  28176. Arg & a);
  28177. `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.buffered_stream.overload1 more...]]``
  28178. template<
  28179. typename Arg>
  28180. explicit ``[link boost_asio.reference.buffered_stream.buffered_stream.overload2 buffered_stream]``(
  28181. Arg & a,
  28182. std::size_t read_buffer_size,
  28183. std::size_t write_buffer_size);
  28184. `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.buffered_stream.overload2 more...]]``
  28185. [section:overload1 buffered_stream::buffered_stream (1 of 2 overloads)]
  28186. Construct, passing the specified argument to initialise the next layer.
  28187. template<
  28188. typename Arg>
  28189. buffered_stream(
  28190. Arg & a);
  28191. [endsect]
  28192. [section:overload2 buffered_stream::buffered_stream (2 of 2 overloads)]
  28193. Construct, passing the specified argument to initialise the next layer.
  28194. template<
  28195. typename Arg>
  28196. buffered_stream(
  28197. Arg & a,
  28198. std::size_t read_buffer_size,
  28199. std::size_t write_buffer_size);
  28200. [endsect]
  28201. [endsect]
  28202. [section:close buffered_stream::close]
  28203. [indexterm2 boost_asio.indexterm.buffered_stream.close..close..buffered_stream]
  28204. Close the stream.
  28205. void ``[link boost_asio.reference.buffered_stream.close.overload1 close]``();
  28206. `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.close.overload1 more...]]``
  28207. void ``[link boost_asio.reference.buffered_stream.close.overload2 close]``(
  28208. boost::system::error_code & ec);
  28209. `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.close.overload2 more...]]``
  28210. [section:overload1 buffered_stream::close (1 of 2 overloads)]
  28211. Close the stream.
  28212. void close();
  28213. [endsect]
  28214. [section:overload2 buffered_stream::close (2 of 2 overloads)]
  28215. Close the stream.
  28216. void close(
  28217. boost::system::error_code & ec);
  28218. [endsect]
  28219. [endsect]
  28220. [section:executor_type buffered_stream::executor_type]
  28221. [indexterm2 boost_asio.indexterm.buffered_stream.executor_type..executor_type..buffered_stream]
  28222. The type of the executor associated with the object.
  28223. typedef lowest_layer_type::executor_type executor_type;
  28224. [heading Requirements]
  28225. ['Header: ][^boost/asio/buffered_stream.hpp]
  28226. ['Convenience header: ][^boost/asio.hpp]
  28227. [endsect]
  28228. [section:fill buffered_stream::fill]
  28229. [indexterm2 boost_asio.indexterm.buffered_stream.fill..fill..buffered_stream]
  28230. 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.
  28231. std::size_t ``[link boost_asio.reference.buffered_stream.fill.overload1 fill]``();
  28232. `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.fill.overload1 more...]]``
  28233. 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.
  28234. std::size_t ``[link boost_asio.reference.buffered_stream.fill.overload2 fill]``(
  28235. boost::system::error_code & ec);
  28236. `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.fill.overload2 more...]]``
  28237. [section:overload1 buffered_stream::fill (1 of 2 overloads)]
  28238. 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.
  28239. std::size_t fill();
  28240. [endsect]
  28241. [section:overload2 buffered_stream::fill (2 of 2 overloads)]
  28242. 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.
  28243. std::size_t fill(
  28244. boost::system::error_code & ec);
  28245. [endsect]
  28246. [endsect]
  28247. [section:flush buffered_stream::flush]
  28248. [indexterm2 boost_asio.indexterm.buffered_stream.flush..flush..buffered_stream]
  28249. 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.
  28250. std::size_t ``[link boost_asio.reference.buffered_stream.flush.overload1 flush]``();
  28251. `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.flush.overload1 more...]]``
  28252. 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.
  28253. std::size_t ``[link boost_asio.reference.buffered_stream.flush.overload2 flush]``(
  28254. boost::system::error_code & ec);
  28255. `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.flush.overload2 more...]]``
  28256. [section:overload1 buffered_stream::flush (1 of 2 overloads)]
  28257. 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.
  28258. std::size_t flush();
  28259. [endsect]
  28260. [section:overload2 buffered_stream::flush (2 of 2 overloads)]
  28261. 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.
  28262. std::size_t flush(
  28263. boost::system::error_code & ec);
  28264. [endsect]
  28265. [endsect]
  28266. [section:get_executor buffered_stream::get_executor]
  28267. [indexterm2 boost_asio.indexterm.buffered_stream.get_executor..get_executor..buffered_stream]
  28268. Get the executor associated with the object.
  28269. executor_type get_executor();
  28270. [endsect]
  28271. [section:in_avail buffered_stream::in_avail]
  28272. [indexterm2 boost_asio.indexterm.buffered_stream.in_avail..in_avail..buffered_stream]
  28273. Determine the amount of data that may be read without blocking.
  28274. std::size_t ``[link boost_asio.reference.buffered_stream.in_avail.overload1 in_avail]``();
  28275. `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.in_avail.overload1 more...]]``
  28276. std::size_t ``[link boost_asio.reference.buffered_stream.in_avail.overload2 in_avail]``(
  28277. boost::system::error_code & ec);
  28278. `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.in_avail.overload2 more...]]``
  28279. [section:overload1 buffered_stream::in_avail (1 of 2 overloads)]
  28280. Determine the amount of data that may be read without blocking.
  28281. std::size_t in_avail();
  28282. [endsect]
  28283. [section:overload2 buffered_stream::in_avail (2 of 2 overloads)]
  28284. Determine the amount of data that may be read without blocking.
  28285. std::size_t in_avail(
  28286. boost::system::error_code & ec);
  28287. [endsect]
  28288. [endsect]
  28289. [section:lowest_layer buffered_stream::lowest_layer]
  28290. [indexterm2 boost_asio.indexterm.buffered_stream.lowest_layer..lowest_layer..buffered_stream]
  28291. Get a reference to the lowest layer.
  28292. lowest_layer_type & ``[link boost_asio.reference.buffered_stream.lowest_layer.overload1 lowest_layer]``();
  28293. `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.lowest_layer.overload1 more...]]``
  28294. Get a const reference to the lowest layer.
  28295. const lowest_layer_type & ``[link boost_asio.reference.buffered_stream.lowest_layer.overload2 lowest_layer]``() const;
  28296. `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.lowest_layer.overload2 more...]]``
  28297. [section:overload1 buffered_stream::lowest_layer (1 of 2 overloads)]
  28298. Get a reference to the lowest layer.
  28299. lowest_layer_type & lowest_layer();
  28300. [endsect]
  28301. [section:overload2 buffered_stream::lowest_layer (2 of 2 overloads)]
  28302. Get a const reference to the lowest layer.
  28303. const lowest_layer_type & lowest_layer() const;
  28304. [endsect]
  28305. [endsect]
  28306. [section:lowest_layer_type buffered_stream::lowest_layer_type]
  28307. [indexterm2 boost_asio.indexterm.buffered_stream.lowest_layer_type..lowest_layer_type..buffered_stream]
  28308. The type of the lowest layer.
  28309. typedef next_layer_type::lowest_layer_type lowest_layer_type;
  28310. [heading Requirements]
  28311. ['Header: ][^boost/asio/buffered_stream.hpp]
  28312. ['Convenience header: ][^boost/asio.hpp]
  28313. [endsect]
  28314. [section:next_layer buffered_stream::next_layer]
  28315. [indexterm2 boost_asio.indexterm.buffered_stream.next_layer..next_layer..buffered_stream]
  28316. Get a reference to the next layer.
  28317. next_layer_type & next_layer();
  28318. [endsect]
  28319. [section:next_layer_type buffered_stream::next_layer_type]
  28320. [indexterm2 boost_asio.indexterm.buffered_stream.next_layer_type..next_layer_type..buffered_stream]
  28321. The type of the next layer.
  28322. typedef remove_reference< Stream >::type next_layer_type;
  28323. [heading Requirements]
  28324. ['Header: ][^boost/asio/buffered_stream.hpp]
  28325. ['Convenience header: ][^boost/asio.hpp]
  28326. [endsect]
  28327. [section:peek buffered_stream::peek]
  28328. [indexterm2 boost_asio.indexterm.buffered_stream.peek..peek..buffered_stream]
  28329. Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
  28330. template<
  28331. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  28332. std::size_t ``[link boost_asio.reference.buffered_stream.peek.overload1 peek]``(
  28333. const MutableBufferSequence & buffers);
  28334. `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.peek.overload1 more...]]``
  28335. Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred.
  28336. template<
  28337. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  28338. std::size_t ``[link boost_asio.reference.buffered_stream.peek.overload2 peek]``(
  28339. const MutableBufferSequence & buffers,
  28340. boost::system::error_code & ec);
  28341. `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.peek.overload2 more...]]``
  28342. [section:overload1 buffered_stream::peek (1 of 2 overloads)]
  28343. Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
  28344. template<
  28345. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  28346. std::size_t peek(
  28347. const MutableBufferSequence & buffers);
  28348. [endsect]
  28349. [section:overload2 buffered_stream::peek (2 of 2 overloads)]
  28350. Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred.
  28351. template<
  28352. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  28353. std::size_t peek(
  28354. const MutableBufferSequence & buffers,
  28355. boost::system::error_code & ec);
  28356. [endsect]
  28357. [endsect]
  28358. [section:read_some buffered_stream::read_some]
  28359. [indexterm2 boost_asio.indexterm.buffered_stream.read_some..read_some..buffered_stream]
  28360. Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
  28361. template<
  28362. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  28363. std::size_t ``[link boost_asio.reference.buffered_stream.read_some.overload1 read_some]``(
  28364. const MutableBufferSequence & buffers);
  28365. `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.read_some.overload1 more...]]``
  28366. Read some data from the stream. Returns the number of bytes read or 0 if an error occurred.
  28367. template<
  28368. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  28369. std::size_t ``[link boost_asio.reference.buffered_stream.read_some.overload2 read_some]``(
  28370. const MutableBufferSequence & buffers,
  28371. boost::system::error_code & ec);
  28372. `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.read_some.overload2 more...]]``
  28373. [section:overload1 buffered_stream::read_some (1 of 2 overloads)]
  28374. Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
  28375. template<
  28376. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  28377. std::size_t read_some(
  28378. const MutableBufferSequence & buffers);
  28379. [endsect]
  28380. [section:overload2 buffered_stream::read_some (2 of 2 overloads)]
  28381. Read some data from the stream. Returns the number of bytes read or 0 if an error occurred.
  28382. template<
  28383. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  28384. std::size_t read_some(
  28385. const MutableBufferSequence & buffers,
  28386. boost::system::error_code & ec);
  28387. [endsect]
  28388. [endsect]
  28389. [section:write_some buffered_stream::write_some]
  28390. [indexterm2 boost_asio.indexterm.buffered_stream.write_some..write_some..buffered_stream]
  28391. Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
  28392. template<
  28393. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  28394. std::size_t ``[link boost_asio.reference.buffered_stream.write_some.overload1 write_some]``(
  28395. const ConstBufferSequence & buffers);
  28396. `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.write_some.overload1 more...]]``
  28397. Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred.
  28398. template<
  28399. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  28400. std::size_t ``[link boost_asio.reference.buffered_stream.write_some.overload2 write_some]``(
  28401. const ConstBufferSequence & buffers,
  28402. boost::system::error_code & ec);
  28403. `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.write_some.overload2 more...]]``
  28404. [section:overload1 buffered_stream::write_some (1 of 2 overloads)]
  28405. Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
  28406. template<
  28407. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  28408. std::size_t write_some(
  28409. const ConstBufferSequence & buffers);
  28410. [endsect]
  28411. [section:overload2 buffered_stream::write_some (2 of 2 overloads)]
  28412. Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred.
  28413. template<
  28414. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  28415. std::size_t write_some(
  28416. const ConstBufferSequence & buffers,
  28417. boost::system::error_code & ec);
  28418. [endsect]
  28419. [endsect]
  28420. [endsect]
  28421. [section:buffered_write_stream buffered_write_stream]
  28422. Adds buffering to the write-related operations of a stream.
  28423. template<
  28424. typename Stream>
  28425. class buffered_write_stream :
  28426. noncopyable
  28427. [heading Types]
  28428. [table
  28429. [[Name][Description]]
  28430. [
  28431. [[link boost_asio.reference.buffered_write_stream.executor_type [*executor_type]]]
  28432. [The type of the executor associated with the object. ]
  28433. ]
  28434. [
  28435. [[link boost_asio.reference.buffered_write_stream.lowest_layer_type [*lowest_layer_type]]]
  28436. [The type of the lowest layer. ]
  28437. ]
  28438. [
  28439. [[link boost_asio.reference.buffered_write_stream.next_layer_type [*next_layer_type]]]
  28440. [The type of the next layer. ]
  28441. ]
  28442. ]
  28443. [heading Member Functions]
  28444. [table
  28445. [[Name][Description]]
  28446. [
  28447. [[link boost_asio.reference.buffered_write_stream.async_flush [*async_flush]]]
  28448. [Start an asynchronous flush. ]
  28449. ]
  28450. [
  28451. [[link boost_asio.reference.buffered_write_stream.async_read_some [*async_read_some]]]
  28452. [Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation. ]
  28453. ]
  28454. [
  28455. [[link boost_asio.reference.buffered_write_stream.async_write_some [*async_write_some]]]
  28456. [Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation. ]
  28457. ]
  28458. [
  28459. [[link boost_asio.reference.buffered_write_stream.buffered_write_stream [*buffered_write_stream]]]
  28460. [Construct, passing the specified argument to initialise the next layer. ]
  28461. ]
  28462. [
  28463. [[link boost_asio.reference.buffered_write_stream.close [*close]]]
  28464. [Close the stream. ]
  28465. ]
  28466. [
  28467. [[link boost_asio.reference.buffered_write_stream.flush [*flush]]]
  28468. [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.
  28469. [hr]
  28470. 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. ]
  28471. ]
  28472. [
  28473. [[link boost_asio.reference.buffered_write_stream.get_executor [*get_executor]]]
  28474. [Get the executor associated with the object. ]
  28475. ]
  28476. [
  28477. [[link boost_asio.reference.buffered_write_stream.in_avail [*in_avail]]]
  28478. [Determine the amount of data that may be read without blocking. ]
  28479. ]
  28480. [
  28481. [[link boost_asio.reference.buffered_write_stream.lowest_layer [*lowest_layer]]]
  28482. [Get a reference to the lowest layer.
  28483. [hr]
  28484. Get a const reference to the lowest layer. ]
  28485. ]
  28486. [
  28487. [[link boost_asio.reference.buffered_write_stream.next_layer [*next_layer]]]
  28488. [Get a reference to the next layer. ]
  28489. ]
  28490. [
  28491. [[link boost_asio.reference.buffered_write_stream.peek [*peek]]]
  28492. [Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
  28493. [hr]
  28494. Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred. ]
  28495. ]
  28496. [
  28497. [[link boost_asio.reference.buffered_write_stream.read_some [*read_some]]]
  28498. [Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
  28499. [hr]
  28500. Read some data from the stream. Returns the number of bytes read or 0 if an error occurred. ]
  28501. ]
  28502. [
  28503. [[link boost_asio.reference.buffered_write_stream.write_some [*write_some]]]
  28504. [Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
  28505. [hr]
  28506. 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. ]
  28507. ]
  28508. ]
  28509. [heading Data Members]
  28510. [table
  28511. [[Name][Description]]
  28512. [
  28513. [[link boost_asio.reference.buffered_write_stream.default_buffer_size [*default_buffer_size]]]
  28514. [The default buffer size. ]
  28515. ]
  28516. ]
  28517. The [link boost_asio.reference.buffered_write_stream `buffered_write_stream`] class template can be used to add buffering to the synchronous and asynchronous write operations of a stream.
  28518. [heading Thread Safety]
  28519. ['Distinct] ['objects:] Safe.
  28520. ['Shared] ['objects:] Unsafe.
  28521. [heading Requirements]
  28522. ['Header: ][^boost/asio/buffered_write_stream.hpp]
  28523. ['Convenience header: ][^boost/asio.hpp]
  28524. [section:async_flush buffered_write_stream::async_flush]
  28525. [indexterm2 boost_asio.indexterm.buffered_write_stream.async_flush..async_flush..buffered_write_stream]
  28526. Start an asynchronous flush.
  28527. template<
  28528. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  28529. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_flush(
  28530. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  28531. [endsect]
  28532. [section:async_read_some buffered_write_stream::async_read_some]
  28533. [indexterm2 boost_asio.indexterm.buffered_write_stream.async_read_some..async_read_some..buffered_write_stream]
  28534. Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation.
  28535. template<
  28536. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  28537. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  28538. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_some(
  28539. const MutableBufferSequence & buffers,
  28540. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  28541. [endsect]
  28542. [section:async_write_some buffered_write_stream::async_write_some]
  28543. [indexterm2 boost_asio.indexterm.buffered_write_stream.async_write_some..async_write_some..buffered_write_stream]
  28544. Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation.
  28545. template<
  28546. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  28547. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  28548. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_some(
  28549. const ConstBufferSequence & buffers,
  28550. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  28551. [endsect]
  28552. [section:buffered_write_stream buffered_write_stream::buffered_write_stream]
  28553. [indexterm2 boost_asio.indexterm.buffered_write_stream.buffered_write_stream..buffered_write_stream..buffered_write_stream]
  28554. Construct, passing the specified argument to initialise the next layer.
  28555. template<
  28556. typename Arg>
  28557. explicit ``[link boost_asio.reference.buffered_write_stream.buffered_write_stream.overload1 buffered_write_stream]``(
  28558. Arg & a);
  28559. `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.buffered_write_stream.overload1 more...]]``
  28560. template<
  28561. typename Arg>
  28562. ``[link boost_asio.reference.buffered_write_stream.buffered_write_stream.overload2 buffered_write_stream]``(
  28563. Arg & a,
  28564. std::size_t buffer_size);
  28565. `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.buffered_write_stream.overload2 more...]]``
  28566. [section:overload1 buffered_write_stream::buffered_write_stream (1 of 2 overloads)]
  28567. Construct, passing the specified argument to initialise the next layer.
  28568. template<
  28569. typename Arg>
  28570. buffered_write_stream(
  28571. Arg & a);
  28572. [endsect]
  28573. [section:overload2 buffered_write_stream::buffered_write_stream (2 of 2 overloads)]
  28574. Construct, passing the specified argument to initialise the next layer.
  28575. template<
  28576. typename Arg>
  28577. buffered_write_stream(
  28578. Arg & a,
  28579. std::size_t buffer_size);
  28580. [endsect]
  28581. [endsect]
  28582. [section:close buffered_write_stream::close]
  28583. [indexterm2 boost_asio.indexterm.buffered_write_stream.close..close..buffered_write_stream]
  28584. Close the stream.
  28585. void ``[link boost_asio.reference.buffered_write_stream.close.overload1 close]``();
  28586. `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.close.overload1 more...]]``
  28587. void ``[link boost_asio.reference.buffered_write_stream.close.overload2 close]``(
  28588. boost::system::error_code & ec);
  28589. `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.close.overload2 more...]]``
  28590. [section:overload1 buffered_write_stream::close (1 of 2 overloads)]
  28591. Close the stream.
  28592. void close();
  28593. [endsect]
  28594. [section:overload2 buffered_write_stream::close (2 of 2 overloads)]
  28595. Close the stream.
  28596. void close(
  28597. boost::system::error_code & ec);
  28598. [endsect]
  28599. [endsect]
  28600. [section:default_buffer_size buffered_write_stream::default_buffer_size]
  28601. [indexterm2 boost_asio.indexterm.buffered_write_stream.default_buffer_size..default_buffer_size..buffered_write_stream]
  28602. The default buffer size.
  28603. static const std::size_t default_buffer_size = implementation_defined;
  28604. [endsect]
  28605. [section:executor_type buffered_write_stream::executor_type]
  28606. [indexterm2 boost_asio.indexterm.buffered_write_stream.executor_type..executor_type..buffered_write_stream]
  28607. The type of the executor associated with the object.
  28608. typedef lowest_layer_type::executor_type executor_type;
  28609. [heading Requirements]
  28610. ['Header: ][^boost/asio/buffered_write_stream.hpp]
  28611. ['Convenience header: ][^boost/asio.hpp]
  28612. [endsect]
  28613. [section:flush buffered_write_stream::flush]
  28614. [indexterm2 boost_asio.indexterm.buffered_write_stream.flush..flush..buffered_write_stream]
  28615. 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.
  28616. std::size_t ``[link boost_asio.reference.buffered_write_stream.flush.overload1 flush]``();
  28617. `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.flush.overload1 more...]]``
  28618. 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.
  28619. std::size_t ``[link boost_asio.reference.buffered_write_stream.flush.overload2 flush]``(
  28620. boost::system::error_code & ec);
  28621. `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.flush.overload2 more...]]``
  28622. [section:overload1 buffered_write_stream::flush (1 of 2 overloads)]
  28623. 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.
  28624. std::size_t flush();
  28625. [endsect]
  28626. [section:overload2 buffered_write_stream::flush (2 of 2 overloads)]
  28627. 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.
  28628. std::size_t flush(
  28629. boost::system::error_code & ec);
  28630. [endsect]
  28631. [endsect]
  28632. [section:get_executor buffered_write_stream::get_executor]
  28633. [indexterm2 boost_asio.indexterm.buffered_write_stream.get_executor..get_executor..buffered_write_stream]
  28634. Get the executor associated with the object.
  28635. executor_type get_executor();
  28636. [endsect]
  28637. [section:in_avail buffered_write_stream::in_avail]
  28638. [indexterm2 boost_asio.indexterm.buffered_write_stream.in_avail..in_avail..buffered_write_stream]
  28639. Determine the amount of data that may be read without blocking.
  28640. std::size_t ``[link boost_asio.reference.buffered_write_stream.in_avail.overload1 in_avail]``();
  28641. `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.in_avail.overload1 more...]]``
  28642. std::size_t ``[link boost_asio.reference.buffered_write_stream.in_avail.overload2 in_avail]``(
  28643. boost::system::error_code & ec);
  28644. `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.in_avail.overload2 more...]]``
  28645. [section:overload1 buffered_write_stream::in_avail (1 of 2 overloads)]
  28646. Determine the amount of data that may be read without blocking.
  28647. std::size_t in_avail();
  28648. [endsect]
  28649. [section:overload2 buffered_write_stream::in_avail (2 of 2 overloads)]
  28650. Determine the amount of data that may be read without blocking.
  28651. std::size_t in_avail(
  28652. boost::system::error_code & ec);
  28653. [endsect]
  28654. [endsect]
  28655. [section:lowest_layer buffered_write_stream::lowest_layer]
  28656. [indexterm2 boost_asio.indexterm.buffered_write_stream.lowest_layer..lowest_layer..buffered_write_stream]
  28657. Get a reference to the lowest layer.
  28658. lowest_layer_type & ``[link boost_asio.reference.buffered_write_stream.lowest_layer.overload1 lowest_layer]``();
  28659. `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.lowest_layer.overload1 more...]]``
  28660. Get a const reference to the lowest layer.
  28661. const lowest_layer_type & ``[link boost_asio.reference.buffered_write_stream.lowest_layer.overload2 lowest_layer]``() const;
  28662. `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.lowest_layer.overload2 more...]]``
  28663. [section:overload1 buffered_write_stream::lowest_layer (1 of 2 overloads)]
  28664. Get a reference to the lowest layer.
  28665. lowest_layer_type & lowest_layer();
  28666. [endsect]
  28667. [section:overload2 buffered_write_stream::lowest_layer (2 of 2 overloads)]
  28668. Get a const reference to the lowest layer.
  28669. const lowest_layer_type & lowest_layer() const;
  28670. [endsect]
  28671. [endsect]
  28672. [section:lowest_layer_type buffered_write_stream::lowest_layer_type]
  28673. [indexterm2 boost_asio.indexterm.buffered_write_stream.lowest_layer_type..lowest_layer_type..buffered_write_stream]
  28674. The type of the lowest layer.
  28675. typedef next_layer_type::lowest_layer_type lowest_layer_type;
  28676. [heading Requirements]
  28677. ['Header: ][^boost/asio/buffered_write_stream.hpp]
  28678. ['Convenience header: ][^boost/asio.hpp]
  28679. [endsect]
  28680. [section:next_layer buffered_write_stream::next_layer]
  28681. [indexterm2 boost_asio.indexterm.buffered_write_stream.next_layer..next_layer..buffered_write_stream]
  28682. Get a reference to the next layer.
  28683. next_layer_type & next_layer();
  28684. [endsect]
  28685. [section:next_layer_type buffered_write_stream::next_layer_type]
  28686. [indexterm2 boost_asio.indexterm.buffered_write_stream.next_layer_type..next_layer_type..buffered_write_stream]
  28687. The type of the next layer.
  28688. typedef remove_reference< Stream >::type next_layer_type;
  28689. [heading Requirements]
  28690. ['Header: ][^boost/asio/buffered_write_stream.hpp]
  28691. ['Convenience header: ][^boost/asio.hpp]
  28692. [endsect]
  28693. [section:peek buffered_write_stream::peek]
  28694. [indexterm2 boost_asio.indexterm.buffered_write_stream.peek..peek..buffered_write_stream]
  28695. Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
  28696. template<
  28697. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  28698. std::size_t ``[link boost_asio.reference.buffered_write_stream.peek.overload1 peek]``(
  28699. const MutableBufferSequence & buffers);
  28700. `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.peek.overload1 more...]]``
  28701. Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred.
  28702. template<
  28703. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  28704. std::size_t ``[link boost_asio.reference.buffered_write_stream.peek.overload2 peek]``(
  28705. const MutableBufferSequence & buffers,
  28706. boost::system::error_code & ec);
  28707. `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.peek.overload2 more...]]``
  28708. [section:overload1 buffered_write_stream::peek (1 of 2 overloads)]
  28709. Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
  28710. template<
  28711. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  28712. std::size_t peek(
  28713. const MutableBufferSequence & buffers);
  28714. [endsect]
  28715. [section:overload2 buffered_write_stream::peek (2 of 2 overloads)]
  28716. Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred.
  28717. template<
  28718. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  28719. std::size_t peek(
  28720. const MutableBufferSequence & buffers,
  28721. boost::system::error_code & ec);
  28722. [endsect]
  28723. [endsect]
  28724. [section:read_some buffered_write_stream::read_some]
  28725. [indexterm2 boost_asio.indexterm.buffered_write_stream.read_some..read_some..buffered_write_stream]
  28726. Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
  28727. template<
  28728. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  28729. std::size_t ``[link boost_asio.reference.buffered_write_stream.read_some.overload1 read_some]``(
  28730. const MutableBufferSequence & buffers);
  28731. `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.read_some.overload1 more...]]``
  28732. Read some data from the stream. Returns the number of bytes read or 0 if an error occurred.
  28733. template<
  28734. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  28735. std::size_t ``[link boost_asio.reference.buffered_write_stream.read_some.overload2 read_some]``(
  28736. const MutableBufferSequence & buffers,
  28737. boost::system::error_code & ec);
  28738. `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.read_some.overload2 more...]]``
  28739. [section:overload1 buffered_write_stream::read_some (1 of 2 overloads)]
  28740. Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
  28741. template<
  28742. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  28743. std::size_t read_some(
  28744. const MutableBufferSequence & buffers);
  28745. [endsect]
  28746. [section:overload2 buffered_write_stream::read_some (2 of 2 overloads)]
  28747. Read some data from the stream. Returns the number of bytes read or 0 if an error occurred.
  28748. template<
  28749. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  28750. std::size_t read_some(
  28751. const MutableBufferSequence & buffers,
  28752. boost::system::error_code & ec);
  28753. [endsect]
  28754. [endsect]
  28755. [section:write_some buffered_write_stream::write_some]
  28756. [indexterm2 boost_asio.indexterm.buffered_write_stream.write_some..write_some..buffered_write_stream]
  28757. Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
  28758. template<
  28759. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  28760. std::size_t ``[link boost_asio.reference.buffered_write_stream.write_some.overload1 write_some]``(
  28761. const ConstBufferSequence & buffers);
  28762. `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.write_some.overload1 more...]]``
  28763. 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.
  28764. template<
  28765. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  28766. std::size_t ``[link boost_asio.reference.buffered_write_stream.write_some.overload2 write_some]``(
  28767. const ConstBufferSequence & buffers,
  28768. boost::system::error_code & ec);
  28769. `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.write_some.overload2 more...]]``
  28770. [section:overload1 buffered_write_stream::write_some (1 of 2 overloads)]
  28771. Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
  28772. template<
  28773. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  28774. std::size_t write_some(
  28775. const ConstBufferSequence & buffers);
  28776. [endsect]
  28777. [section:overload2 buffered_write_stream::write_some (2 of 2 overloads)]
  28778. 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.
  28779. template<
  28780. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  28781. std::size_t write_some(
  28782. const ConstBufferSequence & buffers,
  28783. boost::system::error_code & ec);
  28784. [endsect]
  28785. [endsect]
  28786. [endsect]
  28787. [section:buffers_begin buffers_begin]
  28788. [indexterm1 boost_asio.indexterm.buffers_begin..buffers_begin]
  28789. Construct an iterator representing the beginning of the buffers' data.
  28790. template<
  28791. typename BufferSequence>
  28792. buffers_iterator< BufferSequence > buffers_begin(
  28793. const BufferSequence & buffers);
  28794. [heading Requirements]
  28795. ['Header: ][^boost/asio/buffers_iterator.hpp]
  28796. ['Convenience header: ][^boost/asio.hpp]
  28797. [endsect]
  28798. [section:buffers_end buffers_end]
  28799. [indexterm1 boost_asio.indexterm.buffers_end..buffers_end]
  28800. Construct an iterator representing the end of the buffers' data.
  28801. template<
  28802. typename BufferSequence>
  28803. buffers_iterator< BufferSequence > buffers_end(
  28804. const BufferSequence & buffers);
  28805. [heading Requirements]
  28806. ['Header: ][^boost/asio/buffers_iterator.hpp]
  28807. ['Convenience header: ][^boost/asio.hpp]
  28808. [endsect]
  28809. [section:buffers_iterator buffers_iterator]
  28810. A random access iterator over the bytes in a buffer sequence.
  28811. template<
  28812. typename BufferSequence,
  28813. typename ByteType = char>
  28814. class buffers_iterator
  28815. [heading Types]
  28816. [table
  28817. [[Name][Description]]
  28818. [
  28819. [[link boost_asio.reference.buffers_iterator.difference_type [*difference_type]]]
  28820. [The type used for the distance between two iterators. ]
  28821. ]
  28822. [
  28823. [[link boost_asio.reference.buffers_iterator.iterator_category [*iterator_category]]]
  28824. [The iterator category. ]
  28825. ]
  28826. [
  28827. [[link boost_asio.reference.buffers_iterator.pointer [*pointer]]]
  28828. [The type of the result of applying operator->() to the iterator. ]
  28829. ]
  28830. [
  28831. [[link boost_asio.reference.buffers_iterator.reference [*reference]]]
  28832. [The type of the result of applying operator*() to the iterator. ]
  28833. ]
  28834. [
  28835. [[link boost_asio.reference.buffers_iterator.value_type [*value_type]]]
  28836. [The type of the value pointed to by the iterator. ]
  28837. ]
  28838. ]
  28839. [heading Member Functions]
  28840. [table
  28841. [[Name][Description]]
  28842. [
  28843. [[link boost_asio.reference.buffers_iterator.begin [*begin]]]
  28844. [Construct an iterator representing the beginning of the buffers' data. ]
  28845. ]
  28846. [
  28847. [[link boost_asio.reference.buffers_iterator.buffers_iterator [*buffers_iterator]]]
  28848. [Default constructor. Creates an iterator in an undefined state. ]
  28849. ]
  28850. [
  28851. [[link boost_asio.reference.buffers_iterator.end [*end]]]
  28852. [Construct an iterator representing the end of the buffers' data. ]
  28853. ]
  28854. [
  28855. [[link boost_asio.reference.buffers_iterator.operator__star_ [*operator *]]]
  28856. [Dereference an iterator. ]
  28857. ]
  28858. [
  28859. [[link boost_asio.reference.buffers_iterator.operator_plus__plus_ [*operator++]]]
  28860. [Increment operator (prefix).
  28861. [hr]
  28862. Increment operator (postfix). ]
  28863. ]
  28864. [
  28865. [[link boost_asio.reference.buffers_iterator.operator_plus__eq_ [*operator+=]]]
  28866. [Addition operator. ]
  28867. ]
  28868. [
  28869. [[link boost_asio.reference.buffers_iterator.operator_minus__minus_ [*operator--]]]
  28870. [Decrement operator (prefix).
  28871. [hr]
  28872. Decrement operator (postfix). ]
  28873. ]
  28874. [
  28875. [[link boost_asio.reference.buffers_iterator.operator_minus__eq_ [*operator-=]]]
  28876. [Subtraction operator. ]
  28877. ]
  28878. [
  28879. [[link boost_asio.reference.buffers_iterator.operator_arrow_ [*operator->]]]
  28880. [Dereference an iterator. ]
  28881. ]
  28882. [
  28883. [[link boost_asio.reference.buffers_iterator.operator_lb__rb_ [*operator\[\]]]]
  28884. [Access an individual element. ]
  28885. ]
  28886. ]
  28887. [heading Friends]
  28888. [table
  28889. [[Name][Description]]
  28890. [
  28891. [[link boost_asio.reference.buffers_iterator.operator_not__eq_ [*operator!=]]]
  28892. [Test two iterators for inequality. ]
  28893. ]
  28894. [
  28895. [[link boost_asio.reference.buffers_iterator.operator_plus_ [*operator+]]]
  28896. [Addition operator. ]
  28897. ]
  28898. [
  28899. [[link boost_asio.reference.buffers_iterator.operator_minus_ [*operator-]]]
  28900. [Subtraction operator. ]
  28901. ]
  28902. [
  28903. [[link boost_asio.reference.buffers_iterator.operator_lt_ [*operator<]]]
  28904. [Compare two iterators. ]
  28905. ]
  28906. [
  28907. [[link boost_asio.reference.buffers_iterator.operator_lt__eq_ [*operator<=]]]
  28908. [Compare two iterators. ]
  28909. ]
  28910. [
  28911. [[link boost_asio.reference.buffers_iterator.operator_eq__eq_ [*operator==]]]
  28912. [Test two iterators for equality. ]
  28913. ]
  28914. [
  28915. [[link boost_asio.reference.buffers_iterator.operator_gt_ [*operator>]]]
  28916. [Compare two iterators. ]
  28917. ]
  28918. [
  28919. [[link boost_asio.reference.buffers_iterator.operator_gt__eq_ [*operator>=]]]
  28920. [Compare two iterators. ]
  28921. ]
  28922. ]
  28923. [heading Requirements]
  28924. ['Header: ][^boost/asio/buffers_iterator.hpp]
  28925. ['Convenience header: ][^boost/asio.hpp]
  28926. [section:begin buffers_iterator::begin]
  28927. [indexterm2 boost_asio.indexterm.buffers_iterator.begin..begin..buffers_iterator]
  28928. Construct an iterator representing the beginning of the buffers' data.
  28929. static buffers_iterator begin(
  28930. const BufferSequence & buffers);
  28931. [endsect]
  28932. [section:buffers_iterator buffers_iterator::buffers_iterator]
  28933. [indexterm2 boost_asio.indexterm.buffers_iterator.buffers_iterator..buffers_iterator..buffers_iterator]
  28934. Default constructor. Creates an iterator in an undefined state.
  28935. buffers_iterator();
  28936. [endsect]
  28937. [section:difference_type buffers_iterator::difference_type]
  28938. [indexterm2 boost_asio.indexterm.buffers_iterator.difference_type..difference_type..buffers_iterator]
  28939. The type used for the distance between two iterators.
  28940. typedef std::ptrdiff_t difference_type;
  28941. [heading Requirements]
  28942. ['Header: ][^boost/asio/buffers_iterator.hpp]
  28943. ['Convenience header: ][^boost/asio.hpp]
  28944. [endsect]
  28945. [section:end buffers_iterator::end]
  28946. [indexterm2 boost_asio.indexterm.buffers_iterator.end..end..buffers_iterator]
  28947. Construct an iterator representing the end of the buffers' data.
  28948. static buffers_iterator end(
  28949. const BufferSequence & buffers);
  28950. [endsect]
  28951. [section:iterator_category buffers_iterator::iterator_category]
  28952. [indexterm2 boost_asio.indexterm.buffers_iterator.iterator_category..iterator_category..buffers_iterator]
  28953. The iterator category.
  28954. typedef std::random_access_iterator_tag iterator_category;
  28955. [heading Requirements]
  28956. ['Header: ][^boost/asio/buffers_iterator.hpp]
  28957. ['Convenience header: ][^boost/asio.hpp]
  28958. [endsect]
  28959. [section:operator__star_ buffers_iterator::operator *]
  28960. [indexterm2 boost_asio.indexterm.buffers_iterator.operator__star_..operator *..buffers_iterator]
  28961. Dereference an iterator.
  28962. reference operator *() const;
  28963. [endsect]
  28964. [section:operator_not__eq_ buffers_iterator::operator!=]
  28965. [indexterm2 boost_asio.indexterm.buffers_iterator.operator_not__eq_..operator!=..buffers_iterator]
  28966. Test two iterators for inequality.
  28967. friend bool operator!=(
  28968. const buffers_iterator & a,
  28969. const buffers_iterator & b);
  28970. [heading Requirements]
  28971. ['Header: ][^boost/asio/buffers_iterator.hpp]
  28972. ['Convenience header: ][^boost/asio.hpp]
  28973. [endsect]
  28974. [section:operator_plus_ buffers_iterator::operator+]
  28975. [indexterm2 boost_asio.indexterm.buffers_iterator.operator_plus_..operator+..buffers_iterator]
  28976. Addition operator.
  28977. friend buffers_iterator ``[link boost_asio.reference.buffers_iterator.operator_plus_.overload1 operator+]``(
  28978. const buffers_iterator & iter,
  28979. std::ptrdiff_t difference);
  28980. `` [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_plus_.overload1 more...]]``
  28981. friend buffers_iterator ``[link boost_asio.reference.buffers_iterator.operator_plus_.overload2 operator+]``(
  28982. std::ptrdiff_t difference,
  28983. const buffers_iterator & iter);
  28984. `` [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_plus_.overload2 more...]]``
  28985. [section:overload1 buffers_iterator::operator+ (1 of 2 overloads)]
  28986. Addition operator.
  28987. friend buffers_iterator operator+(
  28988. const buffers_iterator & iter,
  28989. std::ptrdiff_t difference);
  28990. [heading Requirements]
  28991. ['Header: ][^boost/asio/buffers_iterator.hpp]
  28992. ['Convenience header: ][^boost/asio.hpp]
  28993. [endsect]
  28994. [section:overload2 buffers_iterator::operator+ (2 of 2 overloads)]
  28995. Addition operator.
  28996. friend buffers_iterator operator+(
  28997. std::ptrdiff_t difference,
  28998. const buffers_iterator & iter);
  28999. [heading Requirements]
  29000. ['Header: ][^boost/asio/buffers_iterator.hpp]
  29001. ['Convenience header: ][^boost/asio.hpp]
  29002. [endsect]
  29003. [endsect]
  29004. [section:operator_plus__plus_ buffers_iterator::operator++]
  29005. [indexterm2 boost_asio.indexterm.buffers_iterator.operator_plus__plus_..operator++..buffers_iterator]
  29006. Increment operator (prefix).
  29007. buffers_iterator & ``[link boost_asio.reference.buffers_iterator.operator_plus__plus_.overload1 operator++]``();
  29008. `` [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_plus__plus_.overload1 more...]]``
  29009. Increment operator (postfix).
  29010. buffers_iterator ``[link boost_asio.reference.buffers_iterator.operator_plus__plus_.overload2 operator++]``(
  29011. int );
  29012. `` [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_plus__plus_.overload2 more...]]``
  29013. [section:overload1 buffers_iterator::operator++ (1 of 2 overloads)]
  29014. Increment operator (prefix).
  29015. buffers_iterator & operator++();
  29016. [endsect]
  29017. [section:overload2 buffers_iterator::operator++ (2 of 2 overloads)]
  29018. Increment operator (postfix).
  29019. buffers_iterator operator++(
  29020. int );
  29021. [endsect]
  29022. [endsect]
  29023. [section:operator_plus__eq_ buffers_iterator::operator+=]
  29024. [indexterm2 boost_asio.indexterm.buffers_iterator.operator_plus__eq_..operator+=..buffers_iterator]
  29025. Addition operator.
  29026. buffers_iterator & operator+=(
  29027. std::ptrdiff_t difference);
  29028. [endsect]
  29029. [section:operator_minus_ buffers_iterator::operator-]
  29030. [indexterm2 boost_asio.indexterm.buffers_iterator.operator_minus_..operator-..buffers_iterator]
  29031. Subtraction operator.
  29032. friend buffers_iterator ``[link boost_asio.reference.buffers_iterator.operator_minus_.overload1 operator-]``(
  29033. const buffers_iterator & iter,
  29034. std::ptrdiff_t difference);
  29035. `` [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_minus_.overload1 more...]]``
  29036. friend std::ptrdiff_t ``[link boost_asio.reference.buffers_iterator.operator_minus_.overload2 operator-]``(
  29037. const buffers_iterator & a,
  29038. const buffers_iterator & b);
  29039. `` [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_minus_.overload2 more...]]``
  29040. [section:overload1 buffers_iterator::operator- (1 of 2 overloads)]
  29041. Subtraction operator.
  29042. friend buffers_iterator operator-(
  29043. const buffers_iterator & iter,
  29044. std::ptrdiff_t difference);
  29045. [heading Requirements]
  29046. ['Header: ][^boost/asio/buffers_iterator.hpp]
  29047. ['Convenience header: ][^boost/asio.hpp]
  29048. [endsect]
  29049. [section:overload2 buffers_iterator::operator- (2 of 2 overloads)]
  29050. Subtraction operator.
  29051. friend std::ptrdiff_t operator-(
  29052. const buffers_iterator & a,
  29053. const buffers_iterator & b);
  29054. [heading Requirements]
  29055. ['Header: ][^boost/asio/buffers_iterator.hpp]
  29056. ['Convenience header: ][^boost/asio.hpp]
  29057. [endsect]
  29058. [endsect]
  29059. [section:operator_minus__minus_ buffers_iterator::operator--]
  29060. [indexterm2 boost_asio.indexterm.buffers_iterator.operator_minus__minus_..operator--..buffers_iterator]
  29061. Decrement operator (prefix).
  29062. buffers_iterator & ``[link boost_asio.reference.buffers_iterator.operator_minus__minus_.overload1 operator--]``();
  29063. `` [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_minus__minus_.overload1 more...]]``
  29064. Decrement operator (postfix).
  29065. buffers_iterator ``[link boost_asio.reference.buffers_iterator.operator_minus__minus_.overload2 operator--]``(
  29066. int );
  29067. `` [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_minus__minus_.overload2 more...]]``
  29068. [section:overload1 buffers_iterator::operator-- (1 of 2 overloads)]
  29069. Decrement operator (prefix).
  29070. buffers_iterator & operator--();
  29071. [endsect]
  29072. [section:overload2 buffers_iterator::operator-- (2 of 2 overloads)]
  29073. Decrement operator (postfix).
  29074. buffers_iterator operator--(
  29075. int );
  29076. [endsect]
  29077. [endsect]
  29078. [section:operator_minus__eq_ buffers_iterator::operator-=]
  29079. [indexterm2 boost_asio.indexterm.buffers_iterator.operator_minus__eq_..operator-=..buffers_iterator]
  29080. Subtraction operator.
  29081. buffers_iterator & operator-=(
  29082. std::ptrdiff_t difference);
  29083. [endsect]
  29084. [section:operator_arrow_ buffers_iterator::operator->]
  29085. [indexterm2 boost_asio.indexterm.buffers_iterator.operator_arrow_..operator->..buffers_iterator]
  29086. Dereference an iterator.
  29087. pointer operator->() const;
  29088. [endsect]
  29089. [section:operator_lt_ buffers_iterator::operator<]
  29090. [indexterm2 boost_asio.indexterm.buffers_iterator.operator_lt_..operator<..buffers_iterator]
  29091. Compare two iterators.
  29092. friend bool operator<(
  29093. const buffers_iterator & a,
  29094. const buffers_iterator & b);
  29095. [heading Requirements]
  29096. ['Header: ][^boost/asio/buffers_iterator.hpp]
  29097. ['Convenience header: ][^boost/asio.hpp]
  29098. [endsect]
  29099. [section:operator_lt__eq_ buffers_iterator::operator<=]
  29100. [indexterm2 boost_asio.indexterm.buffers_iterator.operator_lt__eq_..operator<=..buffers_iterator]
  29101. Compare two iterators.
  29102. friend bool operator<=(
  29103. const buffers_iterator & a,
  29104. const buffers_iterator & b);
  29105. [heading Requirements]
  29106. ['Header: ][^boost/asio/buffers_iterator.hpp]
  29107. ['Convenience header: ][^boost/asio.hpp]
  29108. [endsect]
  29109. [section:operator_eq__eq_ buffers_iterator::operator==]
  29110. [indexterm2 boost_asio.indexterm.buffers_iterator.operator_eq__eq_..operator==..buffers_iterator]
  29111. Test two iterators for equality.
  29112. friend bool operator==(
  29113. const buffers_iterator & a,
  29114. const buffers_iterator & b);
  29115. [heading Requirements]
  29116. ['Header: ][^boost/asio/buffers_iterator.hpp]
  29117. ['Convenience header: ][^boost/asio.hpp]
  29118. [endsect]
  29119. [section:operator_gt_ buffers_iterator::operator>]
  29120. [indexterm2 boost_asio.indexterm.buffers_iterator.operator_gt_..operator>..buffers_iterator]
  29121. Compare two iterators.
  29122. friend bool operator>(
  29123. const buffers_iterator & a,
  29124. const buffers_iterator & b);
  29125. [heading Requirements]
  29126. ['Header: ][^boost/asio/buffers_iterator.hpp]
  29127. ['Convenience header: ][^boost/asio.hpp]
  29128. [endsect]
  29129. [section:operator_gt__eq_ buffers_iterator::operator>=]
  29130. [indexterm2 boost_asio.indexterm.buffers_iterator.operator_gt__eq_..operator>=..buffers_iterator]
  29131. Compare two iterators.
  29132. friend bool operator>=(
  29133. const buffers_iterator & a,
  29134. const buffers_iterator & b);
  29135. [heading Requirements]
  29136. ['Header: ][^boost/asio/buffers_iterator.hpp]
  29137. ['Convenience header: ][^boost/asio.hpp]
  29138. [endsect]
  29139. [section:operator_lb__rb_ buffers_iterator::operator\[\]]
  29140. [indexterm2 boost_asio.indexterm.buffers_iterator.operator_lb__rb_..operator\[\]..buffers_iterator]
  29141. Access an individual element.
  29142. reference operator[](
  29143. std::ptrdiff_t difference) const;
  29144. [endsect]
  29145. [section:pointer buffers_iterator::pointer]
  29146. [indexterm2 boost_asio.indexterm.buffers_iterator.pointer..pointer..buffers_iterator]
  29147. The type of the result of applying `operator->()` to the iterator.
  29148. typedef const_or_non_const_ByteType * pointer;
  29149. If the buffer sequence stores buffer objects that are convertible to [link boost_asio.reference.mutable_buffer `mutable_buffer`], this is a pointer to a non-const ByteType. Otherwise, a pointer to a const ByteType.
  29150. [heading Requirements]
  29151. ['Header: ][^boost/asio/buffers_iterator.hpp]
  29152. ['Convenience header: ][^boost/asio.hpp]
  29153. [endsect]
  29154. [section:reference buffers_iterator::reference]
  29155. [indexterm2 boost_asio.indexterm.buffers_iterator.reference..reference..buffers_iterator]
  29156. The type of the result of applying `operator*()` to the iterator.
  29157. typedef const_or_non_const_ByteType & reference;
  29158. If the buffer sequence stores buffer objects that are convertible to [link boost_asio.reference.mutable_buffer `mutable_buffer`], this is a reference to a non-const ByteType. Otherwise, a reference to a const ByteType.
  29159. [heading Requirements]
  29160. ['Header: ][^boost/asio/buffers_iterator.hpp]
  29161. ['Convenience header: ][^boost/asio.hpp]
  29162. [endsect]
  29163. [section:value_type buffers_iterator::value_type]
  29164. [indexterm2 boost_asio.indexterm.buffers_iterator.value_type..value_type..buffers_iterator]
  29165. The type of the value pointed to by the iterator.
  29166. typedef ByteType value_type;
  29167. [heading Requirements]
  29168. ['Header: ][^boost/asio/buffers_iterator.hpp]
  29169. ['Convenience header: ][^boost/asio.hpp]
  29170. [endsect]
  29171. [endsect]
  29172. [section:co_spawn co_spawn]
  29173. [indexterm1 boost_asio.indexterm.co_spawn..co_spawn]
  29174. Spawn a new thread of execution.
  29175. template<
  29176. typename ``[link boost_asio.reference.Executor1 Executor]``,
  29177. typename F,
  29178. typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  29179. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.co_spawn.overload1 co_spawn]``(
  29180. const Executor & ex,
  29181. F && f,
  29182. CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  29183. typename enable_if< is_executor< Executor >::value >::type * = 0);
  29184. `` [''''&raquo;''' [link boost_asio.reference.co_spawn.overload1 more...]]``
  29185. template<
  29186. typename ExecutionContext,
  29187. typename F,
  29188. typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  29189. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.co_spawn.overload2 co_spawn]``(
  29190. ExecutionContext & ctx,
  29191. F && f,
  29192. CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  29193. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  29194. `` [''''&raquo;''' [link boost_asio.reference.co_spawn.overload2 more...]]``
  29195. [heading Requirements]
  29196. ['Header: ][^boost/asio/co_spawn.hpp]
  29197. ['Convenience header: ][^boost/asio.hpp]
  29198. [section:overload1 co_spawn (1 of 2 overloads)]
  29199. Spawn a new thread of execution.
  29200. template<
  29201. typename ``[link boost_asio.reference.Executor1 Executor]``,
  29202. typename F,
  29203. typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  29204. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` co_spawn(
  29205. const Executor & ex,
  29206. F && f,
  29207. CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  29208. typename enable_if< is_executor< Executor >::value >::type * = 0);
  29209. The entry point function object `f` must have the signature:
  29210. awaitable<void, E> f();
  29211. where `E` is convertible from `Executor`.
  29212. [endsect]
  29213. [section:overload2 co_spawn (2 of 2 overloads)]
  29214. Spawn a new thread of execution.
  29215. template<
  29216. typename ExecutionContext,
  29217. typename F,
  29218. typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  29219. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` co_spawn(
  29220. ExecutionContext & ctx,
  29221. F && f,
  29222. CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  29223. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  29224. The entry point function object `f` must have the signature:
  29225. awaitable<void, E> f();
  29226. where `E` is convertible from `ExecutionContext::executor_type`.
  29227. [endsect]
  29228. [endsect]
  29229. [section:connect connect]
  29230. [indexterm1 boost_asio.indexterm.connect..connect]
  29231. The `connect` function is a composed operation that establishes a socket connection by trying each endpoint in a sequence.
  29232. Establishes a socket connection by trying each endpoint in a sequence.
  29233. template<
  29234. typename ``[link boost_asio.reference.Protocol Protocol]``,
  29235. typename ``[link boost_asio.reference.Executor1 Executor]``,
  29236. typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``>
  29237. Protocol::endpoint ``[link boost_asio.reference.connect.overload1 connect]``(
  29238. basic_socket< Protocol, Executor > & s,
  29239. const EndpointSequence & endpoints,
  29240. typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type * = 0);
  29241. `` [''''&raquo;''' [link boost_asio.reference.connect.overload1 more...]]``
  29242. template<
  29243. typename ``[link boost_asio.reference.Protocol Protocol]``,
  29244. typename ``[link boost_asio.reference.Executor1 Executor]``,
  29245. typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``>
  29246. Protocol::endpoint ``[link boost_asio.reference.connect.overload2 connect]``(
  29247. basic_socket< Protocol, Executor > & s,
  29248. const EndpointSequence & endpoints,
  29249. boost::system::error_code & ec,
  29250. typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type * = 0);
  29251. `` [''''&raquo;''' [link boost_asio.reference.connect.overload2 more...]]``
  29252. (Deprecated: Use range overload.) Establishes a socket connection by trying each endpoint in a sequence.
  29253. template<
  29254. typename ``[link boost_asio.reference.Protocol Protocol]``,
  29255. typename ``[link boost_asio.reference.Executor1 Executor]``,
  29256. typename Iterator>
  29257. Iterator ``[link boost_asio.reference.connect.overload3 connect]``(
  29258. basic_socket< Protocol, Executor > & s,
  29259. Iterator begin,
  29260. typename enable_if<!is_endpoint_sequence< Iterator >::value >::type * = 0);
  29261. `` [''''&raquo;''' [link boost_asio.reference.connect.overload3 more...]]``
  29262. template<
  29263. typename ``[link boost_asio.reference.Protocol Protocol]``,
  29264. typename ``[link boost_asio.reference.Executor1 Executor]``,
  29265. typename Iterator>
  29266. Iterator ``[link boost_asio.reference.connect.overload4 connect]``(
  29267. basic_socket< Protocol, Executor > & s,
  29268. Iterator begin,
  29269. boost::system::error_code & ec,
  29270. typename enable_if<!is_endpoint_sequence< Iterator >::value >::type * = 0);
  29271. `` [''''&raquo;''' [link boost_asio.reference.connect.overload4 more...]]``
  29272. Establishes a socket connection by trying each endpoint in a sequence.
  29273. template<
  29274. typename ``[link boost_asio.reference.Protocol Protocol]``,
  29275. typename ``[link boost_asio.reference.Executor1 Executor]``,
  29276. typename Iterator>
  29277. Iterator ``[link boost_asio.reference.connect.overload5 connect]``(
  29278. basic_socket< Protocol, Executor > & s,
  29279. Iterator begin,
  29280. Iterator end);
  29281. `` [''''&raquo;''' [link boost_asio.reference.connect.overload5 more...]]``
  29282. template<
  29283. typename ``[link boost_asio.reference.Protocol Protocol]``,
  29284. typename ``[link boost_asio.reference.Executor1 Executor]``,
  29285. typename Iterator>
  29286. Iterator ``[link boost_asio.reference.connect.overload6 connect]``(
  29287. basic_socket< Protocol, Executor > & s,
  29288. Iterator begin,
  29289. Iterator end,
  29290. boost::system::error_code & ec);
  29291. `` [''''&raquo;''' [link boost_asio.reference.connect.overload6 more...]]``
  29292. template<
  29293. typename ``[link boost_asio.reference.Protocol Protocol]``,
  29294. typename ``[link boost_asio.reference.Executor1 Executor]``,
  29295. typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``,
  29296. typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``>
  29297. Protocol::endpoint ``[link boost_asio.reference.connect.overload7 connect]``(
  29298. basic_socket< Protocol, Executor > & s,
  29299. const EndpointSequence & endpoints,
  29300. ConnectCondition connect_condition,
  29301. typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type * = 0);
  29302. `` [''''&raquo;''' [link boost_asio.reference.connect.overload7 more...]]``
  29303. template<
  29304. typename ``[link boost_asio.reference.Protocol Protocol]``,
  29305. typename ``[link boost_asio.reference.Executor1 Executor]``,
  29306. typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``,
  29307. typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``>
  29308. Protocol::endpoint ``[link boost_asio.reference.connect.overload8 connect]``(
  29309. basic_socket< Protocol, Executor > & s,
  29310. const EndpointSequence & endpoints,
  29311. ConnectCondition connect_condition,
  29312. boost::system::error_code & ec,
  29313. typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type * = 0);
  29314. `` [''''&raquo;''' [link boost_asio.reference.connect.overload8 more...]]``
  29315. (Deprecated: Use range overload.) Establishes a socket connection by trying each endpoint in a sequence.
  29316. template<
  29317. typename ``[link boost_asio.reference.Protocol Protocol]``,
  29318. typename ``[link boost_asio.reference.Executor1 Executor]``,
  29319. typename Iterator,
  29320. typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``>
  29321. Iterator ``[link boost_asio.reference.connect.overload9 connect]``(
  29322. basic_socket< Protocol, Executor > & s,
  29323. Iterator begin,
  29324. ConnectCondition connect_condition,
  29325. typename enable_if<!is_endpoint_sequence< Iterator >::value >::type * = 0);
  29326. `` [''''&raquo;''' [link boost_asio.reference.connect.overload9 more...]]``
  29327. template<
  29328. typename ``[link boost_asio.reference.Protocol Protocol]``,
  29329. typename ``[link boost_asio.reference.Executor1 Executor]``,
  29330. typename Iterator,
  29331. typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``>
  29332. Iterator ``[link boost_asio.reference.connect.overload10 connect]``(
  29333. basic_socket< Protocol, Executor > & s,
  29334. Iterator begin,
  29335. ConnectCondition connect_condition,
  29336. boost::system::error_code & ec,
  29337. typename enable_if<!is_endpoint_sequence< Iterator >::value >::type * = 0);
  29338. `` [''''&raquo;''' [link boost_asio.reference.connect.overload10 more...]]``
  29339. Establishes a socket connection by trying each endpoint in a sequence.
  29340. template<
  29341. typename ``[link boost_asio.reference.Protocol Protocol]``,
  29342. typename ``[link boost_asio.reference.Executor1 Executor]``,
  29343. typename Iterator,
  29344. typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``>
  29345. Iterator ``[link boost_asio.reference.connect.overload11 connect]``(
  29346. basic_socket< Protocol, Executor > & s,
  29347. Iterator begin,
  29348. Iterator end,
  29349. ConnectCondition connect_condition);
  29350. `` [''''&raquo;''' [link boost_asio.reference.connect.overload11 more...]]``
  29351. template<
  29352. typename ``[link boost_asio.reference.Protocol Protocol]``,
  29353. typename ``[link boost_asio.reference.Executor1 Executor]``,
  29354. typename Iterator,
  29355. typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``>
  29356. Iterator ``[link boost_asio.reference.connect.overload12 connect]``(
  29357. basic_socket< Protocol, Executor > & s,
  29358. Iterator begin,
  29359. Iterator end,
  29360. ConnectCondition connect_condition,
  29361. boost::system::error_code & ec);
  29362. `` [''''&raquo;''' [link boost_asio.reference.connect.overload12 more...]]``
  29363. [heading Requirements]
  29364. ['Header: ][^boost/asio/connect.hpp]
  29365. ['Convenience header: ][^boost/asio.hpp]
  29366. [section:overload1 connect (1 of 12 overloads)]
  29367. Establishes a socket connection by trying each endpoint in a sequence.
  29368. template<
  29369. typename ``[link boost_asio.reference.Protocol Protocol]``,
  29370. typename ``[link boost_asio.reference.Executor1 Executor]``,
  29371. typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``>
  29372. Protocol::endpoint connect(
  29373. basic_socket< Protocol, Executor > & s,
  29374. const EndpointSequence & endpoints,
  29375. typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type * = 0);
  29376. This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
  29377. [heading Parameters]
  29378. [variablelist
  29379. [[s][The socket to be connected. If the socket is already open, it will be closed.]]
  29380. [[endpoints][A sequence of endpoints.]]
  29381. ]
  29382. [heading Return Value]
  29383. The successfully connected endpoint.
  29384. [heading Exceptions]
  29385. [variablelist
  29386. [[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.]]
  29387. ]
  29388. [heading Example]
  29389. tcp::resolver r(my_context);
  29390. tcp::resolver::query q("host", "service");
  29391. tcp::socket s(my_context);
  29392. boost::asio::connect(s, r.resolve(q));
  29393. [endsect]
  29394. [section:overload2 connect (2 of 12 overloads)]
  29395. Establishes a socket connection by trying each endpoint in a sequence.
  29396. template<
  29397. typename ``[link boost_asio.reference.Protocol Protocol]``,
  29398. typename ``[link boost_asio.reference.Executor1 Executor]``,
  29399. typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``>
  29400. Protocol::endpoint connect(
  29401. basic_socket< Protocol, Executor > & s,
  29402. const EndpointSequence & endpoints,
  29403. boost::system::error_code & ec,
  29404. typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type * = 0);
  29405. This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
  29406. [heading Parameters]
  29407. [variablelist
  29408. [[s][The socket to be connected. If the socket is already open, it will be closed.]]
  29409. [[endpoints][A sequence of endpoints.]]
  29410. [[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.]]
  29411. ]
  29412. [heading Return Value]
  29413. On success, the successfully connected endpoint. Otherwise, a default-constructed endpoint.
  29414. [heading Example]
  29415. tcp::resolver r(my_context);
  29416. tcp::resolver::query q("host", "service");
  29417. tcp::socket s(my_context);
  29418. boost::system::error_code ec;
  29419. boost::asio::connect(s, r.resolve(q), ec);
  29420. if (ec)
  29421. {
  29422. // An error occurred.
  29423. }
  29424. [endsect]
  29425. [section:overload3 connect (3 of 12 overloads)]
  29426. (Deprecated: Use range overload.) Establishes a socket connection by trying each endpoint in a sequence.
  29427. template<
  29428. typename ``[link boost_asio.reference.Protocol Protocol]``,
  29429. typename ``[link boost_asio.reference.Executor1 Executor]``,
  29430. typename Iterator>
  29431. Iterator connect(
  29432. basic_socket< Protocol, Executor > & s,
  29433. Iterator begin,
  29434. typename enable_if<!is_endpoint_sequence< Iterator >::value >::type * = 0);
  29435. This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
  29436. [heading Parameters]
  29437. [variablelist
  29438. [[s][The socket to be connected. If the socket is already open, it will be closed.]]
  29439. [[begin][An iterator pointing to the start of a sequence of endpoints.]]
  29440. ]
  29441. [heading Return Value]
  29442. On success, an iterator denoting the successfully connected endpoint. Otherwise, the end iterator.
  29443. [heading Exceptions]
  29444. [variablelist
  29445. [[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.]]
  29446. ]
  29447. [heading Remarks]
  29448. This overload assumes that a default constructed object of type `Iterator` represents the end of the sequence. This is a valid assumption for iterator types such as `boost::asio::ip::tcp::resolver::iterator`.
  29449. [endsect]
  29450. [section:overload4 connect (4 of 12 overloads)]
  29451. (Deprecated: Use range overload.) Establishes a socket connection by trying each endpoint in a sequence.
  29452. template<
  29453. typename ``[link boost_asio.reference.Protocol Protocol]``,
  29454. typename ``[link boost_asio.reference.Executor1 Executor]``,
  29455. typename Iterator>
  29456. Iterator connect(
  29457. basic_socket< Protocol, Executor > & s,
  29458. Iterator begin,
  29459. boost::system::error_code & ec,
  29460. typename enable_if<!is_endpoint_sequence< Iterator >::value >::type * = 0);
  29461. This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
  29462. [heading Parameters]
  29463. [variablelist
  29464. [[s][The socket to be connected. If the socket is already open, it will be closed.]]
  29465. [[begin][An iterator pointing to the start of a sequence of endpoints.]]
  29466. [[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.]]
  29467. ]
  29468. [heading Return Value]
  29469. On success, an iterator denoting the successfully connected endpoint. Otherwise, the end iterator.
  29470. [heading Remarks]
  29471. This overload assumes that a default constructed object of type `Iterator` represents the end of the sequence. This is a valid assumption for iterator types such as `boost::asio::ip::tcp::resolver::iterator`.
  29472. [endsect]
  29473. [section:overload5 connect (5 of 12 overloads)]
  29474. Establishes a socket connection by trying each endpoint in a sequence.
  29475. template<
  29476. typename ``[link boost_asio.reference.Protocol Protocol]``,
  29477. typename ``[link boost_asio.reference.Executor1 Executor]``,
  29478. typename Iterator>
  29479. Iterator connect(
  29480. basic_socket< Protocol, Executor > & s,
  29481. Iterator begin,
  29482. Iterator end);
  29483. This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
  29484. [heading Parameters]
  29485. [variablelist
  29486. [[s][The socket to be connected. If the socket is already open, it will be closed.]]
  29487. [[begin][An iterator pointing to the start of a sequence of endpoints.]]
  29488. [[end][An iterator pointing to the end of a sequence of endpoints.]]
  29489. ]
  29490. [heading Return Value]
  29491. An iterator denoting the successfully connected endpoint.
  29492. [heading Exceptions]
  29493. [variablelist
  29494. [[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.]]
  29495. ]
  29496. [heading Example]
  29497. tcp::resolver r(my_context);
  29498. tcp::resolver::query q("host", "service");
  29499. tcp::resolver::results_type e = r.resolve(q);
  29500. tcp::socket s(my_context);
  29501. boost::asio::connect(s, e.begin(), e.end());
  29502. [endsect]
  29503. [section:overload6 connect (6 of 12 overloads)]
  29504. Establishes a socket connection by trying each endpoint in a sequence.
  29505. template<
  29506. typename ``[link boost_asio.reference.Protocol Protocol]``,
  29507. typename ``[link boost_asio.reference.Executor1 Executor]``,
  29508. typename Iterator>
  29509. Iterator connect(
  29510. basic_socket< Protocol, Executor > & s,
  29511. Iterator begin,
  29512. Iterator end,
  29513. boost::system::error_code & ec);
  29514. This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
  29515. [heading Parameters]
  29516. [variablelist
  29517. [[s][The socket to be connected. If the socket is already open, it will be closed.]]
  29518. [[begin][An iterator pointing to the start of a sequence of endpoints.]]
  29519. [[end][An iterator pointing to the end of a sequence of endpoints.]]
  29520. [[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.]]
  29521. ]
  29522. [heading Return Value]
  29523. On success, an iterator denoting the successfully connected endpoint. Otherwise, the end iterator.
  29524. [heading Example]
  29525. tcp::resolver r(my_context);
  29526. tcp::resolver::query q("host", "service");
  29527. tcp::resolver::results_type e = r.resolve(q);
  29528. tcp::socket s(my_context);
  29529. boost::system::error_code ec;
  29530. boost::asio::connect(s, e.begin(), e.end(), ec);
  29531. if (ec)
  29532. {
  29533. // An error occurred.
  29534. }
  29535. [endsect]
  29536. [section:overload7 connect (7 of 12 overloads)]
  29537. Establishes a socket connection by trying each endpoint in a sequence.
  29538. template<
  29539. typename ``[link boost_asio.reference.Protocol Protocol]``,
  29540. typename ``[link boost_asio.reference.Executor1 Executor]``,
  29541. typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``,
  29542. typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``>
  29543. Protocol::endpoint connect(
  29544. basic_socket< Protocol, Executor > & s,
  29545. const EndpointSequence & endpoints,
  29546. ConnectCondition connect_condition,
  29547. typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type * = 0);
  29548. This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
  29549. [heading Parameters]
  29550. [variablelist
  29551. [[s][The socket to be connected. If the socket is already open, it will be closed.]]
  29552. [[endpoints][A sequence of endpoints.]]
  29553. [[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be:
  29554. ``
  29555. bool connect_condition(
  29556. const boost::system::error_code& ec,
  29557. const typename Protocol::endpoint& next);
  29558. ``
  29559. The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is the next endpoint to be tried. The function object should return true if the next endpoint should be tried, and false if it should be skipped.]]
  29560. ]
  29561. [heading Return Value]
  29562. The successfully connected endpoint.
  29563. [heading Exceptions]
  29564. [variablelist
  29565. [[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.]]
  29566. ]
  29567. [heading Example]
  29568. The following connect condition function object can be used to output information about the individual connection attempts:
  29569. struct my_connect_condition
  29570. {
  29571. bool operator()(
  29572. const boost::system::error_code& ec,
  29573. const::tcp::endpoint& next)
  29574. {
  29575. if (ec) std::cout << "Error: " << ec.message() << std::endl;
  29576. std::cout << "Trying: " << next << std::endl;
  29577. return true;
  29578. }
  29579. };
  29580. It would be used with the `boost::asio::connect` function as follows:
  29581. tcp::resolver r(my_context);
  29582. tcp::resolver::query q("host", "service");
  29583. tcp::socket s(my_context);
  29584. tcp::endpoint e = boost::asio::connect(s,
  29585. r.resolve(q), my_connect_condition());
  29586. std::cout << "Connected to: " << e << std::endl;
  29587. [endsect]
  29588. [section:overload8 connect (8 of 12 overloads)]
  29589. Establishes a socket connection by trying each endpoint in a sequence.
  29590. template<
  29591. typename ``[link boost_asio.reference.Protocol Protocol]``,
  29592. typename ``[link boost_asio.reference.Executor1 Executor]``,
  29593. typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``,
  29594. typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``>
  29595. Protocol::endpoint connect(
  29596. basic_socket< Protocol, Executor > & s,
  29597. const EndpointSequence & endpoints,
  29598. ConnectCondition connect_condition,
  29599. boost::system::error_code & ec,
  29600. typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type * = 0);
  29601. This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
  29602. [heading Parameters]
  29603. [variablelist
  29604. [[s][The socket to be connected. If the socket is already open, it will be closed.]]
  29605. [[endpoints][A sequence of endpoints.]]
  29606. [[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be:
  29607. ``
  29608. bool connect_condition(
  29609. const boost::system::error_code& ec,
  29610. const typename Protocol::endpoint& next);
  29611. ``
  29612. The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is the next endpoint to be tried. The function object should return true if the next endpoint should be tried, and false if it should be skipped.]]
  29613. [[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.]]
  29614. ]
  29615. [heading Return Value]
  29616. On success, the successfully connected endpoint. Otherwise, a default-constructed endpoint.
  29617. [heading Example]
  29618. The following connect condition function object can be used to output information about the individual connection attempts:
  29619. struct my_connect_condition
  29620. {
  29621. bool operator()(
  29622. const boost::system::error_code& ec,
  29623. const::tcp::endpoint& next)
  29624. {
  29625. if (ec) std::cout << "Error: " << ec.message() << std::endl;
  29626. std::cout << "Trying: " << next << std::endl;
  29627. return true;
  29628. }
  29629. };
  29630. It would be used with the `boost::asio::connect` function as follows:
  29631. tcp::resolver r(my_context);
  29632. tcp::resolver::query q("host", "service");
  29633. tcp::socket s(my_context);
  29634. boost::system::error_code ec;
  29635. tcp::endpoint e = boost::asio::connect(s,
  29636. r.resolve(q), my_connect_condition(), ec);
  29637. if (ec)
  29638. {
  29639. // An error occurred.
  29640. }
  29641. else
  29642. {
  29643. std::cout << "Connected to: " << e << std::endl;
  29644. }
  29645. [endsect]
  29646. [section:overload9 connect (9 of 12 overloads)]
  29647. (Deprecated: Use range overload.) Establishes a socket connection by trying each endpoint in a sequence.
  29648. template<
  29649. typename ``[link boost_asio.reference.Protocol Protocol]``,
  29650. typename ``[link boost_asio.reference.Executor1 Executor]``,
  29651. typename Iterator,
  29652. typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``>
  29653. Iterator connect(
  29654. basic_socket< Protocol, Executor > & s,
  29655. Iterator begin,
  29656. ConnectCondition connect_condition,
  29657. typename enable_if<!is_endpoint_sequence< Iterator >::value >::type * = 0);
  29658. This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
  29659. [heading Parameters]
  29660. [variablelist
  29661. [[s][The socket to be connected. If the socket is already open, it will be closed.]]
  29662. [[begin][An iterator pointing to the start of a sequence of endpoints.]]
  29663. [[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be:
  29664. ``
  29665. bool connect_condition(
  29666. const boost::system::error_code& ec,
  29667. const typename Protocol::endpoint& next);
  29668. ``
  29669. The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is the next endpoint to be tried. The function object should return true if the next endpoint should be tried, and false if it should be skipped.]]
  29670. ]
  29671. [heading Return Value]
  29672. On success, an iterator denoting the successfully connected endpoint. Otherwise, the end iterator.
  29673. [heading Exceptions]
  29674. [variablelist
  29675. [[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.]]
  29676. ]
  29677. [heading Remarks]
  29678. This overload assumes that a default constructed object of type `Iterator` represents the end of the sequence. This is a valid assumption for iterator types such as `boost::asio::ip::tcp::resolver::iterator`.
  29679. [endsect]
  29680. [section:overload10 connect (10 of 12 overloads)]
  29681. (Deprecated: Use range overload.) Establishes a socket connection by trying each endpoint in a sequence.
  29682. template<
  29683. typename ``[link boost_asio.reference.Protocol Protocol]``,
  29684. typename ``[link boost_asio.reference.Executor1 Executor]``,
  29685. typename Iterator,
  29686. typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``>
  29687. Iterator connect(
  29688. basic_socket< Protocol, Executor > & s,
  29689. Iterator begin,
  29690. ConnectCondition connect_condition,
  29691. boost::system::error_code & ec,
  29692. typename enable_if<!is_endpoint_sequence< Iterator >::value >::type * = 0);
  29693. This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
  29694. [heading Parameters]
  29695. [variablelist
  29696. [[s][The socket to be connected. If the socket is already open, it will be closed.]]
  29697. [[begin][An iterator pointing to the start of a sequence of endpoints.]]
  29698. [[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be:
  29699. ``
  29700. bool connect_condition(
  29701. const boost::system::error_code& ec,
  29702. const typename Protocol::endpoint& next);
  29703. ``
  29704. The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is the next endpoint to be tried. The function object should return true if the next endpoint should be tried, and false if it should be skipped.]]
  29705. [[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.]]
  29706. ]
  29707. [heading Return Value]
  29708. On success, an iterator denoting the successfully connected endpoint. Otherwise, the end iterator.
  29709. [heading Remarks]
  29710. This overload assumes that a default constructed object of type `Iterator` represents the end of the sequence. This is a valid assumption for iterator types such as `boost::asio::ip::tcp::resolver::iterator`.
  29711. [endsect]
  29712. [section:overload11 connect (11 of 12 overloads)]
  29713. Establishes a socket connection by trying each endpoint in a sequence.
  29714. template<
  29715. typename ``[link boost_asio.reference.Protocol Protocol]``,
  29716. typename ``[link boost_asio.reference.Executor1 Executor]``,
  29717. typename Iterator,
  29718. typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``>
  29719. Iterator connect(
  29720. basic_socket< Protocol, Executor > & s,
  29721. Iterator begin,
  29722. Iterator end,
  29723. ConnectCondition connect_condition);
  29724. This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
  29725. [heading Parameters]
  29726. [variablelist
  29727. [[s][The socket to be connected. If the socket is already open, it will be closed.]]
  29728. [[begin][An iterator pointing to the start of a sequence of endpoints.]]
  29729. [[end][An iterator pointing to the end of a sequence of endpoints.]]
  29730. [[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be:
  29731. ``
  29732. bool connect_condition(
  29733. const boost::system::error_code& ec,
  29734. const typename Protocol::endpoint& next);
  29735. ``
  29736. The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is the next endpoint to be tried. The function object should return true if the next endpoint should be tried, and false if it should be skipped.]]
  29737. ]
  29738. [heading Return Value]
  29739. An iterator denoting the successfully connected endpoint.
  29740. [heading Exceptions]
  29741. [variablelist
  29742. [[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.]]
  29743. ]
  29744. [heading Example]
  29745. The following connect condition function object can be used to output information about the individual connection attempts:
  29746. struct my_connect_condition
  29747. {
  29748. bool operator()(
  29749. const boost::system::error_code& ec,
  29750. const::tcp::endpoint& next)
  29751. {
  29752. if (ec) std::cout << "Error: " << ec.message() << std::endl;
  29753. std::cout << "Trying: " << next << std::endl;
  29754. return true;
  29755. }
  29756. };
  29757. It would be used with the `boost::asio::connect` function as follows:
  29758. tcp::resolver r(my_context);
  29759. tcp::resolver::query q("host", "service");
  29760. tcp::resolver::results_type e = r.resolve(q);
  29761. tcp::socket s(my_context);
  29762. tcp::resolver::results_type::iterator i = boost::asio::connect(
  29763. s, e.begin(), e.end(), my_connect_condition());
  29764. std::cout << "Connected to: " << i->endpoint() << std::endl;
  29765. [endsect]
  29766. [section:overload12 connect (12 of 12 overloads)]
  29767. Establishes a socket connection by trying each endpoint in a sequence.
  29768. template<
  29769. typename ``[link boost_asio.reference.Protocol Protocol]``,
  29770. typename ``[link boost_asio.reference.Executor1 Executor]``,
  29771. typename Iterator,
  29772. typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``>
  29773. Iterator connect(
  29774. basic_socket< Protocol, Executor > & s,
  29775. Iterator begin,
  29776. Iterator end,
  29777. ConnectCondition connect_condition,
  29778. boost::system::error_code & ec);
  29779. This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
  29780. [heading Parameters]
  29781. [variablelist
  29782. [[s][The socket to be connected. If the socket is already open, it will be closed.]]
  29783. [[begin][An iterator pointing to the start of a sequence of endpoints.]]
  29784. [[end][An iterator pointing to the end of a sequence of endpoints.]]
  29785. [[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be:
  29786. ``
  29787. bool connect_condition(
  29788. const boost::system::error_code& ec,
  29789. const typename Protocol::endpoint& next);
  29790. ``
  29791. The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is the next endpoint to be tried. The function object should return true if the next endpoint should be tried, and false if it should be skipped.]]
  29792. [[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.]]
  29793. ]
  29794. [heading Return Value]
  29795. On success, an iterator denoting the successfully connected endpoint. Otherwise, the end iterator.
  29796. [heading Example]
  29797. The following connect condition function object can be used to output information about the individual connection attempts:
  29798. struct my_connect_condition
  29799. {
  29800. bool operator()(
  29801. const boost::system::error_code& ec,
  29802. const::tcp::endpoint& next)
  29803. {
  29804. if (ec) std::cout << "Error: " << ec.message() << std::endl;
  29805. std::cout << "Trying: " << next << std::endl;
  29806. return true;
  29807. }
  29808. };
  29809. It would be used with the `boost::asio::connect` function as follows:
  29810. tcp::resolver r(my_context);
  29811. tcp::resolver::query q("host", "service");
  29812. tcp::resolver::results_type e = r.resolve(q);
  29813. tcp::socket s(my_context);
  29814. boost::system::error_code ec;
  29815. tcp::resolver::results_type::iterator i = boost::asio::connect(
  29816. s, e.begin(), e.end(), my_connect_condition());
  29817. if (ec)
  29818. {
  29819. // An error occurred.
  29820. }
  29821. else
  29822. {
  29823. std::cout << "Connected to: " << i->endpoint() << std::endl;
  29824. }
  29825. [endsect]
  29826. [endsect]
  29827. [section:const_buffer const_buffer]
  29828. Holds a buffer that cannot be modified.
  29829. class const_buffer
  29830. [heading Member Functions]
  29831. [table
  29832. [[Name][Description]]
  29833. [
  29834. [[link boost_asio.reference.const_buffer.const_buffer [*const_buffer]]]
  29835. [Construct an empty buffer.
  29836. [hr]
  29837. Construct a buffer to represent a given memory range.
  29838. [hr]
  29839. Construct a non-modifiable buffer from a modifiable one. ]
  29840. ]
  29841. [
  29842. [[link boost_asio.reference.const_buffer.data [*data]]]
  29843. [Get a pointer to the beginning of the memory range. ]
  29844. ]
  29845. [
  29846. [[link boost_asio.reference.const_buffer.operator_plus__eq_ [*operator+=]]]
  29847. [Move the start of the buffer by the specified number of bytes. ]
  29848. ]
  29849. [
  29850. [[link boost_asio.reference.const_buffer.size [*size]]]
  29851. [Get the size of the memory range. ]
  29852. ]
  29853. ]
  29854. [heading Related Functions]
  29855. [table
  29856. [[Name][Description]]
  29857. [
  29858. [[link boost_asio.reference.const_buffer.operator_plus_ [*operator+]]]
  29859. [Create a new non-modifiable buffer that is offset from the start of another. ]
  29860. ]
  29861. ]
  29862. The [link boost_asio.reference.const_buffer `const_buffer`] class provides a safe representation of a buffer that cannot be modified. It does not own the underlying data, and so is cheap to copy or assign.
  29863. [heading Accessing Buffer Contents]
  29864. The contents of a buffer may be accessed using the `data()` and `size()` member functions:
  29865. boost::asio::const_buffer b1 = ...;
  29866. std::size_t s1 = b1.size();
  29867. const unsigned char* p1 = static_cast<const unsigned char*>(b1.data());
  29868. The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered.
  29869. [heading Requirements]
  29870. ['Header: ][^boost/asio/buffer.hpp]
  29871. ['Convenience header: ][^boost/asio.hpp]
  29872. [section:const_buffer const_buffer::const_buffer]
  29873. [indexterm2 boost_asio.indexterm.const_buffer.const_buffer..const_buffer..const_buffer]
  29874. Construct an empty buffer.
  29875. ``[link boost_asio.reference.const_buffer.const_buffer.overload1 const_buffer]``();
  29876. `` [''''&raquo;''' [link boost_asio.reference.const_buffer.const_buffer.overload1 more...]]``
  29877. Construct a buffer to represent a given memory range.
  29878. ``[link boost_asio.reference.const_buffer.const_buffer.overload2 const_buffer]``(
  29879. const void * data,
  29880. std::size_t size);
  29881. `` [''''&raquo;''' [link boost_asio.reference.const_buffer.const_buffer.overload2 more...]]``
  29882. Construct a non-modifiable buffer from a modifiable one.
  29883. ``[link boost_asio.reference.const_buffer.const_buffer.overload3 const_buffer]``(
  29884. const mutable_buffer & b);
  29885. `` [''''&raquo;''' [link boost_asio.reference.const_buffer.const_buffer.overload3 more...]]``
  29886. [section:overload1 const_buffer::const_buffer (1 of 3 overloads)]
  29887. Construct an empty buffer.
  29888. const_buffer();
  29889. [endsect]
  29890. [section:overload2 const_buffer::const_buffer (2 of 3 overloads)]
  29891. Construct a buffer to represent a given memory range.
  29892. const_buffer(
  29893. const void * data,
  29894. std::size_t size);
  29895. [endsect]
  29896. [section:overload3 const_buffer::const_buffer (3 of 3 overloads)]
  29897. Construct a non-modifiable buffer from a modifiable one.
  29898. const_buffer(
  29899. const mutable_buffer & b);
  29900. [endsect]
  29901. [endsect]
  29902. [section:data const_buffer::data]
  29903. [indexterm2 boost_asio.indexterm.const_buffer.data..data..const_buffer]
  29904. Get a pointer to the beginning of the memory range.
  29905. const void * data() const;
  29906. [endsect]
  29907. [section:operator_plus_ const_buffer::operator+]
  29908. [indexterm2 boost_asio.indexterm.const_buffer.operator_plus_..operator+..const_buffer]
  29909. Create a new non-modifiable buffer that is offset from the start of another.
  29910. const_buffer ``[link boost_asio.reference.const_buffer.operator_plus_.overload1 operator+]``(
  29911. const const_buffer & b,
  29912. std::size_t n);
  29913. `` [''''&raquo;''' [link boost_asio.reference.const_buffer.operator_plus_.overload1 more...]]``
  29914. const_buffer ``[link boost_asio.reference.const_buffer.operator_plus_.overload2 operator+]``(
  29915. std::size_t n,
  29916. const const_buffer & b);
  29917. `` [''''&raquo;''' [link boost_asio.reference.const_buffer.operator_plus_.overload2 more...]]``
  29918. [section:overload1 const_buffer::operator+ (1 of 2 overloads)]
  29919. Create a new non-modifiable buffer that is offset from the start of another.
  29920. const_buffer operator+(
  29921. const const_buffer & b,
  29922. std::size_t n);
  29923. [endsect]
  29924. [section:overload2 const_buffer::operator+ (2 of 2 overloads)]
  29925. Create a new non-modifiable buffer that is offset from the start of another.
  29926. const_buffer operator+(
  29927. std::size_t n,
  29928. const const_buffer & b);
  29929. [endsect]
  29930. [endsect]
  29931. [section:operator_plus__eq_ const_buffer::operator+=]
  29932. [indexterm2 boost_asio.indexterm.const_buffer.operator_plus__eq_..operator+=..const_buffer]
  29933. Move the start of the buffer by the specified number of bytes.
  29934. const_buffer & operator+=(
  29935. std::size_t n);
  29936. [endsect]
  29937. [section:size const_buffer::size]
  29938. [indexterm2 boost_asio.indexterm.const_buffer.size..size..const_buffer]
  29939. Get the size of the memory range.
  29940. std::size_t size() const;
  29941. [endsect]
  29942. [endsect]
  29943. [section:const_buffers_1 const_buffers_1]
  29944. (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.
  29945. class const_buffers_1 :
  29946. public const_buffer
  29947. [heading Types]
  29948. [table
  29949. [[Name][Description]]
  29950. [
  29951. [[link boost_asio.reference.const_buffers_1.const_iterator [*const_iterator]]]
  29952. [A random-access iterator type that may be used to read elements. ]
  29953. ]
  29954. [
  29955. [[link boost_asio.reference.const_buffers_1.value_type [*value_type]]]
  29956. [The type for each element in the list of buffers. ]
  29957. ]
  29958. ]
  29959. [heading Member Functions]
  29960. [table
  29961. [[Name][Description]]
  29962. [
  29963. [[link boost_asio.reference.const_buffers_1.begin [*begin]]]
  29964. [Get a random-access iterator to the first element. ]
  29965. ]
  29966. [
  29967. [[link boost_asio.reference.const_buffers_1.const_buffers_1 [*const_buffers_1]]]
  29968. [Construct to represent a given memory range.
  29969. [hr]
  29970. Construct to represent a single non-modifiable buffer. ]
  29971. ]
  29972. [
  29973. [[link boost_asio.reference.const_buffers_1.data [*data]]]
  29974. [Get a pointer to the beginning of the memory range. ]
  29975. ]
  29976. [
  29977. [[link boost_asio.reference.const_buffers_1.end [*end]]]
  29978. [Get a random-access iterator for one past the last element. ]
  29979. ]
  29980. [
  29981. [[link boost_asio.reference.const_buffers_1.operator_plus__eq_ [*operator+=]]]
  29982. [Move the start of the buffer by the specified number of bytes. ]
  29983. ]
  29984. [
  29985. [[link boost_asio.reference.const_buffers_1.size [*size]]]
  29986. [Get the size of the memory range. ]
  29987. ]
  29988. ]
  29989. [heading Related Functions]
  29990. [table
  29991. [[Name][Description]]
  29992. [
  29993. [[link boost_asio.reference.const_buffers_1.operator_plus_ [*operator+]]]
  29994. [Create a new non-modifiable buffer that is offset from the start of another. ]
  29995. ]
  29996. ]
  29997. [heading Requirements]
  29998. ['Header: ][^boost/asio/buffer.hpp]
  29999. ['Convenience header: ][^boost/asio.hpp]
  30000. [section:begin const_buffers_1::begin]
  30001. [indexterm2 boost_asio.indexterm.const_buffers_1.begin..begin..const_buffers_1]
  30002. Get a random-access iterator to the first element.
  30003. const_iterator begin() const;
  30004. [endsect]
  30005. [section:const_buffers_1 const_buffers_1::const_buffers_1]
  30006. [indexterm2 boost_asio.indexterm.const_buffers_1.const_buffers_1..const_buffers_1..const_buffers_1]
  30007. Construct to represent a given memory range.
  30008. ``[link boost_asio.reference.const_buffers_1.const_buffers_1.overload1 const_buffers_1]``(
  30009. const void * data,
  30010. std::size_t size);
  30011. `` [''''&raquo;''' [link boost_asio.reference.const_buffers_1.const_buffers_1.overload1 more...]]``
  30012. Construct to represent a single non-modifiable buffer.
  30013. explicit ``[link boost_asio.reference.const_buffers_1.const_buffers_1.overload2 const_buffers_1]``(
  30014. const const_buffer & b);
  30015. `` [''''&raquo;''' [link boost_asio.reference.const_buffers_1.const_buffers_1.overload2 more...]]``
  30016. [section:overload1 const_buffers_1::const_buffers_1 (1 of 2 overloads)]
  30017. Construct to represent a given memory range.
  30018. const_buffers_1(
  30019. const void * data,
  30020. std::size_t size);
  30021. [endsect]
  30022. [section:overload2 const_buffers_1::const_buffers_1 (2 of 2 overloads)]
  30023. Construct to represent a single non-modifiable buffer.
  30024. const_buffers_1(
  30025. const const_buffer & b);
  30026. [endsect]
  30027. [endsect]
  30028. [section:const_iterator const_buffers_1::const_iterator]
  30029. [indexterm2 boost_asio.indexterm.const_buffers_1.const_iterator..const_iterator..const_buffers_1]
  30030. A random-access iterator type that may be used to read elements.
  30031. typedef const const_buffer * const_iterator;
  30032. [heading Requirements]
  30033. ['Header: ][^boost/asio/buffer.hpp]
  30034. ['Convenience header: ][^boost/asio.hpp]
  30035. [endsect]
  30036. [section:data const_buffers_1::data]
  30037. ['Inherited from const_buffer.]
  30038. [indexterm2 boost_asio.indexterm.const_buffers_1.data..data..const_buffers_1]
  30039. Get a pointer to the beginning of the memory range.
  30040. const void * data() const;
  30041. [endsect]
  30042. [section:end const_buffers_1::end]
  30043. [indexterm2 boost_asio.indexterm.const_buffers_1.end..end..const_buffers_1]
  30044. Get a random-access iterator for one past the last element.
  30045. const_iterator end() const;
  30046. [endsect]
  30047. [section:operator_plus_ const_buffers_1::operator+]
  30048. [indexterm2 boost_asio.indexterm.const_buffers_1.operator_plus_..operator+..const_buffers_1]
  30049. Create a new non-modifiable buffer that is offset from the start of another.
  30050. const_buffer ``[link boost_asio.reference.const_buffers_1.operator_plus_.overload1 operator+]``(
  30051. const const_buffer & b,
  30052. std::size_t n);
  30053. `` [''''&raquo;''' [link boost_asio.reference.const_buffers_1.operator_plus_.overload1 more...]]``
  30054. const_buffer ``[link boost_asio.reference.const_buffers_1.operator_plus_.overload2 operator+]``(
  30055. std::size_t n,
  30056. const const_buffer & b);
  30057. `` [''''&raquo;''' [link boost_asio.reference.const_buffers_1.operator_plus_.overload2 more...]]``
  30058. [section:overload1 const_buffers_1::operator+ (1 of 2 overloads)]
  30059. ['Inherited from const_buffer.]
  30060. Create a new non-modifiable buffer that is offset from the start of another.
  30061. const_buffer operator+(
  30062. const const_buffer & b,
  30063. std::size_t n);
  30064. [endsect]
  30065. [section:overload2 const_buffers_1::operator+ (2 of 2 overloads)]
  30066. ['Inherited from const_buffer.]
  30067. Create a new non-modifiable buffer that is offset from the start of another.
  30068. const_buffer operator+(
  30069. std::size_t n,
  30070. const const_buffer & b);
  30071. [endsect]
  30072. [endsect]
  30073. [section:operator_plus__eq_ const_buffers_1::operator+=]
  30074. ['Inherited from const_buffer.]
  30075. [indexterm2 boost_asio.indexterm.const_buffers_1.operator_plus__eq_..operator+=..const_buffers_1]
  30076. Move the start of the buffer by the specified number of bytes.
  30077. const_buffer & operator+=(
  30078. std::size_t n);
  30079. [endsect]
  30080. [section:size const_buffers_1::size]
  30081. ['Inherited from const_buffer.]
  30082. [indexterm2 boost_asio.indexterm.const_buffers_1.size..size..const_buffers_1]
  30083. Get the size of the memory range.
  30084. std::size_t size() const;
  30085. [endsect]
  30086. [section:value_type const_buffers_1::value_type]
  30087. [indexterm2 boost_asio.indexterm.const_buffers_1.value_type..value_type..const_buffers_1]
  30088. The type for each element in the list of buffers.
  30089. typedef const_buffer value_type;
  30090. [heading Member Functions]
  30091. [table
  30092. [[Name][Description]]
  30093. [
  30094. [[link boost_asio.reference.const_buffer.const_buffer [*const_buffer]]]
  30095. [Construct an empty buffer.
  30096. [hr]
  30097. Construct a buffer to represent a given memory range.
  30098. [hr]
  30099. Construct a non-modifiable buffer from a modifiable one. ]
  30100. ]
  30101. [
  30102. [[link boost_asio.reference.const_buffer.data [*data]]]
  30103. [Get a pointer to the beginning of the memory range. ]
  30104. ]
  30105. [
  30106. [[link boost_asio.reference.const_buffer.operator_plus__eq_ [*operator+=]]]
  30107. [Move the start of the buffer by the specified number of bytes. ]
  30108. ]
  30109. [
  30110. [[link boost_asio.reference.const_buffer.size [*size]]]
  30111. [Get the size of the memory range. ]
  30112. ]
  30113. ]
  30114. [heading Related Functions]
  30115. [table
  30116. [[Name][Description]]
  30117. [
  30118. [[link boost_asio.reference.const_buffer.operator_plus_ [*operator+]]]
  30119. [Create a new non-modifiable buffer that is offset from the start of another. ]
  30120. ]
  30121. ]
  30122. The [link boost_asio.reference.const_buffer `const_buffer`] class provides a safe representation of a buffer that cannot be modified. It does not own the underlying data, and so is cheap to copy or assign.
  30123. [heading Accessing Buffer Contents]
  30124. The contents of a buffer may be accessed using the `data()` and `size()` member functions:
  30125. boost::asio::const_buffer b1 = ...;
  30126. std::size_t s1 = b1.size();
  30127. const unsigned char* p1 = static_cast<const unsigned char*>(b1.data());
  30128. The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered.
  30129. [heading Requirements]
  30130. ['Header: ][^boost/asio/buffer.hpp]
  30131. ['Convenience header: ][^boost/asio.hpp]
  30132. [endsect]
  30133. [endsect]
  30134. [section:coroutine coroutine]
  30135. Provides support for implementing stackless coroutines.
  30136. class coroutine
  30137. [heading Member Functions]
  30138. [table
  30139. [[Name][Description]]
  30140. [
  30141. [[link boost_asio.reference.coroutine.coroutine [*coroutine]]]
  30142. [Constructs a coroutine in its initial state. ]
  30143. ]
  30144. [
  30145. [[link boost_asio.reference.coroutine.is_child [*is_child]]]
  30146. [Returns true if the coroutine is the child of a fork. ]
  30147. ]
  30148. [
  30149. [[link boost_asio.reference.coroutine.is_complete [*is_complete]]]
  30150. [Returns true if the coroutine has reached its terminal state. ]
  30151. ]
  30152. [
  30153. [[link boost_asio.reference.coroutine.is_parent [*is_parent]]]
  30154. [Returns true if the coroutine is the parent of a fork. ]
  30155. ]
  30156. ]
  30157. The `coroutine` class may be used to implement stackless coroutines. The class itself is used to store the current state of the coroutine.
  30158. Coroutines are copy-constructible and assignable, and the space overhead is a single int. They can be used as a base class:
  30159. class session : coroutine
  30160. {
  30161. ...
  30162. };
  30163. or as a data member:
  30164. class session
  30165. {
  30166. ...
  30167. coroutine coro_;
  30168. };
  30169. or even bound in as a function argument using lambdas or `bind()`. The important thing is that as the application maintains a copy of the object for as long as the coroutine must be kept alive.
  30170. [heading Pseudo-keywords]
  30171. A coroutine is used in conjunction with certain "pseudo-keywords", which are implemented as macros. These macros are defined by a header file:
  30172. #include <boost/asio/yield.hpp>
  30173. and may conversely be undefined as follows:
  30174. #include <boost/asio/unyield.hpp>
  30175. [*reenter]
  30176. The `reenter` macro is used to define the body of a coroutine. It takes a single argument: a pointer or reference to a coroutine object. For example, if the base class is a coroutine object you may write:
  30177. reenter (this)
  30178. {
  30179. ... coroutine body ...
  30180. }
  30181. and if a data member or other variable you can write:
  30182. reenter (coro_)
  30183. {
  30184. ... coroutine body ...
  30185. }
  30186. When `reenter` is executed at runtime, control jumps to the location of the last `yield` or `fork`.
  30187. The coroutine body may also be a single statement, such as:
  30188. reenter (this) for (;;)
  30189. {
  30190. ...
  30191. }
  30192. [*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.
  30193. [*yield ['statement]]
  30194. This form of the `yield` keyword is often used with asynchronous operations:
  30195. yield socket_->async_read_some(buffer(*buffer_), *this);
  30196. This divides into four logical steps:
  30197. * `yield` saves the current state of the coroutine.
  30198. * The statement initiates the asynchronous operation.
  30199. * The resume point is defined immediately following the statement.
  30200. * Control is transferred to the end of the coroutine body.
  30201. When the asynchronous operation completes, the function object is invoked and `reenter` causes control to transfer to the resume point. It is important to remember to carry the coroutine state forward with the asynchronous operation. In the above snippet, the current class is a function object object with a coroutine object as base class or data member.
  30202. The statement may also be a compound statement, and this permits us to define local variables with limited scope:
  30203. yield
  30204. {
  30205. mutable_buffers_1 b = buffer(*buffer_);
  30206. socket_->async_read_some(b, *this);
  30207. }
  30208. [*yield return ['expression] ;]
  30209. This form of `yield` is often used in generators or coroutine-based parsers. For example, the function object:
  30210. struct interleave : coroutine
  30211. {
  30212. istream& is1;
  30213. istream& is2;
  30214. char operator()(char c)
  30215. {
  30216. reenter (this) for (;;)
  30217. {
  30218. yield return is1.get();
  30219. yield return is2.get();
  30220. }
  30221. }
  30222. };
  30223. defines a trivial coroutine that interleaves the characters from two input streams.
  30224. This type of `yield` divides into three logical steps:
  30225. * `yield` saves the current state of the coroutine.
  30226. * The resume point is defined immediately following the semicolon.
  30227. * The value of the expression is returned from the function.
  30228. [*yield ;]
  30229. This form of `yield` is equivalent to the following steps:
  30230. * `yield` saves the current state of the coroutine.
  30231. * The resume point is defined immediately following the semicolon.
  30232. * Control is transferred to the end of the coroutine body.
  30233. This form might be applied when coroutines are used for cooperative threading and scheduling is explicitly managed. For example:
  30234. struct task : coroutine
  30235. {
  30236. ...
  30237. void operator()()
  30238. {
  30239. reenter (this)
  30240. {
  30241. while (... not finished ...)
  30242. {
  30243. ... do something ...
  30244. yield;
  30245. ... do some more ...
  30246. yield;
  30247. }
  30248. }
  30249. }
  30250. ...
  30251. };
  30252. ...
  30253. task t1, t2;
  30254. for (;;)
  30255. {
  30256. t1();
  30257. t2();
  30258. }
  30259. [*yield break ;]
  30260. The final form of `yield` is used to explicitly terminate the coroutine. This form is comprised of two steps:
  30261. * `yield` sets the coroutine state to indicate termination.
  30262. * Control is transferred to the end of the coroutine body.
  30263. Once terminated, calls to `is_complete()` return true and the coroutine cannot be reentered.
  30264. Note that a coroutine may also be implicitly terminated if the coroutine body is exited without a yield, e.g. by return, throw or by running to the end of the body.
  30265. [*fork ['statement]]
  30266. The `fork` pseudo-keyword is used when "forking" a coroutine, i.e. splitting it into two (or more) copies. One use of `fork` is in a server, where a new coroutine is created to handle each client connection:
  30267. reenter (this)
  30268. {
  30269. do
  30270. {
  30271. socket_.reset(new tcp::socket(my_context_));
  30272. yield acceptor->async_accept(*socket_, *this);
  30273. fork server(*this)();
  30274. } while (is_parent());
  30275. ... client-specific handling follows ...
  30276. }
  30277. The logical steps involved in a `fork` are:
  30278. * `fork` saves the current state of the coroutine.
  30279. * The statement creates a copy of the coroutine and either executes it immediately or schedules it for later execution.
  30280. * The resume point is defined immediately following the semicolon.
  30281. * For the "parent", control immediately continues from the next line.
  30282. The functions `is_parent()` and `is_child()` can be used to differentiate between parent and child. You would use these functions to alter subsequent control flow.
  30283. Note that `fork` doesn't do the actual forking by itself. It is the application's responsibility to create a clone of the coroutine and call it. The clone can be called immediately, as above, or scheduled for delayed execution using something like [link boost_asio.reference.post `post`].
  30284. [heading Alternate macro names]
  30285. If preferred, an application can use macro names that follow a more typical naming convention, rather than the pseudo-keywords. These are:
  30286. * `BOOST_ASIO_CORO_REENTER` instead of `reenter`
  30287. * `BOOST_ASIO_CORO_YIELD` instead of `yield`
  30288. * `BOOST_ASIO_CORO_FORK` instead of `fork`
  30289. [heading Requirements]
  30290. ['Header: ][^boost/asio/coroutine.hpp]
  30291. ['Convenience header: ][^boost/asio.hpp]
  30292. [section:coroutine coroutine::coroutine]
  30293. [indexterm2 boost_asio.indexterm.coroutine.coroutine..coroutine..coroutine]
  30294. Constructs a coroutine in its initial state.
  30295. coroutine();
  30296. [endsect]
  30297. [section:is_child coroutine::is_child]
  30298. [indexterm2 boost_asio.indexterm.coroutine.is_child..is_child..coroutine]
  30299. Returns true if the coroutine is the child of a fork.
  30300. bool is_child() const;
  30301. [endsect]
  30302. [section:is_complete coroutine::is_complete]
  30303. [indexterm2 boost_asio.indexterm.coroutine.is_complete..is_complete..coroutine]
  30304. Returns true if the coroutine has reached its terminal state.
  30305. bool is_complete() const;
  30306. [endsect]
  30307. [section:is_parent coroutine::is_parent]
  30308. [indexterm2 boost_asio.indexterm.coroutine.is_parent..is_parent..coroutine]
  30309. Returns true if the coroutine is the parent of a fork.
  30310. bool is_parent() const;
  30311. [endsect]
  30312. [endsect]
  30313. [section:deadline_timer deadline_timer]
  30314. [indexterm1 boost_asio.indexterm.deadline_timer..deadline_timer]
  30315. Typedef for the typical usage of timer. Uses a UTC clock.
  30316. typedef basic_deadline_timer< boost::posix_time::ptime > deadline_timer;
  30317. [heading Types]
  30318. [table
  30319. [[Name][Description]]
  30320. [
  30321. [[link boost_asio.reference.basic_deadline_timer__rebind_executor [*rebind_executor]]]
  30322. [Rebinds the timer type to another executor. ]
  30323. ]
  30324. [
  30325. [[link boost_asio.reference.basic_deadline_timer.duration_type [*duration_type]]]
  30326. [The duration type. ]
  30327. ]
  30328. [
  30329. [[link boost_asio.reference.basic_deadline_timer.executor_type [*executor_type]]]
  30330. [The type of the executor associated with the object. ]
  30331. ]
  30332. [
  30333. [[link boost_asio.reference.basic_deadline_timer.time_type [*time_type]]]
  30334. [The time type. ]
  30335. ]
  30336. [
  30337. [[link boost_asio.reference.basic_deadline_timer.traits_type [*traits_type]]]
  30338. [The time traits type. ]
  30339. ]
  30340. ]
  30341. [heading Member Functions]
  30342. [table
  30343. [[Name][Description]]
  30344. [
  30345. [[link boost_asio.reference.basic_deadline_timer.async_wait [*async_wait]]]
  30346. [Start an asynchronous wait on the timer. ]
  30347. ]
  30348. [
  30349. [[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer [*basic_deadline_timer]]]
  30350. [Constructor.
  30351. [hr]
  30352. Constructor to set a particular expiry time as an absolute time.
  30353. [hr]
  30354. Constructor to set a particular expiry time relative to now.
  30355. [hr]
  30356. Move-construct a basic_deadline_timer from another. ]
  30357. ]
  30358. [
  30359. [[link boost_asio.reference.basic_deadline_timer.cancel [*cancel]]]
  30360. [Cancel any asynchronous operations that are waiting on the timer. ]
  30361. ]
  30362. [
  30363. [[link boost_asio.reference.basic_deadline_timer.cancel_one [*cancel_one]]]
  30364. [Cancels one asynchronous operation that is waiting on the timer. ]
  30365. ]
  30366. [
  30367. [[link boost_asio.reference.basic_deadline_timer.expires_at [*expires_at]]]
  30368. [Get the timer's expiry time as an absolute time.
  30369. [hr]
  30370. Set the timer's expiry time as an absolute time. ]
  30371. ]
  30372. [
  30373. [[link boost_asio.reference.basic_deadline_timer.expires_from_now [*expires_from_now]]]
  30374. [Get the timer's expiry time relative to now.
  30375. [hr]
  30376. Set the timer's expiry time relative to now. ]
  30377. ]
  30378. [
  30379. [[link boost_asio.reference.basic_deadline_timer.get_executor [*get_executor]]]
  30380. [Get the executor associated with the object. ]
  30381. ]
  30382. [
  30383. [[link boost_asio.reference.basic_deadline_timer.operator_eq_ [*operator=]]]
  30384. [Move-assign a basic_deadline_timer from another. ]
  30385. ]
  30386. [
  30387. [[link boost_asio.reference.basic_deadline_timer.wait [*wait]]]
  30388. [Perform a blocking wait on the timer. ]
  30389. ]
  30390. [
  30391. [[link boost_asio.reference.basic_deadline_timer._basic_deadline_timer [*~basic_deadline_timer]]]
  30392. [Destroys the timer. ]
  30393. ]
  30394. ]
  30395. The [link boost_asio.reference.basic_deadline_timer `basic_deadline_timer`] class template provides the ability to perform a blocking or asynchronous wait for a timer to expire.
  30396. A deadline timer is always in one of two states: "expired" or "not expired". If the `wait()` or `async_wait()` function is called on an expired timer, the wait operation will complete immediately.
  30397. Most applications will use the [link boost_asio.reference.deadline_timer `deadline_timer`] typedef.
  30398. [heading Thread Safety]
  30399. ['Distinct] ['objects:] Safe.
  30400. ['Shared] ['objects:] Unsafe.
  30401. [heading Examples]
  30402. Performing a blocking wait:
  30403. // Construct a timer without setting an expiry time.
  30404. boost::asio::deadline_timer timer(my_context);
  30405. // Set an expiry time relative to now.
  30406. timer.expires_from_now(boost::posix_time::seconds(5));
  30407. // Wait for the timer to expire.
  30408. timer.wait();
  30409. Performing an asynchronous wait:
  30410. void handler(const boost::system::error_code& error)
  30411. {
  30412. if (!error)
  30413. {
  30414. // Timer expired.
  30415. }
  30416. }
  30417. ...
  30418. // Construct a timer with an absolute expiry time.
  30419. boost::asio::deadline_timer timer(my_context,
  30420. boost::posix_time::time_from_string("2005-12-07 23:59:59.000"));
  30421. // Start an asynchronous wait.
  30422. timer.async_wait(handler);
  30423. [heading Changing an active deadline_timer's expiry time]
  30424. Changing the expiry time of a timer while there are pending asynchronous waits causes those wait operations to be cancelled. To ensure that the action associated with the timer is performed only once, use something like this: used:
  30425. void on_some_event()
  30426. {
  30427. if (my_timer.expires_from_now(seconds(5)) > 0)
  30428. {
  30429. // We managed to cancel the timer. Start new asynchronous wait.
  30430. my_timer.async_wait(on_timeout);
  30431. }
  30432. else
  30433. {
  30434. // Too late, timer has already expired!
  30435. }
  30436. }
  30437. void on_timeout(const boost::system::error_code& e)
  30438. {
  30439. if (e != boost::asio::error::operation_aborted)
  30440. {
  30441. // Timer was not cancelled, take necessary action.
  30442. }
  30443. }
  30444. * 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.
  30445. * If a wait handler is cancelled, the boost::system::error\_code passed to it contains the value `boost::asio::error::operation_aborted`.
  30446. [heading Requirements]
  30447. ['Header: ][^boost/asio/deadline_timer.hpp]
  30448. ['Convenience header: ][^boost/asio.hpp]
  30449. [endsect]
  30450. [section:default_completion_token default_completion_token]
  30451. Traits type used to determine the default completion token type associated with a type (such as an executor).
  30452. template<
  30453. typename T>
  30454. struct default_completion_token
  30455. [heading Types]
  30456. [table
  30457. [[Name][Description]]
  30458. [
  30459. [[link boost_asio.reference.default_completion_token.type [*type]]]
  30460. [If T has a nested type default_completion_token_type, T::default_completion_token_type. Otherwise the typedef type is not defined. ]
  30461. ]
  30462. ]
  30463. A program may specialise this traits type if the `T` template parameter in the specialisation is a user-defined type.
  30464. Specialisations of this trait may provide a nested typedef `type`, which is a default-constructible completion token type.
  30465. [heading Requirements]
  30466. ['Header: ][^boost/asio/async_result.hpp]
  30467. ['Convenience header: ][^boost/asio.hpp]
  30468. [section:type default_completion_token::type]
  30469. [indexterm2 boost_asio.indexterm.default_completion_token.type..type..default_completion_token]
  30470. If `T` has a nested type `default_completion_token_type`, `T::default_completion_token_type`. Otherwise the typedef `type` is not defined.
  30471. typedef see_below type;
  30472. [heading Requirements]
  30473. ['Header: ][^boost/asio/async_result.hpp]
  30474. ['Convenience header: ][^boost/asio.hpp]
  30475. [endsect]
  30476. [endsect]
  30477. [section:defer defer]
  30478. [indexterm1 boost_asio.indexterm.defer..defer]
  30479. Submits a completion token or function object for execution.
  30480. template<
  30481. typename CompletionToken>
  30482. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.defer.overload1 defer]``(
  30483. CompletionToken && token);
  30484. `` [''''&raquo;''' [link boost_asio.reference.defer.overload1 more...]]``
  30485. template<
  30486. typename ``[link boost_asio.reference.Executor1 Executor]``,
  30487. typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  30488. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.defer.overload2 defer]``(
  30489. const Executor & ex,
  30490. CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  30491. typename enable_if< is_executor< Executor >::value >::type * = 0);
  30492. `` [''''&raquo;''' [link boost_asio.reference.defer.overload2 more...]]``
  30493. template<
  30494. typename ExecutionContext,
  30495. typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  30496. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.defer.overload3 defer]``(
  30497. ExecutionContext & ctx,
  30498. CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  30499. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  30500. `` [''''&raquo;''' [link boost_asio.reference.defer.overload3 more...]]``
  30501. [heading Requirements]
  30502. ['Header: ][^boost/asio/defer.hpp]
  30503. ['Convenience header: ][^boost/asio.hpp]
  30504. [section:overload1 defer (1 of 3 overloads)]
  30505. Submits a completion token or function object for execution.
  30506. template<
  30507. typename CompletionToken>
  30508. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` defer(
  30509. CompletionToken && token);
  30510. This function submits an object for execution using the object's associated executor. The function object is queued for execution, and is never called from the current thread prior to returning from `defer()`.
  30511. The use of `defer()`, rather than [link boost_asio.reference.post `post`] , indicates the caller's preference that the executor defer the queueing of the function object. This may allow the executor to optimise queueing for cases when the function object represents a continuation of the current call context.
  30512. This function has the following effects:
  30513. * Constructs a function object handler of type `Handler`, initialized with `handler(forward<CompletionToken>(token))`.
  30514. * Constructs an object `result` of type `async_result<Handler>`, initializing the object as `result(handler)`.
  30515. * Obtains the handler's associated executor object `ex` by performing `get_associated_executor(handler)`.
  30516. * Obtains the handler's associated allocator object `alloc` by performing `get_associated_allocator(handler)`.
  30517. * Performs `ex.defer(std::move(handler), alloc)`.
  30518. * Returns `result.get()`.
  30519. [endsect]
  30520. [section:overload2 defer (2 of 3 overloads)]
  30521. Submits a completion token or function object for execution.
  30522. template<
  30523. typename ``[link boost_asio.reference.Executor1 Executor]``,
  30524. typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  30525. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` defer(
  30526. const Executor & ex,
  30527. CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  30528. typename enable_if< is_executor< Executor >::value >::type * = 0);
  30529. This function submits an object for execution using the specified executor. The function object is queued for execution, and is never called from the current thread prior to returning from `defer()`.
  30530. The use of `defer()`, rather than [link boost_asio.reference.post `post`] , indicates the caller's preference that the executor defer the queueing of the function object. This may allow the executor to optimise queueing for cases when the function object represents a continuation of the current call context.
  30531. This function has the following effects:
  30532. * Constructs a function object handler of type `Handler`, initialized with `handler(forward<CompletionToken>(token))`.
  30533. * Constructs an object `result` of type `async_result<Handler>`, initializing the object as `result(handler)`.
  30534. * Obtains the handler's associated executor object `ex1` by performing `get_associated_executor(handler)`.
  30535. * Creates a work object `w` by performing `make_work(ex1)`.
  30536. * Obtains the handler's associated allocator object `alloc` by performing `get_associated_allocator(handler)`.
  30537. * Constructs a function object `f` with a function call operator that performs `ex1.dispatch(std::move(handler), alloc)` followed by `w.reset()`.
  30538. * Performs `Executor(ex).defer(std::move(f), alloc)`.
  30539. * Returns `result.get()`.
  30540. [endsect]
  30541. [section:overload3 defer (3 of 3 overloads)]
  30542. Submits a completion token or function object for execution.
  30543. template<
  30544. typename ExecutionContext,
  30545. typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  30546. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` defer(
  30547. ExecutionContext & ctx,
  30548. CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  30549. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  30550. [heading Return Value]
  30551. `defer(ctx.get_executor(), forward<CompletionToken>(token))`.
  30552. [endsect]
  30553. [endsect]
  30554. [section:detached detached]
  30555. [indexterm1 boost_asio.indexterm.detached..detached]
  30556. A special value, similar to std::nothrow.
  30557. constexpr detached_t detached;
  30558. See the documentation for [link boost_asio.reference.detached_t `detached_t`] for a usage example.
  30559. [heading Requirements]
  30560. ['Header: ][^boost/asio/detached.hpp]
  30561. ['Convenience header: ][^boost/asio.hpp]
  30562. [endsect]
  30563. [section:detached_t detached_t]
  30564. Class used to specify that an asynchronous operation is detached.
  30565. class detached_t
  30566. [heading Member Functions]
  30567. [table
  30568. [[Name][Description]]
  30569. [
  30570. [[link boost_asio.reference.detached_t.detached_t [*detached_t]]]
  30571. [Constructor. ]
  30572. ]
  30573. ]
  30574. The [link boost_asio.reference.detached_t `detached_t`] class is used to indicate that an asynchronous operation is detached. That is, there is no completion handler waiting for the operation's result. A [link boost_asio.reference.detached_t `detached_t`] object may be passed as a handler to an asynchronous operation, typically using the special value `boost::asio::detached`. For example:
  30575. my_socket.async_send(my_buffer, boost::asio::detached);
  30576. [heading Requirements]
  30577. ['Header: ][^boost/asio/detached.hpp]
  30578. ['Convenience header: ][^boost/asio.hpp]
  30579. [section:detached_t detached_t::detached_t]
  30580. [indexterm2 boost_asio.indexterm.detached_t.detached_t..detached_t..detached_t]
  30581. Constructor.
  30582. constexpr detached_t();
  30583. [endsect]
  30584. [endsect]
  30585. [section:dispatch dispatch]
  30586. [indexterm1 boost_asio.indexterm.dispatch..dispatch]
  30587. Submits a completion token or function object for execution.
  30588. template<
  30589. typename CompletionToken>
  30590. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.dispatch.overload1 dispatch]``(
  30591. CompletionToken && token);
  30592. `` [''''&raquo;''' [link boost_asio.reference.dispatch.overload1 more...]]``
  30593. template<
  30594. typename ``[link boost_asio.reference.Executor1 Executor]``,
  30595. typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  30596. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.dispatch.overload2 dispatch]``(
  30597. const Executor & ex,
  30598. CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  30599. typename enable_if< is_executor< Executor >::value >::type * = 0);
  30600. `` [''''&raquo;''' [link boost_asio.reference.dispatch.overload2 more...]]``
  30601. template<
  30602. typename ExecutionContext,
  30603. typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  30604. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.dispatch.overload3 dispatch]``(
  30605. ExecutionContext & ctx,
  30606. CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  30607. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  30608. `` [''''&raquo;''' [link boost_asio.reference.dispatch.overload3 more...]]``
  30609. [heading Requirements]
  30610. ['Header: ][^boost/asio/dispatch.hpp]
  30611. ['Convenience header: ][^boost/asio.hpp]
  30612. [section:overload1 dispatch (1 of 3 overloads)]
  30613. Submits a completion token or function object for execution.
  30614. template<
  30615. typename CompletionToken>
  30616. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` dispatch(
  30617. CompletionToken && token);
  30618. This function submits an object for execution using the object's associated executor. The function object may be called from the current thread prior to returning from `dispatch()`. Otherwise, it is queued for execution.
  30619. This function has the following effects:
  30620. * Constructs a function object handler of type `Handler`, initialized with `handler(forward<CompletionToken>(token))`.
  30621. * Constructs an object `result` of type `async_result<Handler>`, initializing the object as `result(handler)`.
  30622. * Obtains the handler's associated executor object `ex` by performing `get_associated_executor(handler)`.
  30623. * Obtains the handler's associated allocator object `alloc` by performing `get_associated_allocator(handler)`.
  30624. * Performs `ex.dispatch(std::move(handler), alloc)`.
  30625. * Returns `result.get()`.
  30626. [endsect]
  30627. [section:overload2 dispatch (2 of 3 overloads)]
  30628. Submits a completion token or function object for execution.
  30629. template<
  30630. typename ``[link boost_asio.reference.Executor1 Executor]``,
  30631. typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  30632. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` dispatch(
  30633. const Executor & ex,
  30634. CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  30635. typename enable_if< is_executor< Executor >::value >::type * = 0);
  30636. This function submits an object for execution using the specified executor. The function object may be called from the current thread prior to returning from `dispatch()`. Otherwise, it is queued for execution.
  30637. This function has the following effects:
  30638. * Constructs a function object handler of type `Handler`, initialized with `handler(forward<CompletionToken>(token))`.
  30639. * Constructs an object `result` of type `async_result<Handler>`, initializing the object as `result(handler)`.
  30640. * Obtains the handler's associated executor object `ex1` by performing `get_associated_executor(handler)`.
  30641. * Creates a work object `w` by performing `make_work(ex1)`.
  30642. * Obtains the handler's associated allocator object `alloc` by performing `get_associated_allocator(handler)`.
  30643. * Constructs a function object `f` with a function call operator that performs `ex1.dispatch(std::move(handler), alloc)` followed by `w.reset()`.
  30644. * Performs `Executor(ex).dispatch(std::move(f), alloc)`.
  30645. * Returns `result.get()`.
  30646. [endsect]
  30647. [section:overload3 dispatch (3 of 3 overloads)]
  30648. Submits a completion token or function object for execution.
  30649. template<
  30650. typename ExecutionContext,
  30651. typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  30652. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` dispatch(
  30653. ExecutionContext & ctx,
  30654. CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  30655. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  30656. [heading Return Value]
  30657. `dispatch(ctx.get_executor(), forward<CompletionToken>(token))`.
  30658. [endsect]
  30659. [endsect]
  30660. [section:dynamic_buffer dynamic_buffer]
  30661. [indexterm1 boost_asio.indexterm.dynamic_buffer..dynamic_buffer]
  30662. The `boost::asio::dynamic_buffer` function is used to create a dynamically resized buffer from a `std::basic_string` or `std::vector`.
  30663. Create a new dynamic buffer that represents the given string.
  30664. template<
  30665. typename Elem,
  30666. typename Traits,
  30667. typename Allocator>
  30668. dynamic_string_buffer< Elem, Traits, Allocator > ``[link boost_asio.reference.dynamic_buffer.overload1 dynamic_buffer]``(
  30669. std::basic_string< Elem, Traits, Allocator > & data);
  30670. `` [''''&raquo;''' [link boost_asio.reference.dynamic_buffer.overload1 more...]]``
  30671. template<
  30672. typename Elem,
  30673. typename Traits,
  30674. typename Allocator>
  30675. dynamic_string_buffer< Elem, Traits, Allocator > ``[link boost_asio.reference.dynamic_buffer.overload2 dynamic_buffer]``(
  30676. std::basic_string< Elem, Traits, Allocator > & data,
  30677. std::size_t max_size);
  30678. `` [''''&raquo;''' [link boost_asio.reference.dynamic_buffer.overload2 more...]]``
  30679. Create a new dynamic buffer that represents the given vector.
  30680. template<
  30681. typename Elem,
  30682. typename Allocator>
  30683. dynamic_vector_buffer< Elem, Allocator > ``[link boost_asio.reference.dynamic_buffer.overload3 dynamic_buffer]``(
  30684. std::vector< Elem, Allocator > & data);
  30685. `` [''''&raquo;''' [link boost_asio.reference.dynamic_buffer.overload3 more...]]``
  30686. template<
  30687. typename Elem,
  30688. typename Allocator>
  30689. dynamic_vector_buffer< Elem, Allocator > ``[link boost_asio.reference.dynamic_buffer.overload4 dynamic_buffer]``(
  30690. std::vector< Elem, Allocator > & data,
  30691. std::size_t max_size);
  30692. `` [''''&raquo;''' [link boost_asio.reference.dynamic_buffer.overload4 more...]]``
  30693. [heading Requirements]
  30694. ['Header: ][^boost/asio/buffer.hpp]
  30695. ['Convenience header: ][^boost/asio.hpp]
  30696. [section:overload1 dynamic_buffer (1 of 4 overloads)]
  30697. Create a new dynamic buffer that represents the given string.
  30698. template<
  30699. typename Elem,
  30700. typename Traits,
  30701. typename Allocator>
  30702. dynamic_string_buffer< Elem, Traits, Allocator > dynamic_buffer(
  30703. std::basic_string< Elem, Traits, Allocator > & data);
  30704. [heading Return Value]
  30705. `dynamic_string_buffer<Elem, Traits, Allocator>(data)`.
  30706. [endsect]
  30707. [section:overload2 dynamic_buffer (2 of 4 overloads)]
  30708. Create a new dynamic buffer that represents the given string.
  30709. template<
  30710. typename Elem,
  30711. typename Traits,
  30712. typename Allocator>
  30713. dynamic_string_buffer< Elem, Traits, Allocator > dynamic_buffer(
  30714. std::basic_string< Elem, Traits, Allocator > & data,
  30715. std::size_t max_size);
  30716. [heading Return Value]
  30717. `dynamic_string_buffer<Elem, Traits, Allocator>(data, max_size)`.
  30718. [endsect]
  30719. [section:overload3 dynamic_buffer (3 of 4 overloads)]
  30720. Create a new dynamic buffer that represents the given vector.
  30721. template<
  30722. typename Elem,
  30723. typename Allocator>
  30724. dynamic_vector_buffer< Elem, Allocator > dynamic_buffer(
  30725. std::vector< Elem, Allocator > & data);
  30726. [heading Return Value]
  30727. `dynamic_vector_buffer<Elem, Allocator>(data)`.
  30728. [endsect]
  30729. [section:overload4 dynamic_buffer (4 of 4 overloads)]
  30730. Create a new dynamic buffer that represents the given vector.
  30731. template<
  30732. typename Elem,
  30733. typename Allocator>
  30734. dynamic_vector_buffer< Elem, Allocator > dynamic_buffer(
  30735. std::vector< Elem, Allocator > & data,
  30736. std::size_t max_size);
  30737. [heading Return Value]
  30738. `dynamic_vector_buffer<Elem, Allocator>(data, max_size)`.
  30739. [endsect]
  30740. [endsect]
  30741. [section:dynamic_string_buffer dynamic_string_buffer]
  30742. Adapt a basic\_string to the DynamicBuffer requirements.
  30743. template<
  30744. typename Elem,
  30745. typename Traits,
  30746. typename Allocator>
  30747. class dynamic_string_buffer
  30748. [heading Types]
  30749. [table
  30750. [[Name][Description]]
  30751. [
  30752. [[link boost_asio.reference.dynamic_string_buffer.const_buffers_type [*const_buffers_type]]]
  30753. [The type used to represent a sequence of constant buffers that refers to the underlying memory. ]
  30754. ]
  30755. [
  30756. [[link boost_asio.reference.dynamic_string_buffer.mutable_buffers_type [*mutable_buffers_type]]]
  30757. [The type used to represent a sequence of mutable buffers that refers to the underlying memory. ]
  30758. ]
  30759. ]
  30760. [heading Member Functions]
  30761. [table
  30762. [[Name][Description]]
  30763. [
  30764. [[link boost_asio.reference.dynamic_string_buffer.capacity [*capacity]]]
  30765. [Get the maximum size that the buffer may grow to without triggering reallocation. ]
  30766. ]
  30767. [
  30768. [[link boost_asio.reference.dynamic_string_buffer.commit [*commit]]]
  30769. [DynamicBuffer_v1: Move bytes from the output sequence to the input sequence. ]
  30770. ]
  30771. [
  30772. [[link boost_asio.reference.dynamic_string_buffer.consume [*consume]]]
  30773. [DynamicBuffer_v1: Remove characters from the input sequence. DynamicBuffer_v2: Consume the specified number of bytes from the beginning of the underlying memory. ]
  30774. ]
  30775. [
  30776. [[link boost_asio.reference.dynamic_string_buffer.data [*data]]]
  30777. [DynamicBuffer_v1: Get a list of buffers that represents the input sequence.
  30778. [hr]
  30779. DynamicBuffer_v2: Get a sequence of buffers that represents the underlying memory. ]
  30780. ]
  30781. [
  30782. [[link boost_asio.reference.dynamic_string_buffer.dynamic_string_buffer [*dynamic_string_buffer]]]
  30783. [Construct a dynamic buffer from a string.
  30784. [hr]
  30785. DynamicBuffer_v2: Copy construct a dynamic buffer.
  30786. [hr]
  30787. Move construct a dynamic buffer. ]
  30788. ]
  30789. [
  30790. [[link boost_asio.reference.dynamic_string_buffer.grow [*grow]]]
  30791. [DynamicBuffer_v2: Grow the underlying memory by the specified number of bytes. ]
  30792. ]
  30793. [
  30794. [[link boost_asio.reference.dynamic_string_buffer.max_size [*max_size]]]
  30795. [Get the maximum size of the dynamic buffer. ]
  30796. ]
  30797. [
  30798. [[link boost_asio.reference.dynamic_string_buffer.prepare [*prepare]]]
  30799. [DynamicBuffer_v1: Get a list of buffers that represents the output sequence, with the given size. ]
  30800. ]
  30801. [
  30802. [[link boost_asio.reference.dynamic_string_buffer.shrink [*shrink]]]
  30803. [DynamicBuffer_v2: Shrink the underlying memory by the specified number of bytes. ]
  30804. ]
  30805. [
  30806. [[link boost_asio.reference.dynamic_string_buffer.size [*size]]]
  30807. [DynamicBuffer_v1: Get the size of the input sequence. DynamicBuffer_v2: Get the current size of the underlying memory. ]
  30808. ]
  30809. ]
  30810. Requires that `sizeof(Elem) == 1`.
  30811. [heading Requirements]
  30812. ['Header: ][^boost/asio/buffer.hpp]
  30813. ['Convenience header: ][^boost/asio.hpp]
  30814. [section:capacity dynamic_string_buffer::capacity]
  30815. [indexterm2 boost_asio.indexterm.dynamic_string_buffer.capacity..capacity..dynamic_string_buffer]
  30816. Get the maximum size that the buffer may grow to without triggering reallocation.
  30817. std::size_t capacity() const;
  30818. [heading Return Value]
  30819. The current capacity of the underlying string if less than `max_size()`. Otherwise returns `max_size()`.
  30820. [endsect]
  30821. [section:commit dynamic_string_buffer::commit]
  30822. [indexterm2 boost_asio.indexterm.dynamic_string_buffer.commit..commit..dynamic_string_buffer]
  30823. [*DynamicBuffer\_v1:] Move bytes from the output sequence to the input sequence.
  30824. void commit(
  30825. std::size_t n);
  30826. [heading Parameters]
  30827. [variablelist
  30828. [[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.]]
  30829. ]
  30830. Requires a preceding call `prepare(x)` where `x >= n`, and no intervening operations that modify the input or output sequence.
  30831. [heading Remarks]
  30832. If `n` is greater than the size of the output sequence, the entire output sequence is moved to the input sequence and no error is issued.
  30833. [endsect]
  30834. [section:const_buffers_type dynamic_string_buffer::const_buffers_type]
  30835. [indexterm2 boost_asio.indexterm.dynamic_string_buffer.const_buffers_type..const_buffers_type..dynamic_string_buffer]
  30836. The type used to represent a sequence of constant buffers that refers to the underlying memory.
  30837. typedef const_buffer const_buffers_type;
  30838. [heading Member Functions]
  30839. [table
  30840. [[Name][Description]]
  30841. [
  30842. [[link boost_asio.reference.const_buffer.const_buffer [*const_buffer]]]
  30843. [Construct an empty buffer.
  30844. [hr]
  30845. Construct a buffer to represent a given memory range.
  30846. [hr]
  30847. Construct a non-modifiable buffer from a modifiable one. ]
  30848. ]
  30849. [
  30850. [[link boost_asio.reference.const_buffer.data [*data]]]
  30851. [Get a pointer to the beginning of the memory range. ]
  30852. ]
  30853. [
  30854. [[link boost_asio.reference.const_buffer.operator_plus__eq_ [*operator+=]]]
  30855. [Move the start of the buffer by the specified number of bytes. ]
  30856. ]
  30857. [
  30858. [[link boost_asio.reference.const_buffer.size [*size]]]
  30859. [Get the size of the memory range. ]
  30860. ]
  30861. ]
  30862. [heading Related Functions]
  30863. [table
  30864. [[Name][Description]]
  30865. [
  30866. [[link boost_asio.reference.const_buffer.operator_plus_ [*operator+]]]
  30867. [Create a new non-modifiable buffer that is offset from the start of another. ]
  30868. ]
  30869. ]
  30870. The [link boost_asio.reference.const_buffer `const_buffer`] class provides a safe representation of a buffer that cannot be modified. It does not own the underlying data, and so is cheap to copy or assign.
  30871. [heading Accessing Buffer Contents]
  30872. The contents of a buffer may be accessed using the `data()` and `size()` member functions:
  30873. boost::asio::const_buffer b1 = ...;
  30874. std::size_t s1 = b1.size();
  30875. const unsigned char* p1 = static_cast<const unsigned char*>(b1.data());
  30876. The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered.
  30877. [heading Requirements]
  30878. ['Header: ][^boost/asio/buffer.hpp]
  30879. ['Convenience header: ][^boost/asio.hpp]
  30880. [endsect]
  30881. [section:consume dynamic_string_buffer::consume]
  30882. [indexterm2 boost_asio.indexterm.dynamic_string_buffer.consume..consume..dynamic_string_buffer]
  30883. [*DynamicBuffer\_v1:] Remove characters from the input sequence. [*DynamicBuffer\_v2:] Consume the specified number of bytes from the beginning of the underlying memory.
  30884. void consume(
  30885. std::size_t n);
  30886. [*DynamicBuffer\_v1:] Removes `n` characters from the beginning of the input sequence.
  30887. [heading Remarks]
  30888. If `n` is greater than the size of the input sequence, the entire input sequence is consumed and no error is issued.
  30889. [*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.
  30890. [endsect]
  30891. [section:data dynamic_string_buffer::data]
  30892. [indexterm2 boost_asio.indexterm.dynamic_string_buffer.data..data..dynamic_string_buffer]
  30893. [*DynamicBuffer\_v1:] Get a list of buffers that represents the input sequence.
  30894. const_buffers_type ``[link boost_asio.reference.dynamic_string_buffer.data.overload1 data]``() const;
  30895. `` [''''&raquo;''' [link boost_asio.reference.dynamic_string_buffer.data.overload1 more...]]``
  30896. [*DynamicBuffer\_v2:] Get a sequence of buffers that represents the underlying memory.
  30897. mutable_buffers_type ``[link boost_asio.reference.dynamic_string_buffer.data.overload2 data]``(
  30898. std::size_t pos,
  30899. std::size_t n);
  30900. `` [''''&raquo;''' [link boost_asio.reference.dynamic_string_buffer.data.overload2 more...]]``
  30901. const_buffers_type ``[link boost_asio.reference.dynamic_string_buffer.data.overload3 data]``(
  30902. std::size_t pos,
  30903. std::size_t n) const;
  30904. `` [''''&raquo;''' [link boost_asio.reference.dynamic_string_buffer.data.overload3 more...]]``
  30905. [section:overload1 dynamic_string_buffer::data (1 of 3 overloads)]
  30906. [*DynamicBuffer\_v1:] Get a list of buffers that represents the input sequence.
  30907. const_buffers_type data() const;
  30908. [heading Return Value]
  30909. An object of type `const_buffers_type` that satisfies ConstBufferSequence requirements, representing the basic\_string memory in the input sequence.
  30910. [heading Remarks]
  30911. The returned object is invalidated by any `dynamic_string_buffer` or `basic_string` member function that resizes or erases the string.
  30912. [endsect]
  30913. [section:overload2 dynamic_string_buffer::data (2 of 3 overloads)]
  30914. [*DynamicBuffer\_v2:] Get a sequence of buffers that represents the underlying memory.
  30915. mutable_buffers_type data(
  30916. std::size_t pos,
  30917. std::size_t n);
  30918. [heading Parameters]
  30919. [variablelist
  30920. [[pos][Position of the first byte to represent in the buffer sequence]]
  30921. [[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.]]
  30922. ]
  30923. [heading Return Value]
  30924. An object of type `mutable_buffers_type` that satisfies MutableBufferSequence requirements, representing the basic\_string memory.
  30925. [heading Remarks]
  30926. The returned object is invalidated by any `dynamic_string_buffer` or `basic_string` member function that resizes or erases the string.
  30927. [endsect]
  30928. [section:overload3 dynamic_string_buffer::data (3 of 3 overloads)]
  30929. [*DynamicBuffer\_v2:] Get a sequence of buffers that represents the underlying memory.
  30930. const_buffers_type data(
  30931. std::size_t pos,
  30932. std::size_t n) const;
  30933. [heading Parameters]
  30934. [variablelist
  30935. [[pos][Position of the first byte to represent in the buffer sequence]]
  30936. [[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.]]
  30937. ]
  30938. [heading Remarks]
  30939. The returned object is invalidated by any `dynamic_string_buffer` or `basic_string` member function that resizes or erases the string.
  30940. [endsect]
  30941. [endsect]
  30942. [section:dynamic_string_buffer dynamic_string_buffer::dynamic_string_buffer]
  30943. [indexterm2 boost_asio.indexterm.dynamic_string_buffer.dynamic_string_buffer..dynamic_string_buffer..dynamic_string_buffer]
  30944. Construct a dynamic buffer from a string.
  30945. explicit ``[link boost_asio.reference.dynamic_string_buffer.dynamic_string_buffer.overload1 dynamic_string_buffer]``(
  30946. std::basic_string< Elem, Traits, Allocator > & s,
  30947. std::size_t maximum_size = (std::numeric_limits< std::size_t >::max)());
  30948. `` [''''&raquo;''' [link boost_asio.reference.dynamic_string_buffer.dynamic_string_buffer.overload1 more...]]``
  30949. [*DynamicBuffer\_v2:] Copy construct a dynamic buffer.
  30950. ``[link boost_asio.reference.dynamic_string_buffer.dynamic_string_buffer.overload2 dynamic_string_buffer]``(
  30951. const dynamic_string_buffer & other);
  30952. `` [''''&raquo;''' [link boost_asio.reference.dynamic_string_buffer.dynamic_string_buffer.overload2 more...]]``
  30953. Move construct a dynamic buffer.
  30954. ``[link boost_asio.reference.dynamic_string_buffer.dynamic_string_buffer.overload3 dynamic_string_buffer]``(
  30955. dynamic_string_buffer && other);
  30956. `` [''''&raquo;''' [link boost_asio.reference.dynamic_string_buffer.dynamic_string_buffer.overload3 more...]]``
  30957. [section:overload1 dynamic_string_buffer::dynamic_string_buffer (1 of 3 overloads)]
  30958. Construct a dynamic buffer from a string.
  30959. dynamic_string_buffer(
  30960. std::basic_string< Elem, Traits, Allocator > & s,
  30961. std::size_t maximum_size = (std::numeric_limits< std::size_t >::max)());
  30962. [heading Parameters]
  30963. [variablelist
  30964. [[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.]]
  30965. ]
  30966. [*DynamicBuffer\_v1:] Any existing data in the string is treated as the dynamic buffer's input sequence.
  30967. [heading Parameters]
  30968. [variablelist
  30969. [[maximum_size][Specifies a maximum size for the buffer, in bytes. ]]
  30970. ]
  30971. [endsect]
  30972. [section:overload2 dynamic_string_buffer::dynamic_string_buffer (2 of 3 overloads)]
  30973. [*DynamicBuffer\_v2:] Copy construct a dynamic buffer.
  30974. dynamic_string_buffer(
  30975. const dynamic_string_buffer & other);
  30976. [endsect]
  30977. [section:overload3 dynamic_string_buffer::dynamic_string_buffer (3 of 3 overloads)]
  30978. Move construct a dynamic buffer.
  30979. dynamic_string_buffer(
  30980. dynamic_string_buffer && other);
  30981. [endsect]
  30982. [endsect]
  30983. [section:grow dynamic_string_buffer::grow]
  30984. [indexterm2 boost_asio.indexterm.dynamic_string_buffer.grow..grow..dynamic_string_buffer]
  30985. [*DynamicBuffer\_v2:] Grow the underlying memory by the specified number of bytes.
  30986. void grow(
  30987. std::size_t n);
  30988. Resizes the string to accommodate an additional `n` bytes at the end.
  30989. [heading Exceptions]
  30990. [variablelist
  30991. [[std::length_error][If `size() + n > max_size()`. ]]
  30992. ]
  30993. [endsect]
  30994. [section:max_size dynamic_string_buffer::max_size]
  30995. [indexterm2 boost_asio.indexterm.dynamic_string_buffer.max_size..max_size..dynamic_string_buffer]
  30996. Get the maximum size of the dynamic buffer.
  30997. std::size_t max_size() const;
  30998. [heading Return Value]
  30999. The allowed maximum size of the underlying memory.
  31000. [endsect]
  31001. [section:mutable_buffers_type dynamic_string_buffer::mutable_buffers_type]
  31002. [indexterm2 boost_asio.indexterm.dynamic_string_buffer.mutable_buffers_type..mutable_buffers_type..dynamic_string_buffer]
  31003. The type used to represent a sequence of mutable buffers that refers to the underlying memory.
  31004. typedef mutable_buffer mutable_buffers_type;
  31005. [heading Member Functions]
  31006. [table
  31007. [[Name][Description]]
  31008. [
  31009. [[link boost_asio.reference.mutable_buffer.data [*data]]]
  31010. [Get a pointer to the beginning of the memory range. ]
  31011. ]
  31012. [
  31013. [[link boost_asio.reference.mutable_buffer.mutable_buffer [*mutable_buffer]]]
  31014. [Construct an empty buffer.
  31015. [hr]
  31016. Construct a buffer to represent a given memory range. ]
  31017. ]
  31018. [
  31019. [[link boost_asio.reference.mutable_buffer.operator_plus__eq_ [*operator+=]]]
  31020. [Move the start of the buffer by the specified number of bytes. ]
  31021. ]
  31022. [
  31023. [[link boost_asio.reference.mutable_buffer.size [*size]]]
  31024. [Get the size of the memory range. ]
  31025. ]
  31026. ]
  31027. [heading Related Functions]
  31028. [table
  31029. [[Name][Description]]
  31030. [
  31031. [[link boost_asio.reference.mutable_buffer.operator_plus_ [*operator+]]]
  31032. [Create a new modifiable buffer that is offset from the start of another. ]
  31033. ]
  31034. ]
  31035. The [link boost_asio.reference.mutable_buffer `mutable_buffer`] class provides a safe representation of a buffer that can be modified. It does not own the underlying data, and so is cheap to copy or assign.
  31036. [heading Accessing Buffer Contents]
  31037. The contents of a buffer may be accessed using the `data()` and `size()` member functions:
  31038. boost::asio::mutable_buffer b1 = ...;
  31039. std::size_t s1 = b1.size();
  31040. unsigned char* p1 = static_cast<unsigned char*>(b1.data());
  31041. The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered.
  31042. [heading Requirements]
  31043. ['Header: ][^boost/asio/buffer.hpp]
  31044. ['Convenience header: ][^boost/asio.hpp]
  31045. [endsect]
  31046. [section:prepare dynamic_string_buffer::prepare]
  31047. [indexterm2 boost_asio.indexterm.dynamic_string_buffer.prepare..prepare..dynamic_string_buffer]
  31048. [*DynamicBuffer\_v1:] Get a list of buffers that represents the output sequence, with the given size.
  31049. mutable_buffers_type prepare(
  31050. std::size_t n);
  31051. Ensures that the output sequence can accommodate `n` bytes, resizing the basic\_string object as necessary.
  31052. [heading Return Value]
  31053. An object of type `mutable_buffers_type` that satisfies MutableBufferSequence requirements, representing basic\_string memory at the start of the output sequence of size `n`.
  31054. [heading Exceptions]
  31055. [variablelist
  31056. [[std::length_error][If `size() + n > max_size()`.]]
  31057. ]
  31058. [heading Remarks]
  31059. The returned object is invalidated by any `dynamic_string_buffer` or `basic_string` member function that modifies the input sequence or output sequence.
  31060. [endsect]
  31061. [section:shrink dynamic_string_buffer::shrink]
  31062. [indexterm2 boost_asio.indexterm.dynamic_string_buffer.shrink..shrink..dynamic_string_buffer]
  31063. [*DynamicBuffer\_v2:] Shrink the underlying memory by the specified number of bytes.
  31064. void shrink(
  31065. std::size_t n);
  31066. Erases `n` bytes from the end of the string by resizing the basic\_string object. If `n` is greater than the current size of the string, the string is emptied.
  31067. [endsect]
  31068. [section:size dynamic_string_buffer::size]
  31069. [indexterm2 boost_asio.indexterm.dynamic_string_buffer.size..size..dynamic_string_buffer]
  31070. [*DynamicBuffer\_v1:] Get the size of the input sequence. [*DynamicBuffer\_v2:] Get the current size of the underlying memory.
  31071. std::size_t size() const;
  31072. [heading Return Value]
  31073. [*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()`.
  31074. [endsect]
  31075. [endsect]
  31076. [section:dynamic_vector_buffer dynamic_vector_buffer]
  31077. Adapt a vector to the DynamicBuffer requirements.
  31078. template<
  31079. typename Elem,
  31080. typename Allocator>
  31081. class dynamic_vector_buffer
  31082. [heading Types]
  31083. [table
  31084. [[Name][Description]]
  31085. [
  31086. [[link boost_asio.reference.dynamic_vector_buffer.const_buffers_type [*const_buffers_type]]]
  31087. [The type used to represent a sequence of constant buffers that refers to the underlying memory. ]
  31088. ]
  31089. [
  31090. [[link boost_asio.reference.dynamic_vector_buffer.mutable_buffers_type [*mutable_buffers_type]]]
  31091. [The type used to represent a sequence of mutable buffers that refers to the underlying memory. ]
  31092. ]
  31093. ]
  31094. [heading Member Functions]
  31095. [table
  31096. [[Name][Description]]
  31097. [
  31098. [[link boost_asio.reference.dynamic_vector_buffer.capacity [*capacity]]]
  31099. [Get the maximum size that the buffer may grow to without triggering reallocation. ]
  31100. ]
  31101. [
  31102. [[link boost_asio.reference.dynamic_vector_buffer.commit [*commit]]]
  31103. [DynamicBuffer_v1: Move bytes from the output sequence to the input sequence. ]
  31104. ]
  31105. [
  31106. [[link boost_asio.reference.dynamic_vector_buffer.consume [*consume]]]
  31107. [DynamicBuffer_v1: Remove characters from the input sequence. DynamicBuffer_v2: Consume the specified number of bytes from the beginning of the underlying memory. ]
  31108. ]
  31109. [
  31110. [[link boost_asio.reference.dynamic_vector_buffer.data [*data]]]
  31111. [DynamicBuffer_v1: Get a list of buffers that represents the input sequence.
  31112. [hr]
  31113. DynamicBuffer_v2: Get a sequence of buffers that represents the underlying memory. ]
  31114. ]
  31115. [
  31116. [[link boost_asio.reference.dynamic_vector_buffer.dynamic_vector_buffer [*dynamic_vector_buffer]]]
  31117. [Construct a dynamic buffer from a vector.
  31118. [hr]
  31119. DynamicBuffer_v2: Copy construct a dynamic buffer.
  31120. [hr]
  31121. Move construct a dynamic buffer. ]
  31122. ]
  31123. [
  31124. [[link boost_asio.reference.dynamic_vector_buffer.grow [*grow]]]
  31125. [DynamicBuffer_v2: Grow the underlying memory by the specified number of bytes. ]
  31126. ]
  31127. [
  31128. [[link boost_asio.reference.dynamic_vector_buffer.max_size [*max_size]]]
  31129. [Get the maximum size of the dynamic buffer. ]
  31130. ]
  31131. [
  31132. [[link boost_asio.reference.dynamic_vector_buffer.prepare [*prepare]]]
  31133. [DynamicBuffer_v1: Get a list of buffers that represents the output sequence, with the given size. ]
  31134. ]
  31135. [
  31136. [[link boost_asio.reference.dynamic_vector_buffer.shrink [*shrink]]]
  31137. [DynamicBuffer_v2: Shrink the underlying memory by the specified number of bytes. ]
  31138. ]
  31139. [
  31140. [[link boost_asio.reference.dynamic_vector_buffer.size [*size]]]
  31141. [DynamicBuffer_v1: Get the size of the input sequence. DynamicBuffer_v2: Get the current size of the underlying memory. ]
  31142. ]
  31143. ]
  31144. Requires that `sizeof(Elem) == 1`.
  31145. [heading Requirements]
  31146. ['Header: ][^boost/asio/buffer.hpp]
  31147. ['Convenience header: ][^boost/asio.hpp]
  31148. [section:capacity dynamic_vector_buffer::capacity]
  31149. [indexterm2 boost_asio.indexterm.dynamic_vector_buffer.capacity..capacity..dynamic_vector_buffer]
  31150. Get the maximum size that the buffer may grow to without triggering reallocation.
  31151. std::size_t capacity() const;
  31152. [heading Return Value]
  31153. [*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()`.
  31154. [endsect]
  31155. [section:commit dynamic_vector_buffer::commit]
  31156. [indexterm2 boost_asio.indexterm.dynamic_vector_buffer.commit..commit..dynamic_vector_buffer]
  31157. [*DynamicBuffer\_v1:] Move bytes from the output sequence to the input sequence.
  31158. void commit(
  31159. std::size_t n);
  31160. [heading Parameters]
  31161. [variablelist
  31162. [[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.]]
  31163. ]
  31164. Requires a preceding call `prepare(x)` where `x >= n`, and no intervening operations that modify the input or output sequence.
  31165. [heading Remarks]
  31166. If `n` is greater than the size of the output sequence, the entire output sequence is moved to the input sequence and no error is issued.
  31167. [endsect]
  31168. [section:const_buffers_type dynamic_vector_buffer::const_buffers_type]
  31169. [indexterm2 boost_asio.indexterm.dynamic_vector_buffer.const_buffers_type..const_buffers_type..dynamic_vector_buffer]
  31170. The type used to represent a sequence of constant buffers that refers to the underlying memory.
  31171. typedef const_buffer const_buffers_type;
  31172. [heading Member Functions]
  31173. [table
  31174. [[Name][Description]]
  31175. [
  31176. [[link boost_asio.reference.const_buffer.const_buffer [*const_buffer]]]
  31177. [Construct an empty buffer.
  31178. [hr]
  31179. Construct a buffer to represent a given memory range.
  31180. [hr]
  31181. Construct a non-modifiable buffer from a modifiable one. ]
  31182. ]
  31183. [
  31184. [[link boost_asio.reference.const_buffer.data [*data]]]
  31185. [Get a pointer to the beginning of the memory range. ]
  31186. ]
  31187. [
  31188. [[link boost_asio.reference.const_buffer.operator_plus__eq_ [*operator+=]]]
  31189. [Move the start of the buffer by the specified number of bytes. ]
  31190. ]
  31191. [
  31192. [[link boost_asio.reference.const_buffer.size [*size]]]
  31193. [Get the size of the memory range. ]
  31194. ]
  31195. ]
  31196. [heading Related Functions]
  31197. [table
  31198. [[Name][Description]]
  31199. [
  31200. [[link boost_asio.reference.const_buffer.operator_plus_ [*operator+]]]
  31201. [Create a new non-modifiable buffer that is offset from the start of another. ]
  31202. ]
  31203. ]
  31204. The [link boost_asio.reference.const_buffer `const_buffer`] class provides a safe representation of a buffer that cannot be modified. It does not own the underlying data, and so is cheap to copy or assign.
  31205. [heading Accessing Buffer Contents]
  31206. The contents of a buffer may be accessed using the `data()` and `size()` member functions:
  31207. boost::asio::const_buffer b1 = ...;
  31208. std::size_t s1 = b1.size();
  31209. const unsigned char* p1 = static_cast<const unsigned char*>(b1.data());
  31210. The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered.
  31211. [heading Requirements]
  31212. ['Header: ][^boost/asio/buffer.hpp]
  31213. ['Convenience header: ][^boost/asio.hpp]
  31214. [endsect]
  31215. [section:consume dynamic_vector_buffer::consume]
  31216. [indexterm2 boost_asio.indexterm.dynamic_vector_buffer.consume..consume..dynamic_vector_buffer]
  31217. [*DynamicBuffer\_v1:] Remove characters from the input sequence. [*DynamicBuffer\_v2:] Consume the specified number of bytes from the beginning of the underlying memory.
  31218. void consume(
  31219. std::size_t n);
  31220. [*DynamicBuffer\_v1:] Removes `n` characters from the beginning of the input sequence.
  31221. [heading Remarks]
  31222. If `n` is greater than the size of the input sequence, the entire input sequence is consumed and no error is issued.
  31223. [*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.
  31224. [endsect]
  31225. [section:data dynamic_vector_buffer::data]
  31226. [indexterm2 boost_asio.indexterm.dynamic_vector_buffer.data..data..dynamic_vector_buffer]
  31227. [*DynamicBuffer\_v1:] Get a list of buffers that represents the input sequence.
  31228. const_buffers_type ``[link boost_asio.reference.dynamic_vector_buffer.data.overload1 data]``() const;
  31229. `` [''''&raquo;''' [link boost_asio.reference.dynamic_vector_buffer.data.overload1 more...]]``
  31230. [*DynamicBuffer\_v2:] Get a sequence of buffers that represents the underlying memory.
  31231. mutable_buffers_type ``[link boost_asio.reference.dynamic_vector_buffer.data.overload2 data]``(
  31232. std::size_t pos,
  31233. std::size_t n);
  31234. `` [''''&raquo;''' [link boost_asio.reference.dynamic_vector_buffer.data.overload2 more...]]``
  31235. const_buffers_type ``[link boost_asio.reference.dynamic_vector_buffer.data.overload3 data]``(
  31236. std::size_t pos,
  31237. std::size_t n) const;
  31238. `` [''''&raquo;''' [link boost_asio.reference.dynamic_vector_buffer.data.overload3 more...]]``
  31239. [section:overload1 dynamic_vector_buffer::data (1 of 3 overloads)]
  31240. [*DynamicBuffer\_v1:] Get a list of buffers that represents the input sequence.
  31241. const_buffers_type data() const;
  31242. [heading Return Value]
  31243. An object of type `const_buffers_type` that satisfies ConstBufferSequence requirements, representing the vector memory in the input sequence.
  31244. [heading Remarks]
  31245. The returned object is invalidated by any `dynamic_vector_buffer` or `vector` member function that modifies the input sequence or output sequence.
  31246. [endsect]
  31247. [section:overload2 dynamic_vector_buffer::data (2 of 3 overloads)]
  31248. [*DynamicBuffer\_v2:] Get a sequence of buffers that represents the underlying memory.
  31249. mutable_buffers_type data(
  31250. std::size_t pos,
  31251. std::size_t n);
  31252. [heading Parameters]
  31253. [variablelist
  31254. [[pos][Position of the first byte to represent in the buffer sequence]]
  31255. [[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.]]
  31256. ]
  31257. [heading Return Value]
  31258. An object of type `mutable_buffers_type` that satisfies MutableBufferSequence requirements, representing the vector memory.
  31259. [heading Remarks]
  31260. The returned object is invalidated by any `dynamic_vector_buffer` or `vector` member function that resizes or erases the vector.
  31261. [endsect]
  31262. [section:overload3 dynamic_vector_buffer::data (3 of 3 overloads)]
  31263. [*DynamicBuffer\_v2:] Get a sequence of buffers that represents the underlying memory.
  31264. const_buffers_type data(
  31265. std::size_t pos,
  31266. std::size_t n) const;
  31267. [heading Parameters]
  31268. [variablelist
  31269. [[pos][Position of the first byte to represent in the buffer sequence]]
  31270. [[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.]]
  31271. ]
  31272. [heading Remarks]
  31273. The returned object is invalidated by any `dynamic_vector_buffer` or `vector` member function that resizes or erases the vector.
  31274. [endsect]
  31275. [endsect]
  31276. [section:dynamic_vector_buffer dynamic_vector_buffer::dynamic_vector_buffer]
  31277. [indexterm2 boost_asio.indexterm.dynamic_vector_buffer.dynamic_vector_buffer..dynamic_vector_buffer..dynamic_vector_buffer]
  31278. Construct a dynamic buffer from a vector.
  31279. explicit ``[link boost_asio.reference.dynamic_vector_buffer.dynamic_vector_buffer.overload1 dynamic_vector_buffer]``(
  31280. std::vector< Elem, Allocator > & v,
  31281. std::size_t maximum_size = (std::numeric_limits< std::size_t >::max)());
  31282. `` [''''&raquo;''' [link boost_asio.reference.dynamic_vector_buffer.dynamic_vector_buffer.overload1 more...]]``
  31283. [*DynamicBuffer\_v2:] Copy construct a dynamic buffer.
  31284. ``[link boost_asio.reference.dynamic_vector_buffer.dynamic_vector_buffer.overload2 dynamic_vector_buffer]``(
  31285. const dynamic_vector_buffer & other);
  31286. `` [''''&raquo;''' [link boost_asio.reference.dynamic_vector_buffer.dynamic_vector_buffer.overload2 more...]]``
  31287. Move construct a dynamic buffer.
  31288. ``[link boost_asio.reference.dynamic_vector_buffer.dynamic_vector_buffer.overload3 dynamic_vector_buffer]``(
  31289. dynamic_vector_buffer && other);
  31290. `` [''''&raquo;''' [link boost_asio.reference.dynamic_vector_buffer.dynamic_vector_buffer.overload3 more...]]``
  31291. [section:overload1 dynamic_vector_buffer::dynamic_vector_buffer (1 of 3 overloads)]
  31292. Construct a dynamic buffer from a vector.
  31293. dynamic_vector_buffer(
  31294. std::vector< Elem, Allocator > & v,
  31295. std::size_t maximum_size = (std::numeric_limits< std::size_t >::max)());
  31296. [heading Parameters]
  31297. [variablelist
  31298. [[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.]]
  31299. [[maximum_size][Specifies a maximum size for the buffer, in bytes. ]]
  31300. ]
  31301. [endsect]
  31302. [section:overload2 dynamic_vector_buffer::dynamic_vector_buffer (2 of 3 overloads)]
  31303. [*DynamicBuffer\_v2:] Copy construct a dynamic buffer.
  31304. dynamic_vector_buffer(
  31305. const dynamic_vector_buffer & other);
  31306. [endsect]
  31307. [section:overload3 dynamic_vector_buffer::dynamic_vector_buffer (3 of 3 overloads)]
  31308. Move construct a dynamic buffer.
  31309. dynamic_vector_buffer(
  31310. dynamic_vector_buffer && other);
  31311. [endsect]
  31312. [endsect]
  31313. [section:grow dynamic_vector_buffer::grow]
  31314. [indexterm2 boost_asio.indexterm.dynamic_vector_buffer.grow..grow..dynamic_vector_buffer]
  31315. [*DynamicBuffer\_v2:] Grow the underlying memory by the specified number of bytes.
  31316. void grow(
  31317. std::size_t n);
  31318. Resizes the vector to accommodate an additional `n` bytes at the end.
  31319. [heading Exceptions]
  31320. [variablelist
  31321. [[std::length_error][If `size() + n > max_size()`. ]]
  31322. ]
  31323. [endsect]
  31324. [section:max_size dynamic_vector_buffer::max_size]
  31325. [indexterm2 boost_asio.indexterm.dynamic_vector_buffer.max_size..max_size..dynamic_vector_buffer]
  31326. Get the maximum size of the dynamic buffer.
  31327. std::size_t max_size() const;
  31328. [heading Return Value]
  31329. [*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.
  31330. [endsect]
  31331. [section:mutable_buffers_type dynamic_vector_buffer::mutable_buffers_type]
  31332. [indexterm2 boost_asio.indexterm.dynamic_vector_buffer.mutable_buffers_type..mutable_buffers_type..dynamic_vector_buffer]
  31333. The type used to represent a sequence of mutable buffers that refers to the underlying memory.
  31334. typedef mutable_buffer mutable_buffers_type;
  31335. [heading Member Functions]
  31336. [table
  31337. [[Name][Description]]
  31338. [
  31339. [[link boost_asio.reference.mutable_buffer.data [*data]]]
  31340. [Get a pointer to the beginning of the memory range. ]
  31341. ]
  31342. [
  31343. [[link boost_asio.reference.mutable_buffer.mutable_buffer [*mutable_buffer]]]
  31344. [Construct an empty buffer.
  31345. [hr]
  31346. Construct a buffer to represent a given memory range. ]
  31347. ]
  31348. [
  31349. [[link boost_asio.reference.mutable_buffer.operator_plus__eq_ [*operator+=]]]
  31350. [Move the start of the buffer by the specified number of bytes. ]
  31351. ]
  31352. [
  31353. [[link boost_asio.reference.mutable_buffer.size [*size]]]
  31354. [Get the size of the memory range. ]
  31355. ]
  31356. ]
  31357. [heading Related Functions]
  31358. [table
  31359. [[Name][Description]]
  31360. [
  31361. [[link boost_asio.reference.mutable_buffer.operator_plus_ [*operator+]]]
  31362. [Create a new modifiable buffer that is offset from the start of another. ]
  31363. ]
  31364. ]
  31365. The [link boost_asio.reference.mutable_buffer `mutable_buffer`] class provides a safe representation of a buffer that can be modified. It does not own the underlying data, and so is cheap to copy or assign.
  31366. [heading Accessing Buffer Contents]
  31367. The contents of a buffer may be accessed using the `data()` and `size()` member functions:
  31368. boost::asio::mutable_buffer b1 = ...;
  31369. std::size_t s1 = b1.size();
  31370. unsigned char* p1 = static_cast<unsigned char*>(b1.data());
  31371. The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered.
  31372. [heading Requirements]
  31373. ['Header: ][^boost/asio/buffer.hpp]
  31374. ['Convenience header: ][^boost/asio.hpp]
  31375. [endsect]
  31376. [section:prepare dynamic_vector_buffer::prepare]
  31377. [indexterm2 boost_asio.indexterm.dynamic_vector_buffer.prepare..prepare..dynamic_vector_buffer]
  31378. [*DynamicBuffer\_v1:] Get a list of buffers that represents the output sequence, with the given size.
  31379. mutable_buffers_type prepare(
  31380. std::size_t n);
  31381. Ensures that the output sequence can accommodate `n` bytes, resizing the vector object as necessary.
  31382. [heading Return Value]
  31383. An object of type `mutable_buffers_type` that satisfies MutableBufferSequence requirements, representing vector memory at the start of the output sequence of size `n`.
  31384. [heading Exceptions]
  31385. [variablelist
  31386. [[std::length_error][If `size() + n > max_size()`.]]
  31387. ]
  31388. [heading Remarks]
  31389. The returned object is invalidated by any `dynamic_vector_buffer` or `vector` member function that modifies the input sequence or output sequence.
  31390. [endsect]
  31391. [section:shrink dynamic_vector_buffer::shrink]
  31392. [indexterm2 boost_asio.indexterm.dynamic_vector_buffer.shrink..shrink..dynamic_vector_buffer]
  31393. [*DynamicBuffer\_v2:] Shrink the underlying memory by the specified number of bytes.
  31394. void shrink(
  31395. std::size_t n);
  31396. Erases `n` bytes from the end of the vector by resizing the vector object. If `n` is greater than the current size of the vector, the vector is emptied.
  31397. [endsect]
  31398. [section:size dynamic_vector_buffer::size]
  31399. [indexterm2 boost_asio.indexterm.dynamic_vector_buffer.size..size..dynamic_vector_buffer]
  31400. [*DynamicBuffer\_v1:] Get the size of the input sequence. [*DynamicBuffer\_v2:] Get the current size of the underlying memory.
  31401. std::size_t size() const;
  31402. [heading Return Value]
  31403. [*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()`.
  31404. [endsect]
  31405. [endsect]
  31406. [section:error__addrinfo_category error::addrinfo_category]
  31407. [indexterm1 boost_asio.indexterm.error__addrinfo_category..error::addrinfo_category]
  31408. static const boost::system::error_category & addrinfo_category = boost::asio::error::get_addrinfo_category();
  31409. [heading Requirements]
  31410. ['Header: ][^boost/asio/error.hpp]
  31411. ['Convenience header: ][^boost/asio.hpp]
  31412. [endsect]
  31413. [section:error__addrinfo_errors error::addrinfo_errors]
  31414. [indexterm1 boost_asio.indexterm.error__addrinfo_errors..error::addrinfo_errors]
  31415. enum addrinfo_errors
  31416. [indexterm2 boost_asio.indexterm.error__addrinfo_errors.service_not_found..service_not_found..error::addrinfo_errors]
  31417. [indexterm2 boost_asio.indexterm.error__addrinfo_errors.socket_type_not_supported..socket_type_not_supported..error::addrinfo_errors]
  31418. [heading Values]
  31419. [variablelist
  31420. [
  31421. [service_not_found]
  31422. [The service is not supported for the given socket type. ]
  31423. ]
  31424. [
  31425. [socket_type_not_supported]
  31426. [The socket type is not supported. ]
  31427. ]
  31428. ]
  31429. [heading Requirements]
  31430. ['Header: ][^boost/asio/error.hpp]
  31431. ['Convenience header: ][^boost/asio.hpp]
  31432. [endsect]
  31433. [section:error__basic_errors error::basic_errors]
  31434. [indexterm1 boost_asio.indexterm.error__basic_errors..error::basic_errors]
  31435. enum basic_errors
  31436. [indexterm2 boost_asio.indexterm.error__basic_errors.access_denied..access_denied..error::basic_errors]
  31437. [indexterm2 boost_asio.indexterm.error__basic_errors.address_family_not_supported..address_family_not_supported..error::basic_errors]
  31438. [indexterm2 boost_asio.indexterm.error__basic_errors.address_in_use..address_in_use..error::basic_errors]
  31439. [indexterm2 boost_asio.indexterm.error__basic_errors.already_connected..already_connected..error::basic_errors]
  31440. [indexterm2 boost_asio.indexterm.error__basic_errors.already_started..already_started..error::basic_errors]
  31441. [indexterm2 boost_asio.indexterm.error__basic_errors.broken_pipe..broken_pipe..error::basic_errors]
  31442. [indexterm2 boost_asio.indexterm.error__basic_errors.connection_aborted..connection_aborted..error::basic_errors]
  31443. [indexterm2 boost_asio.indexterm.error__basic_errors.connection_refused..connection_refused..error::basic_errors]
  31444. [indexterm2 boost_asio.indexterm.error__basic_errors.connection_reset..connection_reset..error::basic_errors]
  31445. [indexterm2 boost_asio.indexterm.error__basic_errors.bad_descriptor..bad_descriptor..error::basic_errors]
  31446. [indexterm2 boost_asio.indexterm.error__basic_errors.fault..fault..error::basic_errors]
  31447. [indexterm2 boost_asio.indexterm.error__basic_errors.host_unreachable..host_unreachable..error::basic_errors]
  31448. [indexterm2 boost_asio.indexterm.error__basic_errors.in_progress..in_progress..error::basic_errors]
  31449. [indexterm2 boost_asio.indexterm.error__basic_errors.interrupted..interrupted..error::basic_errors]
  31450. [indexterm2 boost_asio.indexterm.error__basic_errors.invalid_argument..invalid_argument..error::basic_errors]
  31451. [indexterm2 boost_asio.indexterm.error__basic_errors.message_size..message_size..error::basic_errors]
  31452. [indexterm2 boost_asio.indexterm.error__basic_errors.name_too_long..name_too_long..error::basic_errors]
  31453. [indexterm2 boost_asio.indexterm.error__basic_errors.network_down..network_down..error::basic_errors]
  31454. [indexterm2 boost_asio.indexterm.error__basic_errors.network_reset..network_reset..error::basic_errors]
  31455. [indexterm2 boost_asio.indexterm.error__basic_errors.network_unreachable..network_unreachable..error::basic_errors]
  31456. [indexterm2 boost_asio.indexterm.error__basic_errors.no_descriptors..no_descriptors..error::basic_errors]
  31457. [indexterm2 boost_asio.indexterm.error__basic_errors.no_buffer_space..no_buffer_space..error::basic_errors]
  31458. [indexterm2 boost_asio.indexterm.error__basic_errors.no_memory..no_memory..error::basic_errors]
  31459. [indexterm2 boost_asio.indexterm.error__basic_errors.no_permission..no_permission..error::basic_errors]
  31460. [indexterm2 boost_asio.indexterm.error__basic_errors.no_protocol_option..no_protocol_option..error::basic_errors]
  31461. [indexterm2 boost_asio.indexterm.error__basic_errors.no_such_device..no_such_device..error::basic_errors]
  31462. [indexterm2 boost_asio.indexterm.error__basic_errors.not_connected..not_connected..error::basic_errors]
  31463. [indexterm2 boost_asio.indexterm.error__basic_errors.not_socket..not_socket..error::basic_errors]
  31464. [indexterm2 boost_asio.indexterm.error__basic_errors.operation_aborted..operation_aborted..error::basic_errors]
  31465. [indexterm2 boost_asio.indexterm.error__basic_errors.operation_not_supported..operation_not_supported..error::basic_errors]
  31466. [indexterm2 boost_asio.indexterm.error__basic_errors.shut_down..shut_down..error::basic_errors]
  31467. [indexterm2 boost_asio.indexterm.error__basic_errors.timed_out..timed_out..error::basic_errors]
  31468. [indexterm2 boost_asio.indexterm.error__basic_errors.try_again..try_again..error::basic_errors]
  31469. [indexterm2 boost_asio.indexterm.error__basic_errors.would_block..would_block..error::basic_errors]
  31470. [heading Values]
  31471. [variablelist
  31472. [
  31473. [access_denied]
  31474. [Permission denied. ]
  31475. ]
  31476. [
  31477. [address_family_not_supported]
  31478. [Address family not supported by protocol. ]
  31479. ]
  31480. [
  31481. [address_in_use]
  31482. [Address already in use. ]
  31483. ]
  31484. [
  31485. [already_connected]
  31486. [Transport endpoint is already connected. ]
  31487. ]
  31488. [
  31489. [already_started]
  31490. [Operation already in progress. ]
  31491. ]
  31492. [
  31493. [broken_pipe]
  31494. [Broken pipe. ]
  31495. ]
  31496. [
  31497. [connection_aborted]
  31498. [A connection has been aborted. ]
  31499. ]
  31500. [
  31501. [connection_refused]
  31502. [Connection refused. ]
  31503. ]
  31504. [
  31505. [connection_reset]
  31506. [Connection reset by peer. ]
  31507. ]
  31508. [
  31509. [bad_descriptor]
  31510. [Bad file descriptor. ]
  31511. ]
  31512. [
  31513. [fault]
  31514. [Bad address. ]
  31515. ]
  31516. [
  31517. [host_unreachable]
  31518. [No route to host. ]
  31519. ]
  31520. [
  31521. [in_progress]
  31522. [Operation now in progress. ]
  31523. ]
  31524. [
  31525. [interrupted]
  31526. [Interrupted system call. ]
  31527. ]
  31528. [
  31529. [invalid_argument]
  31530. [Invalid argument. ]
  31531. ]
  31532. [
  31533. [message_size]
  31534. [Message too long. ]
  31535. ]
  31536. [
  31537. [name_too_long]
  31538. [The name was too long. ]
  31539. ]
  31540. [
  31541. [network_down]
  31542. [Network is down. ]
  31543. ]
  31544. [
  31545. [network_reset]
  31546. [Network dropped connection on reset. ]
  31547. ]
  31548. [
  31549. [network_unreachable]
  31550. [Network is unreachable. ]
  31551. ]
  31552. [
  31553. [no_descriptors]
  31554. [Too many open files. ]
  31555. ]
  31556. [
  31557. [no_buffer_space]
  31558. [No buffer space available. ]
  31559. ]
  31560. [
  31561. [no_memory]
  31562. [Cannot allocate memory. ]
  31563. ]
  31564. [
  31565. [no_permission]
  31566. [Operation not permitted. ]
  31567. ]
  31568. [
  31569. [no_protocol_option]
  31570. [Protocol not available. ]
  31571. ]
  31572. [
  31573. [no_such_device]
  31574. [No such device. ]
  31575. ]
  31576. [
  31577. [not_connected]
  31578. [Transport endpoint is not connected. ]
  31579. ]
  31580. [
  31581. [not_socket]
  31582. [Socket operation on non-socket. ]
  31583. ]
  31584. [
  31585. [operation_aborted]
  31586. [Operation cancelled. ]
  31587. ]
  31588. [
  31589. [operation_not_supported]
  31590. [Operation not supported. ]
  31591. ]
  31592. [
  31593. [shut_down]
  31594. [Cannot send after transport endpoint shutdown. ]
  31595. ]
  31596. [
  31597. [timed_out]
  31598. [Connection timed out. ]
  31599. ]
  31600. [
  31601. [try_again]
  31602. [Resource temporarily unavailable. ]
  31603. ]
  31604. [
  31605. [would_block]
  31606. [The socket is marked non-blocking and the requested operation would block. ]
  31607. ]
  31608. ]
  31609. [heading Requirements]
  31610. ['Header: ][^boost/asio/error.hpp]
  31611. ['Convenience header: ][^boost/asio.hpp]
  31612. [endsect]
  31613. [section:error__get_addrinfo_category error::get_addrinfo_category]
  31614. [indexterm1 boost_asio.indexterm.error__get_addrinfo_category..error::get_addrinfo_category]
  31615. const boost::system::error_category & get_addrinfo_category();
  31616. [heading Requirements]
  31617. ['Header: ][^boost/asio/error.hpp]
  31618. ['Convenience header: ][^boost/asio.hpp]
  31619. [endsect]
  31620. [section:error__get_misc_category error::get_misc_category]
  31621. [indexterm1 boost_asio.indexterm.error__get_misc_category..error::get_misc_category]
  31622. const boost::system::error_category & get_misc_category();
  31623. [heading Requirements]
  31624. ['Header: ][^boost/asio/error.hpp]
  31625. ['Convenience header: ][^boost/asio.hpp]
  31626. [endsect]
  31627. [section:error__get_netdb_category error::get_netdb_category]
  31628. [indexterm1 boost_asio.indexterm.error__get_netdb_category..error::get_netdb_category]
  31629. const boost::system::error_category & get_netdb_category();
  31630. [heading Requirements]
  31631. ['Header: ][^boost/asio/error.hpp]
  31632. ['Convenience header: ][^boost/asio.hpp]
  31633. [endsect]
  31634. [section:error__get_ssl_category error::get_ssl_category]
  31635. [indexterm1 boost_asio.indexterm.error__get_ssl_category..error::get_ssl_category]
  31636. const boost::system::error_category & get_ssl_category();
  31637. [heading Requirements]
  31638. ['Header: ][^boost/asio/ssl/error.hpp]
  31639. ['Convenience header: ][^boost/asio/ssl.hpp]
  31640. [endsect]
  31641. [section:error__get_system_category error::get_system_category]
  31642. [indexterm1 boost_asio.indexterm.error__get_system_category..error::get_system_category]
  31643. const boost::system::error_category & get_system_category();
  31644. [heading Requirements]
  31645. ['Header: ][^boost/asio/error.hpp]
  31646. ['Convenience header: ][^boost/asio.hpp]
  31647. [endsect]
  31648. [section:error__make_error_code error::make_error_code]
  31649. [indexterm1 boost_asio.indexterm.error__make_error_code..error::make_error_code]
  31650. boost::system::error_code ``[link boost_asio.reference.error__make_error_code.overload1 make_error_code]``(
  31651. basic_errors e);
  31652. `` [''''&raquo;''' [link boost_asio.reference.error__make_error_code.overload1 more...]]``
  31653. boost::system::error_code ``[link boost_asio.reference.error__make_error_code.overload2 make_error_code]``(
  31654. netdb_errors e);
  31655. `` [''''&raquo;''' [link boost_asio.reference.error__make_error_code.overload2 more...]]``
  31656. boost::system::error_code ``[link boost_asio.reference.error__make_error_code.overload3 make_error_code]``(
  31657. addrinfo_errors e);
  31658. `` [''''&raquo;''' [link boost_asio.reference.error__make_error_code.overload3 more...]]``
  31659. boost::system::error_code ``[link boost_asio.reference.error__make_error_code.overload4 make_error_code]``(
  31660. misc_errors e);
  31661. `` [''''&raquo;''' [link boost_asio.reference.error__make_error_code.overload4 more...]]``
  31662. boost::system::error_code ``[link boost_asio.reference.error__make_error_code.overload5 make_error_code]``(
  31663. ssl_errors e);
  31664. `` [''''&raquo;''' [link boost_asio.reference.error__make_error_code.overload5 more...]]``
  31665. [heading Requirements]
  31666. ['Header: ][^boost/asio/error.hpp]
  31667. ['Convenience header: ][^boost/asio.hpp]
  31668. [section:overload1 error::make_error_code (1 of 5 overloads)]
  31669. boost::system::error_code make_error_code(
  31670. basic_errors e);
  31671. [endsect]
  31672. [section:overload2 error::make_error_code (2 of 5 overloads)]
  31673. boost::system::error_code make_error_code(
  31674. netdb_errors e);
  31675. [endsect]
  31676. [section:overload3 error::make_error_code (3 of 5 overloads)]
  31677. boost::system::error_code make_error_code(
  31678. addrinfo_errors e);
  31679. [endsect]
  31680. [section:overload4 error::make_error_code (4 of 5 overloads)]
  31681. boost::system::error_code make_error_code(
  31682. misc_errors e);
  31683. [endsect]
  31684. [section:overload5 error::make_error_code (5 of 5 overloads)]
  31685. boost::system::error_code make_error_code(
  31686. ssl_errors e);
  31687. [endsect]
  31688. [endsect]
  31689. [section:error__misc_category error::misc_category]
  31690. [indexterm1 boost_asio.indexterm.error__misc_category..error::misc_category]
  31691. static const boost::system::error_category & misc_category = boost::asio::error::get_misc_category();
  31692. [heading Requirements]
  31693. ['Header: ][^boost/asio/error.hpp]
  31694. ['Convenience header: ][^boost/asio.hpp]
  31695. [endsect]
  31696. [section:error__misc_errors error::misc_errors]
  31697. [indexterm1 boost_asio.indexterm.error__misc_errors..error::misc_errors]
  31698. enum misc_errors
  31699. [indexterm2 boost_asio.indexterm.error__misc_errors.already_open..already_open..error::misc_errors]
  31700. [indexterm2 boost_asio.indexterm.error__misc_errors.eof..eof..error::misc_errors]
  31701. [indexterm2 boost_asio.indexterm.error__misc_errors.not_found..not_found..error::misc_errors]
  31702. [indexterm2 boost_asio.indexterm.error__misc_errors.fd_set_failure..fd_set_failure..error::misc_errors]
  31703. [heading Values]
  31704. [variablelist
  31705. [
  31706. [already_open]
  31707. [Already open. ]
  31708. ]
  31709. [
  31710. [eof]
  31711. [End of file or stream. ]
  31712. ]
  31713. [
  31714. [not_found]
  31715. [Element not found. ]
  31716. ]
  31717. [
  31718. [fd_set_failure]
  31719. [The descriptor cannot fit into the select system call's fd_set. ]
  31720. ]
  31721. ]
  31722. [heading Requirements]
  31723. ['Header: ][^boost/asio/error.hpp]
  31724. ['Convenience header: ][^boost/asio.hpp]
  31725. [endsect]
  31726. [section:error__netdb_category error::netdb_category]
  31727. [indexterm1 boost_asio.indexterm.error__netdb_category..error::netdb_category]
  31728. static const boost::system::error_category & netdb_category = boost::asio::error::get_netdb_category();
  31729. [heading Requirements]
  31730. ['Header: ][^boost/asio/error.hpp]
  31731. ['Convenience header: ][^boost/asio.hpp]
  31732. [endsect]
  31733. [section:error__netdb_errors error::netdb_errors]
  31734. [indexterm1 boost_asio.indexterm.error__netdb_errors..error::netdb_errors]
  31735. enum netdb_errors
  31736. [indexterm2 boost_asio.indexterm.error__netdb_errors.host_not_found..host_not_found..error::netdb_errors]
  31737. [indexterm2 boost_asio.indexterm.error__netdb_errors.host_not_found_try_again..host_not_found_try_again..error::netdb_errors]
  31738. [indexterm2 boost_asio.indexterm.error__netdb_errors.no_data..no_data..error::netdb_errors]
  31739. [indexterm2 boost_asio.indexterm.error__netdb_errors.no_recovery..no_recovery..error::netdb_errors]
  31740. [heading Values]
  31741. [variablelist
  31742. [
  31743. [host_not_found]
  31744. [Host not found (authoritative). ]
  31745. ]
  31746. [
  31747. [host_not_found_try_again]
  31748. [Host not found (non-authoritative). ]
  31749. ]
  31750. [
  31751. [no_data]
  31752. [The query is valid but does not have associated address data. ]
  31753. ]
  31754. [
  31755. [no_recovery]
  31756. [A non-recoverable error occurred. ]
  31757. ]
  31758. ]
  31759. [heading Requirements]
  31760. ['Header: ][^boost/asio/error.hpp]
  31761. ['Convenience header: ][^boost/asio.hpp]
  31762. [endsect]
  31763. [section:error__ssl_category error::ssl_category]
  31764. [indexterm1 boost_asio.indexterm.error__ssl_category..error::ssl_category]
  31765. static const boost::system::error_category & ssl_category = boost::asio::error::get_ssl_category();
  31766. [heading Requirements]
  31767. ['Header: ][^boost/asio/ssl/error.hpp]
  31768. ['Convenience header: ][^boost/asio/ssl.hpp]
  31769. [endsect]
  31770. [section:error__ssl_errors error::ssl_errors]
  31771. [indexterm1 boost_asio.indexterm.error__ssl_errors..error::ssl_errors]
  31772. enum ssl_errors
  31773. [heading Requirements]
  31774. ['Header: ][^boost/asio/ssl/error.hpp]
  31775. ['Convenience header: ][^boost/asio/ssl.hpp]
  31776. [endsect]
  31777. [section:error__system_category error::system_category]
  31778. [indexterm1 boost_asio.indexterm.error__system_category..error::system_category]
  31779. static const boost::system::error_category & system_category = boost::asio::error::get_system_category();
  31780. [heading Requirements]
  31781. ['Header: ][^boost/asio/error.hpp]
  31782. ['Convenience header: ][^boost/asio.hpp]
  31783. [endsect]
  31784. [section:execution_context execution_context]
  31785. A context for function object execution.
  31786. class execution_context :
  31787. noncopyable
  31788. [heading Types]
  31789. [table
  31790. [[Name][Description]]
  31791. [
  31792. [[link boost_asio.reference.execution_context__id [*id]]]
  31793. [Class used to uniquely identify a service. ]
  31794. ]
  31795. [
  31796. [[link boost_asio.reference.execution_context__service [*service]]]
  31797. [Base class for all io_context services. ]
  31798. ]
  31799. [
  31800. [[link boost_asio.reference.execution_context.fork_event [*fork_event]]]
  31801. [Fork-related event notifications. ]
  31802. ]
  31803. ]
  31804. [heading Member Functions]
  31805. [table
  31806. [[Name][Description]]
  31807. [
  31808. [[link boost_asio.reference.execution_context.execution_context [*execution_context]]]
  31809. [Constructor. ]
  31810. ]
  31811. [
  31812. [[link boost_asio.reference.execution_context.notify_fork [*notify_fork]]]
  31813. [Notify the execution_context of a fork-related event. ]
  31814. ]
  31815. [
  31816. [[link boost_asio.reference.execution_context._execution_context [*~execution_context]]]
  31817. [Destructor. ]
  31818. ]
  31819. ]
  31820. [heading Protected Member Functions]
  31821. [table
  31822. [[Name][Description]]
  31823. [
  31824. [[link boost_asio.reference.execution_context.destroy [*destroy]]]
  31825. [Destroys all services in the context. ]
  31826. ]
  31827. [
  31828. [[link boost_asio.reference.execution_context.shutdown [*shutdown]]]
  31829. [Shuts down all services in the context. ]
  31830. ]
  31831. ]
  31832. [heading Friends]
  31833. [table
  31834. [[Name][Description]]
  31835. [
  31836. [[link boost_asio.reference.execution_context.add_service [*add_service]]]
  31837. [(Deprecated: Use make_service().) Add a service object to the execution_context. ]
  31838. ]
  31839. [
  31840. [[link boost_asio.reference.execution_context.has_service [*has_service]]]
  31841. [Determine if an execution_context contains a specified service type. ]
  31842. ]
  31843. [
  31844. [[link boost_asio.reference.execution_context.make_service [*make_service]]]
  31845. [Creates a service object and adds it to the execution_context. ]
  31846. ]
  31847. [
  31848. [[link boost_asio.reference.execution_context.use_service [*use_service]]]
  31849. [Obtain the service object corresponding to the given type. ]
  31850. ]
  31851. ]
  31852. An execution context represents a place where function objects will be executed. An `io_context` is an example of an execution context.
  31853. [heading The execution_context class and services]
  31854. Class [link boost_asio.reference.execution_context `execution_context`] implements an extensible, type-safe, polymorphic set of services, indexed by service type.
  31855. Services exist to manage the resources that are shared across an execution context. For example, timers may be implemented in terms of a single timer queue, and this queue would be stored in a service.
  31856. Access to the services of an [link boost_asio.reference.execution_context `execution_context`] is via three function templates, `use_service()`, `add_service()` and `has_service()`.
  31857. In a call to `use_service<Service>()`, the type argument chooses a service, making available all members of the named type. If `Service` is not present in an [link boost_asio.reference.execution_context `execution_context`], an object of type `Service` is created and added to the [link boost_asio.reference.execution_context `execution_context`]. A C++ program can check if an [link boost_asio.reference.execution_context `execution_context`] implements a particular service with the function template `has_service<Service>()`.
  31858. Service objects may be explicitly added to an [link boost_asio.reference.execution_context `execution_context`] using the function template `add_service<Service>()`. If the `Service` is already present, the [link boost_asio.reference.service_already_exists `service_already_exists`] exception is thrown. If the owner of the service is not the same object as the [link boost_asio.reference.execution_context `execution_context`] parameter, the [link boost_asio.reference.invalid_service_owner `invalid_service_owner`] exception is thrown.
  31859. Once a service reference is obtained from an [link boost_asio.reference.execution_context `execution_context`] object by calling `use_service()`, that reference remains usable as long as the owning [link boost_asio.reference.execution_context `execution_context`] object exists.
  31860. All service implementations have [link boost_asio.reference.execution_context__service `execution_context::service`] as a public base class. Custom services may be implemented by deriving from this class and then added to an [link boost_asio.reference.execution_context `execution_context`] using the facilities described above.
  31861. [heading The execution_context as a base class]
  31862. Class [link boost_asio.reference.execution_context `execution_context`] may be used only as a base class for concrete execution context types. The `io_context` is an example of such a derived type.
  31863. On destruction, a class that is derived from [link boost_asio.reference.execution_context `execution_context`] must perform `execution_context::shutdown()` followed by `execution_context::destroy()`.
  31864. This destruction sequence permits programs to simplify their resource management by using `shared_ptr<>`. Where an object's lifetime is tied to the lifetime of a connection (or some other sequence of asynchronous operations), a `shared_ptr` to the object would be bound into the handlers for all asynchronous operations associated with it. This works as follows:
  31865. * 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.
  31866. * 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.
  31867. [heading Requirements]
  31868. ['Header: ][^boost/asio/execution_context.hpp]
  31869. ['Convenience header: ][^boost/asio.hpp]
  31870. [section:add_service execution_context::add_service]
  31871. [indexterm2 boost_asio.indexterm.execution_context.add_service..add_service..execution_context]
  31872. (Deprecated: Use `make_service()`.) Add a service object to the [link boost_asio.reference.execution_context `execution_context`].
  31873. template<
  31874. typename ``[link boost_asio.reference.Service Service]``>
  31875. friend void add_service(
  31876. execution_context & e,
  31877. Service * svc);
  31878. This function is used to add a service to the [link boost_asio.reference.execution_context `execution_context`].
  31879. [heading Parameters]
  31880. [variablelist
  31881. [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
  31882. [[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:
  31883. ``
  31884. delete static_cast<execution_context::service*>(svc)
  31885. ``
  31886. ]]
  31887. ]
  31888. [heading Exceptions]
  31889. [variablelist
  31890. [[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`].]]
  31891. [[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. ]]
  31892. ]
  31893. [heading Requirements]
  31894. ['Header: ][^boost/asio/execution_context.hpp]
  31895. ['Convenience header: ][^boost/asio.hpp]
  31896. [endsect]
  31897. [section:destroy execution_context::destroy]
  31898. [indexterm2 boost_asio.indexterm.execution_context.destroy..destroy..execution_context]
  31899. Destroys all services in the context.
  31900. void destroy();
  31901. This function is implemented as follows:
  31902. * 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)`.
  31903. [endsect]
  31904. [section:execution_context execution_context::execution_context]
  31905. [indexterm2 boost_asio.indexterm.execution_context.execution_context..execution_context..execution_context]
  31906. Constructor.
  31907. execution_context();
  31908. [endsect]
  31909. [section:fork_event execution_context::fork_event]
  31910. [indexterm2 boost_asio.indexterm.execution_context.fork_event..fork_event..execution_context]
  31911. Fork-related event notifications.
  31912. enum fork_event
  31913. [indexterm2 boost_asio.indexterm.execution_context.fork_event.fork_prepare..fork_prepare..execution_context]
  31914. [indexterm2 boost_asio.indexterm.execution_context.fork_event.fork_parent..fork_parent..execution_context]
  31915. [indexterm2 boost_asio.indexterm.execution_context.fork_event.fork_child..fork_child..execution_context]
  31916. [heading Values]
  31917. [variablelist
  31918. [
  31919. [fork_prepare]
  31920. [Notify the context that the process is about to fork. ]
  31921. ]
  31922. [
  31923. [fork_parent]
  31924. [Notify the context that the process has forked and is the parent. ]
  31925. ]
  31926. [
  31927. [fork_child]
  31928. [Notify the context that the process has forked and is the child. ]
  31929. ]
  31930. ]
  31931. [endsect]
  31932. [section:has_service execution_context::has_service]
  31933. [indexterm2 boost_asio.indexterm.execution_context.has_service..has_service..execution_context]
  31934. Determine if an [link boost_asio.reference.execution_context `execution_context`] contains a specified service type.
  31935. template<
  31936. typename ``[link boost_asio.reference.Service Service]``>
  31937. friend bool has_service(
  31938. execution_context & e);
  31939. This function is used to determine whether the [link boost_asio.reference.execution_context `execution_context`] contains a service object corresponding to the given service type.
  31940. [heading Parameters]
  31941. [variablelist
  31942. [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
  31943. ]
  31944. [heading Return Value]
  31945. A boolean indicating whether the [link boost_asio.reference.execution_context `execution_context`] contains the service.
  31946. [heading Requirements]
  31947. ['Header: ][^boost/asio/execution_context.hpp]
  31948. ['Convenience header: ][^boost/asio.hpp]
  31949. [endsect]
  31950. [section:make_service execution_context::make_service]
  31951. [indexterm2 boost_asio.indexterm.execution_context.make_service..make_service..execution_context]
  31952. Creates a service object and adds it to the [link boost_asio.reference.execution_context `execution_context`].
  31953. template<
  31954. typename ``[link boost_asio.reference.Service Service]``,
  31955. typename... Args>
  31956. friend Service & make_service(
  31957. execution_context & e,
  31958. Args &&... args);
  31959. This function is used to add a service to the [link boost_asio.reference.execution_context `execution_context`].
  31960. [heading Parameters]
  31961. [variablelist
  31962. [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
  31963. [[args][Zero or more arguments to be passed to the service constructor.]]
  31964. ]
  31965. [heading Exceptions]
  31966. [variablelist
  31967. [[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`]. ]]
  31968. ]
  31969. [heading Requirements]
  31970. ['Header: ][^boost/asio/execution_context.hpp]
  31971. ['Convenience header: ][^boost/asio.hpp]
  31972. [endsect]
  31973. [section:notify_fork execution_context::notify_fork]
  31974. [indexterm2 boost_asio.indexterm.execution_context.notify_fork..notify_fork..execution_context]
  31975. Notify the [link boost_asio.reference.execution_context `execution_context`] of a fork-related event.
  31976. void notify_fork(
  31977. fork_event event);
  31978. This function is used to inform the [link boost_asio.reference.execution_context `execution_context`] that the process is about to fork, or has just forked. This allows the [link boost_asio.reference.execution_context `execution_context`], and the services it contains, to perform any necessary housekeeping to ensure correct operation following a fork.
  31979. This function must not be called while any other [link boost_asio.reference.execution_context `execution_context`] function, or any function associated with the execution\_context's derived class, is being called in another thread. It is, however, safe to call this function from within a completion handler, provided no other thread is accessing the [link boost_asio.reference.execution_context `execution_context`] or its derived class.
  31980. [heading Parameters]
  31981. [variablelist
  31982. [[event][A fork-related event.]]
  31983. ]
  31984. [heading Exceptions]
  31985. [variablelist
  31986. [[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.]]
  31987. ]
  31988. [heading Example]
  31989. The following code illustrates how to incorporate the `notify_fork()` function:
  31990. my_execution_context.notify_fork(execution_context::fork_prepare);
  31991. if (fork() == 0)
  31992. {
  31993. // This is the child process.
  31994. my_execution_context.notify_fork(execution_context::fork_child);
  31995. }
  31996. else
  31997. {
  31998. // This is the parent process.
  31999. my_execution_context.notify_fork(execution_context::fork_parent);
  32000. }
  32001. [heading Remarks]
  32002. For each service object `svc` in the [link boost_asio.reference.execution_context `execution_context`] set, performs `svc->notify_fork();`. When processing the fork\_prepare event, services are visited in reverse order of the beginning of service object lifetime. Otherwise, services are visited in order of the beginning of service object lifetime.
  32003. [endsect]
  32004. [section:shutdown execution_context::shutdown]
  32005. [indexterm2 boost_asio.indexterm.execution_context.shutdown..shutdown..execution_context]
  32006. Shuts down all services in the context.
  32007. void shutdown();
  32008. This function is implemented as follows:
  32009. * 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()`.
  32010. [endsect]
  32011. [section:use_service execution_context::use_service]
  32012. [indexterm2 boost_asio.indexterm.execution_context.use_service..use_service..execution_context]
  32013. Obtain the service object corresponding to the given type.
  32014. template<
  32015. typename ``[link boost_asio.reference.Service Service]``>
  32016. friend Service & ``[link boost_asio.reference.execution_context.use_service.overload1 use_service]``(
  32017. execution_context & e);
  32018. `` [''''&raquo;''' [link boost_asio.reference.execution_context.use_service.overload1 more...]]``
  32019. template<
  32020. typename ``[link boost_asio.reference.Service Service]``>
  32021. friend Service & ``[link boost_asio.reference.execution_context.use_service.overload2 use_service]``(
  32022. io_context & ioc);
  32023. `` [''''&raquo;''' [link boost_asio.reference.execution_context.use_service.overload2 more...]]``
  32024. [section:overload1 execution_context::use_service (1 of 2 overloads)]
  32025. Obtain the service object corresponding to the given type.
  32026. template<
  32027. typename ``[link boost_asio.reference.Service Service]``>
  32028. friend Service & use_service(
  32029. execution_context & e);
  32030. This function is used to locate a service object that corresponds to the given service type. If there is no existing implementation of the service, then the [link boost_asio.reference.execution_context `execution_context`] will create a new instance of the service.
  32031. [heading Parameters]
  32032. [variablelist
  32033. [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
  32034. ]
  32035. [heading Return Value]
  32036. The service interface implementing the specified service type. Ownership of the service interface is not transferred to the caller.
  32037. [heading Requirements]
  32038. ['Header: ][^boost/asio/execution_context.hpp]
  32039. ['Convenience header: ][^boost/asio.hpp]
  32040. [endsect]
  32041. [section:overload2 execution_context::use_service (2 of 2 overloads)]
  32042. Obtain the service object corresponding to the given type.
  32043. template<
  32044. typename ``[link boost_asio.reference.Service Service]``>
  32045. friend Service & use_service(
  32046. io_context & ioc);
  32047. This function is used to locate a service object that corresponds to the given service type. If there is no existing implementation of the service, then the [link boost_asio.reference.io_context `io_context`] will create a new instance of the service.
  32048. [heading Parameters]
  32049. [variablelist
  32050. [[ioc][The [link boost_asio.reference.io_context `io_context`] object that owns the service.]]
  32051. ]
  32052. [heading Return Value]
  32053. The service interface implementing the specified service type. Ownership of the service interface is not transferred to the caller.
  32054. [heading Remarks]
  32055. This overload is preserved for backwards compatibility with services that inherit from [link boost_asio.reference.io_context__service `io_context::service`].
  32056. [heading Requirements]
  32057. ['Header: ][^boost/asio/execution_context.hpp]
  32058. ['Convenience header: ][^boost/asio.hpp]
  32059. [endsect]
  32060. [endsect]
  32061. [section:_execution_context execution_context::~execution_context]
  32062. [indexterm2 boost_asio.indexterm.execution_context._execution_context..~execution_context..execution_context]
  32063. Destructor.
  32064. ~execution_context();
  32065. [endsect]
  32066. [endsect]
  32067. [section:execution_context__id execution_context::id]
  32068. Class used to uniquely identify a service.
  32069. class id :
  32070. noncopyable
  32071. [heading Member Functions]
  32072. [table
  32073. [[Name][Description]]
  32074. [
  32075. [[link boost_asio.reference.execution_context__id.id [*id]]]
  32076. [Constructor. ]
  32077. ]
  32078. ]
  32079. [heading Requirements]
  32080. ['Header: ][^boost/asio/execution_context.hpp]
  32081. ['Convenience header: ][^boost/asio.hpp]
  32082. [section:id execution_context::id::id]
  32083. [indexterm2 boost_asio.indexterm.execution_context__id.id..id..execution_context::id]
  32084. Constructor.
  32085. id();
  32086. [endsect]
  32087. [endsect]
  32088. [section:execution_context__service execution_context::service]
  32089. Base class for all [link boost_asio.reference.io_context `io_context`] services.
  32090. class service :
  32091. noncopyable
  32092. [heading Member Functions]
  32093. [table
  32094. [[Name][Description]]
  32095. [
  32096. [[link boost_asio.reference.execution_context__service.context [*context]]]
  32097. [Get the context object that owns the service. ]
  32098. ]
  32099. ]
  32100. [heading Protected Member Functions]
  32101. [table
  32102. [[Name][Description]]
  32103. [
  32104. [[link boost_asio.reference.execution_context__service.service [*service]]]
  32105. [Constructor. ]
  32106. ]
  32107. [
  32108. [[link boost_asio.reference.execution_context__service._service [*~service]]]
  32109. [Destructor. ]
  32110. ]
  32111. ]
  32112. [heading Private Member Functions]
  32113. [table
  32114. [[Name][Description]]
  32115. [
  32116. [[link boost_asio.reference.execution_context__service.notify_fork [*notify_fork]]]
  32117. [Handle notification of a fork-related event to perform any necessary housekeeping. ]
  32118. ]
  32119. [
  32120. [[link boost_asio.reference.execution_context__service.shutdown [*shutdown]]]
  32121. [Destroy all user-defined handler objects owned by the service. ]
  32122. ]
  32123. ]
  32124. [heading Requirements]
  32125. ['Header: ][^boost/asio/execution_context.hpp]
  32126. ['Convenience header: ][^boost/asio.hpp]
  32127. [section:context execution_context::service::context]
  32128. [indexterm2 boost_asio.indexterm.execution_context__service.context..context..execution_context::service]
  32129. Get the context object that owns the service.
  32130. execution_context & context();
  32131. [endsect]
  32132. [section:service execution_context::service::service]
  32133. [indexterm2 boost_asio.indexterm.execution_context__service.service..service..execution_context::service]
  32134. Constructor.
  32135. service(
  32136. execution_context & owner);
  32137. [heading Parameters]
  32138. [variablelist
  32139. [[owner][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service. ]]
  32140. ]
  32141. [endsect]
  32142. [section:_service execution_context::service::~service]
  32143. [indexterm2 boost_asio.indexterm.execution_context__service._service..~service..execution_context::service]
  32144. Destructor.
  32145. virtual ~service();
  32146. [endsect]
  32147. [section:notify_fork execution_context::service::notify_fork]
  32148. [indexterm2 boost_asio.indexterm.execution_context__service.notify_fork..notify_fork..execution_context::service]
  32149. Handle notification of a fork-related event to perform any necessary housekeeping.
  32150. virtual void notify_fork(
  32151. execution_context::fork_event event);
  32152. This function is not a pure virtual so that services only have to implement it if necessary. The default implementation does nothing.
  32153. [endsect]
  32154. [section:shutdown execution_context::service::shutdown]
  32155. [indexterm2 boost_asio.indexterm.execution_context__service.shutdown..shutdown..execution_context::service]
  32156. Destroy all user-defined handler objects owned by the service.
  32157. void shutdown();
  32158. [endsect]
  32159. [endsect]
  32160. [section:executor executor]
  32161. Polymorphic wrapper for executors.
  32162. class executor
  32163. [heading Types]
  32164. [table
  32165. [[Name][Description]]
  32166. [
  32167. [[link boost_asio.reference.executor__unspecified_bool_type_t [*unspecified_bool_type_t]]]
  32168. []
  32169. ]
  32170. [
  32171. [[link boost_asio.reference.executor.unspecified_bool_type [*unspecified_bool_type]]]
  32172. []
  32173. ]
  32174. ]
  32175. [heading Member Functions]
  32176. [table
  32177. [[Name][Description]]
  32178. [
  32179. [[link boost_asio.reference.executor.context [*context]]]
  32180. [Obtain the underlying execution context. ]
  32181. ]
  32182. [
  32183. [[link boost_asio.reference.executor.defer [*defer]]]
  32184. [Request the executor to invoke the given function object. ]
  32185. ]
  32186. [
  32187. [[link boost_asio.reference.executor.dispatch [*dispatch]]]
  32188. [Request the executor to invoke the given function object. ]
  32189. ]
  32190. [
  32191. [[link boost_asio.reference.executor.executor [*executor]]]
  32192. [Default constructor.
  32193. [hr]
  32194. Construct from nullptr.
  32195. [hr]
  32196. Copy constructor.
  32197. [hr]
  32198. Move constructor.
  32199. [hr]
  32200. Construct a polymorphic wrapper for the specified executor.
  32201. [hr]
  32202. Allocator-aware constructor to create a polymorphic wrapper for the specified executor. ]
  32203. ]
  32204. [
  32205. [[link boost_asio.reference.executor.on_work_finished [*on_work_finished]]]
  32206. [Inform the executor that some work is no longer outstanding. ]
  32207. ]
  32208. [
  32209. [[link boost_asio.reference.executor.on_work_started [*on_work_started]]]
  32210. [Inform the executor that it has some outstanding work to do. ]
  32211. ]
  32212. [
  32213. [[link boost_asio.reference.executor.operator_unspecified_bool_type [*operator unspecified_bool_type]]]
  32214. [Operator to test if the executor contains a valid target. ]
  32215. ]
  32216. [
  32217. [[link boost_asio.reference.executor.operator_eq_ [*operator=]]]
  32218. [Assignment operator.
  32219. [hr]
  32220. [hr]
  32221. Assignment operator for nullptr_t.
  32222. [hr]
  32223. Assignment operator to create a polymorphic wrapper for the specified executor. ]
  32224. ]
  32225. [
  32226. [[link boost_asio.reference.executor.post [*post]]]
  32227. [Request the executor to invoke the given function object. ]
  32228. ]
  32229. [
  32230. [[link boost_asio.reference.executor.target [*target]]]
  32231. [Obtain a pointer to the target executor object. ]
  32232. ]
  32233. [
  32234. [[link boost_asio.reference.executor.target_type [*target_type]]]
  32235. [Obtain type information for the target executor object. ]
  32236. ]
  32237. [
  32238. [[link boost_asio.reference.executor.unspecified_bool_true [*unspecified_bool_true]]]
  32239. []
  32240. ]
  32241. [
  32242. [[link boost_asio.reference.executor._executor [*~executor]]]
  32243. [Destructor. ]
  32244. ]
  32245. ]
  32246. [heading Friends]
  32247. [table
  32248. [[Name][Description]]
  32249. [
  32250. [[link boost_asio.reference.executor.operator_not__eq_ [*operator!=]]]
  32251. [Compare two executors for inequality. ]
  32252. ]
  32253. [
  32254. [[link boost_asio.reference.executor.operator_eq__eq_ [*operator==]]]
  32255. [Compare two executors for equality. ]
  32256. ]
  32257. ]
  32258. [heading Requirements]
  32259. ['Header: ][^boost/asio/executor.hpp]
  32260. ['Convenience header: ][^boost/asio.hpp]
  32261. [section:context executor::context]
  32262. [indexterm2 boost_asio.indexterm.executor.context..context..executor]
  32263. Obtain the underlying execution context.
  32264. execution_context & context() const;
  32265. [endsect]
  32266. [section:defer executor::defer]
  32267. [indexterm2 boost_asio.indexterm.executor.defer..defer..executor]
  32268. Request the executor to invoke the given function object.
  32269. template<
  32270. typename Function,
  32271. typename Allocator>
  32272. void defer(
  32273. Function && f,
  32274. const Allocator & a) const;
  32275. This function is used to ask the executor to execute the given function object. The function object is executed according to the rules of the target executor object.
  32276. [heading Parameters]
  32277. [variablelist
  32278. [[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:
  32279. ``
  32280. void function();
  32281. ``
  32282. ]]
  32283. [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
  32284. ]
  32285. [endsect]
  32286. [section:dispatch executor::dispatch]
  32287. [indexterm2 boost_asio.indexterm.executor.dispatch..dispatch..executor]
  32288. Request the executor to invoke the given function object.
  32289. template<
  32290. typename Function,
  32291. typename Allocator>
  32292. void dispatch(
  32293. Function && f,
  32294. const Allocator & a) const;
  32295. This function is used to ask the executor to execute the given function object. The function object is executed according to the rules of the target executor object.
  32296. [heading Parameters]
  32297. [variablelist
  32298. [[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:
  32299. ``
  32300. void function();
  32301. ``
  32302. ]]
  32303. [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
  32304. ]
  32305. [endsect]
  32306. [section:executor executor::executor]
  32307. [indexterm2 boost_asio.indexterm.executor.executor..executor..executor]
  32308. Default constructor.
  32309. ``[link boost_asio.reference.executor.executor.overload1 executor]``();
  32310. `` [''''&raquo;''' [link boost_asio.reference.executor.executor.overload1 more...]]``
  32311. Construct from nullptr.
  32312. ``[link boost_asio.reference.executor.executor.overload2 executor]``(
  32313. nullptr_t );
  32314. `` [''''&raquo;''' [link boost_asio.reference.executor.executor.overload2 more...]]``
  32315. Copy constructor.
  32316. ``[link boost_asio.reference.executor.executor.overload3 executor]``(
  32317. const executor & other);
  32318. `` [''''&raquo;''' [link boost_asio.reference.executor.executor.overload3 more...]]``
  32319. Move constructor.
  32320. ``[link boost_asio.reference.executor.executor.overload4 executor]``(
  32321. executor && other);
  32322. `` [''''&raquo;''' [link boost_asio.reference.executor.executor.overload4 more...]]``
  32323. Construct a polymorphic wrapper for the specified executor.
  32324. template<
  32325. typename ``[link boost_asio.reference.Executor1 Executor]``>
  32326. ``[link boost_asio.reference.executor.executor.overload5 executor]``(
  32327. Executor e);
  32328. `` [''''&raquo;''' [link boost_asio.reference.executor.executor.overload5 more...]]``
  32329. Allocator-aware constructor to create a polymorphic wrapper for the specified executor.
  32330. template<
  32331. typename ``[link boost_asio.reference.Executor1 Executor]``,
  32332. typename Allocator>
  32333. ``[link boost_asio.reference.executor.executor.overload6 executor]``(
  32334. allocator_arg_t ,
  32335. const Allocator & a,
  32336. Executor e);
  32337. `` [''''&raquo;''' [link boost_asio.reference.executor.executor.overload6 more...]]``
  32338. [section:overload1 executor::executor (1 of 6 overloads)]
  32339. Default constructor.
  32340. executor();
  32341. [endsect]
  32342. [section:overload2 executor::executor (2 of 6 overloads)]
  32343. Construct from nullptr.
  32344. executor(
  32345. nullptr_t );
  32346. [endsect]
  32347. [section:overload3 executor::executor (3 of 6 overloads)]
  32348. Copy constructor.
  32349. executor(
  32350. const executor & other);
  32351. [endsect]
  32352. [section:overload4 executor::executor (4 of 6 overloads)]
  32353. Move constructor.
  32354. executor(
  32355. executor && other);
  32356. [endsect]
  32357. [section:overload5 executor::executor (5 of 6 overloads)]
  32358. Construct a polymorphic wrapper for the specified executor.
  32359. template<
  32360. typename ``[link boost_asio.reference.Executor1 Executor]``>
  32361. executor(
  32362. Executor e);
  32363. [endsect]
  32364. [section:overload6 executor::executor (6 of 6 overloads)]
  32365. Allocator-aware constructor to create a polymorphic wrapper for the specified executor.
  32366. template<
  32367. typename ``[link boost_asio.reference.Executor1 Executor]``,
  32368. typename Allocator>
  32369. executor(
  32370. allocator_arg_t ,
  32371. const Allocator & a,
  32372. Executor e);
  32373. [endsect]
  32374. [endsect]
  32375. [section:on_work_finished executor::on_work_finished]
  32376. [indexterm2 boost_asio.indexterm.executor.on_work_finished..on_work_finished..executor]
  32377. Inform the executor that some work is no longer outstanding.
  32378. void on_work_finished() const;
  32379. [endsect]
  32380. [section:on_work_started executor::on_work_started]
  32381. [indexterm2 boost_asio.indexterm.executor.on_work_started..on_work_started..executor]
  32382. Inform the executor that it has some outstanding work to do.
  32383. void on_work_started() const;
  32384. [endsect]
  32385. [section:operator_unspecified_bool_type executor::operator unspecified_bool_type]
  32386. [indexterm2 boost_asio.indexterm.executor.operator_unspecified_bool_type..operator unspecified_bool_type..executor]
  32387. Operator to test if the executor contains a valid target.
  32388. operator unspecified_bool_type() const;
  32389. [endsect]
  32390. [section:operator_not__eq_ executor::operator!=]
  32391. [indexterm2 boost_asio.indexterm.executor.operator_not__eq_..operator!=..executor]
  32392. Compare two executors for inequality.
  32393. friend bool operator!=(
  32394. const executor & a,
  32395. const executor & b);
  32396. [heading Requirements]
  32397. ['Header: ][^boost/asio/executor.hpp]
  32398. ['Convenience header: ][^boost/asio.hpp]
  32399. [endsect]
  32400. [section:operator_eq_ executor::operator=]
  32401. [indexterm2 boost_asio.indexterm.executor.operator_eq_..operator=..executor]
  32402. Assignment operator.
  32403. executor & ``[link boost_asio.reference.executor.operator_eq_.overload1 operator=]``(
  32404. const executor & other);
  32405. `` [''''&raquo;''' [link boost_asio.reference.executor.operator_eq_.overload1 more...]]``
  32406. executor & ``[link boost_asio.reference.executor.operator_eq_.overload2 operator=]``(
  32407. executor && other);
  32408. `` [''''&raquo;''' [link boost_asio.reference.executor.operator_eq_.overload2 more...]]``
  32409. Assignment operator for nullptr\_t.
  32410. executor & ``[link boost_asio.reference.executor.operator_eq_.overload3 operator=]``(
  32411. nullptr_t );
  32412. `` [''''&raquo;''' [link boost_asio.reference.executor.operator_eq_.overload3 more...]]``
  32413. Assignment operator to create a polymorphic wrapper for the specified executor.
  32414. template<
  32415. typename ``[link boost_asio.reference.Executor1 Executor]``>
  32416. executor & ``[link boost_asio.reference.executor.operator_eq_.overload4 operator=]``(
  32417. Executor && e);
  32418. `` [''''&raquo;''' [link boost_asio.reference.executor.operator_eq_.overload4 more...]]``
  32419. [section:overload1 executor::operator= (1 of 4 overloads)]
  32420. Assignment operator.
  32421. executor & operator=(
  32422. const executor & other);
  32423. [endsect]
  32424. [section:overload2 executor::operator= (2 of 4 overloads)]
  32425. executor & operator=(
  32426. executor && other);
  32427. [endsect]
  32428. [section:overload3 executor::operator= (3 of 4 overloads)]
  32429. Assignment operator for nullptr\_t.
  32430. executor & operator=(
  32431. nullptr_t );
  32432. [endsect]
  32433. [section:overload4 executor::operator= (4 of 4 overloads)]
  32434. Assignment operator to create a polymorphic wrapper for the specified executor.
  32435. template<
  32436. typename ``[link boost_asio.reference.Executor1 Executor]``>
  32437. executor & operator=(
  32438. Executor && e);
  32439. [endsect]
  32440. [endsect]
  32441. [section:operator_eq__eq_ executor::operator==]
  32442. [indexterm2 boost_asio.indexterm.executor.operator_eq__eq_..operator==..executor]
  32443. Compare two executors for equality.
  32444. friend bool operator==(
  32445. const executor & a,
  32446. const executor & b);
  32447. [heading Requirements]
  32448. ['Header: ][^boost/asio/executor.hpp]
  32449. ['Convenience header: ][^boost/asio.hpp]
  32450. [endsect]
  32451. [section:post executor::post]
  32452. [indexterm2 boost_asio.indexterm.executor.post..post..executor]
  32453. Request the executor to invoke the given function object.
  32454. template<
  32455. typename Function,
  32456. typename Allocator>
  32457. void post(
  32458. Function && f,
  32459. const Allocator & a) const;
  32460. This function is used to ask the executor to execute the given function object. The function object is executed according to the rules of the target executor object.
  32461. [heading Parameters]
  32462. [variablelist
  32463. [[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:
  32464. ``
  32465. void function();
  32466. ``
  32467. ]]
  32468. [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
  32469. ]
  32470. [endsect]
  32471. [section:target executor::target]
  32472. [indexterm2 boost_asio.indexterm.executor.target..target..executor]
  32473. Obtain a pointer to the target executor object.
  32474. template<
  32475. typename ``[link boost_asio.reference.Executor1 Executor]``>
  32476. Executor * ``[link boost_asio.reference.executor.target.overload1 target]``();
  32477. `` [''''&raquo;''' [link boost_asio.reference.executor.target.overload1 more...]]``
  32478. template<
  32479. typename ``[link boost_asio.reference.Executor1 Executor]``>
  32480. const Executor * ``[link boost_asio.reference.executor.target.overload2 target]``() const;
  32481. `` [''''&raquo;''' [link boost_asio.reference.executor.target.overload2 more...]]``
  32482. [section:overload1 executor::target (1 of 2 overloads)]
  32483. Obtain a pointer to the target executor object.
  32484. template<
  32485. typename ``[link boost_asio.reference.Executor1 Executor]``>
  32486. Executor * target();
  32487. [heading Return Value]
  32488. If `target_type() == typeid(T)`, a pointer to the stored executor target; otherwise, a null pointer.
  32489. [endsect]
  32490. [section:overload2 executor::target (2 of 2 overloads)]
  32491. Obtain a pointer to the target executor object.
  32492. template<
  32493. typename ``[link boost_asio.reference.Executor1 Executor]``>
  32494. const Executor * target() const;
  32495. [heading Return Value]
  32496. If `target_type() == typeid(T)`, a pointer to the stored executor target; otherwise, a null pointer.
  32497. [endsect]
  32498. [endsect]
  32499. [section:target_type executor::target_type]
  32500. [indexterm2 boost_asio.indexterm.executor.target_type..target_type..executor]
  32501. Obtain type information for the target executor object.
  32502. const std::type_info & target_type() const;
  32503. [heading Return Value]
  32504. If `*this` has a target type of type `T`, `typeid(T)`; otherwise, `typeid(void)`.
  32505. [endsect]
  32506. [section:unspecified_bool_true executor::unspecified_bool_true]
  32507. [indexterm2 boost_asio.indexterm.executor.unspecified_bool_true..unspecified_bool_true..executor]
  32508. static void unspecified_bool_true(
  32509. unspecified_bool_type_t );
  32510. [endsect]
  32511. [section:unspecified_bool_type executor::unspecified_bool_type]
  32512. [indexterm2 boost_asio.indexterm.executor.unspecified_bool_type..unspecified_bool_type..executor]
  32513. typedef void(*) unspecified_bool_type;
  32514. [heading Requirements]
  32515. ['Header: ][^boost/asio/executor.hpp]
  32516. ['Convenience header: ][^boost/asio.hpp]
  32517. [endsect]
  32518. [section:_executor executor::~executor]
  32519. [indexterm2 boost_asio.indexterm.executor._executor..~executor..executor]
  32520. Destructor.
  32521. ~executor();
  32522. [endsect]
  32523. [endsect]
  32524. [section:executor__unspecified_bool_type_t executor::unspecified_bool_type_t]
  32525. struct unspecified_bool_type_t
  32526. [heading Requirements]
  32527. ['Header: ][^boost/asio/executor.hpp]
  32528. ['Convenience header: ][^boost/asio.hpp]
  32529. [endsect]
  32530. [section:executor_arg executor_arg]
  32531. [indexterm1 boost_asio.indexterm.executor_arg..executor_arg]
  32532. A special value, similar to std::nothrow, used to disambiguate constructors that accept executor arguments.
  32533. constexpr executor_arg_t executor_arg;
  32534. See [link boost_asio.reference.executor_arg_t `executor_arg_t`] and [link boost_asio.reference.uses_executor `uses_executor`] for more information.
  32535. [heading Requirements]
  32536. ['Header: ][^boost/asio/uses_executor.hpp]
  32537. ['Convenience header: ][^boost/asio.hpp]
  32538. [endsect]
  32539. [section:executor_arg_t executor_arg_t]
  32540. A special type, similar to std::nothrow\_t, used to disambiguate constructors that accept executor arguments.
  32541. struct executor_arg_t
  32542. [heading Member Functions]
  32543. [table
  32544. [[Name][Description]]
  32545. [
  32546. [[link boost_asio.reference.executor_arg_t.executor_arg_t [*executor_arg_t]]]
  32547. [Constructor. ]
  32548. ]
  32549. ]
  32550. The [link boost_asio.reference.executor_arg_t `executor_arg_t`] struct is an empty structure type used as a unique type to disambiguate constructor and function overloading. Specifically, some types have constructors with [link boost_asio.reference.executor_arg_t `executor_arg_t`] as the first argument, immediately followed by an argument of a type that satisfies the Executor type requirements.
  32551. [heading Requirements]
  32552. ['Header: ][^boost/asio/uses_executor.hpp]
  32553. ['Convenience header: ][^boost/asio.hpp]
  32554. [section:executor_arg_t executor_arg_t::executor_arg_t]
  32555. [indexterm2 boost_asio.indexterm.executor_arg_t.executor_arg_t..executor_arg_t..executor_arg_t]
  32556. Constructor.
  32557. constexpr executor_arg_t();
  32558. [endsect]
  32559. [endsect]
  32560. [section:executor_binder executor_binder]
  32561. A call wrapper type to bind an executor of type `Executor` to an object of type `T`.
  32562. template<
  32563. typename T,
  32564. typename ``[link boost_asio.reference.Executor1 Executor]``>
  32565. class executor_binder
  32566. [heading Types]
  32567. [table
  32568. [[Name][Description]]
  32569. [
  32570. [[link boost_asio.reference.executor_binder.argument_type [*argument_type]]]
  32571. [The type of the function's argument. ]
  32572. ]
  32573. [
  32574. [[link boost_asio.reference.executor_binder.executor_type [*executor_type]]]
  32575. [The type of the associated executor. ]
  32576. ]
  32577. [
  32578. [[link boost_asio.reference.executor_binder.first_argument_type [*first_argument_type]]]
  32579. [The type of the function's first argument. ]
  32580. ]
  32581. [
  32582. [[link boost_asio.reference.executor_binder.result_type [*result_type]]]
  32583. [The return type if a function. ]
  32584. ]
  32585. [
  32586. [[link boost_asio.reference.executor_binder.second_argument_type [*second_argument_type]]]
  32587. [The type of the function's second argument. ]
  32588. ]
  32589. [
  32590. [[link boost_asio.reference.executor_binder.target_type [*target_type]]]
  32591. [The type of the target object. ]
  32592. ]
  32593. ]
  32594. [heading Member Functions]
  32595. [table
  32596. [[Name][Description]]
  32597. [
  32598. [[link boost_asio.reference.executor_binder.executor_binder [*executor_binder]]]
  32599. [Construct an executor wrapper for the specified object.
  32600. [hr]
  32601. Copy constructor.
  32602. [hr]
  32603. Construct a copy, but specify a different executor.
  32604. [hr]
  32605. Construct a copy of a different executor wrapper type.
  32606. [hr]
  32607. Construct a copy of a different executor wrapper type, but specify a different executor.
  32608. [hr]
  32609. Move constructor.
  32610. [hr]
  32611. Move construct the target object, but specify a different executor.
  32612. [hr]
  32613. Move construct from a different executor wrapper type.
  32614. [hr]
  32615. Move construct from a different executor wrapper type, but specify a different executor. ]
  32616. ]
  32617. [
  32618. [[link boost_asio.reference.executor_binder.get [*get]]]
  32619. [Obtain a reference to the target object. ]
  32620. ]
  32621. [
  32622. [[link boost_asio.reference.executor_binder.get_executor [*get_executor]]]
  32623. [Obtain the associated executor. ]
  32624. ]
  32625. [
  32626. [[link boost_asio.reference.executor_binder.operator_lp__rp_ [*operator()]]]
  32627. []
  32628. ]
  32629. [
  32630. [[link boost_asio.reference.executor_binder._executor_binder [*~executor_binder]]]
  32631. [Destructor. ]
  32632. ]
  32633. ]
  32634. [heading Requirements]
  32635. ['Header: ][^boost/asio/bind_executor.hpp]
  32636. ['Convenience header: ][^boost/asio.hpp]
  32637. [section:argument_type executor_binder::argument_type]
  32638. [indexterm2 boost_asio.indexterm.executor_binder.argument_type..argument_type..executor_binder]
  32639. The type of the function's argument.
  32640. typedef see_below argument_type;
  32641. The type of `argument_type` is based on the type `T` of the wrapper's target object:
  32642. * if `T` is a pointer to a function type accepting a single argument, `argument_type` is a synonym for the return type of `T`;
  32643. * if `T` is a class type with a member type `argument_type`, then `argument_type` is a synonym for `T::argument_type`;
  32644. * otherwise `argument_type` is not defined.
  32645. [heading Requirements]
  32646. ['Header: ][^boost/asio/bind_executor.hpp]
  32647. ['Convenience header: ][^boost/asio.hpp]
  32648. [endsect]
  32649. [section:executor_binder executor_binder::executor_binder]
  32650. [indexterm2 boost_asio.indexterm.executor_binder.executor_binder..executor_binder..executor_binder]
  32651. Construct an executor wrapper for the specified object.
  32652. template<
  32653. typename U>
  32654. ``[link boost_asio.reference.executor_binder.executor_binder.overload1 executor_binder]``(
  32655. executor_arg_t ,
  32656. const executor_type & e,
  32657. U && u);
  32658. `` [''''&raquo;''' [link boost_asio.reference.executor_binder.executor_binder.overload1 more...]]``
  32659. Copy constructor.
  32660. ``[link boost_asio.reference.executor_binder.executor_binder.overload2 executor_binder]``(
  32661. const executor_binder & other);
  32662. `` [''''&raquo;''' [link boost_asio.reference.executor_binder.executor_binder.overload2 more...]]``
  32663. Construct a copy, but specify a different executor.
  32664. ``[link boost_asio.reference.executor_binder.executor_binder.overload3 executor_binder]``(
  32665. executor_arg_t ,
  32666. const executor_type & e,
  32667. const executor_binder & other);
  32668. `` [''''&raquo;''' [link boost_asio.reference.executor_binder.executor_binder.overload3 more...]]``
  32669. Construct a copy of a different executor wrapper type.
  32670. template<
  32671. typename U,
  32672. typename ``[link boost_asio.reference.Executor1 OtherExecutor]``>
  32673. ``[link boost_asio.reference.executor_binder.executor_binder.overload4 executor_binder]``(
  32674. const executor_binder< U, OtherExecutor > & other);
  32675. `` [''''&raquo;''' [link boost_asio.reference.executor_binder.executor_binder.overload4 more...]]``
  32676. Construct a copy of a different executor wrapper type, but specify a different executor.
  32677. template<
  32678. typename U,
  32679. typename ``[link boost_asio.reference.Executor1 OtherExecutor]``>
  32680. ``[link boost_asio.reference.executor_binder.executor_binder.overload5 executor_binder]``(
  32681. executor_arg_t ,
  32682. const executor_type & e,
  32683. const executor_binder< U, OtherExecutor > & other);
  32684. `` [''''&raquo;''' [link boost_asio.reference.executor_binder.executor_binder.overload5 more...]]``
  32685. Move constructor.
  32686. ``[link boost_asio.reference.executor_binder.executor_binder.overload6 executor_binder]``(
  32687. executor_binder && other);
  32688. `` [''''&raquo;''' [link boost_asio.reference.executor_binder.executor_binder.overload6 more...]]``
  32689. Move construct the target object, but specify a different executor.
  32690. ``[link boost_asio.reference.executor_binder.executor_binder.overload7 executor_binder]``(
  32691. executor_arg_t ,
  32692. const executor_type & e,
  32693. executor_binder && other);
  32694. `` [''''&raquo;''' [link boost_asio.reference.executor_binder.executor_binder.overload7 more...]]``
  32695. Move construct from a different executor wrapper type.
  32696. template<
  32697. typename U,
  32698. typename ``[link boost_asio.reference.Executor1 OtherExecutor]``>
  32699. ``[link boost_asio.reference.executor_binder.executor_binder.overload8 executor_binder]``(
  32700. executor_binder< U, OtherExecutor > && other);
  32701. `` [''''&raquo;''' [link boost_asio.reference.executor_binder.executor_binder.overload8 more...]]``
  32702. Move construct from a different executor wrapper type, but specify a different executor.
  32703. template<
  32704. typename U,
  32705. typename ``[link boost_asio.reference.Executor1 OtherExecutor]``>
  32706. ``[link boost_asio.reference.executor_binder.executor_binder.overload9 executor_binder]``(
  32707. executor_arg_t ,
  32708. const executor_type & e,
  32709. executor_binder< U, OtherExecutor > && other);
  32710. `` [''''&raquo;''' [link boost_asio.reference.executor_binder.executor_binder.overload9 more...]]``
  32711. [section:overload1 executor_binder::executor_binder (1 of 9 overloads)]
  32712. Construct an executor wrapper for the specified object.
  32713. template<
  32714. typename U>
  32715. executor_binder(
  32716. executor_arg_t ,
  32717. const executor_type & e,
  32718. U && u);
  32719. This constructor is only valid if the type `T` is constructible from type `U`.
  32720. [endsect]
  32721. [section:overload2 executor_binder::executor_binder (2 of 9 overloads)]
  32722. Copy constructor.
  32723. executor_binder(
  32724. const executor_binder & other);
  32725. [endsect]
  32726. [section:overload3 executor_binder::executor_binder (3 of 9 overloads)]
  32727. Construct a copy, but specify a different executor.
  32728. executor_binder(
  32729. executor_arg_t ,
  32730. const executor_type & e,
  32731. const executor_binder & other);
  32732. [endsect]
  32733. [section:overload4 executor_binder::executor_binder (4 of 9 overloads)]
  32734. Construct a copy of a different executor wrapper type.
  32735. template<
  32736. typename U,
  32737. typename ``[link boost_asio.reference.Executor1 OtherExecutor]``>
  32738. executor_binder(
  32739. const executor_binder< U, OtherExecutor > & other);
  32740. This constructor is only valid if the `Executor` type is constructible from type `OtherExecutor`, and the type `T` is constructible from type `U`.
  32741. [endsect]
  32742. [section:overload5 executor_binder::executor_binder (5 of 9 overloads)]
  32743. Construct a copy of a different executor wrapper type, but specify a different executor.
  32744. template<
  32745. typename U,
  32746. typename ``[link boost_asio.reference.Executor1 OtherExecutor]``>
  32747. executor_binder(
  32748. executor_arg_t ,
  32749. const executor_type & e,
  32750. const executor_binder< U, OtherExecutor > & other);
  32751. This constructor is only valid if the type `T` is constructible from type `U`.
  32752. [endsect]
  32753. [section:overload6 executor_binder::executor_binder (6 of 9 overloads)]
  32754. Move constructor.
  32755. executor_binder(
  32756. executor_binder && other);
  32757. [endsect]
  32758. [section:overload7 executor_binder::executor_binder (7 of 9 overloads)]
  32759. Move construct the target object, but specify a different executor.
  32760. executor_binder(
  32761. executor_arg_t ,
  32762. const executor_type & e,
  32763. executor_binder && other);
  32764. [endsect]
  32765. [section:overload8 executor_binder::executor_binder (8 of 9 overloads)]
  32766. Move construct from a different executor wrapper type.
  32767. template<
  32768. typename U,
  32769. typename ``[link boost_asio.reference.Executor1 OtherExecutor]``>
  32770. executor_binder(
  32771. executor_binder< U, OtherExecutor > && other);
  32772. [endsect]
  32773. [section:overload9 executor_binder::executor_binder (9 of 9 overloads)]
  32774. Move construct from a different executor wrapper type, but specify a different executor.
  32775. template<
  32776. typename U,
  32777. typename ``[link boost_asio.reference.Executor1 OtherExecutor]``>
  32778. executor_binder(
  32779. executor_arg_t ,
  32780. const executor_type & e,
  32781. executor_binder< U, OtherExecutor > && other);
  32782. [endsect]
  32783. [endsect]
  32784. [section:executor_type executor_binder::executor_type]
  32785. [indexterm2 boost_asio.indexterm.executor_binder.executor_type..executor_type..executor_binder]
  32786. The type of the associated executor.
  32787. typedef Executor executor_type;
  32788. [heading Requirements]
  32789. ['Header: ][^boost/asio/bind_executor.hpp]
  32790. ['Convenience header: ][^boost/asio.hpp]
  32791. [endsect]
  32792. [section:first_argument_type executor_binder::first_argument_type]
  32793. [indexterm2 boost_asio.indexterm.executor_binder.first_argument_type..first_argument_type..executor_binder]
  32794. The type of the function's first argument.
  32795. typedef see_below first_argument_type;
  32796. The type of `first_argument_type` is based on the type `T` of the wrapper's target object:
  32797. * if `T` is a pointer to a function type accepting two arguments, `first_argument_type` is a synonym for the return type of `T`;
  32798. * 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`;
  32799. * otherwise `first_argument_type` is not defined.
  32800. [heading Requirements]
  32801. ['Header: ][^boost/asio/bind_executor.hpp]
  32802. ['Convenience header: ][^boost/asio.hpp]
  32803. [endsect]
  32804. [section:get executor_binder::get]
  32805. [indexterm2 boost_asio.indexterm.executor_binder.get..get..executor_binder]
  32806. Obtain a reference to the target object.
  32807. target_type & ``[link boost_asio.reference.executor_binder.get.overload1 get]``();
  32808. `` [''''&raquo;''' [link boost_asio.reference.executor_binder.get.overload1 more...]]``
  32809. const target_type & ``[link boost_asio.reference.executor_binder.get.overload2 get]``() const;
  32810. `` [''''&raquo;''' [link boost_asio.reference.executor_binder.get.overload2 more...]]``
  32811. [section:overload1 executor_binder::get (1 of 2 overloads)]
  32812. Obtain a reference to the target object.
  32813. target_type & get();
  32814. [endsect]
  32815. [section:overload2 executor_binder::get (2 of 2 overloads)]
  32816. Obtain a reference to the target object.
  32817. const target_type & get() const;
  32818. [endsect]
  32819. [endsect]
  32820. [section:get_executor executor_binder::get_executor]
  32821. [indexterm2 boost_asio.indexterm.executor_binder.get_executor..get_executor..executor_binder]
  32822. Obtain the associated executor.
  32823. executor_type get_executor() const;
  32824. [endsect]
  32825. [section:operator_lp__rp_ executor_binder::operator()]
  32826. [indexterm2 boost_asio.indexterm.executor_binder.operator_lp__rp_..operator()..executor_binder]
  32827. template<
  32828. typename... Args>
  32829. auto ``[link boost_asio.reference.executor_binder.operator_lp__rp_.overload1 operator()]``(
  32830. Args && ...);
  32831. `` [''''&raquo;''' [link boost_asio.reference.executor_binder.operator_lp__rp_.overload1 more...]]``
  32832. template<
  32833. typename... Args>
  32834. auto ``[link boost_asio.reference.executor_binder.operator_lp__rp_.overload2 operator()]``(
  32835. Args && ...) const;
  32836. `` [''''&raquo;''' [link boost_asio.reference.executor_binder.operator_lp__rp_.overload2 more...]]``
  32837. [section:overload1 executor_binder::operator() (1 of 2 overloads)]
  32838. template<
  32839. typename... Args>
  32840. auto operator()(
  32841. Args && ...);
  32842. [endsect]
  32843. [section:overload2 executor_binder::operator() (2 of 2 overloads)]
  32844. template<
  32845. typename... Args>
  32846. auto operator()(
  32847. Args && ...) const;
  32848. [endsect]
  32849. [endsect]
  32850. [section:result_type executor_binder::result_type]
  32851. [indexterm2 boost_asio.indexterm.executor_binder.result_type..result_type..executor_binder]
  32852. The return type if a function.
  32853. typedef see_below result_type;
  32854. The type of `result_type` is based on the type `T` of the wrapper's target object:
  32855. * if `T` is a pointer to function type, `result_type` is a synonym for the return type of `T`;
  32856. * if `T` is a class type with a member type `result_type`, then `result_type` is a synonym for `T::result_type`;
  32857. * otherwise `result_type` is not defined.
  32858. [heading Requirements]
  32859. ['Header: ][^boost/asio/bind_executor.hpp]
  32860. ['Convenience header: ][^boost/asio.hpp]
  32861. [endsect]
  32862. [section:second_argument_type executor_binder::second_argument_type]
  32863. [indexterm2 boost_asio.indexterm.executor_binder.second_argument_type..second_argument_type..executor_binder]
  32864. The type of the function's second argument.
  32865. typedef see_below second_argument_type;
  32866. The type of `second_argument_type` is based on the type `T` of the wrapper's target object:
  32867. * if `T` is a pointer to a function type accepting two arguments, `second_argument_type` is a synonym for the return type of `T`;
  32868. * 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`;
  32869. * otherwise `second_argument_type` is not defined.
  32870. [heading Requirements]
  32871. ['Header: ][^boost/asio/bind_executor.hpp]
  32872. ['Convenience header: ][^boost/asio.hpp]
  32873. [endsect]
  32874. [section:target_type executor_binder::target_type]
  32875. [indexterm2 boost_asio.indexterm.executor_binder.target_type..target_type..executor_binder]
  32876. The type of the target object.
  32877. typedef T target_type;
  32878. [heading Requirements]
  32879. ['Header: ][^boost/asio/bind_executor.hpp]
  32880. ['Convenience header: ][^boost/asio.hpp]
  32881. [endsect]
  32882. [section:_executor_binder executor_binder::~executor_binder]
  32883. [indexterm2 boost_asio.indexterm.executor_binder._executor_binder..~executor_binder..executor_binder]
  32884. Destructor.
  32885. ~executor_binder();
  32886. [endsect]
  32887. [endsect]
  32888. [section:executor_work_guard executor_work_guard]
  32889. An object of type `executor_work_guard` controls ownership of executor work within a scope.
  32890. template<
  32891. typename ``[link boost_asio.reference.Executor1 Executor]``>
  32892. class executor_work_guard
  32893. [heading Types]
  32894. [table
  32895. [[Name][Description]]
  32896. [
  32897. [[link boost_asio.reference.executor_work_guard.executor_type [*executor_type]]]
  32898. [The underlying executor type. ]
  32899. ]
  32900. ]
  32901. [heading Member Functions]
  32902. [table
  32903. [[Name][Description]]
  32904. [
  32905. [[link boost_asio.reference.executor_work_guard.executor_work_guard [*executor_work_guard]]]
  32906. [Constructs a executor_work_guard object for the specified executor.
  32907. [hr]
  32908. Copy constructor.
  32909. [hr]
  32910. Move constructor. ]
  32911. ]
  32912. [
  32913. [[link boost_asio.reference.executor_work_guard.get_executor [*get_executor]]]
  32914. [Obtain the associated executor. ]
  32915. ]
  32916. [
  32917. [[link boost_asio.reference.executor_work_guard.owns_work [*owns_work]]]
  32918. [Whether the executor_work_guard object owns some outstanding work. ]
  32919. ]
  32920. [
  32921. [[link boost_asio.reference.executor_work_guard.reset [*reset]]]
  32922. [Indicate that the work is no longer outstanding. ]
  32923. ]
  32924. [
  32925. [[link boost_asio.reference.executor_work_guard._executor_work_guard [*~executor_work_guard]]]
  32926. [Destructor. ]
  32927. ]
  32928. ]
  32929. [heading Requirements]
  32930. ['Header: ][^boost/asio/executor_work_guard.hpp]
  32931. ['Convenience header: ][^boost/asio.hpp]
  32932. [section:executor_type executor_work_guard::executor_type]
  32933. [indexterm2 boost_asio.indexterm.executor_work_guard.executor_type..executor_type..executor_work_guard]
  32934. The underlying executor type.
  32935. typedef Executor executor_type;
  32936. [heading Requirements]
  32937. ['Header: ][^boost/asio/executor_work_guard.hpp]
  32938. ['Convenience header: ][^boost/asio.hpp]
  32939. [endsect]
  32940. [section:executor_work_guard executor_work_guard::executor_work_guard]
  32941. [indexterm2 boost_asio.indexterm.executor_work_guard.executor_work_guard..executor_work_guard..executor_work_guard]
  32942. Constructs a `executor_work_guard` object for the specified executor.
  32943. explicit ``[link boost_asio.reference.executor_work_guard.executor_work_guard.overload1 executor_work_guard]``(
  32944. const executor_type & e);
  32945. `` [''''&raquo;''' [link boost_asio.reference.executor_work_guard.executor_work_guard.overload1 more...]]``
  32946. Copy constructor.
  32947. ``[link boost_asio.reference.executor_work_guard.executor_work_guard.overload2 executor_work_guard]``(
  32948. const executor_work_guard & other);
  32949. `` [''''&raquo;''' [link boost_asio.reference.executor_work_guard.executor_work_guard.overload2 more...]]``
  32950. Move constructor.
  32951. ``[link boost_asio.reference.executor_work_guard.executor_work_guard.overload3 executor_work_guard]``(
  32952. executor_work_guard && other);
  32953. `` [''''&raquo;''' [link boost_asio.reference.executor_work_guard.executor_work_guard.overload3 more...]]``
  32954. [section:overload1 executor_work_guard::executor_work_guard (1 of 3 overloads)]
  32955. Constructs a `executor_work_guard` object for the specified executor.
  32956. executor_work_guard(
  32957. const executor_type & e);
  32958. Stores a copy of `e` and calls `on_work_started()` on it.
  32959. [endsect]
  32960. [section:overload2 executor_work_guard::executor_work_guard (2 of 3 overloads)]
  32961. Copy constructor.
  32962. executor_work_guard(
  32963. const executor_work_guard & other);
  32964. [endsect]
  32965. [section:overload3 executor_work_guard::executor_work_guard (3 of 3 overloads)]
  32966. Move constructor.
  32967. executor_work_guard(
  32968. executor_work_guard && other);
  32969. [endsect]
  32970. [endsect]
  32971. [section:get_executor executor_work_guard::get_executor]
  32972. [indexterm2 boost_asio.indexterm.executor_work_guard.get_executor..get_executor..executor_work_guard]
  32973. Obtain the associated executor.
  32974. executor_type get_executor() const;
  32975. [endsect]
  32976. [section:owns_work executor_work_guard::owns_work]
  32977. [indexterm2 boost_asio.indexterm.executor_work_guard.owns_work..owns_work..executor_work_guard]
  32978. Whether the [link boost_asio.reference.executor_work_guard `executor_work_guard`] object owns some outstanding work.
  32979. bool owns_work() const;
  32980. [endsect]
  32981. [section:reset executor_work_guard::reset]
  32982. [indexterm2 boost_asio.indexterm.executor_work_guard.reset..reset..executor_work_guard]
  32983. Indicate that the work is no longer outstanding.
  32984. void reset();
  32985. [endsect]
  32986. [section:_executor_work_guard executor_work_guard::~executor_work_guard]
  32987. [indexterm2 boost_asio.indexterm.executor_work_guard._executor_work_guard..~executor_work_guard..executor_work_guard]
  32988. Destructor.
  32989. ~executor_work_guard();
  32990. Unless the object has already been reset, or is in a moved-from state, calls `on_work_finished()` on the stored executor.
  32991. [endsect]
  32992. [endsect]
  32993. [section:generic__basic_endpoint generic::basic_endpoint]
  32994. Describes an endpoint for any socket type.
  32995. template<
  32996. typename ``[link boost_asio.reference.Protocol Protocol]``>
  32997. class basic_endpoint
  32998. [heading Types]
  32999. [table
  33000. [[Name][Description]]
  33001. [
  33002. [[link boost_asio.reference.generic__basic_endpoint.data_type [*data_type]]]
  33003. [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
  33004. ]
  33005. [
  33006. [[link boost_asio.reference.generic__basic_endpoint.protocol_type [*protocol_type]]]
  33007. [The protocol type associated with the endpoint. ]
  33008. ]
  33009. ]
  33010. [heading Member Functions]
  33011. [table
  33012. [[Name][Description]]
  33013. [
  33014. [[link boost_asio.reference.generic__basic_endpoint.basic_endpoint [*basic_endpoint]]]
  33015. [Default constructor.
  33016. [hr]
  33017. Construct an endpoint from the specified socket address.
  33018. [hr]
  33019. Construct an endpoint from the specific endpoint type.
  33020. [hr]
  33021. Copy constructor. ]
  33022. ]
  33023. [
  33024. [[link boost_asio.reference.generic__basic_endpoint.capacity [*capacity]]]
  33025. [Get the capacity of the endpoint in the native type. ]
  33026. ]
  33027. [
  33028. [[link boost_asio.reference.generic__basic_endpoint.data [*data]]]
  33029. [Get the underlying endpoint in the native type. ]
  33030. ]
  33031. [
  33032. [[link boost_asio.reference.generic__basic_endpoint.operator_eq_ [*operator=]]]
  33033. [Assign from another endpoint. ]
  33034. ]
  33035. [
  33036. [[link boost_asio.reference.generic__basic_endpoint.protocol [*protocol]]]
  33037. [The protocol associated with the endpoint. ]
  33038. ]
  33039. [
  33040. [[link boost_asio.reference.generic__basic_endpoint.resize [*resize]]]
  33041. [Set the underlying size of the endpoint in the native type. ]
  33042. ]
  33043. [
  33044. [[link boost_asio.reference.generic__basic_endpoint.size [*size]]]
  33045. [Get the underlying size of the endpoint in the native type. ]
  33046. ]
  33047. ]
  33048. [heading Friends]
  33049. [table
  33050. [[Name][Description]]
  33051. [
  33052. [[link boost_asio.reference.generic__basic_endpoint.operator_not__eq_ [*operator!=]]]
  33053. [Compare two endpoints for inequality. ]
  33054. ]
  33055. [
  33056. [[link boost_asio.reference.generic__basic_endpoint.operator_lt_ [*operator<]]]
  33057. [Compare endpoints for ordering. ]
  33058. ]
  33059. [
  33060. [[link boost_asio.reference.generic__basic_endpoint.operator_lt__eq_ [*operator<=]]]
  33061. [Compare endpoints for ordering. ]
  33062. ]
  33063. [
  33064. [[link boost_asio.reference.generic__basic_endpoint.operator_eq__eq_ [*operator==]]]
  33065. [Compare two endpoints for equality. ]
  33066. ]
  33067. [
  33068. [[link boost_asio.reference.generic__basic_endpoint.operator_gt_ [*operator>]]]
  33069. [Compare endpoints for ordering. ]
  33070. ]
  33071. [
  33072. [[link boost_asio.reference.generic__basic_endpoint.operator_gt__eq_ [*operator>=]]]
  33073. [Compare endpoints for ordering. ]
  33074. ]
  33075. ]
  33076. The [link boost_asio.reference.generic__basic_endpoint `generic::basic_endpoint`] class template describes an endpoint that may be associated with any socket type.
  33077. [heading Remarks]
  33078. The socket types sockaddr type must be able to fit into a `sockaddr_storage` structure.
  33079. [heading Thread Safety]
  33080. ['Distinct] ['objects:] Safe.
  33081. ['Shared] ['objects:] Unsafe.
  33082. [heading Requirements]
  33083. ['Header: ][^boost/asio/generic/basic_endpoint.hpp]
  33084. ['Convenience header: ][^boost/asio.hpp]
  33085. [section:basic_endpoint generic::basic_endpoint::basic_endpoint]
  33086. [indexterm2 boost_asio.indexterm.generic__basic_endpoint.basic_endpoint..basic_endpoint..generic::basic_endpoint]
  33087. Default constructor.
  33088. ``[link boost_asio.reference.generic__basic_endpoint.basic_endpoint.overload1 basic_endpoint]``();
  33089. `` [''''&raquo;''' [link boost_asio.reference.generic__basic_endpoint.basic_endpoint.overload1 more...]]``
  33090. Construct an endpoint from the specified socket address.
  33091. ``[link boost_asio.reference.generic__basic_endpoint.basic_endpoint.overload2 basic_endpoint]``(
  33092. const void * socket_address,
  33093. std::size_t socket_address_size,
  33094. int socket_protocol = 0);
  33095. `` [''''&raquo;''' [link boost_asio.reference.generic__basic_endpoint.basic_endpoint.overload2 more...]]``
  33096. Construct an endpoint from the specific endpoint type.
  33097. template<
  33098. typename ``[link boost_asio.reference.Endpoint Endpoint]``>
  33099. ``[link boost_asio.reference.generic__basic_endpoint.basic_endpoint.overload3 basic_endpoint]``(
  33100. const Endpoint & endpoint);
  33101. `` [''''&raquo;''' [link boost_asio.reference.generic__basic_endpoint.basic_endpoint.overload3 more...]]``
  33102. Copy constructor.
  33103. ``[link boost_asio.reference.generic__basic_endpoint.basic_endpoint.overload4 basic_endpoint]``(
  33104. const basic_endpoint & other);
  33105. `` [''''&raquo;''' [link boost_asio.reference.generic__basic_endpoint.basic_endpoint.overload4 more...]]``
  33106. [section:overload1 generic::basic_endpoint::basic_endpoint (1 of 4 overloads)]
  33107. Default constructor.
  33108. basic_endpoint();
  33109. [endsect]
  33110. [section:overload2 generic::basic_endpoint::basic_endpoint (2 of 4 overloads)]
  33111. Construct an endpoint from the specified socket address.
  33112. basic_endpoint(
  33113. const void * socket_address,
  33114. std::size_t socket_address_size,
  33115. int socket_protocol = 0);
  33116. [endsect]
  33117. [section:overload3 generic::basic_endpoint::basic_endpoint (3 of 4 overloads)]
  33118. Construct an endpoint from the specific endpoint type.
  33119. template<
  33120. typename ``[link boost_asio.reference.Endpoint Endpoint]``>
  33121. basic_endpoint(
  33122. const Endpoint & endpoint);
  33123. [endsect]
  33124. [section:overload4 generic::basic_endpoint::basic_endpoint (4 of 4 overloads)]
  33125. Copy constructor.
  33126. basic_endpoint(
  33127. const basic_endpoint & other);
  33128. [endsect]
  33129. [endsect]
  33130. [section:capacity generic::basic_endpoint::capacity]
  33131. [indexterm2 boost_asio.indexterm.generic__basic_endpoint.capacity..capacity..generic::basic_endpoint]
  33132. Get the capacity of the endpoint in the native type.
  33133. std::size_t capacity() const;
  33134. [endsect]
  33135. [section:data generic::basic_endpoint::data]
  33136. [indexterm2 boost_asio.indexterm.generic__basic_endpoint.data..data..generic::basic_endpoint]
  33137. Get the underlying endpoint in the native type.
  33138. data_type * ``[link boost_asio.reference.generic__basic_endpoint.data.overload1 data]``();
  33139. `` [''''&raquo;''' [link boost_asio.reference.generic__basic_endpoint.data.overload1 more...]]``
  33140. const data_type * ``[link boost_asio.reference.generic__basic_endpoint.data.overload2 data]``() const;
  33141. `` [''''&raquo;''' [link boost_asio.reference.generic__basic_endpoint.data.overload2 more...]]``
  33142. [section:overload1 generic::basic_endpoint::data (1 of 2 overloads)]
  33143. Get the underlying endpoint in the native type.
  33144. data_type * data();
  33145. [endsect]
  33146. [section:overload2 generic::basic_endpoint::data (2 of 2 overloads)]
  33147. Get the underlying endpoint in the native type.
  33148. const data_type * data() const;
  33149. [endsect]
  33150. [endsect]
  33151. [section:data_type generic::basic_endpoint::data_type]
  33152. [indexterm2 boost_asio.indexterm.generic__basic_endpoint.data_type..data_type..generic::basic_endpoint]
  33153. The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer.
  33154. typedef implementation_defined data_type;
  33155. [heading Requirements]
  33156. ['Header: ][^boost/asio/generic/basic_endpoint.hpp]
  33157. ['Convenience header: ][^boost/asio.hpp]
  33158. [endsect]
  33159. [section:operator_not__eq_ generic::basic_endpoint::operator!=]
  33160. [indexterm2 boost_asio.indexterm.generic__basic_endpoint.operator_not__eq_..operator!=..generic::basic_endpoint]
  33161. Compare two endpoints for inequality.
  33162. friend bool operator!=(
  33163. const basic_endpoint< Protocol > & e1,
  33164. const basic_endpoint< Protocol > & e2);
  33165. [heading Requirements]
  33166. ['Header: ][^boost/asio/generic/basic_endpoint.hpp]
  33167. ['Convenience header: ][^boost/asio.hpp]
  33168. [endsect]
  33169. [section:operator_lt_ generic::basic_endpoint::operator<]
  33170. [indexterm2 boost_asio.indexterm.generic__basic_endpoint.operator_lt_..operator<..generic::basic_endpoint]
  33171. Compare endpoints for ordering.
  33172. friend bool operator<(
  33173. const basic_endpoint< Protocol > & e1,
  33174. const basic_endpoint< Protocol > & e2);
  33175. [heading Requirements]
  33176. ['Header: ][^boost/asio/generic/basic_endpoint.hpp]
  33177. ['Convenience header: ][^boost/asio.hpp]
  33178. [endsect]
  33179. [section:operator_lt__eq_ generic::basic_endpoint::operator<=]
  33180. [indexterm2 boost_asio.indexterm.generic__basic_endpoint.operator_lt__eq_..operator<=..generic::basic_endpoint]
  33181. Compare endpoints for ordering.
  33182. friend bool operator<=(
  33183. const basic_endpoint< Protocol > & e1,
  33184. const basic_endpoint< Protocol > & e2);
  33185. [heading Requirements]
  33186. ['Header: ][^boost/asio/generic/basic_endpoint.hpp]
  33187. ['Convenience header: ][^boost/asio.hpp]
  33188. [endsect]
  33189. [section:operator_eq_ generic::basic_endpoint::operator=]
  33190. [indexterm2 boost_asio.indexterm.generic__basic_endpoint.operator_eq_..operator=..generic::basic_endpoint]
  33191. Assign from another endpoint.
  33192. basic_endpoint & operator=(
  33193. const basic_endpoint & other);
  33194. [endsect]
  33195. [section:operator_eq__eq_ generic::basic_endpoint::operator==]
  33196. [indexterm2 boost_asio.indexterm.generic__basic_endpoint.operator_eq__eq_..operator==..generic::basic_endpoint]
  33197. Compare two endpoints for equality.
  33198. friend bool operator==(
  33199. const basic_endpoint< Protocol > & e1,
  33200. const basic_endpoint< Protocol > & e2);
  33201. [heading Requirements]
  33202. ['Header: ][^boost/asio/generic/basic_endpoint.hpp]
  33203. ['Convenience header: ][^boost/asio.hpp]
  33204. [endsect]
  33205. [section:operator_gt_ generic::basic_endpoint::operator>]
  33206. [indexterm2 boost_asio.indexterm.generic__basic_endpoint.operator_gt_..operator>..generic::basic_endpoint]
  33207. Compare endpoints for ordering.
  33208. friend bool operator>(
  33209. const basic_endpoint< Protocol > & e1,
  33210. const basic_endpoint< Protocol > & e2);
  33211. [heading Requirements]
  33212. ['Header: ][^boost/asio/generic/basic_endpoint.hpp]
  33213. ['Convenience header: ][^boost/asio.hpp]
  33214. [endsect]
  33215. [section:operator_gt__eq_ generic::basic_endpoint::operator>=]
  33216. [indexterm2 boost_asio.indexterm.generic__basic_endpoint.operator_gt__eq_..operator>=..generic::basic_endpoint]
  33217. Compare endpoints for ordering.
  33218. friend bool operator>=(
  33219. const basic_endpoint< Protocol > & e1,
  33220. const basic_endpoint< Protocol > & e2);
  33221. [heading Requirements]
  33222. ['Header: ][^boost/asio/generic/basic_endpoint.hpp]
  33223. ['Convenience header: ][^boost/asio.hpp]
  33224. [endsect]
  33225. [section:protocol generic::basic_endpoint::protocol]
  33226. [indexterm2 boost_asio.indexterm.generic__basic_endpoint.protocol..protocol..generic::basic_endpoint]
  33227. The protocol associated with the endpoint.
  33228. protocol_type protocol() const;
  33229. [endsect]
  33230. [section:protocol_type generic::basic_endpoint::protocol_type]
  33231. [indexterm2 boost_asio.indexterm.generic__basic_endpoint.protocol_type..protocol_type..generic::basic_endpoint]
  33232. The protocol type associated with the endpoint.
  33233. typedef Protocol protocol_type;
  33234. [heading Requirements]
  33235. ['Header: ][^boost/asio/generic/basic_endpoint.hpp]
  33236. ['Convenience header: ][^boost/asio.hpp]
  33237. [endsect]
  33238. [section:resize generic::basic_endpoint::resize]
  33239. [indexterm2 boost_asio.indexterm.generic__basic_endpoint.resize..resize..generic::basic_endpoint]
  33240. Set the underlying size of the endpoint in the native type.
  33241. void resize(
  33242. std::size_t new_size);
  33243. [endsect]
  33244. [section:size generic::basic_endpoint::size]
  33245. [indexterm2 boost_asio.indexterm.generic__basic_endpoint.size..size..generic::basic_endpoint]
  33246. Get the underlying size of the endpoint in the native type.
  33247. std::size_t size() const;
  33248. [endsect]
  33249. [endsect]
  33250. [section:generic__datagram_protocol generic::datagram_protocol]
  33251. Encapsulates the flags needed for a generic datagram-oriented socket.
  33252. class datagram_protocol
  33253. [heading Types]
  33254. [table
  33255. [[Name][Description]]
  33256. [
  33257. [[link boost_asio.reference.generic__datagram_protocol.endpoint [*endpoint]]]
  33258. [The type of an endpoint. ]
  33259. ]
  33260. [
  33261. [[link boost_asio.reference.generic__datagram_protocol.socket [*socket]]]
  33262. [The generic socket type. ]
  33263. ]
  33264. ]
  33265. [heading Member Functions]
  33266. [table
  33267. [[Name][Description]]
  33268. [
  33269. [[link boost_asio.reference.generic__datagram_protocol.datagram_protocol [*datagram_protocol]]]
  33270. [Construct a protocol object for a specific address family and protocol.
  33271. [hr]
  33272. Construct a generic protocol object from a specific protocol. ]
  33273. ]
  33274. [
  33275. [[link boost_asio.reference.generic__datagram_protocol.family [*family]]]
  33276. [Obtain an identifier for the protocol family. ]
  33277. ]
  33278. [
  33279. [[link boost_asio.reference.generic__datagram_protocol.protocol [*protocol]]]
  33280. [Obtain an identifier for the protocol. ]
  33281. ]
  33282. [
  33283. [[link boost_asio.reference.generic__datagram_protocol.type [*type]]]
  33284. [Obtain an identifier for the type of the protocol. ]
  33285. ]
  33286. ]
  33287. [heading Friends]
  33288. [table
  33289. [[Name][Description]]
  33290. [
  33291. [[link boost_asio.reference.generic__datagram_protocol.operator_not__eq_ [*operator!=]]]
  33292. [Compare two protocols for inequality. ]
  33293. ]
  33294. [
  33295. [[link boost_asio.reference.generic__datagram_protocol.operator_eq__eq_ [*operator==]]]
  33296. [Compare two protocols for equality. ]
  33297. ]
  33298. ]
  33299. The [link boost_asio.reference.generic__datagram_protocol `generic::datagram_protocol`] class contains flags necessary for datagram-oriented sockets of any address family and protocol.
  33300. [heading Examples]
  33301. Constructing using a native address family and socket protocol:
  33302. datagram_protocol p(AF_INET, IPPROTO_UDP);
  33303. Constructing from a specific protocol type:
  33304. datagram_protocol p(boost::asio::ip::udp::v4());
  33305. [heading Thread Safety]
  33306. ['Distinct] ['objects:] Safe.
  33307. ['Shared] ['objects:] Safe.
  33308. [heading Requirements]
  33309. ['Header: ][^boost/asio/generic/datagram_protocol.hpp]
  33310. ['Convenience header: ][^boost/asio.hpp]
  33311. [section:datagram_protocol generic::datagram_protocol::datagram_protocol]
  33312. [indexterm2 boost_asio.indexterm.generic__datagram_protocol.datagram_protocol..datagram_protocol..generic::datagram_protocol]
  33313. Construct a protocol object for a specific address family and protocol.
  33314. ``[link boost_asio.reference.generic__datagram_protocol.datagram_protocol.overload1 datagram_protocol]``(
  33315. int address_family,
  33316. int socket_protocol);
  33317. `` [''''&raquo;''' [link boost_asio.reference.generic__datagram_protocol.datagram_protocol.overload1 more...]]``
  33318. Construct a generic protocol object from a specific protocol.
  33319. template<
  33320. typename ``[link boost_asio.reference.Protocol Protocol]``>
  33321. ``[link boost_asio.reference.generic__datagram_protocol.datagram_protocol.overload2 datagram_protocol]``(
  33322. const Protocol & source_protocol);
  33323. `` [''''&raquo;''' [link boost_asio.reference.generic__datagram_protocol.datagram_protocol.overload2 more...]]``
  33324. [section:overload1 generic::datagram_protocol::datagram_protocol (1 of 2 overloads)]
  33325. Construct a protocol object for a specific address family and protocol.
  33326. datagram_protocol(
  33327. int address_family,
  33328. int socket_protocol);
  33329. [endsect]
  33330. [section:overload2 generic::datagram_protocol::datagram_protocol (2 of 2 overloads)]
  33331. Construct a generic protocol object from a specific protocol.
  33332. template<
  33333. typename ``[link boost_asio.reference.Protocol Protocol]``>
  33334. datagram_protocol(
  33335. const Protocol & source_protocol);
  33336. [heading Exceptions]
  33337. [variablelist
  33338. [[@c][bad\_cast Thrown if the source protocol is not datagram-oriented. ]]
  33339. ]
  33340. [endsect]
  33341. [endsect]
  33342. [section:endpoint generic::datagram_protocol::endpoint]
  33343. [indexterm2 boost_asio.indexterm.generic__datagram_protocol.endpoint..endpoint..generic::datagram_protocol]
  33344. The type of an endpoint.
  33345. typedef basic_endpoint< datagram_protocol > endpoint;
  33346. [heading Types]
  33347. [table
  33348. [[Name][Description]]
  33349. [
  33350. [[link boost_asio.reference.generic__basic_endpoint.data_type [*data_type]]]
  33351. [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
  33352. ]
  33353. [
  33354. [[link boost_asio.reference.generic__basic_endpoint.protocol_type [*protocol_type]]]
  33355. [The protocol type associated with the endpoint. ]
  33356. ]
  33357. ]
  33358. [heading Member Functions]
  33359. [table
  33360. [[Name][Description]]
  33361. [
  33362. [[link boost_asio.reference.generic__basic_endpoint.basic_endpoint [*basic_endpoint]]]
  33363. [Default constructor.
  33364. [hr]
  33365. Construct an endpoint from the specified socket address.
  33366. [hr]
  33367. Construct an endpoint from the specific endpoint type.
  33368. [hr]
  33369. Copy constructor. ]
  33370. ]
  33371. [
  33372. [[link boost_asio.reference.generic__basic_endpoint.capacity [*capacity]]]
  33373. [Get the capacity of the endpoint in the native type. ]
  33374. ]
  33375. [
  33376. [[link boost_asio.reference.generic__basic_endpoint.data [*data]]]
  33377. [Get the underlying endpoint in the native type. ]
  33378. ]
  33379. [
  33380. [[link boost_asio.reference.generic__basic_endpoint.operator_eq_ [*operator=]]]
  33381. [Assign from another endpoint. ]
  33382. ]
  33383. [
  33384. [[link boost_asio.reference.generic__basic_endpoint.protocol [*protocol]]]
  33385. [The protocol associated with the endpoint. ]
  33386. ]
  33387. [
  33388. [[link boost_asio.reference.generic__basic_endpoint.resize [*resize]]]
  33389. [Set the underlying size of the endpoint in the native type. ]
  33390. ]
  33391. [
  33392. [[link boost_asio.reference.generic__basic_endpoint.size [*size]]]
  33393. [Get the underlying size of the endpoint in the native type. ]
  33394. ]
  33395. ]
  33396. [heading Friends]
  33397. [table
  33398. [[Name][Description]]
  33399. [
  33400. [[link boost_asio.reference.generic__basic_endpoint.operator_not__eq_ [*operator!=]]]
  33401. [Compare two endpoints for inequality. ]
  33402. ]
  33403. [
  33404. [[link boost_asio.reference.generic__basic_endpoint.operator_lt_ [*operator<]]]
  33405. [Compare endpoints for ordering. ]
  33406. ]
  33407. [
  33408. [[link boost_asio.reference.generic__basic_endpoint.operator_lt__eq_ [*operator<=]]]
  33409. [Compare endpoints for ordering. ]
  33410. ]
  33411. [
  33412. [[link boost_asio.reference.generic__basic_endpoint.operator_eq__eq_ [*operator==]]]
  33413. [Compare two endpoints for equality. ]
  33414. ]
  33415. [
  33416. [[link boost_asio.reference.generic__basic_endpoint.operator_gt_ [*operator>]]]
  33417. [Compare endpoints for ordering. ]
  33418. ]
  33419. [
  33420. [[link boost_asio.reference.generic__basic_endpoint.operator_gt__eq_ [*operator>=]]]
  33421. [Compare endpoints for ordering. ]
  33422. ]
  33423. ]
  33424. The [link boost_asio.reference.generic__basic_endpoint `generic::basic_endpoint`] class template describes an endpoint that may be associated with any socket type.
  33425. [heading Remarks]
  33426. The socket types sockaddr type must be able to fit into a `sockaddr_storage` structure.
  33427. [heading Thread Safety]
  33428. ['Distinct] ['objects:] Safe.
  33429. ['Shared] ['objects:] Unsafe.
  33430. [heading Requirements]
  33431. ['Header: ][^boost/asio/generic/datagram_protocol.hpp]
  33432. ['Convenience header: ][^boost/asio.hpp]
  33433. [endsect]
  33434. [section:family generic::datagram_protocol::family]
  33435. [indexterm2 boost_asio.indexterm.generic__datagram_protocol.family..family..generic::datagram_protocol]
  33436. Obtain an identifier for the protocol family.
  33437. int family() const;
  33438. [endsect]
  33439. [section:operator_not__eq_ generic::datagram_protocol::operator!=]
  33440. [indexterm2 boost_asio.indexterm.generic__datagram_protocol.operator_not__eq_..operator!=..generic::datagram_protocol]
  33441. Compare two protocols for inequality.
  33442. friend bool operator!=(
  33443. const datagram_protocol & p1,
  33444. const datagram_protocol & p2);
  33445. [heading Requirements]
  33446. ['Header: ][^boost/asio/generic/datagram_protocol.hpp]
  33447. ['Convenience header: ][^boost/asio.hpp]
  33448. [endsect]
  33449. [section:operator_eq__eq_ generic::datagram_protocol::operator==]
  33450. [indexterm2 boost_asio.indexterm.generic__datagram_protocol.operator_eq__eq_..operator==..generic::datagram_protocol]
  33451. Compare two protocols for equality.
  33452. friend bool operator==(
  33453. const datagram_protocol & p1,
  33454. const datagram_protocol & p2);
  33455. [heading Requirements]
  33456. ['Header: ][^boost/asio/generic/datagram_protocol.hpp]
  33457. ['Convenience header: ][^boost/asio.hpp]
  33458. [endsect]
  33459. [section:protocol generic::datagram_protocol::protocol]
  33460. [indexterm2 boost_asio.indexterm.generic__datagram_protocol.protocol..protocol..generic::datagram_protocol]
  33461. Obtain an identifier for the protocol.
  33462. int protocol() const;
  33463. [endsect]
  33464. [section:socket generic::datagram_protocol::socket]
  33465. [indexterm2 boost_asio.indexterm.generic__datagram_protocol.socket..socket..generic::datagram_protocol]
  33466. The generic socket type.
  33467. typedef basic_datagram_socket< datagram_protocol > socket;
  33468. [heading Types]
  33469. [table
  33470. [[Name][Description]]
  33471. [
  33472. [[link boost_asio.reference.basic_datagram_socket__rebind_executor [*rebind_executor]]]
  33473. [Rebinds the socket type to another executor. ]
  33474. ]
  33475. [
  33476. [[link boost_asio.reference.basic_datagram_socket.broadcast [*broadcast]]]
  33477. [Socket option to permit sending of broadcast messages. ]
  33478. ]
  33479. [
  33480. [[link boost_asio.reference.basic_datagram_socket.bytes_readable [*bytes_readable]]]
  33481. [IO control command to get the amount of data that can be read without blocking. ]
  33482. ]
  33483. [
  33484. [[link boost_asio.reference.basic_datagram_socket.debug [*debug]]]
  33485. [Socket option to enable socket-level debugging. ]
  33486. ]
  33487. [
  33488. [[link boost_asio.reference.basic_datagram_socket.do_not_route [*do_not_route]]]
  33489. [Socket option to prevent routing, use local interfaces only. ]
  33490. ]
  33491. [
  33492. [[link boost_asio.reference.basic_datagram_socket.enable_connection_aborted [*enable_connection_aborted]]]
  33493. [Socket option to report aborted connections on accept. ]
  33494. ]
  33495. [
  33496. [[link boost_asio.reference.basic_datagram_socket.endpoint_type [*endpoint_type]]]
  33497. [The endpoint type. ]
  33498. ]
  33499. [
  33500. [[link boost_asio.reference.basic_datagram_socket.executor_type [*executor_type]]]
  33501. [The type of the executor associated with the object. ]
  33502. ]
  33503. [
  33504. [[link boost_asio.reference.basic_datagram_socket.keep_alive [*keep_alive]]]
  33505. [Socket option to send keep-alives. ]
  33506. ]
  33507. [
  33508. [[link boost_asio.reference.basic_datagram_socket.linger [*linger]]]
  33509. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  33510. ]
  33511. [
  33512. [[link boost_asio.reference.basic_datagram_socket.lowest_layer_type [*lowest_layer_type]]]
  33513. [A basic_socket is always the lowest layer. ]
  33514. ]
  33515. [
  33516. [[link boost_asio.reference.basic_datagram_socket.message_flags [*message_flags]]]
  33517. [Bitmask type for flags that can be passed to send and receive operations. ]
  33518. ]
  33519. [
  33520. [[link boost_asio.reference.basic_datagram_socket.native_handle_type [*native_handle_type]]]
  33521. [The native representation of a socket. ]
  33522. ]
  33523. [
  33524. [[link boost_asio.reference.basic_datagram_socket.out_of_band_inline [*out_of_band_inline]]]
  33525. [Socket option for putting received out-of-band data inline. ]
  33526. ]
  33527. [
  33528. [[link boost_asio.reference.basic_datagram_socket.protocol_type [*protocol_type]]]
  33529. [The protocol type. ]
  33530. ]
  33531. [
  33532. [[link boost_asio.reference.basic_datagram_socket.receive_buffer_size [*receive_buffer_size]]]
  33533. [Socket option for the receive buffer size of a socket. ]
  33534. ]
  33535. [
  33536. [[link boost_asio.reference.basic_datagram_socket.receive_low_watermark [*receive_low_watermark]]]
  33537. [Socket option for the receive low watermark. ]
  33538. ]
  33539. [
  33540. [[link boost_asio.reference.basic_datagram_socket.reuse_address [*reuse_address]]]
  33541. [Socket option to allow the socket to be bound to an address that is already in use. ]
  33542. ]
  33543. [
  33544. [[link boost_asio.reference.basic_datagram_socket.send_buffer_size [*send_buffer_size]]]
  33545. [Socket option for the send buffer size of a socket. ]
  33546. ]
  33547. [
  33548. [[link boost_asio.reference.basic_datagram_socket.send_low_watermark [*send_low_watermark]]]
  33549. [Socket option for the send low watermark. ]
  33550. ]
  33551. [
  33552. [[link boost_asio.reference.basic_datagram_socket.shutdown_type [*shutdown_type]]]
  33553. [Different ways a socket may be shutdown. ]
  33554. ]
  33555. [
  33556. [[link boost_asio.reference.basic_datagram_socket.wait_type [*wait_type]]]
  33557. [Wait types. ]
  33558. ]
  33559. ]
  33560. [heading Member Functions]
  33561. [table
  33562. [[Name][Description]]
  33563. [
  33564. [[link boost_asio.reference.basic_datagram_socket.assign [*assign]]]
  33565. [Assign an existing native socket to the socket. ]
  33566. ]
  33567. [
  33568. [[link boost_asio.reference.basic_datagram_socket.async_connect [*async_connect]]]
  33569. [Start an asynchronous connect. ]
  33570. ]
  33571. [
  33572. [[link boost_asio.reference.basic_datagram_socket.async_receive [*async_receive]]]
  33573. [Start an asynchronous receive on a connected socket. ]
  33574. ]
  33575. [
  33576. [[link boost_asio.reference.basic_datagram_socket.async_receive_from [*async_receive_from]]]
  33577. [Start an asynchronous receive. ]
  33578. ]
  33579. [
  33580. [[link boost_asio.reference.basic_datagram_socket.async_send [*async_send]]]
  33581. [Start an asynchronous send on a connected socket. ]
  33582. ]
  33583. [
  33584. [[link boost_asio.reference.basic_datagram_socket.async_send_to [*async_send_to]]]
  33585. [Start an asynchronous send. ]
  33586. ]
  33587. [
  33588. [[link boost_asio.reference.basic_datagram_socket.async_wait [*async_wait]]]
  33589. [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  33590. ]
  33591. [
  33592. [[link boost_asio.reference.basic_datagram_socket.at_mark [*at_mark]]]
  33593. [Determine whether the socket is at the out-of-band data mark. ]
  33594. ]
  33595. [
  33596. [[link boost_asio.reference.basic_datagram_socket.available [*available]]]
  33597. [Determine the number of bytes available for reading. ]
  33598. ]
  33599. [
  33600. [[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket [*basic_datagram_socket]]]
  33601. [Construct a basic_datagram_socket without opening it.
  33602. [hr]
  33603. Construct and open a basic_datagram_socket.
  33604. [hr]
  33605. Construct a basic_datagram_socket, opening it and binding it to the given local endpoint.
  33606. [hr]
  33607. Construct a basic_datagram_socket on an existing native socket.
  33608. [hr]
  33609. Move-construct a basic_datagram_socket from another.
  33610. [hr]
  33611. Move-construct a basic_datagram_socket from a socket of another protocol type. ]
  33612. ]
  33613. [
  33614. [[link boost_asio.reference.basic_datagram_socket.bind [*bind]]]
  33615. [Bind the socket to the given local endpoint. ]
  33616. ]
  33617. [
  33618. [[link boost_asio.reference.basic_datagram_socket.cancel [*cancel]]]
  33619. [Cancel all asynchronous operations associated with the socket. ]
  33620. ]
  33621. [
  33622. [[link boost_asio.reference.basic_datagram_socket.close [*close]]]
  33623. [Close the socket. ]
  33624. ]
  33625. [
  33626. [[link boost_asio.reference.basic_datagram_socket.connect [*connect]]]
  33627. [Connect the socket to the specified endpoint. ]
  33628. ]
  33629. [
  33630. [[link boost_asio.reference.basic_datagram_socket.get_executor [*get_executor]]]
  33631. [Get the executor associated with the object. ]
  33632. ]
  33633. [
  33634. [[link boost_asio.reference.basic_datagram_socket.get_option [*get_option]]]
  33635. [Get an option from the socket. ]
  33636. ]
  33637. [
  33638. [[link boost_asio.reference.basic_datagram_socket.io_control [*io_control]]]
  33639. [Perform an IO control command on the socket. ]
  33640. ]
  33641. [
  33642. [[link boost_asio.reference.basic_datagram_socket.is_open [*is_open]]]
  33643. [Determine whether the socket is open. ]
  33644. ]
  33645. [
  33646. [[link boost_asio.reference.basic_datagram_socket.local_endpoint [*local_endpoint]]]
  33647. [Get the local endpoint of the socket. ]
  33648. ]
  33649. [
  33650. [[link boost_asio.reference.basic_datagram_socket.lowest_layer [*lowest_layer]]]
  33651. [Get a reference to the lowest layer.
  33652. [hr]
  33653. Get a const reference to the lowest layer. ]
  33654. ]
  33655. [
  33656. [[link boost_asio.reference.basic_datagram_socket.native_handle [*native_handle]]]
  33657. [Get the native socket representation. ]
  33658. ]
  33659. [
  33660. [[link boost_asio.reference.basic_datagram_socket.native_non_blocking [*native_non_blocking]]]
  33661. [Gets the non-blocking mode of the native socket implementation.
  33662. [hr]
  33663. Sets the non-blocking mode of the native socket implementation. ]
  33664. ]
  33665. [
  33666. [[link boost_asio.reference.basic_datagram_socket.non_blocking [*non_blocking]]]
  33667. [Gets the non-blocking mode of the socket.
  33668. [hr]
  33669. Sets the non-blocking mode of the socket. ]
  33670. ]
  33671. [
  33672. [[link boost_asio.reference.basic_datagram_socket.open [*open]]]
  33673. [Open the socket using the specified protocol. ]
  33674. ]
  33675. [
  33676. [[link boost_asio.reference.basic_datagram_socket.operator_eq_ [*operator=]]]
  33677. [Move-assign a basic_datagram_socket from another.
  33678. [hr]
  33679. Move-assign a basic_datagram_socket from a socket of another protocol type. ]
  33680. ]
  33681. [
  33682. [[link boost_asio.reference.basic_datagram_socket.receive [*receive]]]
  33683. [Receive some data on a connected socket. ]
  33684. ]
  33685. [
  33686. [[link boost_asio.reference.basic_datagram_socket.receive_from [*receive_from]]]
  33687. [Receive a datagram with the endpoint of the sender. ]
  33688. ]
  33689. [
  33690. [[link boost_asio.reference.basic_datagram_socket.release [*release]]]
  33691. [Release ownership of the underlying native socket. ]
  33692. ]
  33693. [
  33694. [[link boost_asio.reference.basic_datagram_socket.remote_endpoint [*remote_endpoint]]]
  33695. [Get the remote endpoint of the socket. ]
  33696. ]
  33697. [
  33698. [[link boost_asio.reference.basic_datagram_socket.send [*send]]]
  33699. [Send some data on a connected socket. ]
  33700. ]
  33701. [
  33702. [[link boost_asio.reference.basic_datagram_socket.send_to [*send_to]]]
  33703. [Send a datagram to the specified endpoint. ]
  33704. ]
  33705. [
  33706. [[link boost_asio.reference.basic_datagram_socket.set_option [*set_option]]]
  33707. [Set an option on the socket. ]
  33708. ]
  33709. [
  33710. [[link boost_asio.reference.basic_datagram_socket.shutdown [*shutdown]]]
  33711. [Disable sends or receives on the socket. ]
  33712. ]
  33713. [
  33714. [[link boost_asio.reference.basic_datagram_socket.wait [*wait]]]
  33715. [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  33716. ]
  33717. [
  33718. [[link boost_asio.reference.basic_datagram_socket._basic_datagram_socket [*~basic_datagram_socket]]]
  33719. [Destroys the socket. ]
  33720. ]
  33721. ]
  33722. [heading Data Members]
  33723. [table
  33724. [[Name][Description]]
  33725. [
  33726. [[link boost_asio.reference.basic_datagram_socket.max_connections [*max_connections]]]
  33727. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  33728. ]
  33729. [
  33730. [[link boost_asio.reference.basic_datagram_socket.max_listen_connections [*max_listen_connections]]]
  33731. [The maximum length of the queue of pending incoming connections. ]
  33732. ]
  33733. [
  33734. [[link boost_asio.reference.basic_datagram_socket.message_do_not_route [*message_do_not_route]]]
  33735. [Specify that the data should not be subject to routing. ]
  33736. ]
  33737. [
  33738. [[link boost_asio.reference.basic_datagram_socket.message_end_of_record [*message_end_of_record]]]
  33739. [Specifies that the data marks the end of a record. ]
  33740. ]
  33741. [
  33742. [[link boost_asio.reference.basic_datagram_socket.message_out_of_band [*message_out_of_band]]]
  33743. [Process out-of-band data. ]
  33744. ]
  33745. [
  33746. [[link boost_asio.reference.basic_datagram_socket.message_peek [*message_peek]]]
  33747. [Peek at incoming data without removing it from the input queue. ]
  33748. ]
  33749. ]
  33750. [heading Protected Data Members]
  33751. [table
  33752. [[Name][Description]]
  33753. [
  33754. [[link boost_asio.reference.basic_datagram_socket.impl_ [*impl_]]]
  33755. []
  33756. ]
  33757. ]
  33758. The [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] class template provides asynchronous and blocking datagram-oriented socket functionality.
  33759. [heading Thread Safety]
  33760. ['Distinct] ['objects:] Safe.
  33761. ['Shared] ['objects:] Unsafe.
  33762. [heading Requirements]
  33763. ['Header: ][^boost/asio/generic/datagram_protocol.hpp]
  33764. ['Convenience header: ][^boost/asio.hpp]
  33765. [endsect]
  33766. [section:type generic::datagram_protocol::type]
  33767. [indexterm2 boost_asio.indexterm.generic__datagram_protocol.type..type..generic::datagram_protocol]
  33768. Obtain an identifier for the type of the protocol.
  33769. int type() const;
  33770. [endsect]
  33771. [endsect]
  33772. [section:generic__raw_protocol generic::raw_protocol]
  33773. Encapsulates the flags needed for a generic raw socket.
  33774. class raw_protocol
  33775. [heading Types]
  33776. [table
  33777. [[Name][Description]]
  33778. [
  33779. [[link boost_asio.reference.generic__raw_protocol.endpoint [*endpoint]]]
  33780. [The type of an endpoint. ]
  33781. ]
  33782. [
  33783. [[link boost_asio.reference.generic__raw_protocol.socket [*socket]]]
  33784. [The generic socket type. ]
  33785. ]
  33786. ]
  33787. [heading Member Functions]
  33788. [table
  33789. [[Name][Description]]
  33790. [
  33791. [[link boost_asio.reference.generic__raw_protocol.family [*family]]]
  33792. [Obtain an identifier for the protocol family. ]
  33793. ]
  33794. [
  33795. [[link boost_asio.reference.generic__raw_protocol.protocol [*protocol]]]
  33796. [Obtain an identifier for the protocol. ]
  33797. ]
  33798. [
  33799. [[link boost_asio.reference.generic__raw_protocol.raw_protocol [*raw_protocol]]]
  33800. [Construct a protocol object for a specific address family and protocol.
  33801. [hr]
  33802. Construct a generic protocol object from a specific protocol. ]
  33803. ]
  33804. [
  33805. [[link boost_asio.reference.generic__raw_protocol.type [*type]]]
  33806. [Obtain an identifier for the type of the protocol. ]
  33807. ]
  33808. ]
  33809. [heading Friends]
  33810. [table
  33811. [[Name][Description]]
  33812. [
  33813. [[link boost_asio.reference.generic__raw_protocol.operator_not__eq_ [*operator!=]]]
  33814. [Compare two protocols for inequality. ]
  33815. ]
  33816. [
  33817. [[link boost_asio.reference.generic__raw_protocol.operator_eq__eq_ [*operator==]]]
  33818. [Compare two protocols for equality. ]
  33819. ]
  33820. ]
  33821. The [link boost_asio.reference.generic__raw_protocol `generic::raw_protocol`] class contains flags necessary for raw sockets of any address family and protocol.
  33822. [heading Examples]
  33823. Constructing using a native address family and socket protocol:
  33824. raw_protocol p(AF_INET, IPPROTO_ICMP);
  33825. Constructing from a specific protocol type:
  33826. raw_protocol p(boost::asio::ip::icmp::v4());
  33827. [heading Thread Safety]
  33828. ['Distinct] ['objects:] Safe.
  33829. ['Shared] ['objects:] Safe.
  33830. [heading Requirements]
  33831. ['Header: ][^boost/asio/generic/raw_protocol.hpp]
  33832. ['Convenience header: ][^boost/asio.hpp]
  33833. [section:endpoint generic::raw_protocol::endpoint]
  33834. [indexterm2 boost_asio.indexterm.generic__raw_protocol.endpoint..endpoint..generic::raw_protocol]
  33835. The type of an endpoint.
  33836. typedef basic_endpoint< raw_protocol > endpoint;
  33837. [heading Types]
  33838. [table
  33839. [[Name][Description]]
  33840. [
  33841. [[link boost_asio.reference.generic__basic_endpoint.data_type [*data_type]]]
  33842. [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
  33843. ]
  33844. [
  33845. [[link boost_asio.reference.generic__basic_endpoint.protocol_type [*protocol_type]]]
  33846. [The protocol type associated with the endpoint. ]
  33847. ]
  33848. ]
  33849. [heading Member Functions]
  33850. [table
  33851. [[Name][Description]]
  33852. [
  33853. [[link boost_asio.reference.generic__basic_endpoint.basic_endpoint [*basic_endpoint]]]
  33854. [Default constructor.
  33855. [hr]
  33856. Construct an endpoint from the specified socket address.
  33857. [hr]
  33858. Construct an endpoint from the specific endpoint type.
  33859. [hr]
  33860. Copy constructor. ]
  33861. ]
  33862. [
  33863. [[link boost_asio.reference.generic__basic_endpoint.capacity [*capacity]]]
  33864. [Get the capacity of the endpoint in the native type. ]
  33865. ]
  33866. [
  33867. [[link boost_asio.reference.generic__basic_endpoint.data [*data]]]
  33868. [Get the underlying endpoint in the native type. ]
  33869. ]
  33870. [
  33871. [[link boost_asio.reference.generic__basic_endpoint.operator_eq_ [*operator=]]]
  33872. [Assign from another endpoint. ]
  33873. ]
  33874. [
  33875. [[link boost_asio.reference.generic__basic_endpoint.protocol [*protocol]]]
  33876. [The protocol associated with the endpoint. ]
  33877. ]
  33878. [
  33879. [[link boost_asio.reference.generic__basic_endpoint.resize [*resize]]]
  33880. [Set the underlying size of the endpoint in the native type. ]
  33881. ]
  33882. [
  33883. [[link boost_asio.reference.generic__basic_endpoint.size [*size]]]
  33884. [Get the underlying size of the endpoint in the native type. ]
  33885. ]
  33886. ]
  33887. [heading Friends]
  33888. [table
  33889. [[Name][Description]]
  33890. [
  33891. [[link boost_asio.reference.generic__basic_endpoint.operator_not__eq_ [*operator!=]]]
  33892. [Compare two endpoints for inequality. ]
  33893. ]
  33894. [
  33895. [[link boost_asio.reference.generic__basic_endpoint.operator_lt_ [*operator<]]]
  33896. [Compare endpoints for ordering. ]
  33897. ]
  33898. [
  33899. [[link boost_asio.reference.generic__basic_endpoint.operator_lt__eq_ [*operator<=]]]
  33900. [Compare endpoints for ordering. ]
  33901. ]
  33902. [
  33903. [[link boost_asio.reference.generic__basic_endpoint.operator_eq__eq_ [*operator==]]]
  33904. [Compare two endpoints for equality. ]
  33905. ]
  33906. [
  33907. [[link boost_asio.reference.generic__basic_endpoint.operator_gt_ [*operator>]]]
  33908. [Compare endpoints for ordering. ]
  33909. ]
  33910. [
  33911. [[link boost_asio.reference.generic__basic_endpoint.operator_gt__eq_ [*operator>=]]]
  33912. [Compare endpoints for ordering. ]
  33913. ]
  33914. ]
  33915. The [link boost_asio.reference.generic__basic_endpoint `generic::basic_endpoint`] class template describes an endpoint that may be associated with any socket type.
  33916. [heading Remarks]
  33917. The socket types sockaddr type must be able to fit into a `sockaddr_storage` structure.
  33918. [heading Thread Safety]
  33919. ['Distinct] ['objects:] Safe.
  33920. ['Shared] ['objects:] Unsafe.
  33921. [heading Requirements]
  33922. ['Header: ][^boost/asio/generic/raw_protocol.hpp]
  33923. ['Convenience header: ][^boost/asio.hpp]
  33924. [endsect]
  33925. [section:family generic::raw_protocol::family]
  33926. [indexterm2 boost_asio.indexterm.generic__raw_protocol.family..family..generic::raw_protocol]
  33927. Obtain an identifier for the protocol family.
  33928. int family() const;
  33929. [endsect]
  33930. [section:operator_not__eq_ generic::raw_protocol::operator!=]
  33931. [indexterm2 boost_asio.indexterm.generic__raw_protocol.operator_not__eq_..operator!=..generic::raw_protocol]
  33932. Compare two protocols for inequality.
  33933. friend bool operator!=(
  33934. const raw_protocol & p1,
  33935. const raw_protocol & p2);
  33936. [heading Requirements]
  33937. ['Header: ][^boost/asio/generic/raw_protocol.hpp]
  33938. ['Convenience header: ][^boost/asio.hpp]
  33939. [endsect]
  33940. [section:operator_eq__eq_ generic::raw_protocol::operator==]
  33941. [indexterm2 boost_asio.indexterm.generic__raw_protocol.operator_eq__eq_..operator==..generic::raw_protocol]
  33942. Compare two protocols for equality.
  33943. friend bool operator==(
  33944. const raw_protocol & p1,
  33945. const raw_protocol & p2);
  33946. [heading Requirements]
  33947. ['Header: ][^boost/asio/generic/raw_protocol.hpp]
  33948. ['Convenience header: ][^boost/asio.hpp]
  33949. [endsect]
  33950. [section:protocol generic::raw_protocol::protocol]
  33951. [indexterm2 boost_asio.indexterm.generic__raw_protocol.protocol..protocol..generic::raw_protocol]
  33952. Obtain an identifier for the protocol.
  33953. int protocol() const;
  33954. [endsect]
  33955. [section:raw_protocol generic::raw_protocol::raw_protocol]
  33956. [indexterm2 boost_asio.indexterm.generic__raw_protocol.raw_protocol..raw_protocol..generic::raw_protocol]
  33957. Construct a protocol object for a specific address family and protocol.
  33958. ``[link boost_asio.reference.generic__raw_protocol.raw_protocol.overload1 raw_protocol]``(
  33959. int address_family,
  33960. int socket_protocol);
  33961. `` [''''&raquo;''' [link boost_asio.reference.generic__raw_protocol.raw_protocol.overload1 more...]]``
  33962. Construct a generic protocol object from a specific protocol.
  33963. template<
  33964. typename ``[link boost_asio.reference.Protocol Protocol]``>
  33965. ``[link boost_asio.reference.generic__raw_protocol.raw_protocol.overload2 raw_protocol]``(
  33966. const Protocol & source_protocol);
  33967. `` [''''&raquo;''' [link boost_asio.reference.generic__raw_protocol.raw_protocol.overload2 more...]]``
  33968. [section:overload1 generic::raw_protocol::raw_protocol (1 of 2 overloads)]
  33969. Construct a protocol object for a specific address family and protocol.
  33970. raw_protocol(
  33971. int address_family,
  33972. int socket_protocol);
  33973. [endsect]
  33974. [section:overload2 generic::raw_protocol::raw_protocol (2 of 2 overloads)]
  33975. Construct a generic protocol object from a specific protocol.
  33976. template<
  33977. typename ``[link boost_asio.reference.Protocol Protocol]``>
  33978. raw_protocol(
  33979. const Protocol & source_protocol);
  33980. [heading Exceptions]
  33981. [variablelist
  33982. [[@c][bad\_cast Thrown if the source protocol is not raw-oriented. ]]
  33983. ]
  33984. [endsect]
  33985. [endsect]
  33986. [section:socket generic::raw_protocol::socket]
  33987. [indexterm2 boost_asio.indexterm.generic__raw_protocol.socket..socket..generic::raw_protocol]
  33988. The generic socket type.
  33989. typedef basic_raw_socket< raw_protocol > socket;
  33990. [heading Types]
  33991. [table
  33992. [[Name][Description]]
  33993. [
  33994. [[link boost_asio.reference.basic_raw_socket__rebind_executor [*rebind_executor]]]
  33995. [Rebinds the socket type to another executor. ]
  33996. ]
  33997. [
  33998. [[link boost_asio.reference.basic_raw_socket.broadcast [*broadcast]]]
  33999. [Socket option to permit sending of broadcast messages. ]
  34000. ]
  34001. [
  34002. [[link boost_asio.reference.basic_raw_socket.bytes_readable [*bytes_readable]]]
  34003. [IO control command to get the amount of data that can be read without blocking. ]
  34004. ]
  34005. [
  34006. [[link boost_asio.reference.basic_raw_socket.debug [*debug]]]
  34007. [Socket option to enable socket-level debugging. ]
  34008. ]
  34009. [
  34010. [[link boost_asio.reference.basic_raw_socket.do_not_route [*do_not_route]]]
  34011. [Socket option to prevent routing, use local interfaces only. ]
  34012. ]
  34013. [
  34014. [[link boost_asio.reference.basic_raw_socket.enable_connection_aborted [*enable_connection_aborted]]]
  34015. [Socket option to report aborted connections on accept. ]
  34016. ]
  34017. [
  34018. [[link boost_asio.reference.basic_raw_socket.endpoint_type [*endpoint_type]]]
  34019. [The endpoint type. ]
  34020. ]
  34021. [
  34022. [[link boost_asio.reference.basic_raw_socket.executor_type [*executor_type]]]
  34023. [The type of the executor associated with the object. ]
  34024. ]
  34025. [
  34026. [[link boost_asio.reference.basic_raw_socket.keep_alive [*keep_alive]]]
  34027. [Socket option to send keep-alives. ]
  34028. ]
  34029. [
  34030. [[link boost_asio.reference.basic_raw_socket.linger [*linger]]]
  34031. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  34032. ]
  34033. [
  34034. [[link boost_asio.reference.basic_raw_socket.lowest_layer_type [*lowest_layer_type]]]
  34035. [A basic_socket is always the lowest layer. ]
  34036. ]
  34037. [
  34038. [[link boost_asio.reference.basic_raw_socket.message_flags [*message_flags]]]
  34039. [Bitmask type for flags that can be passed to send and receive operations. ]
  34040. ]
  34041. [
  34042. [[link boost_asio.reference.basic_raw_socket.native_handle_type [*native_handle_type]]]
  34043. [The native representation of a socket. ]
  34044. ]
  34045. [
  34046. [[link boost_asio.reference.basic_raw_socket.out_of_band_inline [*out_of_band_inline]]]
  34047. [Socket option for putting received out-of-band data inline. ]
  34048. ]
  34049. [
  34050. [[link boost_asio.reference.basic_raw_socket.protocol_type [*protocol_type]]]
  34051. [The protocol type. ]
  34052. ]
  34053. [
  34054. [[link boost_asio.reference.basic_raw_socket.receive_buffer_size [*receive_buffer_size]]]
  34055. [Socket option for the receive buffer size of a socket. ]
  34056. ]
  34057. [
  34058. [[link boost_asio.reference.basic_raw_socket.receive_low_watermark [*receive_low_watermark]]]
  34059. [Socket option for the receive low watermark. ]
  34060. ]
  34061. [
  34062. [[link boost_asio.reference.basic_raw_socket.reuse_address [*reuse_address]]]
  34063. [Socket option to allow the socket to be bound to an address that is already in use. ]
  34064. ]
  34065. [
  34066. [[link boost_asio.reference.basic_raw_socket.send_buffer_size [*send_buffer_size]]]
  34067. [Socket option for the send buffer size of a socket. ]
  34068. ]
  34069. [
  34070. [[link boost_asio.reference.basic_raw_socket.send_low_watermark [*send_low_watermark]]]
  34071. [Socket option for the send low watermark. ]
  34072. ]
  34073. [
  34074. [[link boost_asio.reference.basic_raw_socket.shutdown_type [*shutdown_type]]]
  34075. [Different ways a socket may be shutdown. ]
  34076. ]
  34077. [
  34078. [[link boost_asio.reference.basic_raw_socket.wait_type [*wait_type]]]
  34079. [Wait types. ]
  34080. ]
  34081. ]
  34082. [heading Member Functions]
  34083. [table
  34084. [[Name][Description]]
  34085. [
  34086. [[link boost_asio.reference.basic_raw_socket.assign [*assign]]]
  34087. [Assign an existing native socket to the socket. ]
  34088. ]
  34089. [
  34090. [[link boost_asio.reference.basic_raw_socket.async_connect [*async_connect]]]
  34091. [Start an asynchronous connect. ]
  34092. ]
  34093. [
  34094. [[link boost_asio.reference.basic_raw_socket.async_receive [*async_receive]]]
  34095. [Start an asynchronous receive on a connected socket. ]
  34096. ]
  34097. [
  34098. [[link boost_asio.reference.basic_raw_socket.async_receive_from [*async_receive_from]]]
  34099. [Start an asynchronous receive. ]
  34100. ]
  34101. [
  34102. [[link boost_asio.reference.basic_raw_socket.async_send [*async_send]]]
  34103. [Start an asynchronous send on a connected socket. ]
  34104. ]
  34105. [
  34106. [[link boost_asio.reference.basic_raw_socket.async_send_to [*async_send_to]]]
  34107. [Start an asynchronous send. ]
  34108. ]
  34109. [
  34110. [[link boost_asio.reference.basic_raw_socket.async_wait [*async_wait]]]
  34111. [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  34112. ]
  34113. [
  34114. [[link boost_asio.reference.basic_raw_socket.at_mark [*at_mark]]]
  34115. [Determine whether the socket is at the out-of-band data mark. ]
  34116. ]
  34117. [
  34118. [[link boost_asio.reference.basic_raw_socket.available [*available]]]
  34119. [Determine the number of bytes available for reading. ]
  34120. ]
  34121. [
  34122. [[link boost_asio.reference.basic_raw_socket.basic_raw_socket [*basic_raw_socket]]]
  34123. [Construct a basic_raw_socket without opening it.
  34124. [hr]
  34125. Construct and open a basic_raw_socket.
  34126. [hr]
  34127. Construct a basic_raw_socket, opening it and binding it to the given local endpoint.
  34128. [hr]
  34129. Construct a basic_raw_socket on an existing native socket.
  34130. [hr]
  34131. Move-construct a basic_raw_socket from another.
  34132. [hr]
  34133. Move-construct a basic_raw_socket from a socket of another protocol type. ]
  34134. ]
  34135. [
  34136. [[link boost_asio.reference.basic_raw_socket.bind [*bind]]]
  34137. [Bind the socket to the given local endpoint. ]
  34138. ]
  34139. [
  34140. [[link boost_asio.reference.basic_raw_socket.cancel [*cancel]]]
  34141. [Cancel all asynchronous operations associated with the socket. ]
  34142. ]
  34143. [
  34144. [[link boost_asio.reference.basic_raw_socket.close [*close]]]
  34145. [Close the socket. ]
  34146. ]
  34147. [
  34148. [[link boost_asio.reference.basic_raw_socket.connect [*connect]]]
  34149. [Connect the socket to the specified endpoint. ]
  34150. ]
  34151. [
  34152. [[link boost_asio.reference.basic_raw_socket.get_executor [*get_executor]]]
  34153. [Get the executor associated with the object. ]
  34154. ]
  34155. [
  34156. [[link boost_asio.reference.basic_raw_socket.get_option [*get_option]]]
  34157. [Get an option from the socket. ]
  34158. ]
  34159. [
  34160. [[link boost_asio.reference.basic_raw_socket.io_control [*io_control]]]
  34161. [Perform an IO control command on the socket. ]
  34162. ]
  34163. [
  34164. [[link boost_asio.reference.basic_raw_socket.is_open [*is_open]]]
  34165. [Determine whether the socket is open. ]
  34166. ]
  34167. [
  34168. [[link boost_asio.reference.basic_raw_socket.local_endpoint [*local_endpoint]]]
  34169. [Get the local endpoint of the socket. ]
  34170. ]
  34171. [
  34172. [[link boost_asio.reference.basic_raw_socket.lowest_layer [*lowest_layer]]]
  34173. [Get a reference to the lowest layer.
  34174. [hr]
  34175. Get a const reference to the lowest layer. ]
  34176. ]
  34177. [
  34178. [[link boost_asio.reference.basic_raw_socket.native_handle [*native_handle]]]
  34179. [Get the native socket representation. ]
  34180. ]
  34181. [
  34182. [[link boost_asio.reference.basic_raw_socket.native_non_blocking [*native_non_blocking]]]
  34183. [Gets the non-blocking mode of the native socket implementation.
  34184. [hr]
  34185. Sets the non-blocking mode of the native socket implementation. ]
  34186. ]
  34187. [
  34188. [[link boost_asio.reference.basic_raw_socket.non_blocking [*non_blocking]]]
  34189. [Gets the non-blocking mode of the socket.
  34190. [hr]
  34191. Sets the non-blocking mode of the socket. ]
  34192. ]
  34193. [
  34194. [[link boost_asio.reference.basic_raw_socket.open [*open]]]
  34195. [Open the socket using the specified protocol. ]
  34196. ]
  34197. [
  34198. [[link boost_asio.reference.basic_raw_socket.operator_eq_ [*operator=]]]
  34199. [Move-assign a basic_raw_socket from another.
  34200. [hr]
  34201. Move-assign a basic_raw_socket from a socket of another protocol type. ]
  34202. ]
  34203. [
  34204. [[link boost_asio.reference.basic_raw_socket.receive [*receive]]]
  34205. [Receive some data on a connected socket. ]
  34206. ]
  34207. [
  34208. [[link boost_asio.reference.basic_raw_socket.receive_from [*receive_from]]]
  34209. [Receive raw data with the endpoint of the sender. ]
  34210. ]
  34211. [
  34212. [[link boost_asio.reference.basic_raw_socket.release [*release]]]
  34213. [Release ownership of the underlying native socket. ]
  34214. ]
  34215. [
  34216. [[link boost_asio.reference.basic_raw_socket.remote_endpoint [*remote_endpoint]]]
  34217. [Get the remote endpoint of the socket. ]
  34218. ]
  34219. [
  34220. [[link boost_asio.reference.basic_raw_socket.send [*send]]]
  34221. [Send some data on a connected socket. ]
  34222. ]
  34223. [
  34224. [[link boost_asio.reference.basic_raw_socket.send_to [*send_to]]]
  34225. [Send raw data to the specified endpoint. ]
  34226. ]
  34227. [
  34228. [[link boost_asio.reference.basic_raw_socket.set_option [*set_option]]]
  34229. [Set an option on the socket. ]
  34230. ]
  34231. [
  34232. [[link boost_asio.reference.basic_raw_socket.shutdown [*shutdown]]]
  34233. [Disable sends or receives on the socket. ]
  34234. ]
  34235. [
  34236. [[link boost_asio.reference.basic_raw_socket.wait [*wait]]]
  34237. [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  34238. ]
  34239. [
  34240. [[link boost_asio.reference.basic_raw_socket._basic_raw_socket [*~basic_raw_socket]]]
  34241. [Destroys the socket. ]
  34242. ]
  34243. ]
  34244. [heading Data Members]
  34245. [table
  34246. [[Name][Description]]
  34247. [
  34248. [[link boost_asio.reference.basic_raw_socket.max_connections [*max_connections]]]
  34249. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  34250. ]
  34251. [
  34252. [[link boost_asio.reference.basic_raw_socket.max_listen_connections [*max_listen_connections]]]
  34253. [The maximum length of the queue of pending incoming connections. ]
  34254. ]
  34255. [
  34256. [[link boost_asio.reference.basic_raw_socket.message_do_not_route [*message_do_not_route]]]
  34257. [Specify that the data should not be subject to routing. ]
  34258. ]
  34259. [
  34260. [[link boost_asio.reference.basic_raw_socket.message_end_of_record [*message_end_of_record]]]
  34261. [Specifies that the data marks the end of a record. ]
  34262. ]
  34263. [
  34264. [[link boost_asio.reference.basic_raw_socket.message_out_of_band [*message_out_of_band]]]
  34265. [Process out-of-band data. ]
  34266. ]
  34267. [
  34268. [[link boost_asio.reference.basic_raw_socket.message_peek [*message_peek]]]
  34269. [Peek at incoming data without removing it from the input queue. ]
  34270. ]
  34271. ]
  34272. [heading Protected Data Members]
  34273. [table
  34274. [[Name][Description]]
  34275. [
  34276. [[link boost_asio.reference.basic_raw_socket.impl_ [*impl_]]]
  34277. []
  34278. ]
  34279. ]
  34280. The [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] class template provides asynchronous and blocking raw-oriented socket functionality.
  34281. [heading Thread Safety]
  34282. ['Distinct] ['objects:] Safe.
  34283. ['Shared] ['objects:] Unsafe.
  34284. [heading Requirements]
  34285. ['Header: ][^boost/asio/generic/raw_protocol.hpp]
  34286. ['Convenience header: ][^boost/asio.hpp]
  34287. [endsect]
  34288. [section:type generic::raw_protocol::type]
  34289. [indexterm2 boost_asio.indexterm.generic__raw_protocol.type..type..generic::raw_protocol]
  34290. Obtain an identifier for the type of the protocol.
  34291. int type() const;
  34292. [endsect]
  34293. [endsect]
  34294. [section:generic__seq_packet_protocol generic::seq_packet_protocol]
  34295. Encapsulates the flags needed for a generic sequenced packet socket.
  34296. class seq_packet_protocol
  34297. [heading Types]
  34298. [table
  34299. [[Name][Description]]
  34300. [
  34301. [[link boost_asio.reference.generic__seq_packet_protocol.endpoint [*endpoint]]]
  34302. [The type of an endpoint. ]
  34303. ]
  34304. [
  34305. [[link boost_asio.reference.generic__seq_packet_protocol.socket [*socket]]]
  34306. [The generic socket type. ]
  34307. ]
  34308. ]
  34309. [heading Member Functions]
  34310. [table
  34311. [[Name][Description]]
  34312. [
  34313. [[link boost_asio.reference.generic__seq_packet_protocol.family [*family]]]
  34314. [Obtain an identifier for the protocol family. ]
  34315. ]
  34316. [
  34317. [[link boost_asio.reference.generic__seq_packet_protocol.protocol [*protocol]]]
  34318. [Obtain an identifier for the protocol. ]
  34319. ]
  34320. [
  34321. [[link boost_asio.reference.generic__seq_packet_protocol.seq_packet_protocol [*seq_packet_protocol]]]
  34322. [Construct a protocol object for a specific address family and protocol.
  34323. [hr]
  34324. Construct a generic protocol object from a specific protocol. ]
  34325. ]
  34326. [
  34327. [[link boost_asio.reference.generic__seq_packet_protocol.type [*type]]]
  34328. [Obtain an identifier for the type of the protocol. ]
  34329. ]
  34330. ]
  34331. [heading Friends]
  34332. [table
  34333. [[Name][Description]]
  34334. [
  34335. [[link boost_asio.reference.generic__seq_packet_protocol.operator_not__eq_ [*operator!=]]]
  34336. [Compare two protocols for inequality. ]
  34337. ]
  34338. [
  34339. [[link boost_asio.reference.generic__seq_packet_protocol.operator_eq__eq_ [*operator==]]]
  34340. [Compare two protocols for equality. ]
  34341. ]
  34342. ]
  34343. The [link boost_asio.reference.generic__seq_packet_protocol `generic::seq_packet_protocol`] class contains flags necessary for seq\_packet-oriented sockets of any address family and protocol.
  34344. [heading Examples]
  34345. Constructing using a native address family and socket protocol:
  34346. seq_packet_protocol p(AF_INET, IPPROTO_SCTP);
  34347. [heading Thread Safety]
  34348. ['Distinct] ['objects:] Safe.
  34349. ['Shared] ['objects:] Safe.
  34350. [heading Requirements]
  34351. ['Header: ][^boost/asio/generic/seq_packet_protocol.hpp]
  34352. ['Convenience header: ][^boost/asio.hpp]
  34353. [section:endpoint generic::seq_packet_protocol::endpoint]
  34354. [indexterm2 boost_asio.indexterm.generic__seq_packet_protocol.endpoint..endpoint..generic::seq_packet_protocol]
  34355. The type of an endpoint.
  34356. typedef basic_endpoint< seq_packet_protocol > endpoint;
  34357. [heading Types]
  34358. [table
  34359. [[Name][Description]]
  34360. [
  34361. [[link boost_asio.reference.generic__basic_endpoint.data_type [*data_type]]]
  34362. [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
  34363. ]
  34364. [
  34365. [[link boost_asio.reference.generic__basic_endpoint.protocol_type [*protocol_type]]]
  34366. [The protocol type associated with the endpoint. ]
  34367. ]
  34368. ]
  34369. [heading Member Functions]
  34370. [table
  34371. [[Name][Description]]
  34372. [
  34373. [[link boost_asio.reference.generic__basic_endpoint.basic_endpoint [*basic_endpoint]]]
  34374. [Default constructor.
  34375. [hr]
  34376. Construct an endpoint from the specified socket address.
  34377. [hr]
  34378. Construct an endpoint from the specific endpoint type.
  34379. [hr]
  34380. Copy constructor. ]
  34381. ]
  34382. [
  34383. [[link boost_asio.reference.generic__basic_endpoint.capacity [*capacity]]]
  34384. [Get the capacity of the endpoint in the native type. ]
  34385. ]
  34386. [
  34387. [[link boost_asio.reference.generic__basic_endpoint.data [*data]]]
  34388. [Get the underlying endpoint in the native type. ]
  34389. ]
  34390. [
  34391. [[link boost_asio.reference.generic__basic_endpoint.operator_eq_ [*operator=]]]
  34392. [Assign from another endpoint. ]
  34393. ]
  34394. [
  34395. [[link boost_asio.reference.generic__basic_endpoint.protocol [*protocol]]]
  34396. [The protocol associated with the endpoint. ]
  34397. ]
  34398. [
  34399. [[link boost_asio.reference.generic__basic_endpoint.resize [*resize]]]
  34400. [Set the underlying size of the endpoint in the native type. ]
  34401. ]
  34402. [
  34403. [[link boost_asio.reference.generic__basic_endpoint.size [*size]]]
  34404. [Get the underlying size of the endpoint in the native type. ]
  34405. ]
  34406. ]
  34407. [heading Friends]
  34408. [table
  34409. [[Name][Description]]
  34410. [
  34411. [[link boost_asio.reference.generic__basic_endpoint.operator_not__eq_ [*operator!=]]]
  34412. [Compare two endpoints for inequality. ]
  34413. ]
  34414. [
  34415. [[link boost_asio.reference.generic__basic_endpoint.operator_lt_ [*operator<]]]
  34416. [Compare endpoints for ordering. ]
  34417. ]
  34418. [
  34419. [[link boost_asio.reference.generic__basic_endpoint.operator_lt__eq_ [*operator<=]]]
  34420. [Compare endpoints for ordering. ]
  34421. ]
  34422. [
  34423. [[link boost_asio.reference.generic__basic_endpoint.operator_eq__eq_ [*operator==]]]
  34424. [Compare two endpoints for equality. ]
  34425. ]
  34426. [
  34427. [[link boost_asio.reference.generic__basic_endpoint.operator_gt_ [*operator>]]]
  34428. [Compare endpoints for ordering. ]
  34429. ]
  34430. [
  34431. [[link boost_asio.reference.generic__basic_endpoint.operator_gt__eq_ [*operator>=]]]
  34432. [Compare endpoints for ordering. ]
  34433. ]
  34434. ]
  34435. The [link boost_asio.reference.generic__basic_endpoint `generic::basic_endpoint`] class template describes an endpoint that may be associated with any socket type.
  34436. [heading Remarks]
  34437. The socket types sockaddr type must be able to fit into a `sockaddr_storage` structure.
  34438. [heading Thread Safety]
  34439. ['Distinct] ['objects:] Safe.
  34440. ['Shared] ['objects:] Unsafe.
  34441. [heading Requirements]
  34442. ['Header: ][^boost/asio/generic/seq_packet_protocol.hpp]
  34443. ['Convenience header: ][^boost/asio.hpp]
  34444. [endsect]
  34445. [section:family generic::seq_packet_protocol::family]
  34446. [indexterm2 boost_asio.indexterm.generic__seq_packet_protocol.family..family..generic::seq_packet_protocol]
  34447. Obtain an identifier for the protocol family.
  34448. int family() const;
  34449. [endsect]
  34450. [section:operator_not__eq_ generic::seq_packet_protocol::operator!=]
  34451. [indexterm2 boost_asio.indexterm.generic__seq_packet_protocol.operator_not__eq_..operator!=..generic::seq_packet_protocol]
  34452. Compare two protocols for inequality.
  34453. friend bool operator!=(
  34454. const seq_packet_protocol & p1,
  34455. const seq_packet_protocol & p2);
  34456. [heading Requirements]
  34457. ['Header: ][^boost/asio/generic/seq_packet_protocol.hpp]
  34458. ['Convenience header: ][^boost/asio.hpp]
  34459. [endsect]
  34460. [section:operator_eq__eq_ generic::seq_packet_protocol::operator==]
  34461. [indexterm2 boost_asio.indexterm.generic__seq_packet_protocol.operator_eq__eq_..operator==..generic::seq_packet_protocol]
  34462. Compare two protocols for equality.
  34463. friend bool operator==(
  34464. const seq_packet_protocol & p1,
  34465. const seq_packet_protocol & p2);
  34466. [heading Requirements]
  34467. ['Header: ][^boost/asio/generic/seq_packet_protocol.hpp]
  34468. ['Convenience header: ][^boost/asio.hpp]
  34469. [endsect]
  34470. [section:protocol generic::seq_packet_protocol::protocol]
  34471. [indexterm2 boost_asio.indexterm.generic__seq_packet_protocol.protocol..protocol..generic::seq_packet_protocol]
  34472. Obtain an identifier for the protocol.
  34473. int protocol() const;
  34474. [endsect]
  34475. [section:seq_packet_protocol generic::seq_packet_protocol::seq_packet_protocol]
  34476. [indexterm2 boost_asio.indexterm.generic__seq_packet_protocol.seq_packet_protocol..seq_packet_protocol..generic::seq_packet_protocol]
  34477. Construct a protocol object for a specific address family and protocol.
  34478. ``[link boost_asio.reference.generic__seq_packet_protocol.seq_packet_protocol.overload1 seq_packet_protocol]``(
  34479. int address_family,
  34480. int socket_protocol);
  34481. `` [''''&raquo;''' [link boost_asio.reference.generic__seq_packet_protocol.seq_packet_protocol.overload1 more...]]``
  34482. Construct a generic protocol object from a specific protocol.
  34483. template<
  34484. typename ``[link boost_asio.reference.Protocol Protocol]``>
  34485. ``[link boost_asio.reference.generic__seq_packet_protocol.seq_packet_protocol.overload2 seq_packet_protocol]``(
  34486. const Protocol & source_protocol);
  34487. `` [''''&raquo;''' [link boost_asio.reference.generic__seq_packet_protocol.seq_packet_protocol.overload2 more...]]``
  34488. [section:overload1 generic::seq_packet_protocol::seq_packet_protocol (1 of 2 overloads)]
  34489. Construct a protocol object for a specific address family and protocol.
  34490. seq_packet_protocol(
  34491. int address_family,
  34492. int socket_protocol);
  34493. [endsect]
  34494. [section:overload2 generic::seq_packet_protocol::seq_packet_protocol (2 of 2 overloads)]
  34495. Construct a generic protocol object from a specific protocol.
  34496. template<
  34497. typename ``[link boost_asio.reference.Protocol Protocol]``>
  34498. seq_packet_protocol(
  34499. const Protocol & source_protocol);
  34500. [heading Exceptions]
  34501. [variablelist
  34502. [[@c][bad\_cast Thrown if the source protocol is not based around sequenced packets. ]]
  34503. ]
  34504. [endsect]
  34505. [endsect]
  34506. [section:socket generic::seq_packet_protocol::socket]
  34507. [indexterm2 boost_asio.indexterm.generic__seq_packet_protocol.socket..socket..generic::seq_packet_protocol]
  34508. The generic socket type.
  34509. typedef basic_seq_packet_socket< seq_packet_protocol > socket;
  34510. [heading Types]
  34511. [table
  34512. [[Name][Description]]
  34513. [
  34514. [[link boost_asio.reference.basic_seq_packet_socket__rebind_executor [*rebind_executor]]]
  34515. [Rebinds the socket type to another executor. ]
  34516. ]
  34517. [
  34518. [[link boost_asio.reference.basic_seq_packet_socket.broadcast [*broadcast]]]
  34519. [Socket option to permit sending of broadcast messages. ]
  34520. ]
  34521. [
  34522. [[link boost_asio.reference.basic_seq_packet_socket.bytes_readable [*bytes_readable]]]
  34523. [IO control command to get the amount of data that can be read without blocking. ]
  34524. ]
  34525. [
  34526. [[link boost_asio.reference.basic_seq_packet_socket.debug [*debug]]]
  34527. [Socket option to enable socket-level debugging. ]
  34528. ]
  34529. [
  34530. [[link boost_asio.reference.basic_seq_packet_socket.do_not_route [*do_not_route]]]
  34531. [Socket option to prevent routing, use local interfaces only. ]
  34532. ]
  34533. [
  34534. [[link boost_asio.reference.basic_seq_packet_socket.enable_connection_aborted [*enable_connection_aborted]]]
  34535. [Socket option to report aborted connections on accept. ]
  34536. ]
  34537. [
  34538. [[link boost_asio.reference.basic_seq_packet_socket.endpoint_type [*endpoint_type]]]
  34539. [The endpoint type. ]
  34540. ]
  34541. [
  34542. [[link boost_asio.reference.basic_seq_packet_socket.executor_type [*executor_type]]]
  34543. [The type of the executor associated with the object. ]
  34544. ]
  34545. [
  34546. [[link boost_asio.reference.basic_seq_packet_socket.keep_alive [*keep_alive]]]
  34547. [Socket option to send keep-alives. ]
  34548. ]
  34549. [
  34550. [[link boost_asio.reference.basic_seq_packet_socket.linger [*linger]]]
  34551. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  34552. ]
  34553. [
  34554. [[link boost_asio.reference.basic_seq_packet_socket.lowest_layer_type [*lowest_layer_type]]]
  34555. [A basic_socket is always the lowest layer. ]
  34556. ]
  34557. [
  34558. [[link boost_asio.reference.basic_seq_packet_socket.message_flags [*message_flags]]]
  34559. [Bitmask type for flags that can be passed to send and receive operations. ]
  34560. ]
  34561. [
  34562. [[link boost_asio.reference.basic_seq_packet_socket.native_handle_type [*native_handle_type]]]
  34563. [The native representation of a socket. ]
  34564. ]
  34565. [
  34566. [[link boost_asio.reference.basic_seq_packet_socket.out_of_band_inline [*out_of_band_inline]]]
  34567. [Socket option for putting received out-of-band data inline. ]
  34568. ]
  34569. [
  34570. [[link boost_asio.reference.basic_seq_packet_socket.protocol_type [*protocol_type]]]
  34571. [The protocol type. ]
  34572. ]
  34573. [
  34574. [[link boost_asio.reference.basic_seq_packet_socket.receive_buffer_size [*receive_buffer_size]]]
  34575. [Socket option for the receive buffer size of a socket. ]
  34576. ]
  34577. [
  34578. [[link boost_asio.reference.basic_seq_packet_socket.receive_low_watermark [*receive_low_watermark]]]
  34579. [Socket option for the receive low watermark. ]
  34580. ]
  34581. [
  34582. [[link boost_asio.reference.basic_seq_packet_socket.reuse_address [*reuse_address]]]
  34583. [Socket option to allow the socket to be bound to an address that is already in use. ]
  34584. ]
  34585. [
  34586. [[link boost_asio.reference.basic_seq_packet_socket.send_buffer_size [*send_buffer_size]]]
  34587. [Socket option for the send buffer size of a socket. ]
  34588. ]
  34589. [
  34590. [[link boost_asio.reference.basic_seq_packet_socket.send_low_watermark [*send_low_watermark]]]
  34591. [Socket option for the send low watermark. ]
  34592. ]
  34593. [
  34594. [[link boost_asio.reference.basic_seq_packet_socket.shutdown_type [*shutdown_type]]]
  34595. [Different ways a socket may be shutdown. ]
  34596. ]
  34597. [
  34598. [[link boost_asio.reference.basic_seq_packet_socket.wait_type [*wait_type]]]
  34599. [Wait types. ]
  34600. ]
  34601. ]
  34602. [heading Member Functions]
  34603. [table
  34604. [[Name][Description]]
  34605. [
  34606. [[link boost_asio.reference.basic_seq_packet_socket.assign [*assign]]]
  34607. [Assign an existing native socket to the socket. ]
  34608. ]
  34609. [
  34610. [[link boost_asio.reference.basic_seq_packet_socket.async_connect [*async_connect]]]
  34611. [Start an asynchronous connect. ]
  34612. ]
  34613. [
  34614. [[link boost_asio.reference.basic_seq_packet_socket.async_receive [*async_receive]]]
  34615. [Start an asynchronous receive. ]
  34616. ]
  34617. [
  34618. [[link boost_asio.reference.basic_seq_packet_socket.async_send [*async_send]]]
  34619. [Start an asynchronous send. ]
  34620. ]
  34621. [
  34622. [[link boost_asio.reference.basic_seq_packet_socket.async_wait [*async_wait]]]
  34623. [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  34624. ]
  34625. [
  34626. [[link boost_asio.reference.basic_seq_packet_socket.at_mark [*at_mark]]]
  34627. [Determine whether the socket is at the out-of-band data mark. ]
  34628. ]
  34629. [
  34630. [[link boost_asio.reference.basic_seq_packet_socket.available [*available]]]
  34631. [Determine the number of bytes available for reading. ]
  34632. ]
  34633. [
  34634. [[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket [*basic_seq_packet_socket]]]
  34635. [Construct a basic_seq_packet_socket without opening it.
  34636. [hr]
  34637. Construct and open a basic_seq_packet_socket.
  34638. [hr]
  34639. Construct a basic_seq_packet_socket, opening it and binding it to the given local endpoint.
  34640. [hr]
  34641. Construct a basic_seq_packet_socket on an existing native socket.
  34642. [hr]
  34643. Move-construct a basic_seq_packet_socket from another.
  34644. [hr]
  34645. Move-construct a basic_seq_packet_socket from a socket of another protocol type. ]
  34646. ]
  34647. [
  34648. [[link boost_asio.reference.basic_seq_packet_socket.bind [*bind]]]
  34649. [Bind the socket to the given local endpoint. ]
  34650. ]
  34651. [
  34652. [[link boost_asio.reference.basic_seq_packet_socket.cancel [*cancel]]]
  34653. [Cancel all asynchronous operations associated with the socket. ]
  34654. ]
  34655. [
  34656. [[link boost_asio.reference.basic_seq_packet_socket.close [*close]]]
  34657. [Close the socket. ]
  34658. ]
  34659. [
  34660. [[link boost_asio.reference.basic_seq_packet_socket.connect [*connect]]]
  34661. [Connect the socket to the specified endpoint. ]
  34662. ]
  34663. [
  34664. [[link boost_asio.reference.basic_seq_packet_socket.get_executor [*get_executor]]]
  34665. [Get the executor associated with the object. ]
  34666. ]
  34667. [
  34668. [[link boost_asio.reference.basic_seq_packet_socket.get_option [*get_option]]]
  34669. [Get an option from the socket. ]
  34670. ]
  34671. [
  34672. [[link boost_asio.reference.basic_seq_packet_socket.io_control [*io_control]]]
  34673. [Perform an IO control command on the socket. ]
  34674. ]
  34675. [
  34676. [[link boost_asio.reference.basic_seq_packet_socket.is_open [*is_open]]]
  34677. [Determine whether the socket is open. ]
  34678. ]
  34679. [
  34680. [[link boost_asio.reference.basic_seq_packet_socket.local_endpoint [*local_endpoint]]]
  34681. [Get the local endpoint of the socket. ]
  34682. ]
  34683. [
  34684. [[link boost_asio.reference.basic_seq_packet_socket.lowest_layer [*lowest_layer]]]
  34685. [Get a reference to the lowest layer.
  34686. [hr]
  34687. Get a const reference to the lowest layer. ]
  34688. ]
  34689. [
  34690. [[link boost_asio.reference.basic_seq_packet_socket.native_handle [*native_handle]]]
  34691. [Get the native socket representation. ]
  34692. ]
  34693. [
  34694. [[link boost_asio.reference.basic_seq_packet_socket.native_non_blocking [*native_non_blocking]]]
  34695. [Gets the non-blocking mode of the native socket implementation.
  34696. [hr]
  34697. Sets the non-blocking mode of the native socket implementation. ]
  34698. ]
  34699. [
  34700. [[link boost_asio.reference.basic_seq_packet_socket.non_blocking [*non_blocking]]]
  34701. [Gets the non-blocking mode of the socket.
  34702. [hr]
  34703. Sets the non-blocking mode of the socket. ]
  34704. ]
  34705. [
  34706. [[link boost_asio.reference.basic_seq_packet_socket.open [*open]]]
  34707. [Open the socket using the specified protocol. ]
  34708. ]
  34709. [
  34710. [[link boost_asio.reference.basic_seq_packet_socket.operator_eq_ [*operator=]]]
  34711. [Move-assign a basic_seq_packet_socket from another.
  34712. [hr]
  34713. Move-assign a basic_seq_packet_socket from a socket of another protocol type. ]
  34714. ]
  34715. [
  34716. [[link boost_asio.reference.basic_seq_packet_socket.receive [*receive]]]
  34717. [Receive some data on the socket.
  34718. [hr]
  34719. Receive some data on a connected socket. ]
  34720. ]
  34721. [
  34722. [[link boost_asio.reference.basic_seq_packet_socket.release [*release]]]
  34723. [Release ownership of the underlying native socket. ]
  34724. ]
  34725. [
  34726. [[link boost_asio.reference.basic_seq_packet_socket.remote_endpoint [*remote_endpoint]]]
  34727. [Get the remote endpoint of the socket. ]
  34728. ]
  34729. [
  34730. [[link boost_asio.reference.basic_seq_packet_socket.send [*send]]]
  34731. [Send some data on the socket. ]
  34732. ]
  34733. [
  34734. [[link boost_asio.reference.basic_seq_packet_socket.set_option [*set_option]]]
  34735. [Set an option on the socket. ]
  34736. ]
  34737. [
  34738. [[link boost_asio.reference.basic_seq_packet_socket.shutdown [*shutdown]]]
  34739. [Disable sends or receives on the socket. ]
  34740. ]
  34741. [
  34742. [[link boost_asio.reference.basic_seq_packet_socket.wait [*wait]]]
  34743. [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  34744. ]
  34745. [
  34746. [[link boost_asio.reference.basic_seq_packet_socket._basic_seq_packet_socket [*~basic_seq_packet_socket]]]
  34747. [Destroys the socket. ]
  34748. ]
  34749. ]
  34750. [heading Data Members]
  34751. [table
  34752. [[Name][Description]]
  34753. [
  34754. [[link boost_asio.reference.basic_seq_packet_socket.max_connections [*max_connections]]]
  34755. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  34756. ]
  34757. [
  34758. [[link boost_asio.reference.basic_seq_packet_socket.max_listen_connections [*max_listen_connections]]]
  34759. [The maximum length of the queue of pending incoming connections. ]
  34760. ]
  34761. [
  34762. [[link boost_asio.reference.basic_seq_packet_socket.message_do_not_route [*message_do_not_route]]]
  34763. [Specify that the data should not be subject to routing. ]
  34764. ]
  34765. [
  34766. [[link boost_asio.reference.basic_seq_packet_socket.message_end_of_record [*message_end_of_record]]]
  34767. [Specifies that the data marks the end of a record. ]
  34768. ]
  34769. [
  34770. [[link boost_asio.reference.basic_seq_packet_socket.message_out_of_band [*message_out_of_band]]]
  34771. [Process out-of-band data. ]
  34772. ]
  34773. [
  34774. [[link boost_asio.reference.basic_seq_packet_socket.message_peek [*message_peek]]]
  34775. [Peek at incoming data without removing it from the input queue. ]
  34776. ]
  34777. ]
  34778. [heading Protected Data Members]
  34779. [table
  34780. [[Name][Description]]
  34781. [
  34782. [[link boost_asio.reference.basic_seq_packet_socket.impl_ [*impl_]]]
  34783. []
  34784. ]
  34785. ]
  34786. The [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] class template provides asynchronous and blocking sequenced packet socket functionality.
  34787. [heading Thread Safety]
  34788. ['Distinct] ['objects:] Safe.
  34789. ['Shared] ['objects:] Unsafe.
  34790. [heading Requirements]
  34791. ['Header: ][^boost/asio/generic/seq_packet_protocol.hpp]
  34792. ['Convenience header: ][^boost/asio.hpp]
  34793. [endsect]
  34794. [section:type generic::seq_packet_protocol::type]
  34795. [indexterm2 boost_asio.indexterm.generic__seq_packet_protocol.type..type..generic::seq_packet_protocol]
  34796. Obtain an identifier for the type of the protocol.
  34797. int type() const;
  34798. [endsect]
  34799. [endsect]
  34800. [section:generic__stream_protocol generic::stream_protocol]
  34801. Encapsulates the flags needed for a generic stream-oriented socket.
  34802. class stream_protocol
  34803. [heading Types]
  34804. [table
  34805. [[Name][Description]]
  34806. [
  34807. [[link boost_asio.reference.generic__stream_protocol.endpoint [*endpoint]]]
  34808. [The type of an endpoint. ]
  34809. ]
  34810. [
  34811. [[link boost_asio.reference.generic__stream_protocol.iostream [*iostream]]]
  34812. [The generic socket iostream type. ]
  34813. ]
  34814. [
  34815. [[link boost_asio.reference.generic__stream_protocol.socket [*socket]]]
  34816. [The generic socket type. ]
  34817. ]
  34818. ]
  34819. [heading Member Functions]
  34820. [table
  34821. [[Name][Description]]
  34822. [
  34823. [[link boost_asio.reference.generic__stream_protocol.family [*family]]]
  34824. [Obtain an identifier for the protocol family. ]
  34825. ]
  34826. [
  34827. [[link boost_asio.reference.generic__stream_protocol.protocol [*protocol]]]
  34828. [Obtain an identifier for the protocol. ]
  34829. ]
  34830. [
  34831. [[link boost_asio.reference.generic__stream_protocol.stream_protocol [*stream_protocol]]]
  34832. [Construct a protocol object for a specific address family and protocol.
  34833. [hr]
  34834. Construct a generic protocol object from a specific protocol. ]
  34835. ]
  34836. [
  34837. [[link boost_asio.reference.generic__stream_protocol.type [*type]]]
  34838. [Obtain an identifier for the type of the protocol. ]
  34839. ]
  34840. ]
  34841. [heading Friends]
  34842. [table
  34843. [[Name][Description]]
  34844. [
  34845. [[link boost_asio.reference.generic__stream_protocol.operator_not__eq_ [*operator!=]]]
  34846. [Compare two protocols for inequality. ]
  34847. ]
  34848. [
  34849. [[link boost_asio.reference.generic__stream_protocol.operator_eq__eq_ [*operator==]]]
  34850. [Compare two protocols for equality. ]
  34851. ]
  34852. ]
  34853. The [link boost_asio.reference.generic__stream_protocol `generic::stream_protocol`] class contains flags necessary for stream-oriented sockets of any address family and protocol.
  34854. [heading Examples]
  34855. Constructing using a native address family and socket protocol:
  34856. stream_protocol p(AF_INET, IPPROTO_TCP);
  34857. Constructing from a specific protocol type:
  34858. stream_protocol p(boost::asio::ip::tcp::v4());
  34859. [heading Thread Safety]
  34860. ['Distinct] ['objects:] Safe.
  34861. ['Shared] ['objects:] Safe.
  34862. [heading Requirements]
  34863. ['Header: ][^boost/asio/generic/stream_protocol.hpp]
  34864. ['Convenience header: ][^boost/asio.hpp]
  34865. [section:endpoint generic::stream_protocol::endpoint]
  34866. [indexterm2 boost_asio.indexterm.generic__stream_protocol.endpoint..endpoint..generic::stream_protocol]
  34867. The type of an endpoint.
  34868. typedef basic_endpoint< stream_protocol > endpoint;
  34869. [heading Types]
  34870. [table
  34871. [[Name][Description]]
  34872. [
  34873. [[link boost_asio.reference.generic__basic_endpoint.data_type [*data_type]]]
  34874. [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
  34875. ]
  34876. [
  34877. [[link boost_asio.reference.generic__basic_endpoint.protocol_type [*protocol_type]]]
  34878. [The protocol type associated with the endpoint. ]
  34879. ]
  34880. ]
  34881. [heading Member Functions]
  34882. [table
  34883. [[Name][Description]]
  34884. [
  34885. [[link boost_asio.reference.generic__basic_endpoint.basic_endpoint [*basic_endpoint]]]
  34886. [Default constructor.
  34887. [hr]
  34888. Construct an endpoint from the specified socket address.
  34889. [hr]
  34890. Construct an endpoint from the specific endpoint type.
  34891. [hr]
  34892. Copy constructor. ]
  34893. ]
  34894. [
  34895. [[link boost_asio.reference.generic__basic_endpoint.capacity [*capacity]]]
  34896. [Get the capacity of the endpoint in the native type. ]
  34897. ]
  34898. [
  34899. [[link boost_asio.reference.generic__basic_endpoint.data [*data]]]
  34900. [Get the underlying endpoint in the native type. ]
  34901. ]
  34902. [
  34903. [[link boost_asio.reference.generic__basic_endpoint.operator_eq_ [*operator=]]]
  34904. [Assign from another endpoint. ]
  34905. ]
  34906. [
  34907. [[link boost_asio.reference.generic__basic_endpoint.protocol [*protocol]]]
  34908. [The protocol associated with the endpoint. ]
  34909. ]
  34910. [
  34911. [[link boost_asio.reference.generic__basic_endpoint.resize [*resize]]]
  34912. [Set the underlying size of the endpoint in the native type. ]
  34913. ]
  34914. [
  34915. [[link boost_asio.reference.generic__basic_endpoint.size [*size]]]
  34916. [Get the underlying size of the endpoint in the native type. ]
  34917. ]
  34918. ]
  34919. [heading Friends]
  34920. [table
  34921. [[Name][Description]]
  34922. [
  34923. [[link boost_asio.reference.generic__basic_endpoint.operator_not__eq_ [*operator!=]]]
  34924. [Compare two endpoints for inequality. ]
  34925. ]
  34926. [
  34927. [[link boost_asio.reference.generic__basic_endpoint.operator_lt_ [*operator<]]]
  34928. [Compare endpoints for ordering. ]
  34929. ]
  34930. [
  34931. [[link boost_asio.reference.generic__basic_endpoint.operator_lt__eq_ [*operator<=]]]
  34932. [Compare endpoints for ordering. ]
  34933. ]
  34934. [
  34935. [[link boost_asio.reference.generic__basic_endpoint.operator_eq__eq_ [*operator==]]]
  34936. [Compare two endpoints for equality. ]
  34937. ]
  34938. [
  34939. [[link boost_asio.reference.generic__basic_endpoint.operator_gt_ [*operator>]]]
  34940. [Compare endpoints for ordering. ]
  34941. ]
  34942. [
  34943. [[link boost_asio.reference.generic__basic_endpoint.operator_gt__eq_ [*operator>=]]]
  34944. [Compare endpoints for ordering. ]
  34945. ]
  34946. ]
  34947. The [link boost_asio.reference.generic__basic_endpoint `generic::basic_endpoint`] class template describes an endpoint that may be associated with any socket type.
  34948. [heading Remarks]
  34949. The socket types sockaddr type must be able to fit into a `sockaddr_storage` structure.
  34950. [heading Thread Safety]
  34951. ['Distinct] ['objects:] Safe.
  34952. ['Shared] ['objects:] Unsafe.
  34953. [heading Requirements]
  34954. ['Header: ][^boost/asio/generic/stream_protocol.hpp]
  34955. ['Convenience header: ][^boost/asio.hpp]
  34956. [endsect]
  34957. [section:family generic::stream_protocol::family]
  34958. [indexterm2 boost_asio.indexterm.generic__stream_protocol.family..family..generic::stream_protocol]
  34959. Obtain an identifier for the protocol family.
  34960. int family() const;
  34961. [endsect]
  34962. [section:iostream generic::stream_protocol::iostream]
  34963. [indexterm2 boost_asio.indexterm.generic__stream_protocol.iostream..iostream..generic::stream_protocol]
  34964. The generic socket iostream type.
  34965. typedef basic_socket_iostream< stream_protocol > iostream;
  34966. [heading Types]
  34967. [table
  34968. [[Name][Description]]
  34969. [
  34970. [[link boost_asio.reference.basic_socket_iostream.clock_type [*clock_type]]]
  34971. [The clock type. ]
  34972. ]
  34973. [
  34974. [[link boost_asio.reference.basic_socket_iostream.duration [*duration]]]
  34975. [The duration type. ]
  34976. ]
  34977. [
  34978. [[link boost_asio.reference.basic_socket_iostream.duration_type [*duration_type]]]
  34979. [(Deprecated: Use duration.) The duration type. ]
  34980. ]
  34981. [
  34982. [[link boost_asio.reference.basic_socket_iostream.endpoint_type [*endpoint_type]]]
  34983. [The endpoint type. ]
  34984. ]
  34985. [
  34986. [[link boost_asio.reference.basic_socket_iostream.protocol_type [*protocol_type]]]
  34987. [The protocol type. ]
  34988. ]
  34989. [
  34990. [[link boost_asio.reference.basic_socket_iostream.time_point [*time_point]]]
  34991. [The time type. ]
  34992. ]
  34993. [
  34994. [[link boost_asio.reference.basic_socket_iostream.time_type [*time_type]]]
  34995. [(Deprecated: Use time_point.) The time type. ]
  34996. ]
  34997. ]
  34998. [heading Member Functions]
  34999. [table
  35000. [[Name][Description]]
  35001. [
  35002. [[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream [*basic_socket_iostream]]]
  35003. [Construct a basic_socket_iostream without establishing a connection.
  35004. [hr]
  35005. Construct a basic_socket_iostream from the supplied socket.
  35006. [hr]
  35007. Move-construct a basic_socket_iostream from another.
  35008. [hr]
  35009. Establish a connection to an endpoint corresponding to a resolver query. ]
  35010. ]
  35011. [
  35012. [[link boost_asio.reference.basic_socket_iostream.close [*close]]]
  35013. [Close the connection. ]
  35014. ]
  35015. [
  35016. [[link boost_asio.reference.basic_socket_iostream.connect [*connect]]]
  35017. [Establish a connection to an endpoint corresponding to a resolver query. ]
  35018. ]
  35019. [
  35020. [[link boost_asio.reference.basic_socket_iostream.error [*error]]]
  35021. [Get the last error associated with the stream. ]
  35022. ]
  35023. [
  35024. [[link boost_asio.reference.basic_socket_iostream.expires_after [*expires_after]]]
  35025. [Set the stream's expiry time relative to now. ]
  35026. ]
  35027. [
  35028. [[link boost_asio.reference.basic_socket_iostream.expires_at [*expires_at]]]
  35029. [(Deprecated: Use expiry().) Get the stream's expiry time as an absolute time.
  35030. [hr]
  35031. Set the stream's expiry time as an absolute time. ]
  35032. ]
  35033. [
  35034. [[link boost_asio.reference.basic_socket_iostream.expires_from_now [*expires_from_now]]]
  35035. [(Deprecated: Use expiry().) Get the stream's expiry time relative to now.
  35036. [hr]
  35037. (Deprecated: Use expires_after().) Set the stream's expiry time relative to now. ]
  35038. ]
  35039. [
  35040. [[link boost_asio.reference.basic_socket_iostream.expiry [*expiry]]]
  35041. [Get the stream's expiry time as an absolute time. ]
  35042. ]
  35043. [
  35044. [[link boost_asio.reference.basic_socket_iostream.operator_eq_ [*operator=]]]
  35045. [Move-assign a basic_socket_iostream from another. ]
  35046. ]
  35047. [
  35048. [[link boost_asio.reference.basic_socket_iostream.rdbuf [*rdbuf]]]
  35049. [Return a pointer to the underlying streambuf. ]
  35050. ]
  35051. [
  35052. [[link boost_asio.reference.basic_socket_iostream.socket [*socket]]]
  35053. [Get a reference to the underlying socket. ]
  35054. ]
  35055. ]
  35056. [heading Requirements]
  35057. ['Header: ][^boost/asio/generic/stream_protocol.hpp]
  35058. ['Convenience header: ][^boost/asio.hpp]
  35059. [endsect]
  35060. [section:operator_not__eq_ generic::stream_protocol::operator!=]
  35061. [indexterm2 boost_asio.indexterm.generic__stream_protocol.operator_not__eq_..operator!=..generic::stream_protocol]
  35062. Compare two protocols for inequality.
  35063. friend bool operator!=(
  35064. const stream_protocol & p1,
  35065. const stream_protocol & p2);
  35066. [heading Requirements]
  35067. ['Header: ][^boost/asio/generic/stream_protocol.hpp]
  35068. ['Convenience header: ][^boost/asio.hpp]
  35069. [endsect]
  35070. [section:operator_eq__eq_ generic::stream_protocol::operator==]
  35071. [indexterm2 boost_asio.indexterm.generic__stream_protocol.operator_eq__eq_..operator==..generic::stream_protocol]
  35072. Compare two protocols for equality.
  35073. friend bool operator==(
  35074. const stream_protocol & p1,
  35075. const stream_protocol & p2);
  35076. [heading Requirements]
  35077. ['Header: ][^boost/asio/generic/stream_protocol.hpp]
  35078. ['Convenience header: ][^boost/asio.hpp]
  35079. [endsect]
  35080. [section:protocol generic::stream_protocol::protocol]
  35081. [indexterm2 boost_asio.indexterm.generic__stream_protocol.protocol..protocol..generic::stream_protocol]
  35082. Obtain an identifier for the protocol.
  35083. int protocol() const;
  35084. [endsect]
  35085. [section:socket generic::stream_protocol::socket]
  35086. [indexterm2 boost_asio.indexterm.generic__stream_protocol.socket..socket..generic::stream_protocol]
  35087. The generic socket type.
  35088. typedef basic_stream_socket< stream_protocol > socket;
  35089. [heading Types]
  35090. [table
  35091. [[Name][Description]]
  35092. [
  35093. [[link boost_asio.reference.basic_stream_socket__rebind_executor [*rebind_executor]]]
  35094. [Rebinds the socket type to another executor. ]
  35095. ]
  35096. [
  35097. [[link boost_asio.reference.basic_stream_socket.broadcast [*broadcast]]]
  35098. [Socket option to permit sending of broadcast messages. ]
  35099. ]
  35100. [
  35101. [[link boost_asio.reference.basic_stream_socket.bytes_readable [*bytes_readable]]]
  35102. [IO control command to get the amount of data that can be read without blocking. ]
  35103. ]
  35104. [
  35105. [[link boost_asio.reference.basic_stream_socket.debug [*debug]]]
  35106. [Socket option to enable socket-level debugging. ]
  35107. ]
  35108. [
  35109. [[link boost_asio.reference.basic_stream_socket.do_not_route [*do_not_route]]]
  35110. [Socket option to prevent routing, use local interfaces only. ]
  35111. ]
  35112. [
  35113. [[link boost_asio.reference.basic_stream_socket.enable_connection_aborted [*enable_connection_aborted]]]
  35114. [Socket option to report aborted connections on accept. ]
  35115. ]
  35116. [
  35117. [[link boost_asio.reference.basic_stream_socket.endpoint_type [*endpoint_type]]]
  35118. [The endpoint type. ]
  35119. ]
  35120. [
  35121. [[link boost_asio.reference.basic_stream_socket.executor_type [*executor_type]]]
  35122. [The type of the executor associated with the object. ]
  35123. ]
  35124. [
  35125. [[link boost_asio.reference.basic_stream_socket.keep_alive [*keep_alive]]]
  35126. [Socket option to send keep-alives. ]
  35127. ]
  35128. [
  35129. [[link boost_asio.reference.basic_stream_socket.linger [*linger]]]
  35130. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  35131. ]
  35132. [
  35133. [[link boost_asio.reference.basic_stream_socket.lowest_layer_type [*lowest_layer_type]]]
  35134. [A basic_socket is always the lowest layer. ]
  35135. ]
  35136. [
  35137. [[link boost_asio.reference.basic_stream_socket.message_flags [*message_flags]]]
  35138. [Bitmask type for flags that can be passed to send and receive operations. ]
  35139. ]
  35140. [
  35141. [[link boost_asio.reference.basic_stream_socket.native_handle_type [*native_handle_type]]]
  35142. [The native representation of a socket. ]
  35143. ]
  35144. [
  35145. [[link boost_asio.reference.basic_stream_socket.out_of_band_inline [*out_of_band_inline]]]
  35146. [Socket option for putting received out-of-band data inline. ]
  35147. ]
  35148. [
  35149. [[link boost_asio.reference.basic_stream_socket.protocol_type [*protocol_type]]]
  35150. [The protocol type. ]
  35151. ]
  35152. [
  35153. [[link boost_asio.reference.basic_stream_socket.receive_buffer_size [*receive_buffer_size]]]
  35154. [Socket option for the receive buffer size of a socket. ]
  35155. ]
  35156. [
  35157. [[link boost_asio.reference.basic_stream_socket.receive_low_watermark [*receive_low_watermark]]]
  35158. [Socket option for the receive low watermark. ]
  35159. ]
  35160. [
  35161. [[link boost_asio.reference.basic_stream_socket.reuse_address [*reuse_address]]]
  35162. [Socket option to allow the socket to be bound to an address that is already in use. ]
  35163. ]
  35164. [
  35165. [[link boost_asio.reference.basic_stream_socket.send_buffer_size [*send_buffer_size]]]
  35166. [Socket option for the send buffer size of a socket. ]
  35167. ]
  35168. [
  35169. [[link boost_asio.reference.basic_stream_socket.send_low_watermark [*send_low_watermark]]]
  35170. [Socket option for the send low watermark. ]
  35171. ]
  35172. [
  35173. [[link boost_asio.reference.basic_stream_socket.shutdown_type [*shutdown_type]]]
  35174. [Different ways a socket may be shutdown. ]
  35175. ]
  35176. [
  35177. [[link boost_asio.reference.basic_stream_socket.wait_type [*wait_type]]]
  35178. [Wait types. ]
  35179. ]
  35180. ]
  35181. [heading Member Functions]
  35182. [table
  35183. [[Name][Description]]
  35184. [
  35185. [[link boost_asio.reference.basic_stream_socket.assign [*assign]]]
  35186. [Assign an existing native socket to the socket. ]
  35187. ]
  35188. [
  35189. [[link boost_asio.reference.basic_stream_socket.async_connect [*async_connect]]]
  35190. [Start an asynchronous connect. ]
  35191. ]
  35192. [
  35193. [[link boost_asio.reference.basic_stream_socket.async_read_some [*async_read_some]]]
  35194. [Start an asynchronous read. ]
  35195. ]
  35196. [
  35197. [[link boost_asio.reference.basic_stream_socket.async_receive [*async_receive]]]
  35198. [Start an asynchronous receive. ]
  35199. ]
  35200. [
  35201. [[link boost_asio.reference.basic_stream_socket.async_send [*async_send]]]
  35202. [Start an asynchronous send. ]
  35203. ]
  35204. [
  35205. [[link boost_asio.reference.basic_stream_socket.async_wait [*async_wait]]]
  35206. [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  35207. ]
  35208. [
  35209. [[link boost_asio.reference.basic_stream_socket.async_write_some [*async_write_some]]]
  35210. [Start an asynchronous write. ]
  35211. ]
  35212. [
  35213. [[link boost_asio.reference.basic_stream_socket.at_mark [*at_mark]]]
  35214. [Determine whether the socket is at the out-of-band data mark. ]
  35215. ]
  35216. [
  35217. [[link boost_asio.reference.basic_stream_socket.available [*available]]]
  35218. [Determine the number of bytes available for reading. ]
  35219. ]
  35220. [
  35221. [[link boost_asio.reference.basic_stream_socket.basic_stream_socket [*basic_stream_socket]]]
  35222. [Construct a basic_stream_socket without opening it.
  35223. [hr]
  35224. Construct and open a basic_stream_socket.
  35225. [hr]
  35226. Construct a basic_stream_socket, opening it and binding it to the given local endpoint.
  35227. [hr]
  35228. Construct a basic_stream_socket on an existing native socket.
  35229. [hr]
  35230. Move-construct a basic_stream_socket from another.
  35231. [hr]
  35232. Move-construct a basic_stream_socket from a socket of another protocol type. ]
  35233. ]
  35234. [
  35235. [[link boost_asio.reference.basic_stream_socket.bind [*bind]]]
  35236. [Bind the socket to the given local endpoint. ]
  35237. ]
  35238. [
  35239. [[link boost_asio.reference.basic_stream_socket.cancel [*cancel]]]
  35240. [Cancel all asynchronous operations associated with the socket. ]
  35241. ]
  35242. [
  35243. [[link boost_asio.reference.basic_stream_socket.close [*close]]]
  35244. [Close the socket. ]
  35245. ]
  35246. [
  35247. [[link boost_asio.reference.basic_stream_socket.connect [*connect]]]
  35248. [Connect the socket to the specified endpoint. ]
  35249. ]
  35250. [
  35251. [[link boost_asio.reference.basic_stream_socket.get_executor [*get_executor]]]
  35252. [Get the executor associated with the object. ]
  35253. ]
  35254. [
  35255. [[link boost_asio.reference.basic_stream_socket.get_option [*get_option]]]
  35256. [Get an option from the socket. ]
  35257. ]
  35258. [
  35259. [[link boost_asio.reference.basic_stream_socket.io_control [*io_control]]]
  35260. [Perform an IO control command on the socket. ]
  35261. ]
  35262. [
  35263. [[link boost_asio.reference.basic_stream_socket.is_open [*is_open]]]
  35264. [Determine whether the socket is open. ]
  35265. ]
  35266. [
  35267. [[link boost_asio.reference.basic_stream_socket.local_endpoint [*local_endpoint]]]
  35268. [Get the local endpoint of the socket. ]
  35269. ]
  35270. [
  35271. [[link boost_asio.reference.basic_stream_socket.lowest_layer [*lowest_layer]]]
  35272. [Get a reference to the lowest layer.
  35273. [hr]
  35274. Get a const reference to the lowest layer. ]
  35275. ]
  35276. [
  35277. [[link boost_asio.reference.basic_stream_socket.native_handle [*native_handle]]]
  35278. [Get the native socket representation. ]
  35279. ]
  35280. [
  35281. [[link boost_asio.reference.basic_stream_socket.native_non_blocking [*native_non_blocking]]]
  35282. [Gets the non-blocking mode of the native socket implementation.
  35283. [hr]
  35284. Sets the non-blocking mode of the native socket implementation. ]
  35285. ]
  35286. [
  35287. [[link boost_asio.reference.basic_stream_socket.non_blocking [*non_blocking]]]
  35288. [Gets the non-blocking mode of the socket.
  35289. [hr]
  35290. Sets the non-blocking mode of the socket. ]
  35291. ]
  35292. [
  35293. [[link boost_asio.reference.basic_stream_socket.open [*open]]]
  35294. [Open the socket using the specified protocol. ]
  35295. ]
  35296. [
  35297. [[link boost_asio.reference.basic_stream_socket.operator_eq_ [*operator=]]]
  35298. [Move-assign a basic_stream_socket from another.
  35299. [hr]
  35300. Move-assign a basic_stream_socket from a socket of another protocol type. ]
  35301. ]
  35302. [
  35303. [[link boost_asio.reference.basic_stream_socket.read_some [*read_some]]]
  35304. [Read some data from the socket. ]
  35305. ]
  35306. [
  35307. [[link boost_asio.reference.basic_stream_socket.receive [*receive]]]
  35308. [Receive some data on the socket.
  35309. [hr]
  35310. Receive some data on a connected socket. ]
  35311. ]
  35312. [
  35313. [[link boost_asio.reference.basic_stream_socket.release [*release]]]
  35314. [Release ownership of the underlying native socket. ]
  35315. ]
  35316. [
  35317. [[link boost_asio.reference.basic_stream_socket.remote_endpoint [*remote_endpoint]]]
  35318. [Get the remote endpoint of the socket. ]
  35319. ]
  35320. [
  35321. [[link boost_asio.reference.basic_stream_socket.send [*send]]]
  35322. [Send some data on the socket. ]
  35323. ]
  35324. [
  35325. [[link boost_asio.reference.basic_stream_socket.set_option [*set_option]]]
  35326. [Set an option on the socket. ]
  35327. ]
  35328. [
  35329. [[link boost_asio.reference.basic_stream_socket.shutdown [*shutdown]]]
  35330. [Disable sends or receives on the socket. ]
  35331. ]
  35332. [
  35333. [[link boost_asio.reference.basic_stream_socket.wait [*wait]]]
  35334. [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  35335. ]
  35336. [
  35337. [[link boost_asio.reference.basic_stream_socket.write_some [*write_some]]]
  35338. [Write some data to the socket. ]
  35339. ]
  35340. [
  35341. [[link boost_asio.reference.basic_stream_socket._basic_stream_socket [*~basic_stream_socket]]]
  35342. [Destroys the socket. ]
  35343. ]
  35344. ]
  35345. [heading Data Members]
  35346. [table
  35347. [[Name][Description]]
  35348. [
  35349. [[link boost_asio.reference.basic_stream_socket.max_connections [*max_connections]]]
  35350. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  35351. ]
  35352. [
  35353. [[link boost_asio.reference.basic_stream_socket.max_listen_connections [*max_listen_connections]]]
  35354. [The maximum length of the queue of pending incoming connections. ]
  35355. ]
  35356. [
  35357. [[link boost_asio.reference.basic_stream_socket.message_do_not_route [*message_do_not_route]]]
  35358. [Specify that the data should not be subject to routing. ]
  35359. ]
  35360. [
  35361. [[link boost_asio.reference.basic_stream_socket.message_end_of_record [*message_end_of_record]]]
  35362. [Specifies that the data marks the end of a record. ]
  35363. ]
  35364. [
  35365. [[link boost_asio.reference.basic_stream_socket.message_out_of_band [*message_out_of_band]]]
  35366. [Process out-of-band data. ]
  35367. ]
  35368. [
  35369. [[link boost_asio.reference.basic_stream_socket.message_peek [*message_peek]]]
  35370. [Peek at incoming data without removing it from the input queue. ]
  35371. ]
  35372. ]
  35373. [heading Protected Data Members]
  35374. [table
  35375. [[Name][Description]]
  35376. [
  35377. [[link boost_asio.reference.basic_stream_socket.impl_ [*impl_]]]
  35378. []
  35379. ]
  35380. ]
  35381. The [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] class template provides asynchronous and blocking stream-oriented socket functionality.
  35382. [heading Thread Safety]
  35383. ['Distinct] ['objects:] Safe.
  35384. ['Shared] ['objects:] Unsafe.
  35385. [heading Requirements]
  35386. ['Header: ][^boost/asio/generic/stream_protocol.hpp]
  35387. ['Convenience header: ][^boost/asio.hpp]
  35388. [endsect]
  35389. [section:stream_protocol generic::stream_protocol::stream_protocol]
  35390. [indexterm2 boost_asio.indexterm.generic__stream_protocol.stream_protocol..stream_protocol..generic::stream_protocol]
  35391. Construct a protocol object for a specific address family and protocol.
  35392. ``[link boost_asio.reference.generic__stream_protocol.stream_protocol.overload1 stream_protocol]``(
  35393. int address_family,
  35394. int socket_protocol);
  35395. `` [''''&raquo;''' [link boost_asio.reference.generic__stream_protocol.stream_protocol.overload1 more...]]``
  35396. Construct a generic protocol object from a specific protocol.
  35397. template<
  35398. typename ``[link boost_asio.reference.Protocol Protocol]``>
  35399. ``[link boost_asio.reference.generic__stream_protocol.stream_protocol.overload2 stream_protocol]``(
  35400. const Protocol & source_protocol);
  35401. `` [''''&raquo;''' [link boost_asio.reference.generic__stream_protocol.stream_protocol.overload2 more...]]``
  35402. [section:overload1 generic::stream_protocol::stream_protocol (1 of 2 overloads)]
  35403. Construct a protocol object for a specific address family and protocol.
  35404. stream_protocol(
  35405. int address_family,
  35406. int socket_protocol);
  35407. [endsect]
  35408. [section:overload2 generic::stream_protocol::stream_protocol (2 of 2 overloads)]
  35409. Construct a generic protocol object from a specific protocol.
  35410. template<
  35411. typename ``[link boost_asio.reference.Protocol Protocol]``>
  35412. stream_protocol(
  35413. const Protocol & source_protocol);
  35414. [heading Exceptions]
  35415. [variablelist
  35416. [[@c][bad\_cast Thrown if the source protocol is not stream-oriented. ]]
  35417. ]
  35418. [endsect]
  35419. [endsect]
  35420. [section:type generic::stream_protocol::type]
  35421. [indexterm2 boost_asio.indexterm.generic__stream_protocol.type..type..generic::stream_protocol]
  35422. Obtain an identifier for the type of the protocol.
  35423. int type() const;
  35424. [endsect]
  35425. [endsect]
  35426. [section:get_associated_allocator get_associated_allocator]
  35427. [indexterm1 boost_asio.indexterm.get_associated_allocator..get_associated_allocator]
  35428. Helper function to obtain an object's associated allocator.
  35429. template<
  35430. typename T>
  35431. associated_allocator< T >::type ``[link boost_asio.reference.get_associated_allocator.overload1 get_associated_allocator]``(
  35432. const T & t);
  35433. `` [''''&raquo;''' [link boost_asio.reference.get_associated_allocator.overload1 more...]]``
  35434. template<
  35435. typename T,
  35436. typename Allocator>
  35437. associated_allocator< T, Allocator >::type ``[link boost_asio.reference.get_associated_allocator.overload2 get_associated_allocator]``(
  35438. const T & t,
  35439. const Allocator & a);
  35440. `` [''''&raquo;''' [link boost_asio.reference.get_associated_allocator.overload2 more...]]``
  35441. [heading Requirements]
  35442. ['Header: ][^boost/asio/associated_allocator.hpp]
  35443. ['Convenience header: ][^boost/asio.hpp]
  35444. [section:overload1 get_associated_allocator (1 of 2 overloads)]
  35445. Helper function to obtain an object's associated allocator.
  35446. template<
  35447. typename T>
  35448. associated_allocator< T >::type get_associated_allocator(
  35449. const T & t);
  35450. [heading Return Value]
  35451. `associated_allocator<T>::get(t)`
  35452. [endsect]
  35453. [section:overload2 get_associated_allocator (2 of 2 overloads)]
  35454. Helper function to obtain an object's associated allocator.
  35455. template<
  35456. typename T,
  35457. typename Allocator>
  35458. associated_allocator< T, Allocator >::type get_associated_allocator(
  35459. const T & t,
  35460. const Allocator & a);
  35461. [heading Return Value]
  35462. `associated_allocator<T, Allocator>::get(t, a)`
  35463. [endsect]
  35464. [endsect]
  35465. [section:get_associated_executor get_associated_executor]
  35466. [indexterm1 boost_asio.indexterm.get_associated_executor..get_associated_executor]
  35467. Helper function to obtain an object's associated executor.
  35468. template<
  35469. typename T>
  35470. associated_executor< T >::type ``[link boost_asio.reference.get_associated_executor.overload1 get_associated_executor]``(
  35471. const T & t);
  35472. `` [''''&raquo;''' [link boost_asio.reference.get_associated_executor.overload1 more...]]``
  35473. template<
  35474. typename T,
  35475. typename ``[link boost_asio.reference.Executor1 Executor]``>
  35476. associated_executor< T, Executor >::type ``[link boost_asio.reference.get_associated_executor.overload2 get_associated_executor]``(
  35477. const T & t,
  35478. const Executor & ex,
  35479. typename enable_if< is_executor< Executor >::value >::type * = 0);
  35480. `` [''''&raquo;''' [link boost_asio.reference.get_associated_executor.overload2 more...]]``
  35481. template<
  35482. typename T,
  35483. typename ExecutionContext>
  35484. associated_executor< T, typename ExecutionContext::executor_type >::type ``[link boost_asio.reference.get_associated_executor.overload3 get_associated_executor]``(
  35485. const T & t,
  35486. ExecutionContext & ctx,
  35487. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  35488. `` [''''&raquo;''' [link boost_asio.reference.get_associated_executor.overload3 more...]]``
  35489. [heading Requirements]
  35490. ['Header: ][^boost/asio/associated_executor.hpp]
  35491. ['Convenience header: ][^boost/asio.hpp]
  35492. [section:overload1 get_associated_executor (1 of 3 overloads)]
  35493. Helper function to obtain an object's associated executor.
  35494. template<
  35495. typename T>
  35496. associated_executor< T >::type get_associated_executor(
  35497. const T & t);
  35498. [heading Return Value]
  35499. `associated_executor<T>::get(t)`
  35500. [endsect]
  35501. [section:overload2 get_associated_executor (2 of 3 overloads)]
  35502. Helper function to obtain an object's associated executor.
  35503. template<
  35504. typename T,
  35505. typename ``[link boost_asio.reference.Executor1 Executor]``>
  35506. associated_executor< T, Executor >::type get_associated_executor(
  35507. const T & t,
  35508. const Executor & ex,
  35509. typename enable_if< is_executor< Executor >::value >::type * = 0);
  35510. [heading Return Value]
  35511. `associated_executor<T, Executor>::get(t, ex)`
  35512. [endsect]
  35513. [section:overload3 get_associated_executor (3 of 3 overloads)]
  35514. Helper function to obtain an object's associated executor.
  35515. template<
  35516. typename T,
  35517. typename ExecutionContext>
  35518. associated_executor< T, typename ExecutionContext::executor_type >::type get_associated_executor(
  35519. const T & t,
  35520. ExecutionContext & ctx,
  35521. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  35522. [heading Return Value]
  35523. `associated_executor<T, typename ExecutionContext::executor_type>get(t, ctx.get_executor())`
  35524. [endsect]
  35525. [endsect]
  35526. [section:high_resolution_timer high_resolution_timer]
  35527. [indexterm1 boost_asio.indexterm.high_resolution_timer..high_resolution_timer]
  35528. Typedef for a timer based on the high resolution clock.
  35529. typedef basic_waitable_timer< chrono::high_resolution_clock > high_resolution_timer;
  35530. [heading Types]
  35531. [table
  35532. [[Name][Description]]
  35533. [
  35534. [[link boost_asio.reference.basic_waitable_timer__rebind_executor [*rebind_executor]]]
  35535. [Rebinds the timer type to another executor. ]
  35536. ]
  35537. [
  35538. [[link boost_asio.reference.basic_waitable_timer.clock_type [*clock_type]]]
  35539. [The clock type. ]
  35540. ]
  35541. [
  35542. [[link boost_asio.reference.basic_waitable_timer.duration [*duration]]]
  35543. [The duration type of the clock. ]
  35544. ]
  35545. [
  35546. [[link boost_asio.reference.basic_waitable_timer.executor_type [*executor_type]]]
  35547. [The type of the executor associated with the object. ]
  35548. ]
  35549. [
  35550. [[link boost_asio.reference.basic_waitable_timer.time_point [*time_point]]]
  35551. [The time point type of the clock. ]
  35552. ]
  35553. [
  35554. [[link boost_asio.reference.basic_waitable_timer.traits_type [*traits_type]]]
  35555. [The wait traits type. ]
  35556. ]
  35557. ]
  35558. [heading Member Functions]
  35559. [table
  35560. [[Name][Description]]
  35561. [
  35562. [[link boost_asio.reference.basic_waitable_timer.async_wait [*async_wait]]]
  35563. [Start an asynchronous wait on the timer. ]
  35564. ]
  35565. [
  35566. [[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer [*basic_waitable_timer]]]
  35567. [Constructor.
  35568. [hr]
  35569. Constructor to set a particular expiry time as an absolute time.
  35570. [hr]
  35571. Constructor to set a particular expiry time relative to now.
  35572. [hr]
  35573. Move-construct a basic_waitable_timer from another. ]
  35574. ]
  35575. [
  35576. [[link boost_asio.reference.basic_waitable_timer.cancel [*cancel]]]
  35577. [Cancel any asynchronous operations that are waiting on the timer.
  35578. [hr]
  35579. (Deprecated: Use non-error_code overload.) Cancel any asynchronous operations that are waiting on the timer. ]
  35580. ]
  35581. [
  35582. [[link boost_asio.reference.basic_waitable_timer.cancel_one [*cancel_one]]]
  35583. [Cancels one asynchronous operation that is waiting on the timer.
  35584. [hr]
  35585. (Deprecated: Use non-error_code overload.) Cancels one asynchronous operation that is waiting on the timer. ]
  35586. ]
  35587. [
  35588. [[link boost_asio.reference.basic_waitable_timer.expires_after [*expires_after]]]
  35589. [Set the timer's expiry time relative to now. ]
  35590. ]
  35591. [
  35592. [[link boost_asio.reference.basic_waitable_timer.expires_at [*expires_at]]]
  35593. [(Deprecated: Use expiry().) Get the timer's expiry time as an absolute time.
  35594. [hr]
  35595. Set the timer's expiry time as an absolute time.
  35596. [hr]
  35597. (Deprecated: Use non-error_code overload.) Set the timer's expiry time as an absolute time. ]
  35598. ]
  35599. [
  35600. [[link boost_asio.reference.basic_waitable_timer.expires_from_now [*expires_from_now]]]
  35601. [(Deprecated: Use expiry().) Get the timer's expiry time relative to now.
  35602. [hr]
  35603. (Deprecated: Use expires_after().) Set the timer's expiry time relative to now. ]
  35604. ]
  35605. [
  35606. [[link boost_asio.reference.basic_waitable_timer.expiry [*expiry]]]
  35607. [Get the timer's expiry time as an absolute time. ]
  35608. ]
  35609. [
  35610. [[link boost_asio.reference.basic_waitable_timer.get_executor [*get_executor]]]
  35611. [Get the executor associated with the object. ]
  35612. ]
  35613. [
  35614. [[link boost_asio.reference.basic_waitable_timer.operator_eq_ [*operator=]]]
  35615. [Move-assign a basic_waitable_timer from another. ]
  35616. ]
  35617. [
  35618. [[link boost_asio.reference.basic_waitable_timer.wait [*wait]]]
  35619. [Perform a blocking wait on the timer. ]
  35620. ]
  35621. [
  35622. [[link boost_asio.reference.basic_waitable_timer._basic_waitable_timer [*~basic_waitable_timer]]]
  35623. [Destroys the timer. ]
  35624. ]
  35625. ]
  35626. The [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] class template provides the ability to perform a blocking or asynchronous wait for a timer to expire.
  35627. A waitable timer is always in one of two states: "expired" or "not expired". If the `wait()` or `async_wait()` function is called on an expired timer, the wait operation will complete immediately.
  35628. Most applications will use one of the [link boost_asio.reference.steady_timer `steady_timer`], [link boost_asio.reference.system_timer `system_timer`] or [link boost_asio.reference.high_resolution_timer `high_resolution_timer`] typedefs.
  35629. [heading Remarks]
  35630. This waitable timer functionality is for use with the C++11 standard library's `<chrono>` facility, or with the Boost.Chrono library.
  35631. [heading Thread Safety]
  35632. ['Distinct] ['objects:] Safe.
  35633. ['Shared] ['objects:] Unsafe.
  35634. [heading Examples]
  35635. Performing a blocking wait (C++11):
  35636. // Construct a timer without setting an expiry time.
  35637. boost::asio::steady_timer timer(my_context);
  35638. // Set an expiry time relative to now.
  35639. timer.expires_after(std::chrono::seconds(5));
  35640. // Wait for the timer to expire.
  35641. timer.wait();
  35642. Performing an asynchronous wait (C++11):
  35643. void handler(const boost::system::error_code& error)
  35644. {
  35645. if (!error)
  35646. {
  35647. // Timer expired.
  35648. }
  35649. }
  35650. ...
  35651. // Construct a timer with an absolute expiry time.
  35652. boost::asio::steady_timer timer(my_context,
  35653. std::chrono::steady_clock::now() + std::chrono::seconds(60));
  35654. // Start an asynchronous wait.
  35655. timer.async_wait(handler);
  35656. [heading Changing an active waitable timer's expiry time]
  35657. Changing the expiry time of a timer while there are pending asynchronous waits causes those wait operations to be cancelled. To ensure that the action associated with the timer is performed only once, use something like this: used:
  35658. void on_some_event()
  35659. {
  35660. if (my_timer.expires_after(seconds(5)) > 0)
  35661. {
  35662. // We managed to cancel the timer. Start new asynchronous wait.
  35663. my_timer.async_wait(on_timeout);
  35664. }
  35665. else
  35666. {
  35667. // Too late, timer has already expired!
  35668. }
  35669. }
  35670. void on_timeout(const boost::system::error_code& e)
  35671. {
  35672. if (e != boost::asio::error::operation_aborted)
  35673. {
  35674. // Timer was not cancelled, take necessary action.
  35675. }
  35676. }
  35677. * 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.
  35678. * If a wait handler is cancelled, the boost::system::error\_code passed to it contains the value `boost::asio::error::operation_aborted`.
  35679. This typedef uses the C++11 `<chrono>` standard library facility, if available. Otherwise, it may use the Boost.Chrono library. To explicitly utilise Boost.Chrono, use the [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] template directly:
  35680. typedef basic_waitable_timer<boost::chrono::high_resolution_clock> timer;
  35681. [heading Requirements]
  35682. ['Header: ][^boost/asio/high_resolution_timer.hpp]
  35683. ['Convenience header: ][^boost/asio.hpp]
  35684. [endsect]
  35685. [section:invalid_service_owner invalid_service_owner]
  35686. Exception thrown when trying to add a service object to an [link boost_asio.reference.execution_context `execution_context`] where the service has a different owner.
  35687. class invalid_service_owner
  35688. [heading Member Functions]
  35689. [table
  35690. [[Name][Description]]
  35691. [
  35692. [[link boost_asio.reference.invalid_service_owner.invalid_service_owner [*invalid_service_owner]]]
  35693. []
  35694. ]
  35695. ]
  35696. [heading Requirements]
  35697. ['Header: ][^boost/asio/execution_context.hpp]
  35698. ['Convenience header: ][^boost/asio.hpp]
  35699. [section:invalid_service_owner invalid_service_owner::invalid_service_owner]
  35700. [indexterm2 boost_asio.indexterm.invalid_service_owner.invalid_service_owner..invalid_service_owner..invalid_service_owner]
  35701. invalid_service_owner();
  35702. [endsect]
  35703. [endsect]
  35704. [section:io_context io_context]
  35705. Provides core I/O functionality.
  35706. class io_context :
  35707. public execution_context
  35708. [heading Types]
  35709. [table
  35710. [[Name][Description]]
  35711. [
  35712. [[link boost_asio.reference.io_context__executor_type [*executor_type]]]
  35713. [Executor used to submit functions to an io_context. ]
  35714. ]
  35715. [
  35716. [[link boost_asio.reference.io_context__service [*service]]]
  35717. [Base class for all io_context services. ]
  35718. ]
  35719. [
  35720. [[link boost_asio.reference.io_context__strand [*strand]]]
  35721. [Provides serialised handler execution. ]
  35722. ]
  35723. [
  35724. [[link boost_asio.reference.io_context__work [*work]]]
  35725. [(Deprecated: Use executor_work_guard.) Class to inform the io_context when it has work to do. ]
  35726. ]
  35727. [
  35728. [[link boost_asio.reference.io_context.count_type [*count_type]]]
  35729. [The type used to count the number of handlers executed by the context. ]
  35730. ]
  35731. [
  35732. [[link boost_asio.reference.io_context.fork_event [*fork_event]]]
  35733. [Fork-related event notifications. ]
  35734. ]
  35735. ]
  35736. [heading Member Functions]
  35737. [table
  35738. [[Name][Description]]
  35739. [
  35740. [[link boost_asio.reference.io_context.dispatch [*dispatch]]]
  35741. [(Deprecated: Use boost::asio::dispatch().) Request the io_context to invoke the given handler. ]
  35742. ]
  35743. [
  35744. [[link boost_asio.reference.io_context.get_executor [*get_executor]]]
  35745. [Obtains the executor associated with the io_context. ]
  35746. ]
  35747. [
  35748. [[link boost_asio.reference.io_context.io_context [*io_context]]]
  35749. [Constructor. ]
  35750. ]
  35751. [
  35752. [[link boost_asio.reference.io_context.notify_fork [*notify_fork]]]
  35753. [Notify the execution_context of a fork-related event. ]
  35754. ]
  35755. [
  35756. [[link boost_asio.reference.io_context.poll [*poll]]]
  35757. [Run the io_context object's event processing loop to execute ready handlers.
  35758. [hr]
  35759. (Deprecated: Use non-error_code overload.) Run the io_context object's event processing loop to execute ready handlers. ]
  35760. ]
  35761. [
  35762. [[link boost_asio.reference.io_context.poll_one [*poll_one]]]
  35763. [Run the io_context object's event processing loop to execute one ready handler.
  35764. [hr]
  35765. (Deprecated: Use non-error_code overload.) Run the io_context object's event processing loop to execute one ready handler. ]
  35766. ]
  35767. [
  35768. [[link boost_asio.reference.io_context.post [*post]]]
  35769. [(Deprecated: Use boost::asio::post().) Request the io_context to invoke the given handler and return immediately. ]
  35770. ]
  35771. [
  35772. [[link boost_asio.reference.io_context.reset [*reset]]]
  35773. [(Deprecated: Use restart().) Reset the io_context in preparation for a subsequent run() invocation. ]
  35774. ]
  35775. [
  35776. [[link boost_asio.reference.io_context.restart [*restart]]]
  35777. [Restart the io_context in preparation for a subsequent run() invocation. ]
  35778. ]
  35779. [
  35780. [[link boost_asio.reference.io_context.run [*run]]]
  35781. [Run the io_context object's event processing loop.
  35782. [hr]
  35783. (Deprecated: Use non-error_code overload.) Run the io_context object's event processing loop. ]
  35784. ]
  35785. [
  35786. [[link boost_asio.reference.io_context.run_for [*run_for]]]
  35787. [Run the io_context object's event processing loop for a specified duration. ]
  35788. ]
  35789. [
  35790. [[link boost_asio.reference.io_context.run_one [*run_one]]]
  35791. [Run the io_context object's event processing loop to execute at most one handler.
  35792. [hr]
  35793. (Deprecated: Use non-error_code overlaod.) Run the io_context object's event processing loop to execute at most one handler. ]
  35794. ]
  35795. [
  35796. [[link boost_asio.reference.io_context.run_one_for [*run_one_for]]]
  35797. [Run the io_context object's event processing loop for a specified duration to execute at most one handler. ]
  35798. ]
  35799. [
  35800. [[link boost_asio.reference.io_context.run_one_until [*run_one_until]]]
  35801. [Run the io_context object's event processing loop until a specified time to execute at most one handler. ]
  35802. ]
  35803. [
  35804. [[link boost_asio.reference.io_context.run_until [*run_until]]]
  35805. [Run the io_context object's event processing loop until a specified time. ]
  35806. ]
  35807. [
  35808. [[link boost_asio.reference.io_context.stop [*stop]]]
  35809. [Stop the io_context object's event processing loop. ]
  35810. ]
  35811. [
  35812. [[link boost_asio.reference.io_context.stopped [*stopped]]]
  35813. [Determine whether the io_context object has been stopped. ]
  35814. ]
  35815. [
  35816. [[link boost_asio.reference.io_context.wrap [*wrap]]]
  35817. [(Deprecated: Use boost::asio::bind_executor().) Create a new handler that automatically dispatches the wrapped handler on the io_context. ]
  35818. ]
  35819. [
  35820. [[link boost_asio.reference.io_context._io_context [*~io_context]]]
  35821. [Destructor. ]
  35822. ]
  35823. ]
  35824. [heading Protected Member Functions]
  35825. [table
  35826. [[Name][Description]]
  35827. [
  35828. [[link boost_asio.reference.io_context.destroy [*destroy]]]
  35829. [Destroys all services in the context. ]
  35830. ]
  35831. [
  35832. [[link boost_asio.reference.io_context.shutdown [*shutdown]]]
  35833. [Shuts down all services in the context. ]
  35834. ]
  35835. ]
  35836. [heading Friends]
  35837. [table
  35838. [[Name][Description]]
  35839. [
  35840. [[link boost_asio.reference.io_context.add_service [*add_service]]]
  35841. [(Deprecated: Use make_service().) Add a service object to the execution_context. ]
  35842. ]
  35843. [
  35844. [[link boost_asio.reference.io_context.has_service [*has_service]]]
  35845. [Determine if an execution_context contains a specified service type. ]
  35846. ]
  35847. [
  35848. [[link boost_asio.reference.io_context.make_service [*make_service]]]
  35849. [Creates a service object and adds it to the execution_context. ]
  35850. ]
  35851. [
  35852. [[link boost_asio.reference.io_context.use_service [*use_service]]]
  35853. [
  35854. [hr]
  35855. Obtain the service object corresponding to the given type. ]
  35856. ]
  35857. ]
  35858. The [link boost_asio.reference.io_context `io_context`] class provides the core I/O functionality for users of the asynchronous I/O objects, including:
  35859. * `boost::asio::ip::tcp::socket`
  35860. * `boost::asio::ip::tcp::acceptor`
  35861. * `boost::asio::ip::udp::socket`
  35862. * [link boost_asio.reference.deadline_timer `deadline_timer`].
  35863. The [link boost_asio.reference.io_context `io_context`] class also includes facilities intended for developers of custom asynchronous services.
  35864. [heading Thread Safety]
  35865. ['Distinct] ['objects:] Safe.
  35866. ['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.
  35867. [heading Synchronous and asynchronous operations]
  35868. Synchronous operations on I/O objects implicitly run the [link boost_asio.reference.io_context `io_context`] object for an individual operation. The [link boost_asio.reference.io_context `io_context`] functions `run()`, `run_one()`, `run_for()`, `run_until()`, `poll()` or `poll_one()` must be called for the [link boost_asio.reference.io_context `io_context`] to perform asynchronous operations on behalf of a C++ program. Notification that an asynchronous operation has completed is delivered by invocation of the associated handler. Handlers are invoked only by a thread that is currently calling any overload of `run()`, `run_one()`, `run_for()`, `run_until()`, `poll()` or `poll_one()` for the [link boost_asio.reference.io_context `io_context`].
  35869. [heading Effect of exceptions thrown from handlers]
  35870. If an exception is thrown from a handler, the exception is allowed to propagate through the throwing thread's invocation of `run()`, `run_one()`, `run_for()`, `run_until()`, `poll()` or `poll_one()`. No other threads that are calling any of these functions are affected. It is then the responsibility of the application to catch the exception.
  35871. After the exception has been caught, the `run()`, `run_one()`, `run_for()`, `run_until()`, `poll()` or `poll_one()` call may be restarted ['without] the need for an intervening call to `restart()`. This allows the thread to rejoin the [link boost_asio.reference.io_context `io_context`] object's thread pool without impacting any other threads in the pool.
  35872. For example:
  35873. boost::asio::io_context io_context;
  35874. ...
  35875. for (;;)
  35876. {
  35877. try
  35878. {
  35879. io_context.run();
  35880. break; // run() exited normally
  35881. }
  35882. catch (my_exception& e)
  35883. {
  35884. // Deal with exception as appropriate.
  35885. }
  35886. }
  35887. [heading Submitting arbitrary tasks to the io_context]
  35888. To submit functions to the [link boost_asio.reference.io_context `io_context`], use the [link boost_asio.reference.dispatch `dispatch`] , [link boost_asio.reference.post `post`] or [link boost_asio.reference.defer `defer`] free functions.
  35889. For example:
  35890. void my_task()
  35891. {
  35892. ...
  35893. }
  35894. ...
  35895. boost::asio::io_context io_context;
  35896. // Submit a function to the io_context.
  35897. boost::asio::post(io_context, my_task);
  35898. // Submit a lambda object to the io_context.
  35899. boost::asio::post(io_context,
  35900. []()
  35901. {
  35902. ...
  35903. });
  35904. // Run the io_context until it runs out of work.
  35905. io_context.run();
  35906. [heading Stopping the io_context from running out of work]
  35907. Some applications may need to prevent an [link boost_asio.reference.io_context `io_context`] object's `run()` call from returning when there is no more work to do. For example, the [link boost_asio.reference.io_context `io_context`] may be being run in a background thread that is launched prior to the application's asynchronous operations. The `run()` call may be kept running by creating an object of type boost::asio::executor\_work\_guard<io\_context::executor\_type>:
  35908. boost::asio::io_context io_context;
  35909. boost::asio::executor_work_guard<boost::asio::io_context::executor_type>
  35910. = boost::asio::make_work_guard(io_context);
  35911. ...
  35912. To effect a shutdown, the application will then need to call the [link boost_asio.reference.io_context `io_context`] object's `stop()` member function. This will cause the [link boost_asio.reference.io_context `io_context`] `run()` call to return as soon as possible, abandoning unfinished operations and without permitting ready handlers to be dispatched.
  35913. Alternatively, if the application requires that all operations and handlers be allowed to finish normally, the work object may be explicitly reset.
  35914. boost::asio::io_context io_context;
  35915. boost::asio::executor_work_guard<boost::asio::io_context::executor_type>
  35916. = boost::asio::make_work_guard(io_context);
  35917. ...
  35918. work.reset(); // Allow run() to exit.
  35919. [heading Requirements]
  35920. ['Header: ][^boost/asio/io_context.hpp]
  35921. ['Convenience header: ][^boost/asio.hpp]
  35922. [section:add_service io_context::add_service]
  35923. ['Inherited from execution_context.]
  35924. [indexterm2 boost_asio.indexterm.io_context.add_service..add_service..io_context]
  35925. (Deprecated: Use `make_service()`.) Add a service object to the [link boost_asio.reference.execution_context `execution_context`].
  35926. template<
  35927. typename ``[link boost_asio.reference.Service Service]``>
  35928. friend void add_service(
  35929. execution_context & e,
  35930. Service * svc);
  35931. This function is used to add a service to the [link boost_asio.reference.execution_context `execution_context`].
  35932. [heading Parameters]
  35933. [variablelist
  35934. [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
  35935. [[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:
  35936. ``
  35937. delete static_cast<execution_context::service*>(svc)
  35938. ``
  35939. ]]
  35940. ]
  35941. [heading Exceptions]
  35942. [variablelist
  35943. [[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`].]]
  35944. [[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. ]]
  35945. ]
  35946. [heading Requirements]
  35947. ['Header: ][^boost/asio/io_context.hpp]
  35948. ['Convenience header: ][^boost/asio.hpp]
  35949. [endsect]
  35950. [section:count_type io_context::count_type]
  35951. [indexterm2 boost_asio.indexterm.io_context.count_type..count_type..io_context]
  35952. The type used to count the number of handlers executed by the context.
  35953. typedef std::size_t count_type;
  35954. [heading Requirements]
  35955. ['Header: ][^boost/asio/io_context.hpp]
  35956. ['Convenience header: ][^boost/asio.hpp]
  35957. [endsect]
  35958. [section:destroy io_context::destroy]
  35959. ['Inherited from execution_context.]
  35960. [indexterm2 boost_asio.indexterm.io_context.destroy..destroy..io_context]
  35961. Destroys all services in the context.
  35962. void destroy();
  35963. This function is implemented as follows:
  35964. * 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)`.
  35965. [endsect]
  35966. [section:dispatch io_context::dispatch]
  35967. [indexterm2 boost_asio.indexterm.io_context.dispatch..dispatch..io_context]
  35968. (Deprecated: Use [link boost_asio.reference.dispatch `dispatch`].) Request the [link boost_asio.reference.io_context `io_context`] to invoke the given handler.
  35969. template<
  35970. typename ``[link boost_asio.reference.LegacyCompletionHandler LegacyCompletionHandler]``>
  35971. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` dispatch(
  35972. LegacyCompletionHandler && handler);
  35973. This function is used to ask the [link boost_asio.reference.io_context `io_context`] to execute the given handler.
  35974. The [link boost_asio.reference.io_context `io_context`] guarantees that the handler will only be called in a thread in which the `run()`, `run_one()`, `poll()` or `poll_one()` member functions is currently being invoked. The handler may be executed inside this function if the guarantee can be met.
  35975. [heading Parameters]
  35976. [variablelist
  35977. [[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:
  35978. ``
  35979. void handler();
  35980. ``
  35981. ]]
  35982. ]
  35983. [heading Remarks]
  35984. This function throws an exception only if:
  35985. * the handler's `asio_handler_allocate` function; or
  35986. * the handler's copy constructor
  35987. throws an exception.
  35988. [endsect]
  35989. [section:fork_event io_context::fork_event]
  35990. ['Inherited from execution_context.]
  35991. [indexterm2 boost_asio.indexterm.io_context.fork_event..fork_event..io_context]
  35992. Fork-related event notifications.
  35993. enum fork_event
  35994. [indexterm2 boost_asio.indexterm.io_context.fork_event.fork_prepare..fork_prepare..io_context]
  35995. [indexterm2 boost_asio.indexterm.io_context.fork_event.fork_parent..fork_parent..io_context]
  35996. [indexterm2 boost_asio.indexterm.io_context.fork_event.fork_child..fork_child..io_context]
  35997. [heading Values]
  35998. [variablelist
  35999. [
  36000. [fork_prepare]
  36001. [Notify the context that the process is about to fork. ]
  36002. ]
  36003. [
  36004. [fork_parent]
  36005. [Notify the context that the process has forked and is the parent. ]
  36006. ]
  36007. [
  36008. [fork_child]
  36009. [Notify the context that the process has forked and is the child. ]
  36010. ]
  36011. ]
  36012. [endsect]
  36013. [section:get_executor io_context::get_executor]
  36014. [indexterm2 boost_asio.indexterm.io_context.get_executor..get_executor..io_context]
  36015. Obtains the executor associated with the [link boost_asio.reference.io_context `io_context`].
  36016. executor_type get_executor();
  36017. [endsect]
  36018. [section:has_service io_context::has_service]
  36019. ['Inherited from execution_context.]
  36020. [indexterm2 boost_asio.indexterm.io_context.has_service..has_service..io_context]
  36021. Determine if an [link boost_asio.reference.execution_context `execution_context`] contains a specified service type.
  36022. template<
  36023. typename ``[link boost_asio.reference.Service Service]``>
  36024. friend bool has_service(
  36025. execution_context & e);
  36026. This function is used to determine whether the [link boost_asio.reference.execution_context `execution_context`] contains a service object corresponding to the given service type.
  36027. [heading Parameters]
  36028. [variablelist
  36029. [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
  36030. ]
  36031. [heading Return Value]
  36032. A boolean indicating whether the [link boost_asio.reference.execution_context `execution_context`] contains the service.
  36033. [heading Requirements]
  36034. ['Header: ][^boost/asio/io_context.hpp]
  36035. ['Convenience header: ][^boost/asio.hpp]
  36036. [endsect]
  36037. [section:io_context io_context::io_context]
  36038. [indexterm2 boost_asio.indexterm.io_context.io_context..io_context..io_context]
  36039. Constructor.
  36040. ``[link boost_asio.reference.io_context.io_context.overload1 io_context]``();
  36041. `` [''''&raquo;''' [link boost_asio.reference.io_context.io_context.overload1 more...]]``
  36042. explicit ``[link boost_asio.reference.io_context.io_context.overload2 io_context]``(
  36043. int concurrency_hint);
  36044. `` [''''&raquo;''' [link boost_asio.reference.io_context.io_context.overload2 more...]]``
  36045. [section:overload1 io_context::io_context (1 of 2 overloads)]
  36046. Constructor.
  36047. io_context();
  36048. [endsect]
  36049. [section:overload2 io_context::io_context (2 of 2 overloads)]
  36050. Constructor.
  36051. io_context(
  36052. int concurrency_hint);
  36053. Construct with a hint about the required level of concurrency.
  36054. [heading Parameters]
  36055. [variablelist
  36056. [[concurrency_hint][A suggestion to the implementation on how many threads it should allow to run simultaneously. ]]
  36057. ]
  36058. [endsect]
  36059. [endsect]
  36060. [section:make_service io_context::make_service]
  36061. ['Inherited from execution_context.]
  36062. [indexterm2 boost_asio.indexterm.io_context.make_service..make_service..io_context]
  36063. Creates a service object and adds it to the [link boost_asio.reference.execution_context `execution_context`].
  36064. template<
  36065. typename ``[link boost_asio.reference.Service Service]``,
  36066. typename... Args>
  36067. friend Service & make_service(
  36068. execution_context & e,
  36069. Args &&... args);
  36070. This function is used to add a service to the [link boost_asio.reference.execution_context `execution_context`].
  36071. [heading Parameters]
  36072. [variablelist
  36073. [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
  36074. [[args][Zero or more arguments to be passed to the service constructor.]]
  36075. ]
  36076. [heading Exceptions]
  36077. [variablelist
  36078. [[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`]. ]]
  36079. ]
  36080. [heading Requirements]
  36081. ['Header: ][^boost/asio/io_context.hpp]
  36082. ['Convenience header: ][^boost/asio.hpp]
  36083. [endsect]
  36084. [section:notify_fork io_context::notify_fork]
  36085. ['Inherited from execution_context.]
  36086. [indexterm2 boost_asio.indexterm.io_context.notify_fork..notify_fork..io_context]
  36087. Notify the [link boost_asio.reference.execution_context `execution_context`] of a fork-related event.
  36088. void notify_fork(
  36089. fork_event event);
  36090. This function is used to inform the [link boost_asio.reference.execution_context `execution_context`] that the process is about to fork, or has just forked. This allows the [link boost_asio.reference.execution_context `execution_context`], and the services it contains, to perform any necessary housekeeping to ensure correct operation following a fork.
  36091. This function must not be called while any other [link boost_asio.reference.execution_context `execution_context`] function, or any function associated with the execution\_context's derived class, is being called in another thread. It is, however, safe to call this function from within a completion handler, provided no other thread is accessing the [link boost_asio.reference.execution_context `execution_context`] or its derived class.
  36092. [heading Parameters]
  36093. [variablelist
  36094. [[event][A fork-related event.]]
  36095. ]
  36096. [heading Exceptions]
  36097. [variablelist
  36098. [[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.]]
  36099. ]
  36100. [heading Example]
  36101. The following code illustrates how to incorporate the `notify_fork()` function:
  36102. my_execution_context.notify_fork(execution_context::fork_prepare);
  36103. if (fork() == 0)
  36104. {
  36105. // This is the child process.
  36106. my_execution_context.notify_fork(execution_context::fork_child);
  36107. }
  36108. else
  36109. {
  36110. // This is the parent process.
  36111. my_execution_context.notify_fork(execution_context::fork_parent);
  36112. }
  36113. [heading Remarks]
  36114. For each service object `svc` in the [link boost_asio.reference.execution_context `execution_context`] set, performs `svc->notify_fork();`. When processing the fork\_prepare event, services are visited in reverse order of the beginning of service object lifetime. Otherwise, services are visited in order of the beginning of service object lifetime.
  36115. [endsect]
  36116. [section:poll io_context::poll]
  36117. [indexterm2 boost_asio.indexterm.io_context.poll..poll..io_context]
  36118. Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop to execute ready handlers.
  36119. count_type ``[link boost_asio.reference.io_context.poll.overload1 poll]``();
  36120. `` [''''&raquo;''' [link boost_asio.reference.io_context.poll.overload1 more...]]``
  36121. (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.
  36122. count_type ``[link boost_asio.reference.io_context.poll.overload2 poll]``(
  36123. boost::system::error_code & ec);
  36124. `` [''''&raquo;''' [link boost_asio.reference.io_context.poll.overload2 more...]]``
  36125. [section:overload1 io_context::poll (1 of 2 overloads)]
  36126. Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop to execute ready handlers.
  36127. count_type poll();
  36128. The `poll()` function runs handlers that are ready to run, without blocking, until the [link boost_asio.reference.io_context `io_context`] has been stopped or there are no more ready handlers.
  36129. [heading Return Value]
  36130. The number of handlers that were executed.
  36131. [endsect]
  36132. [section:overload2 io_context::poll (2 of 2 overloads)]
  36133. (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.
  36134. count_type poll(
  36135. boost::system::error_code & ec);
  36136. The `poll()` function runs handlers that are ready to run, without blocking, until the [link boost_asio.reference.io_context `io_context`] has been stopped or there are no more ready handlers.
  36137. [heading Parameters]
  36138. [variablelist
  36139. [[ec][Set to indicate what error occurred, if any.]]
  36140. ]
  36141. [heading Return Value]
  36142. The number of handlers that were executed.
  36143. [endsect]
  36144. [endsect]
  36145. [section:poll_one io_context::poll_one]
  36146. [indexterm2 boost_asio.indexterm.io_context.poll_one..poll_one..io_context]
  36147. Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop to execute one ready handler.
  36148. count_type ``[link boost_asio.reference.io_context.poll_one.overload1 poll_one]``();
  36149. `` [''''&raquo;''' [link boost_asio.reference.io_context.poll_one.overload1 more...]]``
  36150. (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.
  36151. count_type ``[link boost_asio.reference.io_context.poll_one.overload2 poll_one]``(
  36152. boost::system::error_code & ec);
  36153. `` [''''&raquo;''' [link boost_asio.reference.io_context.poll_one.overload2 more...]]``
  36154. [section:overload1 io_context::poll_one (1 of 2 overloads)]
  36155. Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop to execute one ready handler.
  36156. count_type poll_one();
  36157. The `poll_one()` function runs at most one handler that is ready to run, without blocking.
  36158. [heading Return Value]
  36159. The number of handlers that were executed.
  36160. [endsect]
  36161. [section:overload2 io_context::poll_one (2 of 2 overloads)]
  36162. (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.
  36163. count_type poll_one(
  36164. boost::system::error_code & ec);
  36165. The `poll_one()` function runs at most one handler that is ready to run, without blocking.
  36166. [heading Parameters]
  36167. [variablelist
  36168. [[ec][Set to indicate what error occurred, if any.]]
  36169. ]
  36170. [heading Return Value]
  36171. The number of handlers that were executed.
  36172. [endsect]
  36173. [endsect]
  36174. [section:post io_context::post]
  36175. [indexterm2 boost_asio.indexterm.io_context.post..post..io_context]
  36176. (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.
  36177. template<
  36178. typename ``[link boost_asio.reference.LegacyCompletionHandler LegacyCompletionHandler]``>
  36179. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` post(
  36180. LegacyCompletionHandler && handler);
  36181. This function is used to ask the [link boost_asio.reference.io_context `io_context`] to execute the given handler, but without allowing the [link boost_asio.reference.io_context `io_context`] to call the handler from inside this function.
  36182. The [link boost_asio.reference.io_context `io_context`] guarantees that the handler will only be called in a thread in which the `run()`, `run_one()`, `poll()` or `poll_one()` member functions is currently being invoked.
  36183. [heading Parameters]
  36184. [variablelist
  36185. [[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:
  36186. ``
  36187. void handler();
  36188. ``
  36189. ]]
  36190. ]
  36191. [heading Remarks]
  36192. This function throws an exception only if:
  36193. * the handler's `asio_handler_allocate` function; or
  36194. * the handler's copy constructor
  36195. throws an exception.
  36196. [endsect]
  36197. [section:reset io_context::reset]
  36198. [indexterm2 boost_asio.indexterm.io_context.reset..reset..io_context]
  36199. (Deprecated: Use `restart()`.) Reset the [link boost_asio.reference.io_context `io_context`] in preparation for a subsequent `run()` invocation.
  36200. void reset();
  36201. This function must be called prior to any second or later set of invocations of the `run()`, `run_one()`, `poll()` or `poll_one()` functions when a previous invocation of these functions returned due to the [link boost_asio.reference.io_context `io_context`] being stopped or running out of work. After a call to `restart()`, the [link boost_asio.reference.io_context `io_context`] object's `stopped()` function will return `false`.
  36202. This function must not be called while there are any unfinished calls to the `run()`, `run_one()`, `poll()` or `poll_one()` functions.
  36203. [endsect]
  36204. [section:restart io_context::restart]
  36205. [indexterm2 boost_asio.indexterm.io_context.restart..restart..io_context]
  36206. Restart the [link boost_asio.reference.io_context `io_context`] in preparation for a subsequent `run()` invocation.
  36207. void restart();
  36208. This function must be called prior to any second or later set of invocations of the `run()`, `run_one()`, `poll()` or `poll_one()` functions when a previous invocation of these functions returned due to the [link boost_asio.reference.io_context `io_context`] being stopped or running out of work. After a call to `restart()`, the [link boost_asio.reference.io_context `io_context`] object's `stopped()` function will return `false`.
  36209. This function must not be called while there are any unfinished calls to the `run()`, `run_one()`, `poll()` or `poll_one()` functions.
  36210. [endsect]
  36211. [section:run io_context::run]
  36212. [indexterm2 boost_asio.indexterm.io_context.run..run..io_context]
  36213. Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop.
  36214. count_type ``[link boost_asio.reference.io_context.run.overload1 run]``();
  36215. `` [''''&raquo;''' [link boost_asio.reference.io_context.run.overload1 more...]]``
  36216. (Deprecated: Use non-error\_code overload.) Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop.
  36217. count_type ``[link boost_asio.reference.io_context.run.overload2 run]``(
  36218. boost::system::error_code & ec);
  36219. `` [''''&raquo;''' [link boost_asio.reference.io_context.run.overload2 more...]]``
  36220. [section:overload1 io_context::run (1 of 2 overloads)]
  36221. Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop.
  36222. count_type run();
  36223. The `run()` function blocks until all work has finished and there are no more handlers to be dispatched, or until the [link boost_asio.reference.io_context `io_context`] has been stopped.
  36224. Multiple threads may call the `run()` function to set up a pool of threads from which the [link boost_asio.reference.io_context `io_context`] may execute handlers. All threads that are waiting in the pool are equivalent and the [link boost_asio.reference.io_context `io_context`] may choose any one of them to invoke a handler.
  36225. A normal exit from the `run()` function implies that the [link boost_asio.reference.io_context `io_context`] object is stopped (the `stopped()` function returns `true`). Subsequent calls to `run()`, `run_one()`, `poll()` or `poll_one()` will return immediately unless there is a prior call to `restart()`.
  36226. [heading Return Value]
  36227. The number of handlers that were executed.
  36228. [heading Remarks]
  36229. Calling the `run()` function from a thread that is currently calling one of `run()`, `run_one()`, `run_for()`, `run_until()`, `poll()` or `poll_one()` on the same [link boost_asio.reference.io_context `io_context`] object may introduce the potential for deadlock. It is the caller's reponsibility to avoid this.
  36230. The `poll()` function may also be used to dispatch ready handlers, but without blocking.
  36231. [endsect]
  36232. [section:overload2 io_context::run (2 of 2 overloads)]
  36233. (Deprecated: Use non-error\_code overload.) Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop.
  36234. count_type run(
  36235. boost::system::error_code & ec);
  36236. The `run()` function blocks until all work has finished and there are no more handlers to be dispatched, or until the [link boost_asio.reference.io_context `io_context`] has been stopped.
  36237. Multiple threads may call the `run()` function to set up a pool of threads from which the [link boost_asio.reference.io_context `io_context`] may execute handlers. All threads that are waiting in the pool are equivalent and the [link boost_asio.reference.io_context `io_context`] may choose any one of them to invoke a handler.
  36238. A normal exit from the `run()` function implies that the [link boost_asio.reference.io_context `io_context`] object is stopped (the `stopped()` function returns `true`). Subsequent calls to `run()`, `run_one()`, `poll()` or `poll_one()` will return immediately unless there is a prior call to `restart()`.
  36239. [heading Parameters]
  36240. [variablelist
  36241. [[ec][Set to indicate what error occurred, if any.]]
  36242. ]
  36243. [heading Return Value]
  36244. The number of handlers that were executed.
  36245. [heading Remarks]
  36246. Calling the `run()` function from a thread that is currently calling one of `run()`, `run_one()`, `run_for()`, `run_until()`, `poll()` or `poll_one()` on the same [link boost_asio.reference.io_context `io_context`] object may introduce the potential for deadlock. It is the caller's reponsibility to avoid this.
  36247. The `poll()` function may also be used to dispatch ready handlers, but without blocking.
  36248. [endsect]
  36249. [endsect]
  36250. [section:run_for io_context::run_for]
  36251. [indexterm2 boost_asio.indexterm.io_context.run_for..run_for..io_context]
  36252. Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop for a specified duration.
  36253. template<
  36254. typename Rep,
  36255. typename Period>
  36256. std::size_t run_for(
  36257. const chrono::duration< Rep, Period > & rel_time);
  36258. The `run_for()` function blocks until all work has finished and there are no more handlers to be dispatched, until the [link boost_asio.reference.io_context `io_context`] has been stopped, or until the specified duration has elapsed.
  36259. [heading Parameters]
  36260. [variablelist
  36261. [[rel_time][The duration for which the call may block.]]
  36262. ]
  36263. [heading Return Value]
  36264. The number of handlers that were executed.
  36265. [endsect]
  36266. [section:run_one io_context::run_one]
  36267. [indexterm2 boost_asio.indexterm.io_context.run_one..run_one..io_context]
  36268. Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop to execute at most one handler.
  36269. count_type ``[link boost_asio.reference.io_context.run_one.overload1 run_one]``();
  36270. `` [''''&raquo;''' [link boost_asio.reference.io_context.run_one.overload1 more...]]``
  36271. (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.
  36272. count_type ``[link boost_asio.reference.io_context.run_one.overload2 run_one]``(
  36273. boost::system::error_code & ec);
  36274. `` [''''&raquo;''' [link boost_asio.reference.io_context.run_one.overload2 more...]]``
  36275. [section:overload1 io_context::run_one (1 of 2 overloads)]
  36276. Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop to execute at most one handler.
  36277. count_type run_one();
  36278. The `run_one()` function blocks until one handler has been dispatched, or until the [link boost_asio.reference.io_context `io_context`] has been stopped.
  36279. [heading Return Value]
  36280. The number of handlers that were executed. A zero return value implies that the [link boost_asio.reference.io_context `io_context`] object is stopped (the `stopped()` function returns `true`). Subsequent calls to `run()`, `run_one()`, `poll()` or `poll_one()` will return immediately unless there is a prior call to `restart()`.
  36281. [heading Remarks]
  36282. Calling the `run_one()` function from a thread that is currently calling one of `run()`, `run_one()`, `run_for()`, `run_until()`, `poll()` or `poll_one()` on the same [link boost_asio.reference.io_context `io_context`] object may introduce the potential for deadlock. It is the caller's reponsibility to avoid this.
  36283. [endsect]
  36284. [section:overload2 io_context::run_one (2 of 2 overloads)]
  36285. (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.
  36286. count_type run_one(
  36287. boost::system::error_code & ec);
  36288. The `run_one()` function blocks until one handler has been dispatched, or until the [link boost_asio.reference.io_context `io_context`] has been stopped.
  36289. [heading Return Value]
  36290. The number of handlers that were executed. A zero return value implies that the [link boost_asio.reference.io_context `io_context`] object is stopped (the `stopped()` function returns `true`). Subsequent calls to `run()`, `run_one()`, `poll()` or `poll_one()` will return immediately unless there is a prior call to `restart()`.
  36291. The number of handlers that were executed.
  36292. [heading Remarks]
  36293. Calling the `run_one()` function from a thread that is currently calling one of `run()`, `run_one()`, `run_for()`, `run_until()`, `poll()` or `poll_one()` on the same [link boost_asio.reference.io_context `io_context`] object may introduce the potential for deadlock. It is the caller's reponsibility to avoid this.
  36294. [endsect]
  36295. [endsect]
  36296. [section:run_one_for io_context::run_one_for]
  36297. [indexterm2 boost_asio.indexterm.io_context.run_one_for..run_one_for..io_context]
  36298. Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop for a specified duration to execute at most one handler.
  36299. template<
  36300. typename Rep,
  36301. typename Period>
  36302. std::size_t run_one_for(
  36303. const chrono::duration< Rep, Period > & rel_time);
  36304. The `run_one_for()` function blocks until one handler has been dispatched, until the [link boost_asio.reference.io_context `io_context`] has been stopped, or until the specified duration has elapsed.
  36305. [heading Parameters]
  36306. [variablelist
  36307. [[rel_time][The duration for which the call may block.]]
  36308. ]
  36309. [heading Return Value]
  36310. The number of handlers that were executed.
  36311. [endsect]
  36312. [section:run_one_until io_context::run_one_until]
  36313. [indexterm2 boost_asio.indexterm.io_context.run_one_until..run_one_until..io_context]
  36314. Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop until a specified time to execute at most one handler.
  36315. template<
  36316. typename Clock,
  36317. typename Duration>
  36318. std::size_t run_one_until(
  36319. const chrono::time_point< Clock, Duration > & abs_time);
  36320. The `run_one_until()` function blocks until one handler has been dispatched, until the [link boost_asio.reference.io_context `io_context`] has been stopped, or until the specified time has been reached.
  36321. [heading Parameters]
  36322. [variablelist
  36323. [[abs_time][The time point until which the call may block.]]
  36324. ]
  36325. [heading Return Value]
  36326. The number of handlers that were executed.
  36327. [endsect]
  36328. [section:run_until io_context::run_until]
  36329. [indexterm2 boost_asio.indexterm.io_context.run_until..run_until..io_context]
  36330. Run the [link boost_asio.reference.io_context `io_context`] object's event processing loop until a specified time.
  36331. template<
  36332. typename Clock,
  36333. typename Duration>
  36334. std::size_t run_until(
  36335. const chrono::time_point< Clock, Duration > & abs_time);
  36336. The `run_until()` function blocks until all work has finished and there are no more handlers to be dispatched, until the [link boost_asio.reference.io_context `io_context`] has been stopped, or until the specified time has been reached.
  36337. [heading Parameters]
  36338. [variablelist
  36339. [[abs_time][The time point until which the call may block.]]
  36340. ]
  36341. [heading Return Value]
  36342. The number of handlers that were executed.
  36343. [endsect]
  36344. [section:shutdown io_context::shutdown]
  36345. ['Inherited from execution_context.]
  36346. [indexterm2 boost_asio.indexterm.io_context.shutdown..shutdown..io_context]
  36347. Shuts down all services in the context.
  36348. void shutdown();
  36349. This function is implemented as follows:
  36350. * 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()`.
  36351. [endsect]
  36352. [section:stop io_context::stop]
  36353. [indexterm2 boost_asio.indexterm.io_context.stop..stop..io_context]
  36354. Stop the [link boost_asio.reference.io_context `io_context`] object's event processing loop.
  36355. void stop();
  36356. This function does not block, but instead simply signals the [link boost_asio.reference.io_context `io_context`] to stop. All invocations of its `run()` or `run_one()` member functions should return as soon as possible. Subsequent calls to `run()`, `run_one()`, `poll()` or `poll_one()` will return immediately until `restart()` is called.
  36357. [endsect]
  36358. [section:stopped io_context::stopped]
  36359. [indexterm2 boost_asio.indexterm.io_context.stopped..stopped..io_context]
  36360. Determine whether the [link boost_asio.reference.io_context `io_context`] object has been stopped.
  36361. bool stopped() const;
  36362. This function is used to determine whether an [link boost_asio.reference.io_context `io_context`] object has been stopped, either through an explicit call to `stop()`, or due to running out of work. When an [link boost_asio.reference.io_context `io_context`] object is stopped, calls to `run()`, `run_one()`, `poll()` or `poll_one()` will return immediately without invoking any handlers.
  36363. [heading Return Value]
  36364. `true` if the [link boost_asio.reference.io_context `io_context`] object is stopped, otherwise `false`.
  36365. [endsect]
  36366. [section:use_service io_context::use_service]
  36367. [indexterm2 boost_asio.indexterm.io_context.use_service..use_service..io_context]
  36368. template<
  36369. typename ``[link boost_asio.reference.Service Service]``>
  36370. friend Service & ``[link boost_asio.reference.io_context.use_service.overload1 use_service]``(
  36371. io_context & ioc);
  36372. `` [''''&raquo;''' [link boost_asio.reference.io_context.use_service.overload1 more...]]``
  36373. Obtain the service object corresponding to the given type.
  36374. template<
  36375. typename ``[link boost_asio.reference.Service Service]``>
  36376. friend Service & ``[link boost_asio.reference.io_context.use_service.overload2 use_service]``(
  36377. execution_context & e);
  36378. `` [''''&raquo;''' [link boost_asio.reference.io_context.use_service.overload2 more...]]``
  36379. [section:overload1 io_context::use_service (1 of 2 overloads)]
  36380. template<
  36381. typename ``[link boost_asio.reference.Service Service]``>
  36382. friend Service & use_service(
  36383. io_context & ioc);
  36384. [heading Requirements]
  36385. ['Header: ][^boost/asio/io_context.hpp]
  36386. ['Convenience header: ][^boost/asio.hpp]
  36387. [endsect]
  36388. [section:overload2 io_context::use_service (2 of 2 overloads)]
  36389. ['Inherited from execution_context.]
  36390. Obtain the service object corresponding to the given type.
  36391. template<
  36392. typename ``[link boost_asio.reference.Service Service]``>
  36393. friend Service & use_service(
  36394. execution_context & e);
  36395. This function is used to locate a service object that corresponds to the given service type. If there is no existing implementation of the service, then the [link boost_asio.reference.execution_context `execution_context`] will create a new instance of the service.
  36396. [heading Parameters]
  36397. [variablelist
  36398. [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
  36399. ]
  36400. [heading Return Value]
  36401. The service interface implementing the specified service type. Ownership of the service interface is not transferred to the caller.
  36402. [heading Requirements]
  36403. ['Header: ][^boost/asio/io_context.hpp]
  36404. ['Convenience header: ][^boost/asio.hpp]
  36405. [endsect]
  36406. [endsect]
  36407. [section:wrap io_context::wrap]
  36408. [indexterm2 boost_asio.indexterm.io_context.wrap..wrap..io_context]
  36409. (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`].
  36410. template<
  36411. typename ``[link boost_asio.reference.Handler Handler]``>
  36412. unspecified wrap(
  36413. Handler handler);
  36414. This function is used to create a new handler function object that, when invoked, will automatically pass the wrapped handler to the [link boost_asio.reference.io_context `io_context`] object's dispatch function.
  36415. [heading Parameters]
  36416. [variablelist
  36417. [[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:
  36418. ``
  36419. void handler(A1 a1, ... An an);
  36420. ``
  36421. ]]
  36422. ]
  36423. [heading Return Value]
  36424. A function object that, when invoked, passes the wrapped handler to the [link boost_asio.reference.io_context `io_context`] object's dispatch function. Given a function object with the signature:
  36425. R f(A1 a1, ... An an);
  36426. If this function object is passed to the wrap function like so:
  36427. io_context.wrap(f);
  36428. then the return value is a function object with the signature
  36429. void g(A1 a1, ... An an);
  36430. that, when invoked, executes code equivalent to:
  36431. io_context.dispatch(boost::bind(f, a1, ... an));
  36432. [endsect]
  36433. [section:_io_context io_context::~io_context]
  36434. [indexterm2 boost_asio.indexterm.io_context._io_context..~io_context..io_context]
  36435. Destructor.
  36436. ~io_context();
  36437. On destruction, the [link boost_asio.reference.io_context `io_context`] performs the following sequence of operations:
  36438. * 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()`.
  36439. * 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.
  36440. * 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)`.
  36441. [heading Remarks]
  36442. The destruction sequence described above permits programs to simplify their resource management by using `shared_ptr<>`. Where an object's lifetime is tied to the lifetime of a connection (or some other sequence of asynchronous operations), a `shared_ptr` to the object would be bound into the handlers for all asynchronous operations associated with it. This works as follows:
  36443. * 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.
  36444. * 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.
  36445. [endsect]
  36446. [endsect]
  36447. [section:io_context__executor_type io_context::executor_type]
  36448. Executor used to submit functions to an [link boost_asio.reference.io_context `io_context`].
  36449. class executor_type
  36450. [heading Member Functions]
  36451. [table
  36452. [[Name][Description]]
  36453. [
  36454. [[link boost_asio.reference.io_context__executor_type.context [*context]]]
  36455. [Obtain the underlying execution context. ]
  36456. ]
  36457. [
  36458. [[link boost_asio.reference.io_context__executor_type.defer [*defer]]]
  36459. [Request the io_context to invoke the given function object. ]
  36460. ]
  36461. [
  36462. [[link boost_asio.reference.io_context__executor_type.dispatch [*dispatch]]]
  36463. [Request the io_context to invoke the given function object. ]
  36464. ]
  36465. [
  36466. [[link boost_asio.reference.io_context__executor_type.on_work_finished [*on_work_finished]]]
  36467. [Inform the io_context that some work is no longer outstanding. ]
  36468. ]
  36469. [
  36470. [[link boost_asio.reference.io_context__executor_type.on_work_started [*on_work_started]]]
  36471. [Inform the io_context that it has some outstanding work to do. ]
  36472. ]
  36473. [
  36474. [[link boost_asio.reference.io_context__executor_type.post [*post]]]
  36475. [Request the io_context to invoke the given function object. ]
  36476. ]
  36477. [
  36478. [[link boost_asio.reference.io_context__executor_type.running_in_this_thread [*running_in_this_thread]]]
  36479. [Determine whether the io_context is running in the current thread. ]
  36480. ]
  36481. ]
  36482. [heading Friends]
  36483. [table
  36484. [[Name][Description]]
  36485. [
  36486. [[link boost_asio.reference.io_context__executor_type.operator_not__eq_ [*operator!=]]]
  36487. [Compare two executors for inequality. ]
  36488. ]
  36489. [
  36490. [[link boost_asio.reference.io_context__executor_type.operator_eq__eq_ [*operator==]]]
  36491. [Compare two executors for equality. ]
  36492. ]
  36493. ]
  36494. [heading Requirements]
  36495. ['Header: ][^boost/asio/io_context.hpp]
  36496. ['Convenience header: ][^boost/asio.hpp]
  36497. [section:context io_context::executor_type::context]
  36498. [indexterm2 boost_asio.indexterm.io_context__executor_type.context..context..io_context::executor_type]
  36499. Obtain the underlying execution context.
  36500. io_context & context() const;
  36501. [endsect]
  36502. [section:defer io_context::executor_type::defer]
  36503. [indexterm2 boost_asio.indexterm.io_context__executor_type.defer..defer..io_context::executor_type]
  36504. Request the [link boost_asio.reference.io_context `io_context`] to invoke the given function object.
  36505. template<
  36506. typename Function,
  36507. typename Allocator>
  36508. void defer(
  36509. Function && f,
  36510. const Allocator & a) const;
  36511. This function is used to ask the [link boost_asio.reference.io_context `io_context`] to execute the given function object. The function object will never be executed inside `defer()`. Instead, it will be scheduled to run on the [link boost_asio.reference.io_context `io_context`].
  36512. If the current thread belongs to the [link boost_asio.reference.io_context `io_context`], `defer()` will delay scheduling the function object until the current thread returns control to the pool.
  36513. [heading Parameters]
  36514. [variablelist
  36515. [[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:
  36516. ``
  36517. void function();
  36518. ``
  36519. ]]
  36520. [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
  36521. ]
  36522. [endsect]
  36523. [section:dispatch io_context::executor_type::dispatch]
  36524. [indexterm2 boost_asio.indexterm.io_context__executor_type.dispatch..dispatch..io_context::executor_type]
  36525. Request the [link boost_asio.reference.io_context `io_context`] to invoke the given function object.
  36526. template<
  36527. typename Function,
  36528. typename Allocator>
  36529. void dispatch(
  36530. Function && f,
  36531. const Allocator & a) const;
  36532. This function is used to ask the [link boost_asio.reference.io_context `io_context`] to execute the given function object. If the current thread is running the [link boost_asio.reference.io_context `io_context`], `dispatch()` executes the function before returning. Otherwise, the function will be scheduled to run on the [link boost_asio.reference.io_context `io_context`].
  36533. [heading Parameters]
  36534. [variablelist
  36535. [[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:
  36536. ``
  36537. void function();
  36538. ``
  36539. ]]
  36540. [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
  36541. ]
  36542. [endsect]
  36543. [section:on_work_finished io_context::executor_type::on_work_finished]
  36544. [indexterm2 boost_asio.indexterm.io_context__executor_type.on_work_finished..on_work_finished..io_context::executor_type]
  36545. Inform the [link boost_asio.reference.io_context `io_context`] that some work is no longer outstanding.
  36546. void on_work_finished() const;
  36547. This function is used to inform the [link boost_asio.reference.io_context `io_context`] that some work has finished. Once the count of unfinished work reaches zero, the [link boost_asio.reference.io_context `io_context`] is stopped and the `run()` and `run_one()` functions may exit.
  36548. [endsect]
  36549. [section:on_work_started io_context::executor_type::on_work_started]
  36550. [indexterm2 boost_asio.indexterm.io_context__executor_type.on_work_started..on_work_started..io_context::executor_type]
  36551. Inform the [link boost_asio.reference.io_context `io_context`] that it has some outstanding work to do.
  36552. void on_work_started() const;
  36553. This function is used to inform the [link boost_asio.reference.io_context `io_context`] that some work has begun. This ensures that the io\_context's `run()` and `run_one()` functions do not exit while the work is underway.
  36554. [endsect]
  36555. [section:operator_not__eq_ io_context::executor_type::operator!=]
  36556. [indexterm2 boost_asio.indexterm.io_context__executor_type.operator_not__eq_..operator!=..io_context::executor_type]
  36557. Compare two executors for inequality.
  36558. friend bool operator!=(
  36559. const executor_type & a,
  36560. const executor_type & b);
  36561. Two executors are equal if they refer to the same underlying [link boost_asio.reference.io_context `io_context`].
  36562. [heading Requirements]
  36563. ['Header: ][^boost/asio/io_context.hpp]
  36564. ['Convenience header: ][^boost/asio.hpp]
  36565. [endsect]
  36566. [section:operator_eq__eq_ io_context::executor_type::operator==]
  36567. [indexterm2 boost_asio.indexterm.io_context__executor_type.operator_eq__eq_..operator==..io_context::executor_type]
  36568. Compare two executors for equality.
  36569. friend bool operator==(
  36570. const executor_type & a,
  36571. const executor_type & b);
  36572. Two executors are equal if they refer to the same underlying [link boost_asio.reference.io_context `io_context`].
  36573. [heading Requirements]
  36574. ['Header: ][^boost/asio/io_context.hpp]
  36575. ['Convenience header: ][^boost/asio.hpp]
  36576. [endsect]
  36577. [section:post io_context::executor_type::post]
  36578. [indexterm2 boost_asio.indexterm.io_context__executor_type.post..post..io_context::executor_type]
  36579. Request the [link boost_asio.reference.io_context `io_context`] to invoke the given function object.
  36580. template<
  36581. typename Function,
  36582. typename Allocator>
  36583. void post(
  36584. Function && f,
  36585. const Allocator & a) const;
  36586. This function is used to ask the [link boost_asio.reference.io_context `io_context`] to execute the given function object. The function object will never be executed inside `post()`. Instead, it will be scheduled to run on the [link boost_asio.reference.io_context `io_context`].
  36587. [heading Parameters]
  36588. [variablelist
  36589. [[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:
  36590. ``
  36591. void function();
  36592. ``
  36593. ]]
  36594. [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
  36595. ]
  36596. [endsect]
  36597. [section:running_in_this_thread io_context::executor_type::running_in_this_thread]
  36598. [indexterm2 boost_asio.indexterm.io_context__executor_type.running_in_this_thread..running_in_this_thread..io_context::executor_type]
  36599. Determine whether the [link boost_asio.reference.io_context `io_context`] is running in the current thread.
  36600. bool running_in_this_thread() const;
  36601. [heading Return Value]
  36602. `true` if the current thread is running the [link boost_asio.reference.io_context `io_context`]. Otherwise returns `false`.
  36603. [endsect]
  36604. [endsect]
  36605. [section:io_context__service io_context::service]
  36606. Base class for all [link boost_asio.reference.io_context `io_context`] services.
  36607. class service
  36608. [heading Member Functions]
  36609. [table
  36610. [[Name][Description]]
  36611. [
  36612. [[link boost_asio.reference.io_context__service.get_io_context [*get_io_context]]]
  36613. [Get the io_context object that owns the service. ]
  36614. ]
  36615. ]
  36616. [heading Protected Member Functions]
  36617. [table
  36618. [[Name][Description]]
  36619. [
  36620. [[link boost_asio.reference.io_context__service.service [*service]]]
  36621. [Constructor. ]
  36622. ]
  36623. [
  36624. [[link boost_asio.reference.io_context__service._service [*~service]]]
  36625. [Destructor. ]
  36626. ]
  36627. ]
  36628. [heading Requirements]
  36629. ['Header: ][^boost/asio/io_context.hpp]
  36630. ['Convenience header: ][^boost/asio.hpp]
  36631. [section:get_io_context io_context::service::get_io_context]
  36632. [indexterm2 boost_asio.indexterm.io_context__service.get_io_context..get_io_context..io_context::service]
  36633. Get the [link boost_asio.reference.io_context `io_context`] object that owns the service.
  36634. boost::asio::io_context & get_io_context();
  36635. [endsect]
  36636. [section:service io_context::service::service]
  36637. [indexterm2 boost_asio.indexterm.io_context__service.service..service..io_context::service]
  36638. Constructor.
  36639. service(
  36640. boost::asio::io_context & owner);
  36641. [heading Parameters]
  36642. [variablelist
  36643. [[owner][The [link boost_asio.reference.io_context `io_context`] object that owns the service. ]]
  36644. ]
  36645. [endsect]
  36646. [section:_service io_context::service::~service]
  36647. [indexterm2 boost_asio.indexterm.io_context__service._service..~service..io_context::service]
  36648. Destructor.
  36649. virtual ~service();
  36650. [endsect]
  36651. [endsect]
  36652. [section:io_context__strand io_context::strand]
  36653. Provides serialised handler execution.
  36654. class strand
  36655. [heading Member Functions]
  36656. [table
  36657. [[Name][Description]]
  36658. [
  36659. [[link boost_asio.reference.io_context__strand.context [*context]]]
  36660. [Obtain the underlying execution context. ]
  36661. ]
  36662. [
  36663. [[link boost_asio.reference.io_context__strand.defer [*defer]]]
  36664. [Request the strand to invoke the given function object. ]
  36665. ]
  36666. [
  36667. [[link boost_asio.reference.io_context__strand.dispatch [*dispatch]]]
  36668. [Request the strand to invoke the given function object.
  36669. [hr]
  36670. (Deprecated: Use boost::asio::dispatch().) Request the strand to invoke the given handler. ]
  36671. ]
  36672. [
  36673. [[link boost_asio.reference.io_context__strand.on_work_finished [*on_work_finished]]]
  36674. [Inform the strand that some work is no longer outstanding. ]
  36675. ]
  36676. [
  36677. [[link boost_asio.reference.io_context__strand.on_work_started [*on_work_started]]]
  36678. [Inform the strand that it has some outstanding work to do. ]
  36679. ]
  36680. [
  36681. [[link boost_asio.reference.io_context__strand.post [*post]]]
  36682. [Request the strand to invoke the given function object.
  36683. [hr]
  36684. (Deprecated: Use boost::asio::post().) Request the strand to invoke the given handler and return immediately. ]
  36685. ]
  36686. [
  36687. [[link boost_asio.reference.io_context__strand.running_in_this_thread [*running_in_this_thread]]]
  36688. [Determine whether the strand is running in the current thread. ]
  36689. ]
  36690. [
  36691. [[link boost_asio.reference.io_context__strand.strand [*strand]]]
  36692. [Constructor. ]
  36693. ]
  36694. [
  36695. [[link boost_asio.reference.io_context__strand.wrap [*wrap]]]
  36696. [(Deprecated: Use boost::asio::bind_executor().) Create a new handler that automatically dispatches the wrapped handler on the strand. ]
  36697. ]
  36698. [
  36699. [[link boost_asio.reference.io_context__strand._strand [*~strand]]]
  36700. [Destructor. ]
  36701. ]
  36702. ]
  36703. [heading Friends]
  36704. [table
  36705. [[Name][Description]]
  36706. [
  36707. [[link boost_asio.reference.io_context__strand.operator_not__eq_ [*operator!=]]]
  36708. [Compare two strands for inequality. ]
  36709. ]
  36710. [
  36711. [[link boost_asio.reference.io_context__strand.operator_eq__eq_ [*operator==]]]
  36712. [Compare two strands for equality. ]
  36713. ]
  36714. ]
  36715. The [link boost_asio.reference.io_context__strand `io_context::strand`] class provides the ability to post and dispatch handlers with the guarantee that none of those handlers will execute concurrently.
  36716. [heading Order of handler invocation]
  36717. Given:
  36718. * a strand object `s`
  36719. * an object `a` meeting completion handler requirements
  36720. * an object `a1` which is an arbitrary copy of `a` made by the implementation
  36721. * an object `b` meeting completion handler requirements
  36722. * an object `b1` which is an arbitrary copy of `b` made by the implementation
  36723. if any of the following conditions are true:
  36724. * `s.post(a)` happens-before `s.post(b)`
  36725. * `s.post(a)` happens-before `s.dispatch(b)`, where the latter is performed outside the strand
  36726. * `s.dispatch(a)` happens-before `s.post(b)`, where the former is performed outside the strand
  36727. * `s.dispatch(a)` happens-before `s.dispatch(b)`, where both are performed outside the strand
  36728. then `asio_handler_invoke(a1, &a1)` happens-before `asio_handler_invoke(b1, &b1)`.
  36729. Note that in the following case:
  36730. async_op_1(..., s.wrap(a));
  36731. async_op_2(..., s.wrap(b));
  36732. the completion of the first async operation will perform `s.dispatch(a)`, and the second will perform `s.dispatch(b)`, but the order in which those are performed is unspecified. That is, you cannot state whether one happens-before the other. Therefore none of the above conditions are met and no ordering guarantee is made.
  36733. [heading Remarks]
  36734. The implementation makes no guarantee that handlers posted or dispatched through different `strand` objects will be invoked concurrently.
  36735. [heading Thread Safety]
  36736. ['Distinct] ['objects:] Safe.
  36737. ['Shared] ['objects:] Safe.
  36738. [heading Requirements]
  36739. ['Header: ][^boost/asio/io_context_strand.hpp]
  36740. ['Convenience header: ][^boost/asio.hpp]
  36741. [section:context io_context::strand::context]
  36742. [indexterm2 boost_asio.indexterm.io_context__strand.context..context..io_context::strand]
  36743. Obtain the underlying execution context.
  36744. boost::asio::io_context & context() const;
  36745. [endsect]
  36746. [section:defer io_context::strand::defer]
  36747. [indexterm2 boost_asio.indexterm.io_context__strand.defer..defer..io_context::strand]
  36748. Request the strand to invoke the given function object.
  36749. template<
  36750. typename Function,
  36751. typename Allocator>
  36752. void defer(
  36753. Function && f,
  36754. const Allocator & a) const;
  36755. This function is used to ask the executor to execute the given function object. The function object will never be executed inside this function. Instead, it will be scheduled to run by the underlying [link boost_asio.reference.io_context `io_context`].
  36756. [heading Parameters]
  36757. [variablelist
  36758. [[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:
  36759. ``
  36760. void function();
  36761. ``
  36762. ]]
  36763. [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
  36764. ]
  36765. [endsect]
  36766. [section:dispatch io_context::strand::dispatch]
  36767. [indexterm2 boost_asio.indexterm.io_context__strand.dispatch..dispatch..io_context::strand]
  36768. Request the strand to invoke the given function object.
  36769. template<
  36770. typename Function,
  36771. typename Allocator>
  36772. void ``[link boost_asio.reference.io_context__strand.dispatch.overload1 dispatch]``(
  36773. Function && f,
  36774. const Allocator & a) const;
  36775. `` [''''&raquo;''' [link boost_asio.reference.io_context__strand.dispatch.overload1 more...]]``
  36776. (Deprecated: Use [link boost_asio.reference.dispatch `dispatch`].) Request the strand to invoke the given handler.
  36777. template<
  36778. typename ``[link boost_asio.reference.LegacyCompletionHandler LegacyCompletionHandler]``>
  36779. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.io_context__strand.dispatch.overload2 dispatch]``(
  36780. LegacyCompletionHandler && handler);
  36781. `` [''''&raquo;''' [link boost_asio.reference.io_context__strand.dispatch.overload2 more...]]``
  36782. [section:overload1 io_context::strand::dispatch (1 of 2 overloads)]
  36783. Request the strand to invoke the given function object.
  36784. template<
  36785. typename Function,
  36786. typename Allocator>
  36787. void dispatch(
  36788. Function && f,
  36789. const Allocator & a) const;
  36790. This function is used to ask the strand to execute the given function object on its underlying [link boost_asio.reference.io_context `io_context`]. The function object will be executed inside this function if the strand is not otherwise busy and if the underlying io\_context's executor's `dispatch()` function is also able to execute the function before returning.
  36791. [heading Parameters]
  36792. [variablelist
  36793. [[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:
  36794. ``
  36795. void function();
  36796. ``
  36797. ]]
  36798. [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
  36799. ]
  36800. [endsect]
  36801. [section:overload2 io_context::strand::dispatch (2 of 2 overloads)]
  36802. (Deprecated: Use [link boost_asio.reference.dispatch `dispatch`].) Request the strand to invoke the given handler.
  36803. template<
  36804. typename ``[link boost_asio.reference.LegacyCompletionHandler LegacyCompletionHandler]``>
  36805. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` dispatch(
  36806. LegacyCompletionHandler && handler);
  36807. This function is used to ask the strand to execute the given handler.
  36808. The strand object guarantees that handlers posted or dispatched through the strand will not be executed concurrently. The handler may be executed inside this function if the guarantee can be met. If this function is called from within a handler that was posted or dispatched through the same strand, then the new handler will be executed immediately.
  36809. 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.
  36810. [heading Parameters]
  36811. [variablelist
  36812. [[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:
  36813. ``
  36814. void handler();
  36815. ``
  36816. ]]
  36817. ]
  36818. [endsect]
  36819. [endsect]
  36820. [section:on_work_finished io_context::strand::on_work_finished]
  36821. [indexterm2 boost_asio.indexterm.io_context__strand.on_work_finished..on_work_finished..io_context::strand]
  36822. Inform the strand that some work is no longer outstanding.
  36823. void on_work_finished() const;
  36824. The strand delegates this call to its underlying [link boost_asio.reference.io_context `io_context`].
  36825. [endsect]
  36826. [section:on_work_started io_context::strand::on_work_started]
  36827. [indexterm2 boost_asio.indexterm.io_context__strand.on_work_started..on_work_started..io_context::strand]
  36828. Inform the strand that it has some outstanding work to do.
  36829. void on_work_started() const;
  36830. The strand delegates this call to its underlying [link boost_asio.reference.io_context `io_context`].
  36831. [endsect]
  36832. [section:operator_not__eq_ io_context::strand::operator!=]
  36833. [indexterm2 boost_asio.indexterm.io_context__strand.operator_not__eq_..operator!=..io_context::strand]
  36834. Compare two strands for inequality.
  36835. friend bool operator!=(
  36836. const strand & a,
  36837. const strand & b);
  36838. Two strands are equal if they refer to the same ordered, non-concurrent state.
  36839. [heading Requirements]
  36840. ['Header: ][^boost/asio/io_context_strand.hpp]
  36841. ['Convenience header: ][^boost/asio.hpp]
  36842. [endsect]
  36843. [section:operator_eq__eq_ io_context::strand::operator==]
  36844. [indexterm2 boost_asio.indexterm.io_context__strand.operator_eq__eq_..operator==..io_context::strand]
  36845. Compare two strands for equality.
  36846. friend bool operator==(
  36847. const strand & a,
  36848. const strand & b);
  36849. Two strands are equal if they refer to the same ordered, non-concurrent state.
  36850. [heading Requirements]
  36851. ['Header: ][^boost/asio/io_context_strand.hpp]
  36852. ['Convenience header: ][^boost/asio.hpp]
  36853. [endsect]
  36854. [section:post io_context::strand::post]
  36855. [indexterm2 boost_asio.indexterm.io_context__strand.post..post..io_context::strand]
  36856. Request the strand to invoke the given function object.
  36857. template<
  36858. typename Function,
  36859. typename Allocator>
  36860. void ``[link boost_asio.reference.io_context__strand.post.overload1 post]``(
  36861. Function && f,
  36862. const Allocator & a) const;
  36863. `` [''''&raquo;''' [link boost_asio.reference.io_context__strand.post.overload1 more...]]``
  36864. (Deprecated: Use [link boost_asio.reference.post `post`].) Request the strand to invoke the given handler and return immediately.
  36865. template<
  36866. typename ``[link boost_asio.reference.LegacyCompletionHandler LegacyCompletionHandler]``>
  36867. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.io_context__strand.post.overload2 post]``(
  36868. LegacyCompletionHandler && handler);
  36869. `` [''''&raquo;''' [link boost_asio.reference.io_context__strand.post.overload2 more...]]``
  36870. [section:overload1 io_context::strand::post (1 of 2 overloads)]
  36871. Request the strand to invoke the given function object.
  36872. template<
  36873. typename Function,
  36874. typename Allocator>
  36875. void post(
  36876. Function && f,
  36877. const Allocator & a) const;
  36878. This function is used to ask the executor to execute the given function object. The function object will never be executed inside this function. Instead, it will be scheduled to run by the underlying [link boost_asio.reference.io_context `io_context`].
  36879. [heading Parameters]
  36880. [variablelist
  36881. [[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:
  36882. ``
  36883. void function();
  36884. ``
  36885. ]]
  36886. [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
  36887. ]
  36888. [endsect]
  36889. [section:overload2 io_context::strand::post (2 of 2 overloads)]
  36890. (Deprecated: Use [link boost_asio.reference.post `post`].) Request the strand to invoke the given handler and return immediately.
  36891. template<
  36892. typename ``[link boost_asio.reference.LegacyCompletionHandler LegacyCompletionHandler]``>
  36893. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` post(
  36894. LegacyCompletionHandler && handler);
  36895. This function is used to ask the strand to execute the given handler, but without allowing the strand to call the handler from inside this function.
  36896. The strand object guarantees that handlers posted or dispatched through the strand will not be executed concurrently. The strand's guarantee is in addition to the guarantee provided by the underlying [link boost_asio.reference.io_context `io_context`]. The [link boost_asio.reference.io_context `io_context`] guarantees that the handler will only be called in a thread in which the io\_context's run member function is currently being invoked.
  36897. [heading Parameters]
  36898. [variablelist
  36899. [[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:
  36900. ``
  36901. void handler();
  36902. ``
  36903. ]]
  36904. ]
  36905. [endsect]
  36906. [endsect]
  36907. [section:running_in_this_thread io_context::strand::running_in_this_thread]
  36908. [indexterm2 boost_asio.indexterm.io_context__strand.running_in_this_thread..running_in_this_thread..io_context::strand]
  36909. Determine whether the strand is running in the current thread.
  36910. bool running_in_this_thread() const;
  36911. [heading Return Value]
  36912. `true` if the current thread is executing a handler that was submitted to the strand using `post()`, `dispatch()` or `wrap()`. Otherwise returns `false`.
  36913. [endsect]
  36914. [section:strand io_context::strand::strand]
  36915. [indexterm2 boost_asio.indexterm.io_context__strand.strand..strand..io_context::strand]
  36916. Constructor.
  36917. strand(
  36918. boost::asio::io_context & io_context);
  36919. Constructs the strand.
  36920. [heading Parameters]
  36921. [variablelist
  36922. [[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. ]]
  36923. ]
  36924. [endsect]
  36925. [section:wrap io_context::strand::wrap]
  36926. [indexterm2 boost_asio.indexterm.io_context__strand.wrap..wrap..io_context::strand]
  36927. (Deprecated: Use [link boost_asio.reference.bind_executor `bind_executor`].) Create a new handler that automatically dispatches the wrapped handler on the strand.
  36928. template<
  36929. typename ``[link boost_asio.reference.Handler Handler]``>
  36930. unspecified wrap(
  36931. Handler handler);
  36932. This function is used to create a new handler function object that, when invoked, will automatically pass the wrapped handler to the strand's dispatch function.
  36933. [heading Parameters]
  36934. [variablelist
  36935. [[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:
  36936. ``
  36937. void handler(A1 a1, ... An an);
  36938. ``
  36939. ]]
  36940. ]
  36941. [heading Return Value]
  36942. A function object that, when invoked, passes the wrapped handler to the strand's dispatch function. Given a function object with the signature:
  36943. R f(A1 a1, ... An an);
  36944. If this function object is passed to the wrap function like so:
  36945. strand.wrap(f);
  36946. then the return value is a function object with the signature
  36947. void g(A1 a1, ... An an);
  36948. that, when invoked, executes code equivalent to:
  36949. strand.dispatch(boost::bind(f, a1, ... an));
  36950. [endsect]
  36951. [section:_strand io_context::strand::~strand]
  36952. [indexterm2 boost_asio.indexterm.io_context__strand._strand..~strand..io_context::strand]
  36953. Destructor.
  36954. ~strand();
  36955. Destroys a strand.
  36956. Handlers posted through the strand that have not yet been invoked will still be dispatched in a way that meets the guarantee of non-concurrency.
  36957. [endsect]
  36958. [endsect]
  36959. [section:io_context__work io_context::work]
  36960. (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.
  36961. class work
  36962. [heading Member Functions]
  36963. [table
  36964. [[Name][Description]]
  36965. [
  36966. [[link boost_asio.reference.io_context__work.get_io_context [*get_io_context]]]
  36967. [Get the io_context associated with the work. ]
  36968. ]
  36969. [
  36970. [[link boost_asio.reference.io_context__work.work [*work]]]
  36971. [Constructor notifies the io_context that work is starting.
  36972. [hr]
  36973. Copy constructor notifies the io_context that work is starting. ]
  36974. ]
  36975. [
  36976. [[link boost_asio.reference.io_context__work._work [*~work]]]
  36977. [Destructor notifies the io_context that the work is complete. ]
  36978. ]
  36979. ]
  36980. The work class is used to inform the [link boost_asio.reference.io_context `io_context`] when work starts and finishes. This ensures that the [link boost_asio.reference.io_context `io_context`] object's `run()` function will not exit while work is underway, and that it does exit when there is no unfinished work remaining.
  36981. The work class is copy-constructible so that it may be used as a data member in a handler class. It is not assignable.
  36982. [heading Requirements]
  36983. ['Header: ][^boost/asio/io_context.hpp]
  36984. ['Convenience header: ][^boost/asio.hpp]
  36985. [section:get_io_context io_context::work::get_io_context]
  36986. [indexterm2 boost_asio.indexterm.io_context__work.get_io_context..get_io_context..io_context::work]
  36987. Get the [link boost_asio.reference.io_context `io_context`] associated with the work.
  36988. boost::asio::io_context & get_io_context();
  36989. [endsect]
  36990. [section:work io_context::work::work]
  36991. [indexterm2 boost_asio.indexterm.io_context__work.work..work..io_context::work]
  36992. Constructor notifies the [link boost_asio.reference.io_context `io_context`] that work is starting.
  36993. explicit ``[link boost_asio.reference.io_context__work.work.overload1 work]``(
  36994. boost::asio::io_context & io_context);
  36995. `` [''''&raquo;''' [link boost_asio.reference.io_context__work.work.overload1 more...]]``
  36996. Copy constructor notifies the [link boost_asio.reference.io_context `io_context`] that work is starting.
  36997. ``[link boost_asio.reference.io_context__work.work.overload2 work]``(
  36998. const work & other);
  36999. `` [''''&raquo;''' [link boost_asio.reference.io_context__work.work.overload2 more...]]``
  37000. [section:overload1 io_context::work::work (1 of 2 overloads)]
  37001. Constructor notifies the [link boost_asio.reference.io_context `io_context`] that work is starting.
  37002. work(
  37003. boost::asio::io_context & io_context);
  37004. The constructor is used to inform the [link boost_asio.reference.io_context `io_context`] that some work has begun. This ensures that the [link boost_asio.reference.io_context `io_context`] object's `run()` function will not exit while the work is underway.
  37005. [endsect]
  37006. [section:overload2 io_context::work::work (2 of 2 overloads)]
  37007. Copy constructor notifies the [link boost_asio.reference.io_context `io_context`] that work is starting.
  37008. work(
  37009. const work & other);
  37010. The constructor is used to inform the [link boost_asio.reference.io_context `io_context`] that some work has begun. This ensures that the [link boost_asio.reference.io_context `io_context`] object's `run()` function will not exit while the work is underway.
  37011. [endsect]
  37012. [endsect]
  37013. [section:_work io_context::work::~work]
  37014. [indexterm2 boost_asio.indexterm.io_context__work._work..~work..io_context::work]
  37015. Destructor notifies the [link boost_asio.reference.io_context `io_context`] that the work is complete.
  37016. ~work();
  37017. The destructor is used to inform the [link boost_asio.reference.io_context `io_context`] that some work has finished. Once the count of unfinished work reaches zero, the [link boost_asio.reference.io_context `io_context`] object's `run()` function is permitted to exit.
  37018. [endsect]
  37019. [endsect]
  37020. [section:io_service io_service]
  37021. [indexterm1 boost_asio.indexterm.io_service..io_service]
  37022. Typedef for backwards compatibility.
  37023. typedef io_context io_service;
  37024. [heading Types]
  37025. [table
  37026. [[Name][Description]]
  37027. [
  37028. [[link boost_asio.reference.io_context__executor_type [*executor_type]]]
  37029. [Executor used to submit functions to an io_context. ]
  37030. ]
  37031. [
  37032. [[link boost_asio.reference.io_context__service [*service]]]
  37033. [Base class for all io_context services. ]
  37034. ]
  37035. [
  37036. [[link boost_asio.reference.io_context__strand [*strand]]]
  37037. [Provides serialised handler execution. ]
  37038. ]
  37039. [
  37040. [[link boost_asio.reference.io_context__work [*work]]]
  37041. [(Deprecated: Use executor_work_guard.) Class to inform the io_context when it has work to do. ]
  37042. ]
  37043. [
  37044. [[link boost_asio.reference.io_context.count_type [*count_type]]]
  37045. [The type used to count the number of handlers executed by the context. ]
  37046. ]
  37047. [
  37048. [[link boost_asio.reference.io_context.fork_event [*fork_event]]]
  37049. [Fork-related event notifications. ]
  37050. ]
  37051. ]
  37052. [heading Member Functions]
  37053. [table
  37054. [[Name][Description]]
  37055. [
  37056. [[link boost_asio.reference.io_context.dispatch [*dispatch]]]
  37057. [(Deprecated: Use boost::asio::dispatch().) Request the io_context to invoke the given handler. ]
  37058. ]
  37059. [
  37060. [[link boost_asio.reference.io_context.get_executor [*get_executor]]]
  37061. [Obtains the executor associated with the io_context. ]
  37062. ]
  37063. [
  37064. [[link boost_asio.reference.io_context.io_context [*io_context]]]
  37065. [Constructor. ]
  37066. ]
  37067. [
  37068. [[link boost_asio.reference.io_context.notify_fork [*notify_fork]]]
  37069. [Notify the execution_context of a fork-related event. ]
  37070. ]
  37071. [
  37072. [[link boost_asio.reference.io_context.poll [*poll]]]
  37073. [Run the io_context object's event processing loop to execute ready handlers.
  37074. [hr]
  37075. (Deprecated: Use non-error_code overload.) Run the io_context object's event processing loop to execute ready handlers. ]
  37076. ]
  37077. [
  37078. [[link boost_asio.reference.io_context.poll_one [*poll_one]]]
  37079. [Run the io_context object's event processing loop to execute one ready handler.
  37080. [hr]
  37081. (Deprecated: Use non-error_code overload.) Run the io_context object's event processing loop to execute one ready handler. ]
  37082. ]
  37083. [
  37084. [[link boost_asio.reference.io_context.post [*post]]]
  37085. [(Deprecated: Use boost::asio::post().) Request the io_context to invoke the given handler and return immediately. ]
  37086. ]
  37087. [
  37088. [[link boost_asio.reference.io_context.reset [*reset]]]
  37089. [(Deprecated: Use restart().) Reset the io_context in preparation for a subsequent run() invocation. ]
  37090. ]
  37091. [
  37092. [[link boost_asio.reference.io_context.restart [*restart]]]
  37093. [Restart the io_context in preparation for a subsequent run() invocation. ]
  37094. ]
  37095. [
  37096. [[link boost_asio.reference.io_context.run [*run]]]
  37097. [Run the io_context object's event processing loop.
  37098. [hr]
  37099. (Deprecated: Use non-error_code overload.) Run the io_context object's event processing loop. ]
  37100. ]
  37101. [
  37102. [[link boost_asio.reference.io_context.run_for [*run_for]]]
  37103. [Run the io_context object's event processing loop for a specified duration. ]
  37104. ]
  37105. [
  37106. [[link boost_asio.reference.io_context.run_one [*run_one]]]
  37107. [Run the io_context object's event processing loop to execute at most one handler.
  37108. [hr]
  37109. (Deprecated: Use non-error_code overlaod.) Run the io_context object's event processing loop to execute at most one handler. ]
  37110. ]
  37111. [
  37112. [[link boost_asio.reference.io_context.run_one_for [*run_one_for]]]
  37113. [Run the io_context object's event processing loop for a specified duration to execute at most one handler. ]
  37114. ]
  37115. [
  37116. [[link boost_asio.reference.io_context.run_one_until [*run_one_until]]]
  37117. [Run the io_context object's event processing loop until a specified time to execute at most one handler. ]
  37118. ]
  37119. [
  37120. [[link boost_asio.reference.io_context.run_until [*run_until]]]
  37121. [Run the io_context object's event processing loop until a specified time. ]
  37122. ]
  37123. [
  37124. [[link boost_asio.reference.io_context.stop [*stop]]]
  37125. [Stop the io_context object's event processing loop. ]
  37126. ]
  37127. [
  37128. [[link boost_asio.reference.io_context.stopped [*stopped]]]
  37129. [Determine whether the io_context object has been stopped. ]
  37130. ]
  37131. [
  37132. [[link boost_asio.reference.io_context.wrap [*wrap]]]
  37133. [(Deprecated: Use boost::asio::bind_executor().) Create a new handler that automatically dispatches the wrapped handler on the io_context. ]
  37134. ]
  37135. [
  37136. [[link boost_asio.reference.io_context._io_context [*~io_context]]]
  37137. [Destructor. ]
  37138. ]
  37139. ]
  37140. [heading Protected Member Functions]
  37141. [table
  37142. [[Name][Description]]
  37143. [
  37144. [[link boost_asio.reference.io_context.destroy [*destroy]]]
  37145. [Destroys all services in the context. ]
  37146. ]
  37147. [
  37148. [[link boost_asio.reference.io_context.shutdown [*shutdown]]]
  37149. [Shuts down all services in the context. ]
  37150. ]
  37151. ]
  37152. [heading Friends]
  37153. [table
  37154. [[Name][Description]]
  37155. [
  37156. [[link boost_asio.reference.io_context.add_service [*add_service]]]
  37157. [(Deprecated: Use make_service().) Add a service object to the execution_context. ]
  37158. ]
  37159. [
  37160. [[link boost_asio.reference.io_context.has_service [*has_service]]]
  37161. [Determine if an execution_context contains a specified service type. ]
  37162. ]
  37163. [
  37164. [[link boost_asio.reference.io_context.make_service [*make_service]]]
  37165. [Creates a service object and adds it to the execution_context. ]
  37166. ]
  37167. [
  37168. [[link boost_asio.reference.io_context.use_service [*use_service]]]
  37169. [
  37170. [hr]
  37171. Obtain the service object corresponding to the given type. ]
  37172. ]
  37173. ]
  37174. The [link boost_asio.reference.io_context `io_context`] class provides the core I/O functionality for users of the asynchronous I/O objects, including:
  37175. * `boost::asio::ip::tcp::socket`
  37176. * `boost::asio::ip::tcp::acceptor`
  37177. * `boost::asio::ip::udp::socket`
  37178. * [link boost_asio.reference.deadline_timer `deadline_timer`].
  37179. The [link boost_asio.reference.io_context `io_context`] class also includes facilities intended for developers of custom asynchronous services.
  37180. [heading Thread Safety]
  37181. ['Distinct] ['objects:] Safe.
  37182. ['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.
  37183. [heading Synchronous and asynchronous operations]
  37184. Synchronous operations on I/O objects implicitly run the [link boost_asio.reference.io_context `io_context`] object for an individual operation. The [link boost_asio.reference.io_context `io_context`] functions `run()`, `run_one()`, `run_for()`, `run_until()`, `poll()` or `poll_one()` must be called for the [link boost_asio.reference.io_context `io_context`] to perform asynchronous operations on behalf of a C++ program. Notification that an asynchronous operation has completed is delivered by invocation of the associated handler. Handlers are invoked only by a thread that is currently calling any overload of `run()`, `run_one()`, `run_for()`, `run_until()`, `poll()` or `poll_one()` for the [link boost_asio.reference.io_context `io_context`].
  37185. [heading Effect of exceptions thrown from handlers]
  37186. If an exception is thrown from a handler, the exception is allowed to propagate through the throwing thread's invocation of `run()`, `run_one()`, `run_for()`, `run_until()`, `poll()` or `poll_one()`. No other threads that are calling any of these functions are affected. It is then the responsibility of the application to catch the exception.
  37187. After the exception has been caught, the `run()`, `run_one()`, `run_for()`, `run_until()`, `poll()` or `poll_one()` call may be restarted ['without] the need for an intervening call to `restart()`. This allows the thread to rejoin the [link boost_asio.reference.io_context `io_context`] object's thread pool without impacting any other threads in the pool.
  37188. For example:
  37189. boost::asio::io_context io_context;
  37190. ...
  37191. for (;;)
  37192. {
  37193. try
  37194. {
  37195. io_context.run();
  37196. break; // run() exited normally
  37197. }
  37198. catch (my_exception& e)
  37199. {
  37200. // Deal with exception as appropriate.
  37201. }
  37202. }
  37203. [heading Submitting arbitrary tasks to the io_context]
  37204. To submit functions to the [link boost_asio.reference.io_context `io_context`], use the [link boost_asio.reference.dispatch `dispatch`] , [link boost_asio.reference.post `post`] or [link boost_asio.reference.defer `defer`] free functions.
  37205. For example:
  37206. void my_task()
  37207. {
  37208. ...
  37209. }
  37210. ...
  37211. boost::asio::io_context io_context;
  37212. // Submit a function to the io_context.
  37213. boost::asio::post(io_context, my_task);
  37214. // Submit a lambda object to the io_context.
  37215. boost::asio::post(io_context,
  37216. []()
  37217. {
  37218. ...
  37219. });
  37220. // Run the io_context until it runs out of work.
  37221. io_context.run();
  37222. [heading Stopping the io_context from running out of work]
  37223. Some applications may need to prevent an [link boost_asio.reference.io_context `io_context`] object's `run()` call from returning when there is no more work to do. For example, the [link boost_asio.reference.io_context `io_context`] may be being run in a background thread that is launched prior to the application's asynchronous operations. The `run()` call may be kept running by creating an object of type boost::asio::executor\_work\_guard<io\_context::executor\_type>:
  37224. boost::asio::io_context io_context;
  37225. boost::asio::executor_work_guard<boost::asio::io_context::executor_type>
  37226. = boost::asio::make_work_guard(io_context);
  37227. ...
  37228. To effect a shutdown, the application will then need to call the [link boost_asio.reference.io_context `io_context`] object's `stop()` member function. This will cause the [link boost_asio.reference.io_context `io_context`] `run()` call to return as soon as possible, abandoning unfinished operations and without permitting ready handlers to be dispatched.
  37229. Alternatively, if the application requires that all operations and handlers be allowed to finish normally, the work object may be explicitly reset.
  37230. boost::asio::io_context io_context;
  37231. boost::asio::executor_work_guard<boost::asio::io_context::executor_type>
  37232. = boost::asio::make_work_guard(io_context);
  37233. ...
  37234. work.reset(); // Allow run() to exit.
  37235. [heading Requirements]
  37236. ['Header: ][^boost/asio/io_service.hpp]
  37237. ['Convenience header: ][^boost/asio.hpp]
  37238. [endsect]
  37239. [section:ip__address ip::address]
  37240. Implements version-independent IP addresses.
  37241. class address
  37242. [heading Member Functions]
  37243. [table
  37244. [[Name][Description]]
  37245. [
  37246. [[link boost_asio.reference.ip__address.address [*address]]]
  37247. [Default constructor.
  37248. [hr]
  37249. Construct an address from an IPv4 address.
  37250. [hr]
  37251. Construct an address from an IPv6 address.
  37252. [hr]
  37253. Copy constructor. ]
  37254. ]
  37255. [
  37256. [[link boost_asio.reference.ip__address.from_string [*from_string]]]
  37257. [(Deprecated: Use make_address().) Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. ]
  37258. ]
  37259. [
  37260. [[link boost_asio.reference.ip__address.is_loopback [*is_loopback]]]
  37261. [Determine whether the address is a loopback address. ]
  37262. ]
  37263. [
  37264. [[link boost_asio.reference.ip__address.is_multicast [*is_multicast]]]
  37265. [Determine whether the address is a multicast address. ]
  37266. ]
  37267. [
  37268. [[link boost_asio.reference.ip__address.is_unspecified [*is_unspecified]]]
  37269. [Determine whether the address is unspecified. ]
  37270. ]
  37271. [
  37272. [[link boost_asio.reference.ip__address.is_v4 [*is_v4]]]
  37273. [Get whether the address is an IP version 4 address. ]
  37274. ]
  37275. [
  37276. [[link boost_asio.reference.ip__address.is_v6 [*is_v6]]]
  37277. [Get whether the address is an IP version 6 address. ]
  37278. ]
  37279. [
  37280. [[link boost_asio.reference.ip__address.operator_eq_ [*operator=]]]
  37281. [Assign from another address.
  37282. [hr]
  37283. Assign from an IPv4 address.
  37284. [hr]
  37285. Assign from an IPv6 address. ]
  37286. ]
  37287. [
  37288. [[link boost_asio.reference.ip__address.to_string [*to_string]]]
  37289. [Get the address as a string.
  37290. [hr]
  37291. (Deprecated: Use other overload.) Get the address as a string. ]
  37292. ]
  37293. [
  37294. [[link boost_asio.reference.ip__address.to_v4 [*to_v4]]]
  37295. [Get the address as an IP version 4 address. ]
  37296. ]
  37297. [
  37298. [[link boost_asio.reference.ip__address.to_v6 [*to_v6]]]
  37299. [Get the address as an IP version 6 address. ]
  37300. ]
  37301. ]
  37302. [heading Friends]
  37303. [table
  37304. [[Name][Description]]
  37305. [
  37306. [[link boost_asio.reference.ip__address.operator_not__eq_ [*operator!=]]]
  37307. [Compare two addresses for inequality. ]
  37308. ]
  37309. [
  37310. [[link boost_asio.reference.ip__address.operator_lt_ [*operator<]]]
  37311. [Compare addresses for ordering. ]
  37312. ]
  37313. [
  37314. [[link boost_asio.reference.ip__address.operator_lt__eq_ [*operator<=]]]
  37315. [Compare addresses for ordering. ]
  37316. ]
  37317. [
  37318. [[link boost_asio.reference.ip__address.operator_eq__eq_ [*operator==]]]
  37319. [Compare two addresses for equality. ]
  37320. ]
  37321. [
  37322. [[link boost_asio.reference.ip__address.operator_gt_ [*operator>]]]
  37323. [Compare addresses for ordering. ]
  37324. ]
  37325. [
  37326. [[link boost_asio.reference.ip__address.operator_gt__eq_ [*operator>=]]]
  37327. [Compare addresses for ordering. ]
  37328. ]
  37329. ]
  37330. [heading Related Functions]
  37331. [table
  37332. [[Name][Description]]
  37333. [
  37334. [[link boost_asio.reference.ip__address.make_address [*make_address]]]
  37335. [Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. ]
  37336. ]
  37337. [
  37338. [[link boost_asio.reference.ip__address.operator_lt__lt_ [*operator<<]]]
  37339. [Output an address as a string. ]
  37340. ]
  37341. ]
  37342. The [link boost_asio.reference.ip__address `ip::address`] class provides the ability to use either IP version 4 or version 6 addresses.
  37343. [heading Thread Safety]
  37344. ['Distinct] ['objects:] Safe.
  37345. ['Shared] ['objects:] Unsafe.
  37346. [heading Requirements]
  37347. ['Header: ][^boost/asio/ip/address.hpp]
  37348. ['Convenience header: ][^boost/asio.hpp]
  37349. [section:address ip::address::address]
  37350. [indexterm2 boost_asio.indexterm.ip__address.address..address..ip::address]
  37351. Default constructor.
  37352. ``[link boost_asio.reference.ip__address.address.overload1 address]``();
  37353. `` [''''&raquo;''' [link boost_asio.reference.ip__address.address.overload1 more...]]``
  37354. Construct an address from an IPv4 address.
  37355. ``[link boost_asio.reference.ip__address.address.overload2 address]``(
  37356. const boost::asio::ip::address_v4 & ipv4_address);
  37357. `` [''''&raquo;''' [link boost_asio.reference.ip__address.address.overload2 more...]]``
  37358. Construct an address from an IPv6 address.
  37359. ``[link boost_asio.reference.ip__address.address.overload3 address]``(
  37360. const boost::asio::ip::address_v6 & ipv6_address);
  37361. `` [''''&raquo;''' [link boost_asio.reference.ip__address.address.overload3 more...]]``
  37362. Copy constructor.
  37363. ``[link boost_asio.reference.ip__address.address.overload4 address]``(
  37364. const address & other);
  37365. `` [''''&raquo;''' [link boost_asio.reference.ip__address.address.overload4 more...]]``
  37366. [section:overload1 ip::address::address (1 of 4 overloads)]
  37367. Default constructor.
  37368. address();
  37369. [endsect]
  37370. [section:overload2 ip::address::address (2 of 4 overloads)]
  37371. Construct an address from an IPv4 address.
  37372. address(
  37373. const boost::asio::ip::address_v4 & ipv4_address);
  37374. [endsect]
  37375. [section:overload3 ip::address::address (3 of 4 overloads)]
  37376. Construct an address from an IPv6 address.
  37377. address(
  37378. const boost::asio::ip::address_v6 & ipv6_address);
  37379. [endsect]
  37380. [section:overload4 ip::address::address (4 of 4 overloads)]
  37381. Copy constructor.
  37382. address(
  37383. const address & other);
  37384. [endsect]
  37385. [endsect]
  37386. [section:from_string ip::address::from_string]
  37387. [indexterm2 boost_asio.indexterm.ip__address.from_string..from_string..ip::address]
  37388. (Deprecated: Use `make_address()`.) Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
  37389. static address ``[link boost_asio.reference.ip__address.from_string.overload1 from_string]``(
  37390. const char * str);
  37391. `` [''''&raquo;''' [link boost_asio.reference.ip__address.from_string.overload1 more...]]``
  37392. static address ``[link boost_asio.reference.ip__address.from_string.overload2 from_string]``(
  37393. const char * str,
  37394. boost::system::error_code & ec);
  37395. `` [''''&raquo;''' [link boost_asio.reference.ip__address.from_string.overload2 more...]]``
  37396. static address ``[link boost_asio.reference.ip__address.from_string.overload3 from_string]``(
  37397. const std::string & str);
  37398. `` [''''&raquo;''' [link boost_asio.reference.ip__address.from_string.overload3 more...]]``
  37399. static address ``[link boost_asio.reference.ip__address.from_string.overload4 from_string]``(
  37400. const std::string & str,
  37401. boost::system::error_code & ec);
  37402. `` [''''&raquo;''' [link boost_asio.reference.ip__address.from_string.overload4 more...]]``
  37403. [section:overload1 ip::address::from_string (1 of 4 overloads)]
  37404. (Deprecated: Use `make_address()`.) Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
  37405. static address from_string(
  37406. const char * str);
  37407. [endsect]
  37408. [section:overload2 ip::address::from_string (2 of 4 overloads)]
  37409. (Deprecated: Use `make_address()`.) Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
  37410. static address from_string(
  37411. const char * str,
  37412. boost::system::error_code & ec);
  37413. [endsect]
  37414. [section:overload3 ip::address::from_string (3 of 4 overloads)]
  37415. (Deprecated: Use `make_address()`.) Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
  37416. static address from_string(
  37417. const std::string & str);
  37418. [endsect]
  37419. [section:overload4 ip::address::from_string (4 of 4 overloads)]
  37420. (Deprecated: Use `make_address()`.) Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
  37421. static address from_string(
  37422. const std::string & str,
  37423. boost::system::error_code & ec);
  37424. [endsect]
  37425. [endsect]
  37426. [section:is_loopback ip::address::is_loopback]
  37427. [indexterm2 boost_asio.indexterm.ip__address.is_loopback..is_loopback..ip::address]
  37428. Determine whether the address is a loopback address.
  37429. bool is_loopback() const;
  37430. [endsect]
  37431. [section:is_multicast ip::address::is_multicast]
  37432. [indexterm2 boost_asio.indexterm.ip__address.is_multicast..is_multicast..ip::address]
  37433. Determine whether the address is a multicast address.
  37434. bool is_multicast() const;
  37435. [endsect]
  37436. [section:is_unspecified ip::address::is_unspecified]
  37437. [indexterm2 boost_asio.indexterm.ip__address.is_unspecified..is_unspecified..ip::address]
  37438. Determine whether the address is unspecified.
  37439. bool is_unspecified() const;
  37440. [endsect]
  37441. [section:is_v4 ip::address::is_v4]
  37442. [indexterm2 boost_asio.indexterm.ip__address.is_v4..is_v4..ip::address]
  37443. Get whether the address is an IP version 4 address.
  37444. bool is_v4() const;
  37445. [endsect]
  37446. [section:is_v6 ip::address::is_v6]
  37447. [indexterm2 boost_asio.indexterm.ip__address.is_v6..is_v6..ip::address]
  37448. Get whether the address is an IP version 6 address.
  37449. bool is_v6() const;
  37450. [endsect]
  37451. [section:make_address ip::address::make_address]
  37452. [indexterm2 boost_asio.indexterm.ip__address.make_address..make_address..ip::address]
  37453. Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
  37454. address ``[link boost_asio.reference.ip__address.make_address.overload1 make_address]``(
  37455. const char * str);
  37456. `` [''''&raquo;''' [link boost_asio.reference.ip__address.make_address.overload1 more...]]``
  37457. address ``[link boost_asio.reference.ip__address.make_address.overload2 make_address]``(
  37458. const char * str,
  37459. boost::system::error_code & ec);
  37460. `` [''''&raquo;''' [link boost_asio.reference.ip__address.make_address.overload2 more...]]``
  37461. address ``[link boost_asio.reference.ip__address.make_address.overload3 make_address]``(
  37462. const std::string & str);
  37463. `` [''''&raquo;''' [link boost_asio.reference.ip__address.make_address.overload3 more...]]``
  37464. address ``[link boost_asio.reference.ip__address.make_address.overload4 make_address]``(
  37465. const std::string & str,
  37466. boost::system::error_code & ec);
  37467. `` [''''&raquo;''' [link boost_asio.reference.ip__address.make_address.overload4 more...]]``
  37468. address ``[link boost_asio.reference.ip__address.make_address.overload5 make_address]``(
  37469. string_view str);
  37470. `` [''''&raquo;''' [link boost_asio.reference.ip__address.make_address.overload5 more...]]``
  37471. address ``[link boost_asio.reference.ip__address.make_address.overload6 make_address]``(
  37472. string_view str,
  37473. boost::system::error_code & ec);
  37474. `` [''''&raquo;''' [link boost_asio.reference.ip__address.make_address.overload6 more...]]``
  37475. [section:overload1 ip::address::make_address (1 of 6 overloads)]
  37476. Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
  37477. address make_address(
  37478. const char * str);
  37479. [endsect]
  37480. [section:overload2 ip::address::make_address (2 of 6 overloads)]
  37481. Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
  37482. address make_address(
  37483. const char * str,
  37484. boost::system::error_code & ec);
  37485. [endsect]
  37486. [section:overload3 ip::address::make_address (3 of 6 overloads)]
  37487. Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
  37488. address make_address(
  37489. const std::string & str);
  37490. [endsect]
  37491. [section:overload4 ip::address::make_address (4 of 6 overloads)]
  37492. Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
  37493. address make_address(
  37494. const std::string & str,
  37495. boost::system::error_code & ec);
  37496. [endsect]
  37497. [section:overload5 ip::address::make_address (5 of 6 overloads)]
  37498. Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
  37499. address make_address(
  37500. string_view str);
  37501. [endsect]
  37502. [section:overload6 ip::address::make_address (6 of 6 overloads)]
  37503. Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
  37504. address make_address(
  37505. string_view str,
  37506. boost::system::error_code & ec);
  37507. [endsect]
  37508. [endsect]
  37509. [section:operator_not__eq_ ip::address::operator!=]
  37510. [indexterm2 boost_asio.indexterm.ip__address.operator_not__eq_..operator!=..ip::address]
  37511. Compare two addresses for inequality.
  37512. friend bool operator!=(
  37513. const address & a1,
  37514. const address & a2);
  37515. [heading Requirements]
  37516. ['Header: ][^boost/asio/ip/address.hpp]
  37517. ['Convenience header: ][^boost/asio.hpp]
  37518. [endsect]
  37519. [section:operator_lt_ ip::address::operator<]
  37520. [indexterm2 boost_asio.indexterm.ip__address.operator_lt_..operator<..ip::address]
  37521. Compare addresses for ordering.
  37522. friend bool operator<(
  37523. const address & a1,
  37524. const address & a2);
  37525. [heading Requirements]
  37526. ['Header: ][^boost/asio/ip/address.hpp]
  37527. ['Convenience header: ][^boost/asio.hpp]
  37528. [endsect]
  37529. [section:operator_lt__lt_ ip::address::operator<<]
  37530. [indexterm2 boost_asio.indexterm.ip__address.operator_lt__lt_..operator<<..ip::address]
  37531. Output an address as a string.
  37532. template<
  37533. typename Elem,
  37534. typename Traits>
  37535. std::basic_ostream< Elem, Traits > & operator<<(
  37536. std::basic_ostream< Elem, Traits > & os,
  37537. const address & addr);
  37538. Used to output a human-readable string for a specified address.
  37539. [heading Parameters]
  37540. [variablelist
  37541. [[os][The output stream to which the string will be written.]]
  37542. [[addr][The address to be written.]]
  37543. ]
  37544. [heading Return Value]
  37545. The output stream.
  37546. [endsect]
  37547. [section:operator_lt__eq_ ip::address::operator<=]
  37548. [indexterm2 boost_asio.indexterm.ip__address.operator_lt__eq_..operator<=..ip::address]
  37549. Compare addresses for ordering.
  37550. friend bool operator<=(
  37551. const address & a1,
  37552. const address & a2);
  37553. [heading Requirements]
  37554. ['Header: ][^boost/asio/ip/address.hpp]
  37555. ['Convenience header: ][^boost/asio.hpp]
  37556. [endsect]
  37557. [section:operator_eq_ ip::address::operator=]
  37558. [indexterm2 boost_asio.indexterm.ip__address.operator_eq_..operator=..ip::address]
  37559. Assign from another address.
  37560. address & ``[link boost_asio.reference.ip__address.operator_eq_.overload1 operator=]``(
  37561. const address & other);
  37562. `` [''''&raquo;''' [link boost_asio.reference.ip__address.operator_eq_.overload1 more...]]``
  37563. Assign from an IPv4 address.
  37564. address & ``[link boost_asio.reference.ip__address.operator_eq_.overload2 operator=]``(
  37565. const boost::asio::ip::address_v4 & ipv4_address);
  37566. `` [''''&raquo;''' [link boost_asio.reference.ip__address.operator_eq_.overload2 more...]]``
  37567. Assign from an IPv6 address.
  37568. address & ``[link boost_asio.reference.ip__address.operator_eq_.overload3 operator=]``(
  37569. const boost::asio::ip::address_v6 & ipv6_address);
  37570. `` [''''&raquo;''' [link boost_asio.reference.ip__address.operator_eq_.overload3 more...]]``
  37571. [section:overload1 ip::address::operator= (1 of 3 overloads)]
  37572. Assign from another address.
  37573. address & operator=(
  37574. const address & other);
  37575. [endsect]
  37576. [section:overload2 ip::address::operator= (2 of 3 overloads)]
  37577. Assign from an IPv4 address.
  37578. address & operator=(
  37579. const boost::asio::ip::address_v4 & ipv4_address);
  37580. [endsect]
  37581. [section:overload3 ip::address::operator= (3 of 3 overloads)]
  37582. Assign from an IPv6 address.
  37583. address & operator=(
  37584. const boost::asio::ip::address_v6 & ipv6_address);
  37585. [endsect]
  37586. [endsect]
  37587. [section:operator_eq__eq_ ip::address::operator==]
  37588. [indexterm2 boost_asio.indexterm.ip__address.operator_eq__eq_..operator==..ip::address]
  37589. Compare two addresses for equality.
  37590. friend bool operator==(
  37591. const address & a1,
  37592. const address & a2);
  37593. [heading Requirements]
  37594. ['Header: ][^boost/asio/ip/address.hpp]
  37595. ['Convenience header: ][^boost/asio.hpp]
  37596. [endsect]
  37597. [section:operator_gt_ ip::address::operator>]
  37598. [indexterm2 boost_asio.indexterm.ip__address.operator_gt_..operator>..ip::address]
  37599. Compare addresses for ordering.
  37600. friend bool operator>(
  37601. const address & a1,
  37602. const address & a2);
  37603. [heading Requirements]
  37604. ['Header: ][^boost/asio/ip/address.hpp]
  37605. ['Convenience header: ][^boost/asio.hpp]
  37606. [endsect]
  37607. [section:operator_gt__eq_ ip::address::operator>=]
  37608. [indexterm2 boost_asio.indexterm.ip__address.operator_gt__eq_..operator>=..ip::address]
  37609. Compare addresses for ordering.
  37610. friend bool operator>=(
  37611. const address & a1,
  37612. const address & a2);
  37613. [heading Requirements]
  37614. ['Header: ][^boost/asio/ip/address.hpp]
  37615. ['Convenience header: ][^boost/asio.hpp]
  37616. [endsect]
  37617. [section:to_string ip::address::to_string]
  37618. [indexterm2 boost_asio.indexterm.ip__address.to_string..to_string..ip::address]
  37619. Get the address as a string.
  37620. std::string ``[link boost_asio.reference.ip__address.to_string.overload1 to_string]``() const;
  37621. `` [''''&raquo;''' [link boost_asio.reference.ip__address.to_string.overload1 more...]]``
  37622. (Deprecated: Use other overload.) Get the address as a string.
  37623. std::string ``[link boost_asio.reference.ip__address.to_string.overload2 to_string]``(
  37624. boost::system::error_code & ec) const;
  37625. `` [''''&raquo;''' [link boost_asio.reference.ip__address.to_string.overload2 more...]]``
  37626. [section:overload1 ip::address::to_string (1 of 2 overloads)]
  37627. Get the address as a string.
  37628. std::string to_string() const;
  37629. [endsect]
  37630. [section:overload2 ip::address::to_string (2 of 2 overloads)]
  37631. (Deprecated: Use other overload.) Get the address as a string.
  37632. std::string to_string(
  37633. boost::system::error_code & ec) const;
  37634. [endsect]
  37635. [endsect]
  37636. [section:to_v4 ip::address::to_v4]
  37637. [indexterm2 boost_asio.indexterm.ip__address.to_v4..to_v4..ip::address]
  37638. Get the address as an IP version 4 address.
  37639. boost::asio::ip::address_v4 to_v4() const;
  37640. [endsect]
  37641. [section:to_v6 ip::address::to_v6]
  37642. [indexterm2 boost_asio.indexterm.ip__address.to_v6..to_v6..ip::address]
  37643. Get the address as an IP version 6 address.
  37644. boost::asio::ip::address_v6 to_v6() const;
  37645. [endsect]
  37646. [endsect]
  37647. [section:ip__address_v4 ip::address_v4]
  37648. Implements IP version 4 style addresses.
  37649. class address_v4
  37650. [heading Types]
  37651. [table
  37652. [[Name][Description]]
  37653. [
  37654. [[link boost_asio.reference.ip__address_v4.bytes_type [*bytes_type]]]
  37655. [The type used to represent an address as an array of bytes. ]
  37656. ]
  37657. [
  37658. [[link boost_asio.reference.ip__address_v4.uint_type [*uint_type]]]
  37659. [The type used to represent an address as an unsigned integer. ]
  37660. ]
  37661. ]
  37662. [heading Member Functions]
  37663. [table
  37664. [[Name][Description]]
  37665. [
  37666. [[link boost_asio.reference.ip__address_v4.address_v4 [*address_v4]]]
  37667. [Default constructor.
  37668. [hr]
  37669. Construct an address from raw bytes.
  37670. [hr]
  37671. Construct an address from an unsigned integer in host byte order.
  37672. [hr]
  37673. Copy constructor. ]
  37674. ]
  37675. [
  37676. [[link boost_asio.reference.ip__address_v4.any [*any]]]
  37677. [Obtain an address object that represents any address. ]
  37678. ]
  37679. [
  37680. [[link boost_asio.reference.ip__address_v4.broadcast [*broadcast]]]
  37681. [Obtain an address object that represents the broadcast address.
  37682. [hr]
  37683. (Deprecated: Use network_v4 class.) Obtain an address object that represents the broadcast address that corresponds to the specified address and netmask. ]
  37684. ]
  37685. [
  37686. [[link boost_asio.reference.ip__address_v4.from_string [*from_string]]]
  37687. [(Deprecated: Use make_address_v4().) Create an address from an IP address string in dotted decimal form. ]
  37688. ]
  37689. [
  37690. [[link boost_asio.reference.ip__address_v4.is_class_a [*is_class_a]]]
  37691. [(Deprecated: Use network_v4 class.) Determine whether the address is a class A address. ]
  37692. ]
  37693. [
  37694. [[link boost_asio.reference.ip__address_v4.is_class_b [*is_class_b]]]
  37695. [(Deprecated: Use network_v4 class.) Determine whether the address is a class B address. ]
  37696. ]
  37697. [
  37698. [[link boost_asio.reference.ip__address_v4.is_class_c [*is_class_c]]]
  37699. [(Deprecated: Use network_v4 class.) Determine whether the address is a class C address. ]
  37700. ]
  37701. [
  37702. [[link boost_asio.reference.ip__address_v4.is_loopback [*is_loopback]]]
  37703. [Determine whether the address is a loopback address. ]
  37704. ]
  37705. [
  37706. [[link boost_asio.reference.ip__address_v4.is_multicast [*is_multicast]]]
  37707. [Determine whether the address is a multicast address. ]
  37708. ]
  37709. [
  37710. [[link boost_asio.reference.ip__address_v4.is_unspecified [*is_unspecified]]]
  37711. [Determine whether the address is unspecified. ]
  37712. ]
  37713. [
  37714. [[link boost_asio.reference.ip__address_v4.loopback [*loopback]]]
  37715. [Obtain an address object that represents the loopback address. ]
  37716. ]
  37717. [
  37718. [[link boost_asio.reference.ip__address_v4.netmask [*netmask]]]
  37719. [(Deprecated: Use network_v4 class.) Obtain the netmask that corresponds to the address, based on its address class. ]
  37720. ]
  37721. [
  37722. [[link boost_asio.reference.ip__address_v4.operator_eq_ [*operator=]]]
  37723. [Assign from another address. ]
  37724. ]
  37725. [
  37726. [[link boost_asio.reference.ip__address_v4.to_bytes [*to_bytes]]]
  37727. [Get the address in bytes, in network byte order. ]
  37728. ]
  37729. [
  37730. [[link boost_asio.reference.ip__address_v4.to_string [*to_string]]]
  37731. [Get the address as a string in dotted decimal format.
  37732. [hr]
  37733. (Deprecated: Use other overload.) Get the address as a string in dotted decimal format. ]
  37734. ]
  37735. [
  37736. [[link boost_asio.reference.ip__address_v4.to_uint [*to_uint]]]
  37737. [Get the address as an unsigned integer in host byte order. ]
  37738. ]
  37739. [
  37740. [[link boost_asio.reference.ip__address_v4.to_ulong [*to_ulong]]]
  37741. [Get the address as an unsigned long in host byte order. ]
  37742. ]
  37743. ]
  37744. [heading Friends]
  37745. [table
  37746. [[Name][Description]]
  37747. [
  37748. [[link boost_asio.reference.ip__address_v4.operator_not__eq_ [*operator!=]]]
  37749. [Compare two addresses for inequality. ]
  37750. ]
  37751. [
  37752. [[link boost_asio.reference.ip__address_v4.operator_lt_ [*operator<]]]
  37753. [Compare addresses for ordering. ]
  37754. ]
  37755. [
  37756. [[link boost_asio.reference.ip__address_v4.operator_lt__eq_ [*operator<=]]]
  37757. [Compare addresses for ordering. ]
  37758. ]
  37759. [
  37760. [[link boost_asio.reference.ip__address_v4.operator_eq__eq_ [*operator==]]]
  37761. [Compare two addresses for equality. ]
  37762. ]
  37763. [
  37764. [[link boost_asio.reference.ip__address_v4.operator_gt_ [*operator>]]]
  37765. [Compare addresses for ordering. ]
  37766. ]
  37767. [
  37768. [[link boost_asio.reference.ip__address_v4.operator_gt__eq_ [*operator>=]]]
  37769. [Compare addresses for ordering. ]
  37770. ]
  37771. ]
  37772. [heading Related Functions]
  37773. [table
  37774. [[Name][Description]]
  37775. [
  37776. [[link boost_asio.reference.ip__address_v4.make_address_v4 [*make_address_v4]]]
  37777. [Create an IPv4 address from raw bytes in network order.
  37778. Create an IPv4 address from an unsigned integer in host byte order.
  37779. Create an IPv4 address from an IP address string in dotted decimal form.
  37780. Create an IPv4 address from a IPv4-mapped IPv6 address. ]
  37781. ]
  37782. [
  37783. [[link boost_asio.reference.ip__address_v4.make_network_v4 [*make_network_v4]]]
  37784. [Create an IPv4 network from an address and prefix length.
  37785. Create an IPv4 network from an address and netmask. ]
  37786. ]
  37787. [
  37788. [[link boost_asio.reference.ip__address_v4.operator_lt__lt_ [*operator<<]]]
  37789. [Output an address as a string.
  37790. Output a network as a string. ]
  37791. ]
  37792. ]
  37793. The [link boost_asio.reference.ip__address_v4 `ip::address_v4`] class provides the ability to use and manipulate IP version 4 addresses.
  37794. [heading Thread Safety]
  37795. ['Distinct] ['objects:] Safe.
  37796. ['Shared] ['objects:] Unsafe.
  37797. [heading Requirements]
  37798. ['Header: ][^boost/asio/ip/address_v4.hpp]
  37799. ['Convenience header: ][^boost/asio.hpp]
  37800. [section:address_v4 ip::address_v4::address_v4]
  37801. [indexterm2 boost_asio.indexterm.ip__address_v4.address_v4..address_v4..ip::address_v4]
  37802. Default constructor.
  37803. ``[link boost_asio.reference.ip__address_v4.address_v4.overload1 address_v4]``();
  37804. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.address_v4.overload1 more...]]``
  37805. Construct an address from raw bytes.
  37806. explicit ``[link boost_asio.reference.ip__address_v4.address_v4.overload2 address_v4]``(
  37807. const bytes_type & bytes);
  37808. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.address_v4.overload2 more...]]``
  37809. Construct an address from an unsigned integer in host byte order.
  37810. explicit ``[link boost_asio.reference.ip__address_v4.address_v4.overload3 address_v4]``(
  37811. uint_type addr);
  37812. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.address_v4.overload3 more...]]``
  37813. Copy constructor.
  37814. ``[link boost_asio.reference.ip__address_v4.address_v4.overload4 address_v4]``(
  37815. const address_v4 & other);
  37816. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.address_v4.overload4 more...]]``
  37817. [section:overload1 ip::address_v4::address_v4 (1 of 4 overloads)]
  37818. Default constructor.
  37819. address_v4();
  37820. [endsect]
  37821. [section:overload2 ip::address_v4::address_v4 (2 of 4 overloads)]
  37822. Construct an address from raw bytes.
  37823. address_v4(
  37824. const bytes_type & bytes);
  37825. [endsect]
  37826. [section:overload3 ip::address_v4::address_v4 (3 of 4 overloads)]
  37827. Construct an address from an unsigned integer in host byte order.
  37828. address_v4(
  37829. uint_type addr);
  37830. [endsect]
  37831. [section:overload4 ip::address_v4::address_v4 (4 of 4 overloads)]
  37832. Copy constructor.
  37833. address_v4(
  37834. const address_v4 & other);
  37835. [endsect]
  37836. [endsect]
  37837. [section:any ip::address_v4::any]
  37838. [indexterm2 boost_asio.indexterm.ip__address_v4.any..any..ip::address_v4]
  37839. Obtain an address object that represents any address.
  37840. static address_v4 any();
  37841. [endsect]
  37842. [section:broadcast ip::address_v4::broadcast]
  37843. [indexterm2 boost_asio.indexterm.ip__address_v4.broadcast..broadcast..ip::address_v4]
  37844. Obtain an address object that represents the broadcast address.
  37845. static address_v4 ``[link boost_asio.reference.ip__address_v4.broadcast.overload1 broadcast]``();
  37846. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.broadcast.overload1 more...]]``
  37847. (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.
  37848. static address_v4 ``[link boost_asio.reference.ip__address_v4.broadcast.overload2 broadcast]``(
  37849. const address_v4 & addr,
  37850. const address_v4 & mask);
  37851. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.broadcast.overload2 more...]]``
  37852. [section:overload1 ip::address_v4::broadcast (1 of 2 overloads)]
  37853. Obtain an address object that represents the broadcast address.
  37854. static address_v4 broadcast();
  37855. [endsect]
  37856. [section:overload2 ip::address_v4::broadcast (2 of 2 overloads)]
  37857. (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.
  37858. static address_v4 broadcast(
  37859. const address_v4 & addr,
  37860. const address_v4 & mask);
  37861. [endsect]
  37862. [endsect]
  37863. [section:bytes_type ip::address_v4::bytes_type]
  37864. [indexterm2 boost_asio.indexterm.ip__address_v4.bytes_type..bytes_type..ip::address_v4]
  37865. The type used to represent an address as an array of bytes.
  37866. typedef array< unsigned char, 4 > bytes_type;
  37867. [heading Remarks]
  37868. This type is defined in terms of the C++0x template `std::array` when it is available. Otherwise, it uses `boost:array`.
  37869. [heading Requirements]
  37870. ['Header: ][^boost/asio/ip/address_v4.hpp]
  37871. ['Convenience header: ][^boost/asio.hpp]
  37872. [endsect]
  37873. [section:from_string ip::address_v4::from_string]
  37874. [indexterm2 boost_asio.indexterm.ip__address_v4.from_string..from_string..ip::address_v4]
  37875. (Deprecated: Use `make_address_v4()`.) Create an address from an IP address string in dotted decimal form.
  37876. static address_v4 ``[link boost_asio.reference.ip__address_v4.from_string.overload1 from_string]``(
  37877. const char * str);
  37878. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.from_string.overload1 more...]]``
  37879. static address_v4 ``[link boost_asio.reference.ip__address_v4.from_string.overload2 from_string]``(
  37880. const char * str,
  37881. boost::system::error_code & ec);
  37882. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.from_string.overload2 more...]]``
  37883. static address_v4 ``[link boost_asio.reference.ip__address_v4.from_string.overload3 from_string]``(
  37884. const std::string & str);
  37885. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.from_string.overload3 more...]]``
  37886. static address_v4 ``[link boost_asio.reference.ip__address_v4.from_string.overload4 from_string]``(
  37887. const std::string & str,
  37888. boost::system::error_code & ec);
  37889. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.from_string.overload4 more...]]``
  37890. [section:overload1 ip::address_v4::from_string (1 of 4 overloads)]
  37891. (Deprecated: Use `make_address_v4()`.) Create an address from an IP address string in dotted decimal form.
  37892. static address_v4 from_string(
  37893. const char * str);
  37894. [endsect]
  37895. [section:overload2 ip::address_v4::from_string (2 of 4 overloads)]
  37896. (Deprecated: Use `make_address_v4()`.) Create an address from an IP address string in dotted decimal form.
  37897. static address_v4 from_string(
  37898. const char * str,
  37899. boost::system::error_code & ec);
  37900. [endsect]
  37901. [section:overload3 ip::address_v4::from_string (3 of 4 overloads)]
  37902. (Deprecated: Use `make_address_v4()`.) Create an address from an IP address string in dotted decimal form.
  37903. static address_v4 from_string(
  37904. const std::string & str);
  37905. [endsect]
  37906. [section:overload4 ip::address_v4::from_string (4 of 4 overloads)]
  37907. (Deprecated: Use `make_address_v4()`.) Create an address from an IP address string in dotted decimal form.
  37908. static address_v4 from_string(
  37909. const std::string & str,
  37910. boost::system::error_code & ec);
  37911. [endsect]
  37912. [endsect]
  37913. [section:is_class_a ip::address_v4::is_class_a]
  37914. [indexterm2 boost_asio.indexterm.ip__address_v4.is_class_a..is_class_a..ip::address_v4]
  37915. (Deprecated: Use [link boost_asio.reference.ip__network_v4 `ip::network_v4`] class.) Determine whether the address is a class A address.
  37916. bool is_class_a() const;
  37917. [endsect]
  37918. [section:is_class_b ip::address_v4::is_class_b]
  37919. [indexterm2 boost_asio.indexterm.ip__address_v4.is_class_b..is_class_b..ip::address_v4]
  37920. (Deprecated: Use [link boost_asio.reference.ip__network_v4 `ip::network_v4`] class.) Determine whether the address is a class B address.
  37921. bool is_class_b() const;
  37922. [endsect]
  37923. [section:is_class_c ip::address_v4::is_class_c]
  37924. [indexterm2 boost_asio.indexterm.ip__address_v4.is_class_c..is_class_c..ip::address_v4]
  37925. (Deprecated: Use [link boost_asio.reference.ip__network_v4 `ip::network_v4`] class.) Determine whether the address is a class C address.
  37926. bool is_class_c() const;
  37927. [endsect]
  37928. [section:is_loopback ip::address_v4::is_loopback]
  37929. [indexterm2 boost_asio.indexterm.ip__address_v4.is_loopback..is_loopback..ip::address_v4]
  37930. Determine whether the address is a loopback address.
  37931. bool is_loopback() const;
  37932. [endsect]
  37933. [section:is_multicast ip::address_v4::is_multicast]
  37934. [indexterm2 boost_asio.indexterm.ip__address_v4.is_multicast..is_multicast..ip::address_v4]
  37935. Determine whether the address is a multicast address.
  37936. bool is_multicast() const;
  37937. [endsect]
  37938. [section:is_unspecified ip::address_v4::is_unspecified]
  37939. [indexterm2 boost_asio.indexterm.ip__address_v4.is_unspecified..is_unspecified..ip::address_v4]
  37940. Determine whether the address is unspecified.
  37941. bool is_unspecified() const;
  37942. [endsect]
  37943. [section:loopback ip::address_v4::loopback]
  37944. [indexterm2 boost_asio.indexterm.ip__address_v4.loopback..loopback..ip::address_v4]
  37945. Obtain an address object that represents the loopback address.
  37946. static address_v4 loopback();
  37947. [endsect]
  37948. [section:make_address_v4 ip::address_v4::make_address_v4]
  37949. [indexterm2 boost_asio.indexterm.ip__address_v4.make_address_v4..make_address_v4..ip::address_v4]
  37950. Create an IPv4 address from raw bytes in network order.
  37951. address_v4 ``[link boost_asio.reference.ip__address_v4.make_address_v4.overload1 make_address_v4]``(
  37952. const address_v4::bytes_type & bytes);
  37953. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.make_address_v4.overload1 more...]]``
  37954. Create an IPv4 address from an unsigned integer in host byte order.
  37955. address_v4 ``[link boost_asio.reference.ip__address_v4.make_address_v4.overload2 make_address_v4]``(
  37956. address_v4::uint_type addr);
  37957. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.make_address_v4.overload2 more...]]``
  37958. Create an IPv4 address from an IP address string in dotted decimal form.
  37959. address_v4 ``[link boost_asio.reference.ip__address_v4.make_address_v4.overload3 make_address_v4]``(
  37960. const char * str);
  37961. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.make_address_v4.overload3 more...]]``
  37962. address_v4 ``[link boost_asio.reference.ip__address_v4.make_address_v4.overload4 make_address_v4]``(
  37963. const char * str,
  37964. boost::system::error_code & ec);
  37965. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.make_address_v4.overload4 more...]]``
  37966. address_v4 ``[link boost_asio.reference.ip__address_v4.make_address_v4.overload5 make_address_v4]``(
  37967. const std::string & str);
  37968. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.make_address_v4.overload5 more...]]``
  37969. address_v4 ``[link boost_asio.reference.ip__address_v4.make_address_v4.overload6 make_address_v4]``(
  37970. const std::string & str,
  37971. boost::system::error_code & ec);
  37972. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.make_address_v4.overload6 more...]]``
  37973. address_v4 ``[link boost_asio.reference.ip__address_v4.make_address_v4.overload7 make_address_v4]``(
  37974. string_view str);
  37975. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.make_address_v4.overload7 more...]]``
  37976. address_v4 ``[link boost_asio.reference.ip__address_v4.make_address_v4.overload8 make_address_v4]``(
  37977. string_view str,
  37978. boost::system::error_code & ec);
  37979. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.make_address_v4.overload8 more...]]``
  37980. Create an IPv4 address from a IPv4-mapped IPv6 address.
  37981. address_v4 ``[link boost_asio.reference.ip__address_v4.make_address_v4.overload9 make_address_v4]``(
  37982. v4_mapped_t ,
  37983. const address_v6 & v6_addr);
  37984. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.make_address_v4.overload9 more...]]``
  37985. [section:overload1 ip::address_v4::make_address_v4 (1 of 9 overloads)]
  37986. Create an IPv4 address from raw bytes in network order.
  37987. address_v4 make_address_v4(
  37988. const address_v4::bytes_type & bytes);
  37989. [endsect]
  37990. [section:overload2 ip::address_v4::make_address_v4 (2 of 9 overloads)]
  37991. Create an IPv4 address from an unsigned integer in host byte order.
  37992. address_v4 make_address_v4(
  37993. address_v4::uint_type addr);
  37994. [endsect]
  37995. [section:overload3 ip::address_v4::make_address_v4 (3 of 9 overloads)]
  37996. Create an IPv4 address from an IP address string in dotted decimal form.
  37997. address_v4 make_address_v4(
  37998. const char * str);
  37999. [endsect]
  38000. [section:overload4 ip::address_v4::make_address_v4 (4 of 9 overloads)]
  38001. Create an IPv4 address from an IP address string in dotted decimal form.
  38002. address_v4 make_address_v4(
  38003. const char * str,
  38004. boost::system::error_code & ec);
  38005. [endsect]
  38006. [section:overload5 ip::address_v4::make_address_v4 (5 of 9 overloads)]
  38007. Create an IPv4 address from an IP address string in dotted decimal form.
  38008. address_v4 make_address_v4(
  38009. const std::string & str);
  38010. [endsect]
  38011. [section:overload6 ip::address_v4::make_address_v4 (6 of 9 overloads)]
  38012. Create an IPv4 address from an IP address string in dotted decimal form.
  38013. address_v4 make_address_v4(
  38014. const std::string & str,
  38015. boost::system::error_code & ec);
  38016. [endsect]
  38017. [section:overload7 ip::address_v4::make_address_v4 (7 of 9 overloads)]
  38018. Create an IPv4 address from an IP address string in dotted decimal form.
  38019. address_v4 make_address_v4(
  38020. string_view str);
  38021. [endsect]
  38022. [section:overload8 ip::address_v4::make_address_v4 (8 of 9 overloads)]
  38023. Create an IPv4 address from an IP address string in dotted decimal form.
  38024. address_v4 make_address_v4(
  38025. string_view str,
  38026. boost::system::error_code & ec);
  38027. [endsect]
  38028. [section:overload9 ip::address_v4::make_address_v4 (9 of 9 overloads)]
  38029. Create an IPv4 address from a IPv4-mapped IPv6 address.
  38030. address_v4 make_address_v4(
  38031. v4_mapped_t ,
  38032. const address_v6 & v6_addr);
  38033. [endsect]
  38034. [endsect]
  38035. [section:make_network_v4 ip::address_v4::make_network_v4]
  38036. [indexterm2 boost_asio.indexterm.ip__address_v4.make_network_v4..make_network_v4..ip::address_v4]
  38037. Create an IPv4 network from an address and prefix length.
  38038. network_v4 ``[link boost_asio.reference.ip__address_v4.make_network_v4.overload1 make_network_v4]``(
  38039. const address_v4 & addr,
  38040. unsigned short prefix_len);
  38041. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.make_network_v4.overload1 more...]]``
  38042. Create an IPv4 network from an address and netmask.
  38043. network_v4 ``[link boost_asio.reference.ip__address_v4.make_network_v4.overload2 make_network_v4]``(
  38044. const address_v4 & addr,
  38045. const address_v4 & mask);
  38046. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.make_network_v4.overload2 more...]]``
  38047. [section:overload1 ip::address_v4::make_network_v4 (1 of 2 overloads)]
  38048. Create an IPv4 network from an address and prefix length.
  38049. network_v4 make_network_v4(
  38050. const address_v4 & addr,
  38051. unsigned short prefix_len);
  38052. [endsect]
  38053. [section:overload2 ip::address_v4::make_network_v4 (2 of 2 overloads)]
  38054. Create an IPv4 network from an address and netmask.
  38055. network_v4 make_network_v4(
  38056. const address_v4 & addr,
  38057. const address_v4 & mask);
  38058. [endsect]
  38059. [endsect]
  38060. [section:netmask ip::address_v4::netmask]
  38061. [indexterm2 boost_asio.indexterm.ip__address_v4.netmask..netmask..ip::address_v4]
  38062. (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.
  38063. static address_v4 netmask(
  38064. const address_v4 & addr);
  38065. [endsect]
  38066. [section:operator_not__eq_ ip::address_v4::operator!=]
  38067. [indexterm2 boost_asio.indexterm.ip__address_v4.operator_not__eq_..operator!=..ip::address_v4]
  38068. Compare two addresses for inequality.
  38069. friend bool operator!=(
  38070. const address_v4 & a1,
  38071. const address_v4 & a2);
  38072. [heading Requirements]
  38073. ['Header: ][^boost/asio/ip/address_v4.hpp]
  38074. ['Convenience header: ][^boost/asio.hpp]
  38075. [endsect]
  38076. [section:operator_lt_ ip::address_v4::operator<]
  38077. [indexterm2 boost_asio.indexterm.ip__address_v4.operator_lt_..operator<..ip::address_v4]
  38078. Compare addresses for ordering.
  38079. friend bool operator<(
  38080. const address_v4 & a1,
  38081. const address_v4 & a2);
  38082. [heading Requirements]
  38083. ['Header: ][^boost/asio/ip/address_v4.hpp]
  38084. ['Convenience header: ][^boost/asio.hpp]
  38085. [endsect]
  38086. [section:operator_lt__lt_ ip::address_v4::operator<<]
  38087. [indexterm2 boost_asio.indexterm.ip__address_v4.operator_lt__lt_..operator<<..ip::address_v4]
  38088. Output an address as a string.
  38089. template<
  38090. typename Elem,
  38091. typename Traits>
  38092. std::basic_ostream< Elem, Traits > & ``[link boost_asio.reference.ip__address_v4.operator_lt__lt_.overload1 operator<<]``(
  38093. std::basic_ostream< Elem, Traits > & os,
  38094. const address_v4 & addr);
  38095. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.operator_lt__lt_.overload1 more...]]``
  38096. Output a network as a string.
  38097. template<
  38098. typename Elem,
  38099. typename Traits>
  38100. std::basic_ostream< Elem, Traits > & ``[link boost_asio.reference.ip__address_v4.operator_lt__lt_.overload2 operator<<]``(
  38101. std::basic_ostream< Elem, Traits > & os,
  38102. const network_v4 & net);
  38103. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.operator_lt__lt_.overload2 more...]]``
  38104. [section:overload1 ip::address_v4::operator<< (1 of 2 overloads)]
  38105. Output an address as a string.
  38106. template<
  38107. typename Elem,
  38108. typename Traits>
  38109. std::basic_ostream< Elem, Traits > & operator<<(
  38110. std::basic_ostream< Elem, Traits > & os,
  38111. const address_v4 & addr);
  38112. Used to output a human-readable string for a specified address.
  38113. [heading Parameters]
  38114. [variablelist
  38115. [[os][The output stream to which the string will be written.]]
  38116. [[addr][The address to be written.]]
  38117. ]
  38118. [heading Return Value]
  38119. The output stream.
  38120. [endsect]
  38121. [section:overload2 ip::address_v4::operator<< (2 of 2 overloads)]
  38122. Output a network as a string.
  38123. template<
  38124. typename Elem,
  38125. typename Traits>
  38126. std::basic_ostream< Elem, Traits > & operator<<(
  38127. std::basic_ostream< Elem, Traits > & os,
  38128. const network_v4 & net);
  38129. Used to output a human-readable string for a specified network.
  38130. [heading Parameters]
  38131. [variablelist
  38132. [[os][The output stream to which the string will be written.]]
  38133. [[net][The network to be written.]]
  38134. ]
  38135. [heading Return Value]
  38136. The output stream.
  38137. [endsect]
  38138. [endsect]
  38139. [section:operator_lt__eq_ ip::address_v4::operator<=]
  38140. [indexterm2 boost_asio.indexterm.ip__address_v4.operator_lt__eq_..operator<=..ip::address_v4]
  38141. Compare addresses for ordering.
  38142. friend bool operator<=(
  38143. const address_v4 & a1,
  38144. const address_v4 & a2);
  38145. [heading Requirements]
  38146. ['Header: ][^boost/asio/ip/address_v4.hpp]
  38147. ['Convenience header: ][^boost/asio.hpp]
  38148. [endsect]
  38149. [section:operator_eq_ ip::address_v4::operator=]
  38150. [indexterm2 boost_asio.indexterm.ip__address_v4.operator_eq_..operator=..ip::address_v4]
  38151. Assign from another address.
  38152. address_v4 & operator=(
  38153. const address_v4 & other);
  38154. [endsect]
  38155. [section:operator_eq__eq_ ip::address_v4::operator==]
  38156. [indexterm2 boost_asio.indexterm.ip__address_v4.operator_eq__eq_..operator==..ip::address_v4]
  38157. Compare two addresses for equality.
  38158. friend bool operator==(
  38159. const address_v4 & a1,
  38160. const address_v4 & a2);
  38161. [heading Requirements]
  38162. ['Header: ][^boost/asio/ip/address_v4.hpp]
  38163. ['Convenience header: ][^boost/asio.hpp]
  38164. [endsect]
  38165. [section:operator_gt_ ip::address_v4::operator>]
  38166. [indexterm2 boost_asio.indexterm.ip__address_v4.operator_gt_..operator>..ip::address_v4]
  38167. Compare addresses for ordering.
  38168. friend bool operator>(
  38169. const address_v4 & a1,
  38170. const address_v4 & a2);
  38171. [heading Requirements]
  38172. ['Header: ][^boost/asio/ip/address_v4.hpp]
  38173. ['Convenience header: ][^boost/asio.hpp]
  38174. [endsect]
  38175. [section:operator_gt__eq_ ip::address_v4::operator>=]
  38176. [indexterm2 boost_asio.indexterm.ip__address_v4.operator_gt__eq_..operator>=..ip::address_v4]
  38177. Compare addresses for ordering.
  38178. friend bool operator>=(
  38179. const address_v4 & a1,
  38180. const address_v4 & a2);
  38181. [heading Requirements]
  38182. ['Header: ][^boost/asio/ip/address_v4.hpp]
  38183. ['Convenience header: ][^boost/asio.hpp]
  38184. [endsect]
  38185. [section:to_bytes ip::address_v4::to_bytes]
  38186. [indexterm2 boost_asio.indexterm.ip__address_v4.to_bytes..to_bytes..ip::address_v4]
  38187. Get the address in bytes, in network byte order.
  38188. bytes_type to_bytes() const;
  38189. [endsect]
  38190. [section:to_string ip::address_v4::to_string]
  38191. [indexterm2 boost_asio.indexterm.ip__address_v4.to_string..to_string..ip::address_v4]
  38192. Get the address as a string in dotted decimal format.
  38193. std::string ``[link boost_asio.reference.ip__address_v4.to_string.overload1 to_string]``() const;
  38194. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.to_string.overload1 more...]]``
  38195. (Deprecated: Use other overload.) Get the address as a string in dotted decimal format.
  38196. std::string ``[link boost_asio.reference.ip__address_v4.to_string.overload2 to_string]``(
  38197. boost::system::error_code & ec) const;
  38198. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.to_string.overload2 more...]]``
  38199. [section:overload1 ip::address_v4::to_string (1 of 2 overloads)]
  38200. Get the address as a string in dotted decimal format.
  38201. std::string to_string() const;
  38202. [endsect]
  38203. [section:overload2 ip::address_v4::to_string (2 of 2 overloads)]
  38204. (Deprecated: Use other overload.) Get the address as a string in dotted decimal format.
  38205. std::string to_string(
  38206. boost::system::error_code & ec) const;
  38207. [endsect]
  38208. [endsect]
  38209. [section:to_uint ip::address_v4::to_uint]
  38210. [indexterm2 boost_asio.indexterm.ip__address_v4.to_uint..to_uint..ip::address_v4]
  38211. Get the address as an unsigned integer in host byte order.
  38212. uint_type to_uint() const;
  38213. [endsect]
  38214. [section:to_ulong ip::address_v4::to_ulong]
  38215. [indexterm2 boost_asio.indexterm.ip__address_v4.to_ulong..to_ulong..ip::address_v4]
  38216. Get the address as an unsigned long in host byte order.
  38217. unsigned long to_ulong() const;
  38218. [endsect]
  38219. [section:uint_type ip::address_v4::uint_type]
  38220. [indexterm2 boost_asio.indexterm.ip__address_v4.uint_type..uint_type..ip::address_v4]
  38221. The type used to represent an address as an unsigned integer.
  38222. typedef uint_least32_t uint_type;
  38223. [heading Requirements]
  38224. ['Header: ][^boost/asio/ip/address_v4.hpp]
  38225. ['Convenience header: ][^boost/asio.hpp]
  38226. [endsect]
  38227. [endsect]
  38228. [section:ip__address_v4_iterator ip::address_v4_iterator]
  38229. [indexterm1 boost_asio.indexterm.ip__address_v4_iterator..ip::address_v4_iterator]
  38230. An input iterator that can be used for traversing IPv4 addresses.
  38231. typedef basic_address_iterator< address_v4 > address_v4_iterator;
  38232. [heading Requirements]
  38233. ['Header: ][^boost/asio/ip/address_v4_iterator.hpp]
  38234. ['Convenience header: ][^boost/asio.hpp]
  38235. [endsect]
  38236. [section:ip__address_v4_range ip::address_v4_range]
  38237. [indexterm1 boost_asio.indexterm.ip__address_v4_range..ip::address_v4_range]
  38238. Represents a range of IPv4 addresses.
  38239. typedef basic_address_range< address_v4 > address_v4_range;
  38240. [heading Requirements]
  38241. ['Header: ][^boost/asio/ip/address_v4_range.hpp]
  38242. ['Convenience header: ][^boost/asio.hpp]
  38243. [endsect]
  38244. [section:ip__address_v6 ip::address_v6]
  38245. Implements IP version 6 style addresses.
  38246. class address_v6
  38247. [heading Types]
  38248. [table
  38249. [[Name][Description]]
  38250. [
  38251. [[link boost_asio.reference.ip__address_v6.bytes_type [*bytes_type]]]
  38252. [The type used to represent an address as an array of bytes. ]
  38253. ]
  38254. ]
  38255. [heading Member Functions]
  38256. [table
  38257. [[Name][Description]]
  38258. [
  38259. [[link boost_asio.reference.ip__address_v6.address_v6 [*address_v6]]]
  38260. [Default constructor.
  38261. [hr]
  38262. Construct an address from raw bytes and scope ID.
  38263. [hr]
  38264. Copy constructor. ]
  38265. ]
  38266. [
  38267. [[link boost_asio.reference.ip__address_v6.any [*any]]]
  38268. [Obtain an address object that represents any address. ]
  38269. ]
  38270. [
  38271. [[link boost_asio.reference.ip__address_v6.from_string [*from_string]]]
  38272. [(Deprecated: Use make_address_v6().) Create an IPv6 address from an IP address string. ]
  38273. ]
  38274. [
  38275. [[link boost_asio.reference.ip__address_v6.is_link_local [*is_link_local]]]
  38276. [Determine whether the address is link local. ]
  38277. ]
  38278. [
  38279. [[link boost_asio.reference.ip__address_v6.is_loopback [*is_loopback]]]
  38280. [Determine whether the address is a loopback address. ]
  38281. ]
  38282. [
  38283. [[link boost_asio.reference.ip__address_v6.is_multicast [*is_multicast]]]
  38284. [Determine whether the address is a multicast address. ]
  38285. ]
  38286. [
  38287. [[link boost_asio.reference.ip__address_v6.is_multicast_global [*is_multicast_global]]]
  38288. [Determine whether the address is a global multicast address. ]
  38289. ]
  38290. [
  38291. [[link boost_asio.reference.ip__address_v6.is_multicast_link_local [*is_multicast_link_local]]]
  38292. [Determine whether the address is a link-local multicast address. ]
  38293. ]
  38294. [
  38295. [[link boost_asio.reference.ip__address_v6.is_multicast_node_local [*is_multicast_node_local]]]
  38296. [Determine whether the address is a node-local multicast address. ]
  38297. ]
  38298. [
  38299. [[link boost_asio.reference.ip__address_v6.is_multicast_org_local [*is_multicast_org_local]]]
  38300. [Determine whether the address is a org-local multicast address. ]
  38301. ]
  38302. [
  38303. [[link boost_asio.reference.ip__address_v6.is_multicast_site_local [*is_multicast_site_local]]]
  38304. [Determine whether the address is a site-local multicast address. ]
  38305. ]
  38306. [
  38307. [[link boost_asio.reference.ip__address_v6.is_site_local [*is_site_local]]]
  38308. [Determine whether the address is site local. ]
  38309. ]
  38310. [
  38311. [[link boost_asio.reference.ip__address_v6.is_unspecified [*is_unspecified]]]
  38312. [Determine whether the address is unspecified. ]
  38313. ]
  38314. [
  38315. [[link boost_asio.reference.ip__address_v6.is_v4_compatible [*is_v4_compatible]]]
  38316. [(Deprecated: No replacement.) Determine whether the address is an IPv4-compatible address. ]
  38317. ]
  38318. [
  38319. [[link boost_asio.reference.ip__address_v6.is_v4_mapped [*is_v4_mapped]]]
  38320. [Determine whether the address is a mapped IPv4 address. ]
  38321. ]
  38322. [
  38323. [[link boost_asio.reference.ip__address_v6.loopback [*loopback]]]
  38324. [Obtain an address object that represents the loopback address. ]
  38325. ]
  38326. [
  38327. [[link boost_asio.reference.ip__address_v6.operator_eq_ [*operator=]]]
  38328. [Assign from another address. ]
  38329. ]
  38330. [
  38331. [[link boost_asio.reference.ip__address_v6.scope_id [*scope_id]]]
  38332. [The scope ID of the address. ]
  38333. ]
  38334. [
  38335. [[link boost_asio.reference.ip__address_v6.to_bytes [*to_bytes]]]
  38336. [Get the address in bytes, in network byte order. ]
  38337. ]
  38338. [
  38339. [[link boost_asio.reference.ip__address_v6.to_string [*to_string]]]
  38340. [Get the address as a string.
  38341. [hr]
  38342. (Deprecated: Use other overload.) Get the address as a string. ]
  38343. ]
  38344. [
  38345. [[link boost_asio.reference.ip__address_v6.to_v4 [*to_v4]]]
  38346. [(Deprecated: Use make_address_v4().) Converts an IPv4-mapped or IPv4-compatible address to an IPv4 address. ]
  38347. ]
  38348. [
  38349. [[link boost_asio.reference.ip__address_v6.v4_compatible [*v4_compatible]]]
  38350. [(Deprecated: No replacement.) Create an IPv4-compatible IPv6 address. ]
  38351. ]
  38352. [
  38353. [[link boost_asio.reference.ip__address_v6.v4_mapped [*v4_mapped]]]
  38354. [(Deprecated: Use make_address_v6().) Create an IPv4-mapped IPv6 address. ]
  38355. ]
  38356. ]
  38357. [heading Friends]
  38358. [table
  38359. [[Name][Description]]
  38360. [
  38361. [[link boost_asio.reference.ip__address_v6.operator_not__eq_ [*operator!=]]]
  38362. [Compare two addresses for inequality. ]
  38363. ]
  38364. [
  38365. [[link boost_asio.reference.ip__address_v6.operator_lt_ [*operator<]]]
  38366. [Compare addresses for ordering. ]
  38367. ]
  38368. [
  38369. [[link boost_asio.reference.ip__address_v6.operator_lt__eq_ [*operator<=]]]
  38370. [Compare addresses for ordering. ]
  38371. ]
  38372. [
  38373. [[link boost_asio.reference.ip__address_v6.operator_eq__eq_ [*operator==]]]
  38374. [Compare two addresses for equality. ]
  38375. ]
  38376. [
  38377. [[link boost_asio.reference.ip__address_v6.operator_gt_ [*operator>]]]
  38378. [Compare addresses for ordering. ]
  38379. ]
  38380. [
  38381. [[link boost_asio.reference.ip__address_v6.operator_gt__eq_ [*operator>=]]]
  38382. [Compare addresses for ordering. ]
  38383. ]
  38384. ]
  38385. [heading Related Functions]
  38386. [table
  38387. [[Name][Description]]
  38388. [
  38389. [[link boost_asio.reference.ip__address_v6.make_address_v6 [*make_address_v6]]]
  38390. [Create an IPv6 address from raw bytes and scope ID.
  38391. Create an IPv6 address from an IP address string.
  38392. Createan IPv6 address from an IP address string.
  38393. Create an IPv4-mapped IPv6 address from an IPv4 address. ]
  38394. ]
  38395. [
  38396. [[link boost_asio.reference.ip__address_v6.make_network_v6 [*make_network_v6]]]
  38397. [Create an IPv6 network from an address and prefix length. ]
  38398. ]
  38399. [
  38400. [[link boost_asio.reference.ip__address_v6.operator_lt__lt_ [*operator<<]]]
  38401. [Output an address as a string.
  38402. Output a network as a string. ]
  38403. ]
  38404. ]
  38405. The [link boost_asio.reference.ip__address_v6 `ip::address_v6`] class provides the ability to use and manipulate IP version 6 addresses.
  38406. [heading Thread Safety]
  38407. ['Distinct] ['objects:] Safe.
  38408. ['Shared] ['objects:] Unsafe.
  38409. [heading Requirements]
  38410. ['Header: ][^boost/asio/ip/address_v6.hpp]
  38411. ['Convenience header: ][^boost/asio.hpp]
  38412. [section:address_v6 ip::address_v6::address_v6]
  38413. [indexterm2 boost_asio.indexterm.ip__address_v6.address_v6..address_v6..ip::address_v6]
  38414. Default constructor.
  38415. ``[link boost_asio.reference.ip__address_v6.address_v6.overload1 address_v6]``();
  38416. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.address_v6.overload1 more...]]``
  38417. Construct an address from raw bytes and scope ID.
  38418. explicit ``[link boost_asio.reference.ip__address_v6.address_v6.overload2 address_v6]``(
  38419. const bytes_type & bytes,
  38420. unsigned long scope_id = 0);
  38421. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.address_v6.overload2 more...]]``
  38422. Copy constructor.
  38423. ``[link boost_asio.reference.ip__address_v6.address_v6.overload3 address_v6]``(
  38424. const address_v6 & other);
  38425. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.address_v6.overload3 more...]]``
  38426. [section:overload1 ip::address_v6::address_v6 (1 of 3 overloads)]
  38427. Default constructor.
  38428. address_v6();
  38429. [endsect]
  38430. [section:overload2 ip::address_v6::address_v6 (2 of 3 overloads)]
  38431. Construct an address from raw bytes and scope ID.
  38432. address_v6(
  38433. const bytes_type & bytes,
  38434. unsigned long scope_id = 0);
  38435. [endsect]
  38436. [section:overload3 ip::address_v6::address_v6 (3 of 3 overloads)]
  38437. Copy constructor.
  38438. address_v6(
  38439. const address_v6 & other);
  38440. [endsect]
  38441. [endsect]
  38442. [section:any ip::address_v6::any]
  38443. [indexterm2 boost_asio.indexterm.ip__address_v6.any..any..ip::address_v6]
  38444. Obtain an address object that represents any address.
  38445. static address_v6 any();
  38446. [endsect]
  38447. [section:bytes_type ip::address_v6::bytes_type]
  38448. [indexterm2 boost_asio.indexterm.ip__address_v6.bytes_type..bytes_type..ip::address_v6]
  38449. The type used to represent an address as an array of bytes.
  38450. typedef array< unsigned char, 16 > bytes_type;
  38451. [heading Remarks]
  38452. This type is defined in terms of the C++0x template `std::array` when it is available. Otherwise, it uses `boost:array`.
  38453. [heading Requirements]
  38454. ['Header: ][^boost/asio/ip/address_v6.hpp]
  38455. ['Convenience header: ][^boost/asio.hpp]
  38456. [endsect]
  38457. [section:from_string ip::address_v6::from_string]
  38458. [indexterm2 boost_asio.indexterm.ip__address_v6.from_string..from_string..ip::address_v6]
  38459. (Deprecated: Use `make_address_v6()`.) Create an IPv6 address from an IP address string.
  38460. static address_v6 ``[link boost_asio.reference.ip__address_v6.from_string.overload1 from_string]``(
  38461. const char * str);
  38462. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.from_string.overload1 more...]]``
  38463. static address_v6 ``[link boost_asio.reference.ip__address_v6.from_string.overload2 from_string]``(
  38464. const char * str,
  38465. boost::system::error_code & ec);
  38466. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.from_string.overload2 more...]]``
  38467. static address_v6 ``[link boost_asio.reference.ip__address_v6.from_string.overload3 from_string]``(
  38468. const std::string & str);
  38469. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.from_string.overload3 more...]]``
  38470. static address_v6 ``[link boost_asio.reference.ip__address_v6.from_string.overload4 from_string]``(
  38471. const std::string & str,
  38472. boost::system::error_code & ec);
  38473. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.from_string.overload4 more...]]``
  38474. [section:overload1 ip::address_v6::from_string (1 of 4 overloads)]
  38475. (Deprecated: Use `make_address_v6()`.) Create an IPv6 address from an IP address string.
  38476. static address_v6 from_string(
  38477. const char * str);
  38478. [endsect]
  38479. [section:overload2 ip::address_v6::from_string (2 of 4 overloads)]
  38480. (Deprecated: Use `make_address_v6()`.) Create an IPv6 address from an IP address string.
  38481. static address_v6 from_string(
  38482. const char * str,
  38483. boost::system::error_code & ec);
  38484. [endsect]
  38485. [section:overload3 ip::address_v6::from_string (3 of 4 overloads)]
  38486. (Deprecated: Use `make_address_v6()`.) Create an IPv6 address from an IP address string.
  38487. static address_v6 from_string(
  38488. const std::string & str);
  38489. [endsect]
  38490. [section:overload4 ip::address_v6::from_string (4 of 4 overloads)]
  38491. (Deprecated: Use `make_address_v6()`.) Create an IPv6 address from an IP address string.
  38492. static address_v6 from_string(
  38493. const std::string & str,
  38494. boost::system::error_code & ec);
  38495. [endsect]
  38496. [endsect]
  38497. [section:is_link_local ip::address_v6::is_link_local]
  38498. [indexterm2 boost_asio.indexterm.ip__address_v6.is_link_local..is_link_local..ip::address_v6]
  38499. Determine whether the address is link local.
  38500. bool is_link_local() const;
  38501. [endsect]
  38502. [section:is_loopback ip::address_v6::is_loopback]
  38503. [indexterm2 boost_asio.indexterm.ip__address_v6.is_loopback..is_loopback..ip::address_v6]
  38504. Determine whether the address is a loopback address.
  38505. bool is_loopback() const;
  38506. [endsect]
  38507. [section:is_multicast ip::address_v6::is_multicast]
  38508. [indexterm2 boost_asio.indexterm.ip__address_v6.is_multicast..is_multicast..ip::address_v6]
  38509. Determine whether the address is a multicast address.
  38510. bool is_multicast() const;
  38511. [endsect]
  38512. [section:is_multicast_global ip::address_v6::is_multicast_global]
  38513. [indexterm2 boost_asio.indexterm.ip__address_v6.is_multicast_global..is_multicast_global..ip::address_v6]
  38514. Determine whether the address is a global multicast address.
  38515. bool is_multicast_global() const;
  38516. [endsect]
  38517. [section:is_multicast_link_local ip::address_v6::is_multicast_link_local]
  38518. [indexterm2 boost_asio.indexterm.ip__address_v6.is_multicast_link_local..is_multicast_link_local..ip::address_v6]
  38519. Determine whether the address is a link-local multicast address.
  38520. bool is_multicast_link_local() const;
  38521. [endsect]
  38522. [section:is_multicast_node_local ip::address_v6::is_multicast_node_local]
  38523. [indexterm2 boost_asio.indexterm.ip__address_v6.is_multicast_node_local..is_multicast_node_local..ip::address_v6]
  38524. Determine whether the address is a node-local multicast address.
  38525. bool is_multicast_node_local() const;
  38526. [endsect]
  38527. [section:is_multicast_org_local ip::address_v6::is_multicast_org_local]
  38528. [indexterm2 boost_asio.indexterm.ip__address_v6.is_multicast_org_local..is_multicast_org_local..ip::address_v6]
  38529. Determine whether the address is a org-local multicast address.
  38530. bool is_multicast_org_local() const;
  38531. [endsect]
  38532. [section:is_multicast_site_local ip::address_v6::is_multicast_site_local]
  38533. [indexterm2 boost_asio.indexterm.ip__address_v6.is_multicast_site_local..is_multicast_site_local..ip::address_v6]
  38534. Determine whether the address is a site-local multicast address.
  38535. bool is_multicast_site_local() const;
  38536. [endsect]
  38537. [section:is_site_local ip::address_v6::is_site_local]
  38538. [indexterm2 boost_asio.indexterm.ip__address_v6.is_site_local..is_site_local..ip::address_v6]
  38539. Determine whether the address is site local.
  38540. bool is_site_local() const;
  38541. [endsect]
  38542. [section:is_unspecified ip::address_v6::is_unspecified]
  38543. [indexterm2 boost_asio.indexterm.ip__address_v6.is_unspecified..is_unspecified..ip::address_v6]
  38544. Determine whether the address is unspecified.
  38545. bool is_unspecified() const;
  38546. [endsect]
  38547. [section:is_v4_compatible ip::address_v6::is_v4_compatible]
  38548. [indexterm2 boost_asio.indexterm.ip__address_v6.is_v4_compatible..is_v4_compatible..ip::address_v6]
  38549. (Deprecated: No replacement.) Determine whether the address is an IPv4-compatible address.
  38550. bool is_v4_compatible() const;
  38551. [endsect]
  38552. [section:is_v4_mapped ip::address_v6::is_v4_mapped]
  38553. [indexterm2 boost_asio.indexterm.ip__address_v6.is_v4_mapped..is_v4_mapped..ip::address_v6]
  38554. Determine whether the address is a mapped IPv4 address.
  38555. bool is_v4_mapped() const;
  38556. [endsect]
  38557. [section:loopback ip::address_v6::loopback]
  38558. [indexterm2 boost_asio.indexterm.ip__address_v6.loopback..loopback..ip::address_v6]
  38559. Obtain an address object that represents the loopback address.
  38560. static address_v6 loopback();
  38561. [endsect]
  38562. [section:make_address_v6 ip::address_v6::make_address_v6]
  38563. [indexterm2 boost_asio.indexterm.ip__address_v6.make_address_v6..make_address_v6..ip::address_v6]
  38564. Create an IPv6 address from raw bytes and scope ID.
  38565. address_v6 ``[link boost_asio.reference.ip__address_v6.make_address_v6.overload1 make_address_v6]``(
  38566. const address_v6::bytes_type & bytes,
  38567. unsigned long scope_id = 0);
  38568. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.make_address_v6.overload1 more...]]``
  38569. Create an IPv6 address from an IP address string.
  38570. address_v6 ``[link boost_asio.reference.ip__address_v6.make_address_v6.overload2 make_address_v6]``(
  38571. const char * str);
  38572. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.make_address_v6.overload2 more...]]``
  38573. address_v6 ``[link boost_asio.reference.ip__address_v6.make_address_v6.overload3 make_address_v6]``(
  38574. const char * str,
  38575. boost::system::error_code & ec);
  38576. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.make_address_v6.overload3 more...]]``
  38577. Createan IPv6 address from an IP address string.
  38578. address_v6 ``[link boost_asio.reference.ip__address_v6.make_address_v6.overload4 make_address_v6]``(
  38579. const std::string & str);
  38580. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.make_address_v6.overload4 more...]]``
  38581. address_v6 ``[link boost_asio.reference.ip__address_v6.make_address_v6.overload5 make_address_v6]``(
  38582. const std::string & str,
  38583. boost::system::error_code & ec);
  38584. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.make_address_v6.overload5 more...]]``
  38585. address_v6 ``[link boost_asio.reference.ip__address_v6.make_address_v6.overload6 make_address_v6]``(
  38586. string_view str);
  38587. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.make_address_v6.overload6 more...]]``
  38588. address_v6 ``[link boost_asio.reference.ip__address_v6.make_address_v6.overload7 make_address_v6]``(
  38589. string_view str,
  38590. boost::system::error_code & ec);
  38591. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.make_address_v6.overload7 more...]]``
  38592. Create an IPv4-mapped IPv6 address from an IPv4 address.
  38593. address_v6 ``[link boost_asio.reference.ip__address_v6.make_address_v6.overload8 make_address_v6]``(
  38594. v4_mapped_t ,
  38595. const address_v4 & v4_addr);
  38596. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.make_address_v6.overload8 more...]]``
  38597. [section:overload1 ip::address_v6::make_address_v6 (1 of 8 overloads)]
  38598. Create an IPv6 address from raw bytes and scope ID.
  38599. address_v6 make_address_v6(
  38600. const address_v6::bytes_type & bytes,
  38601. unsigned long scope_id = 0);
  38602. [endsect]
  38603. [section:overload2 ip::address_v6::make_address_v6 (2 of 8 overloads)]
  38604. Create an IPv6 address from an IP address string.
  38605. address_v6 make_address_v6(
  38606. const char * str);
  38607. [endsect]
  38608. [section:overload3 ip::address_v6::make_address_v6 (3 of 8 overloads)]
  38609. Create an IPv6 address from an IP address string.
  38610. address_v6 make_address_v6(
  38611. const char * str,
  38612. boost::system::error_code & ec);
  38613. [endsect]
  38614. [section:overload4 ip::address_v6::make_address_v6 (4 of 8 overloads)]
  38615. Createan IPv6 address from an IP address string.
  38616. address_v6 make_address_v6(
  38617. const std::string & str);
  38618. [endsect]
  38619. [section:overload5 ip::address_v6::make_address_v6 (5 of 8 overloads)]
  38620. Create an IPv6 address from an IP address string.
  38621. address_v6 make_address_v6(
  38622. const std::string & str,
  38623. boost::system::error_code & ec);
  38624. [endsect]
  38625. [section:overload6 ip::address_v6::make_address_v6 (6 of 8 overloads)]
  38626. Create an IPv6 address from an IP address string.
  38627. address_v6 make_address_v6(
  38628. string_view str);
  38629. [endsect]
  38630. [section:overload7 ip::address_v6::make_address_v6 (7 of 8 overloads)]
  38631. Create an IPv6 address from an IP address string.
  38632. address_v6 make_address_v6(
  38633. string_view str,
  38634. boost::system::error_code & ec);
  38635. [endsect]
  38636. [section:overload8 ip::address_v6::make_address_v6 (8 of 8 overloads)]
  38637. Create an IPv4-mapped IPv6 address from an IPv4 address.
  38638. address_v6 make_address_v6(
  38639. v4_mapped_t ,
  38640. const address_v4 & v4_addr);
  38641. [endsect]
  38642. [endsect]
  38643. [section:make_network_v6 ip::address_v6::make_network_v6]
  38644. [indexterm2 boost_asio.indexterm.ip__address_v6.make_network_v6..make_network_v6..ip::address_v6]
  38645. Create an IPv6 network from an address and prefix length.
  38646. network_v6 make_network_v6(
  38647. const address_v6 & addr,
  38648. unsigned short prefix_len);
  38649. [endsect]
  38650. [section:operator_not__eq_ ip::address_v6::operator!=]
  38651. [indexterm2 boost_asio.indexterm.ip__address_v6.operator_not__eq_..operator!=..ip::address_v6]
  38652. Compare two addresses for inequality.
  38653. friend bool operator!=(
  38654. const address_v6 & a1,
  38655. const address_v6 & a2);
  38656. [heading Requirements]
  38657. ['Header: ][^boost/asio/ip/address_v6.hpp]
  38658. ['Convenience header: ][^boost/asio.hpp]
  38659. [endsect]
  38660. [section:operator_lt_ ip::address_v6::operator<]
  38661. [indexterm2 boost_asio.indexterm.ip__address_v6.operator_lt_..operator<..ip::address_v6]
  38662. Compare addresses for ordering.
  38663. friend bool operator<(
  38664. const address_v6 & a1,
  38665. const address_v6 & a2);
  38666. [heading Requirements]
  38667. ['Header: ][^boost/asio/ip/address_v6.hpp]
  38668. ['Convenience header: ][^boost/asio.hpp]
  38669. [endsect]
  38670. [section:operator_lt__lt_ ip::address_v6::operator<<]
  38671. [indexterm2 boost_asio.indexterm.ip__address_v6.operator_lt__lt_..operator<<..ip::address_v6]
  38672. Output an address as a string.
  38673. template<
  38674. typename Elem,
  38675. typename Traits>
  38676. std::basic_ostream< Elem, Traits > & ``[link boost_asio.reference.ip__address_v6.operator_lt__lt_.overload1 operator<<]``(
  38677. std::basic_ostream< Elem, Traits > & os,
  38678. const address_v6 & addr);
  38679. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.operator_lt__lt_.overload1 more...]]``
  38680. Output a network as a string.
  38681. template<
  38682. typename Elem,
  38683. typename Traits>
  38684. std::basic_ostream< Elem, Traits > & ``[link boost_asio.reference.ip__address_v6.operator_lt__lt_.overload2 operator<<]``(
  38685. std::basic_ostream< Elem, Traits > & os,
  38686. const network_v6 & net);
  38687. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.operator_lt__lt_.overload2 more...]]``
  38688. [section:overload1 ip::address_v6::operator<< (1 of 2 overloads)]
  38689. Output an address as a string.
  38690. template<
  38691. typename Elem,
  38692. typename Traits>
  38693. std::basic_ostream< Elem, Traits > & operator<<(
  38694. std::basic_ostream< Elem, Traits > & os,
  38695. const address_v6 & addr);
  38696. Used to output a human-readable string for a specified address.
  38697. [heading Parameters]
  38698. [variablelist
  38699. [[os][The output stream to which the string will be written.]]
  38700. [[addr][The address to be written.]]
  38701. ]
  38702. [heading Return Value]
  38703. The output stream.
  38704. [endsect]
  38705. [section:overload2 ip::address_v6::operator<< (2 of 2 overloads)]
  38706. Output a network as a string.
  38707. template<
  38708. typename Elem,
  38709. typename Traits>
  38710. std::basic_ostream< Elem, Traits > & operator<<(
  38711. std::basic_ostream< Elem, Traits > & os,
  38712. const network_v6 & net);
  38713. Used to output a human-readable string for a specified network.
  38714. [heading Parameters]
  38715. [variablelist
  38716. [[os][The output stream to which the string will be written.]]
  38717. [[net][The network to be written.]]
  38718. ]
  38719. [heading Return Value]
  38720. The output stream.
  38721. [endsect]
  38722. [endsect]
  38723. [section:operator_lt__eq_ ip::address_v6::operator<=]
  38724. [indexterm2 boost_asio.indexterm.ip__address_v6.operator_lt__eq_..operator<=..ip::address_v6]
  38725. Compare addresses for ordering.
  38726. friend bool operator<=(
  38727. const address_v6 & a1,
  38728. const address_v6 & a2);
  38729. [heading Requirements]
  38730. ['Header: ][^boost/asio/ip/address_v6.hpp]
  38731. ['Convenience header: ][^boost/asio.hpp]
  38732. [endsect]
  38733. [section:operator_eq_ ip::address_v6::operator=]
  38734. [indexterm2 boost_asio.indexterm.ip__address_v6.operator_eq_..operator=..ip::address_v6]
  38735. Assign from another address.
  38736. address_v6 & operator=(
  38737. const address_v6 & other);
  38738. [endsect]
  38739. [section:operator_eq__eq_ ip::address_v6::operator==]
  38740. [indexterm2 boost_asio.indexterm.ip__address_v6.operator_eq__eq_..operator==..ip::address_v6]
  38741. Compare two addresses for equality.
  38742. friend bool operator==(
  38743. const address_v6 & a1,
  38744. const address_v6 & a2);
  38745. [heading Requirements]
  38746. ['Header: ][^boost/asio/ip/address_v6.hpp]
  38747. ['Convenience header: ][^boost/asio.hpp]
  38748. [endsect]
  38749. [section:operator_gt_ ip::address_v6::operator>]
  38750. [indexterm2 boost_asio.indexterm.ip__address_v6.operator_gt_..operator>..ip::address_v6]
  38751. Compare addresses for ordering.
  38752. friend bool operator>(
  38753. const address_v6 & a1,
  38754. const address_v6 & a2);
  38755. [heading Requirements]
  38756. ['Header: ][^boost/asio/ip/address_v6.hpp]
  38757. ['Convenience header: ][^boost/asio.hpp]
  38758. [endsect]
  38759. [section:operator_gt__eq_ ip::address_v6::operator>=]
  38760. [indexterm2 boost_asio.indexterm.ip__address_v6.operator_gt__eq_..operator>=..ip::address_v6]
  38761. Compare addresses for ordering.
  38762. friend bool operator>=(
  38763. const address_v6 & a1,
  38764. const address_v6 & a2);
  38765. [heading Requirements]
  38766. ['Header: ][^boost/asio/ip/address_v6.hpp]
  38767. ['Convenience header: ][^boost/asio.hpp]
  38768. [endsect]
  38769. [section:scope_id ip::address_v6::scope_id]
  38770. [indexterm2 boost_asio.indexterm.ip__address_v6.scope_id..scope_id..ip::address_v6]
  38771. The scope ID of the address.
  38772. unsigned long ``[link boost_asio.reference.ip__address_v6.scope_id.overload1 scope_id]``() const;
  38773. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.scope_id.overload1 more...]]``
  38774. void ``[link boost_asio.reference.ip__address_v6.scope_id.overload2 scope_id]``(
  38775. unsigned long id);
  38776. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.scope_id.overload2 more...]]``
  38777. [section:overload1 ip::address_v6::scope_id (1 of 2 overloads)]
  38778. The scope ID of the address.
  38779. unsigned long scope_id() const;
  38780. Returns the scope ID associated with the IPv6 address.
  38781. [endsect]
  38782. [section:overload2 ip::address_v6::scope_id (2 of 2 overloads)]
  38783. The scope ID of the address.
  38784. void scope_id(
  38785. unsigned long id);
  38786. Modifies the scope ID associated with the IPv6 address.
  38787. [endsect]
  38788. [endsect]
  38789. [section:to_bytes ip::address_v6::to_bytes]
  38790. [indexterm2 boost_asio.indexterm.ip__address_v6.to_bytes..to_bytes..ip::address_v6]
  38791. Get the address in bytes, in network byte order.
  38792. bytes_type to_bytes() const;
  38793. [endsect]
  38794. [section:to_string ip::address_v6::to_string]
  38795. [indexterm2 boost_asio.indexterm.ip__address_v6.to_string..to_string..ip::address_v6]
  38796. Get the address as a string.
  38797. std::string ``[link boost_asio.reference.ip__address_v6.to_string.overload1 to_string]``() const;
  38798. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.to_string.overload1 more...]]``
  38799. (Deprecated: Use other overload.) Get the address as a string.
  38800. std::string ``[link boost_asio.reference.ip__address_v6.to_string.overload2 to_string]``(
  38801. boost::system::error_code & ec) const;
  38802. `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.to_string.overload2 more...]]``
  38803. [section:overload1 ip::address_v6::to_string (1 of 2 overloads)]
  38804. Get the address as a string.
  38805. std::string to_string() const;
  38806. [endsect]
  38807. [section:overload2 ip::address_v6::to_string (2 of 2 overloads)]
  38808. (Deprecated: Use other overload.) Get the address as a string.
  38809. std::string to_string(
  38810. boost::system::error_code & ec) const;
  38811. [endsect]
  38812. [endsect]
  38813. [section:to_v4 ip::address_v6::to_v4]
  38814. [indexterm2 boost_asio.indexterm.ip__address_v6.to_v4..to_v4..ip::address_v6]
  38815. (Deprecated: Use `make_address_v4()`.) Converts an IPv4-mapped or IPv4-compatible address to an IPv4 address.
  38816. address_v4 to_v4() const;
  38817. [endsect]
  38818. [section:v4_compatible ip::address_v6::v4_compatible]
  38819. [indexterm2 boost_asio.indexterm.ip__address_v6.v4_compatible..v4_compatible..ip::address_v6]
  38820. (Deprecated: No replacement.) Create an IPv4-compatible IPv6 address.
  38821. static address_v6 v4_compatible(
  38822. const address_v4 & addr);
  38823. [endsect]
  38824. [section:v4_mapped ip::address_v6::v4_mapped]
  38825. [indexterm2 boost_asio.indexterm.ip__address_v6.v4_mapped..v4_mapped..ip::address_v6]
  38826. (Deprecated: Use `make_address_v6()`.) Create an IPv4-mapped IPv6 address.
  38827. static address_v6 v4_mapped(
  38828. const address_v4 & addr);
  38829. [endsect]
  38830. [endsect]
  38831. [section:ip__address_v6_iterator ip::address_v6_iterator]
  38832. [indexterm1 boost_asio.indexterm.ip__address_v6_iterator..ip::address_v6_iterator]
  38833. An input iterator that can be used for traversing IPv6 addresses.
  38834. typedef basic_address_iterator< address_v6 > address_v6_iterator;
  38835. [heading Requirements]
  38836. ['Header: ][^boost/asio/ip/address_v6_iterator.hpp]
  38837. ['Convenience header: ][^boost/asio.hpp]
  38838. [endsect]
  38839. [section:ip__address_v6_range ip::address_v6_range]
  38840. [indexterm1 boost_asio.indexterm.ip__address_v6_range..ip::address_v6_range]
  38841. Represents a range of IPv6 addresses.
  38842. typedef basic_address_range< address_v6 > address_v6_range;
  38843. [heading Requirements]
  38844. ['Header: ][^boost/asio/ip/address_v6_range.hpp]
  38845. ['Convenience header: ][^boost/asio.hpp]
  38846. [endsect]
  38847. [section:ip__bad_address_cast ip::bad_address_cast]
  38848. Thrown to indicate a failed address conversion.
  38849. class bad_address_cast
  38850. [heading Member Functions]
  38851. [table
  38852. [[Name][Description]]
  38853. [
  38854. [[link boost_asio.reference.ip__bad_address_cast.bad_address_cast [*bad_address_cast]]]
  38855. [Default constructor. ]
  38856. ]
  38857. [
  38858. [[link boost_asio.reference.ip__bad_address_cast.what [*what]]]
  38859. [Get the message associated with the exception. ]
  38860. ]
  38861. [
  38862. [[link boost_asio.reference.ip__bad_address_cast._bad_address_cast [*~bad_address_cast]]]
  38863. [Destructor. ]
  38864. ]
  38865. ]
  38866. [heading Requirements]
  38867. ['Header: ][^boost/asio/ip/bad_address_cast.hpp]
  38868. ['Convenience header: ][^boost/asio.hpp]
  38869. [section:bad_address_cast ip::bad_address_cast::bad_address_cast]
  38870. [indexterm2 boost_asio.indexterm.ip__bad_address_cast.bad_address_cast..bad_address_cast..ip::bad_address_cast]
  38871. Default constructor.
  38872. bad_address_cast();
  38873. [endsect]
  38874. [section:what ip::bad_address_cast::what]
  38875. [indexterm2 boost_asio.indexterm.ip__bad_address_cast.what..what..ip::bad_address_cast]
  38876. Get the message associated with the exception.
  38877. virtual const char * what() const;
  38878. [endsect]
  38879. [section:_bad_address_cast ip::bad_address_cast::~bad_address_cast]
  38880. [indexterm2 boost_asio.indexterm.ip__bad_address_cast._bad_address_cast..~bad_address_cast..ip::bad_address_cast]
  38881. Destructor.
  38882. virtual ~bad_address_cast();
  38883. [endsect]
  38884. [endsect]
  38885. [section:ip__basic_address_iterator_lt__address_v4__gt_ ip::basic_address_iterator< address_v4 >]
  38886. An input iterator that can be used for traversing IPv4 addresses.
  38887. template<>
  38888. class basic_address_iterator< address_v4 >
  38889. [heading Types]
  38890. [table
  38891. [[Name][Description]]
  38892. [
  38893. [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.difference_type [*difference_type]]]
  38894. [Distance between two iterators. ]
  38895. ]
  38896. [
  38897. [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.iterator_category [*iterator_category]]]
  38898. [Denotes that the iterator satisfies the input iterator requirements. ]
  38899. ]
  38900. [
  38901. [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.pointer [*pointer]]]
  38902. [The type of a pointer to an element pointed to by the iterator. ]
  38903. ]
  38904. [
  38905. [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.reference [*reference]]]
  38906. [The type of a reference to an element pointed to by the iterator. ]
  38907. ]
  38908. [
  38909. [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.value_type [*value_type]]]
  38910. [The type of the elements pointed to by the iterator. ]
  38911. ]
  38912. ]
  38913. [heading Member Functions]
  38914. [table
  38915. [[Name][Description]]
  38916. [
  38917. [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.basic_address_iterator [*basic_address_iterator]]]
  38918. [Construct an iterator that points to the specified address.
  38919. [hr]
  38920. Copy constructor. ]
  38921. ]
  38922. [
  38923. [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator__star_ [*operator *]]]
  38924. [Dereference the iterator. ]
  38925. ]
  38926. [
  38927. [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_plus__plus_ [*operator++]]]
  38928. [Pre-increment operator.
  38929. [hr]
  38930. Post-increment operator. ]
  38931. ]
  38932. [
  38933. [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_minus__minus_ [*operator--]]]
  38934. [Pre-decrement operator.
  38935. [hr]
  38936. Post-decrement operator. ]
  38937. ]
  38938. [
  38939. [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_arrow_ [*operator->]]]
  38940. [Dereference the iterator. ]
  38941. ]
  38942. [
  38943. [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_eq_ [*operator=]]]
  38944. [Assignment operator. ]
  38945. ]
  38946. ]
  38947. [heading Friends]
  38948. [table
  38949. [[Name][Description]]
  38950. [
  38951. [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_not__eq_ [*operator!=]]]
  38952. [Compare two addresses for inequality. ]
  38953. ]
  38954. [
  38955. [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_eq__eq_ [*operator==]]]
  38956. [Compare two addresses for equality. ]
  38957. ]
  38958. ]
  38959. In addition to satisfying the input iterator requirements, this iterator also supports decrement.
  38960. [heading Thread Safety]
  38961. ['Distinct] ['objects:] Safe.
  38962. ['Shared] ['objects:] Unsafe.
  38963. [heading Requirements]
  38964. ['Header: ][^boost/asio/ip/address_v4_iterator.hpp]
  38965. ['Convenience header: ][^boost/asio.hpp]
  38966. [section:basic_address_iterator ip::basic_address_iterator< address_v4 >::basic_address_iterator]
  38967. [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.basic_address_iterator..basic_address_iterator..ip::basic_address_iterator< address_v4 >]
  38968. Construct an iterator that points to the specified address.
  38969. ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.basic_address_iterator.overload1 basic_address_iterator]``(
  38970. const address_v4 & addr);
  38971. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.basic_address_iterator.overload1 more...]]``
  38972. Copy constructor.
  38973. ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.basic_address_iterator.overload2 basic_address_iterator]``(
  38974. const basic_address_iterator & other);
  38975. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.basic_address_iterator.overload2 more...]]``
  38976. [section:overload1 ip::basic_address_iterator< address_v4 >::basic_address_iterator (1 of 2 overloads)]
  38977. Construct an iterator that points to the specified address.
  38978. basic_address_iterator(
  38979. const address_v4 & addr);
  38980. [endsect]
  38981. [section:overload2 ip::basic_address_iterator< address_v4 >::basic_address_iterator (2 of 2 overloads)]
  38982. Copy constructor.
  38983. basic_address_iterator(
  38984. const basic_address_iterator & other);
  38985. [endsect]
  38986. [endsect]
  38987. [section:difference_type ip::basic_address_iterator< address_v4 >::difference_type]
  38988. [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.difference_type..difference_type..ip::basic_address_iterator< address_v4 >]
  38989. Distance between two iterators.
  38990. typedef std::ptrdiff_t difference_type;
  38991. [heading Requirements]
  38992. ['Header: ][^boost/asio/ip/address_v4_iterator.hpp]
  38993. ['Convenience header: ][^boost/asio.hpp]
  38994. [endsect]
  38995. [section:iterator_category ip::basic_address_iterator< address_v4 >::iterator_category]
  38996. [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.iterator_category..iterator_category..ip::basic_address_iterator< address_v4 >]
  38997. Denotes that the iterator satisfies the input iterator requirements.
  38998. typedef std::input_iterator_tag iterator_category;
  38999. [heading Requirements]
  39000. ['Header: ][^boost/asio/ip/address_v4_iterator.hpp]
  39001. ['Convenience header: ][^boost/asio.hpp]
  39002. [endsect]
  39003. [section:operator__star_ ip::basic_address_iterator< address_v4 >::operator *]
  39004. [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.operator__star_..operator *..ip::basic_address_iterator< address_v4 >]
  39005. Dereference the iterator.
  39006. const address_v4 & operator *() const;
  39007. [endsect]
  39008. [section:operator_not__eq_ ip::basic_address_iterator< address_v4 >::operator!=]
  39009. [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.operator_not__eq_..operator!=..ip::basic_address_iterator< address_v4 >]
  39010. Compare two addresses for inequality.
  39011. friend bool operator!=(
  39012. const basic_address_iterator & a,
  39013. const basic_address_iterator & b);
  39014. [heading Requirements]
  39015. ['Header: ][^boost/asio/ip/address_v4_iterator.hpp]
  39016. ['Convenience header: ][^boost/asio.hpp]
  39017. [endsect]
  39018. [section:operator_plus__plus_ ip::basic_address_iterator< address_v4 >::operator++]
  39019. [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.operator_plus__plus_..operator++..ip::basic_address_iterator< address_v4 >]
  39020. Pre-increment operator.
  39021. basic_address_iterator & ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_plus__plus_.overload1 operator++]``();
  39022. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_plus__plus_.overload1 more...]]``
  39023. Post-increment operator.
  39024. basic_address_iterator ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_plus__plus_.overload2 operator++]``(
  39025. int );
  39026. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_plus__plus_.overload2 more...]]``
  39027. [section:overload1 ip::basic_address_iterator< address_v4 >::operator++ (1 of 2 overloads)]
  39028. Pre-increment operator.
  39029. basic_address_iterator & operator++();
  39030. [endsect]
  39031. [section:overload2 ip::basic_address_iterator< address_v4 >::operator++ (2 of 2 overloads)]
  39032. Post-increment operator.
  39033. basic_address_iterator operator++(
  39034. int );
  39035. [endsect]
  39036. [endsect]
  39037. [section:operator_minus__minus_ ip::basic_address_iterator< address_v4 >::operator--]
  39038. [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.operator_minus__minus_..operator--..ip::basic_address_iterator< address_v4 >]
  39039. Pre-decrement operator.
  39040. basic_address_iterator & ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_minus__minus_.overload1 operator--]``();
  39041. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_minus__minus_.overload1 more...]]``
  39042. Post-decrement operator.
  39043. basic_address_iterator ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_minus__minus_.overload2 operator--]``(
  39044. int );
  39045. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_.operator_minus__minus_.overload2 more...]]``
  39046. [section:overload1 ip::basic_address_iterator< address_v4 >::operator-- (1 of 2 overloads)]
  39047. Pre-decrement operator.
  39048. basic_address_iterator & operator--();
  39049. [endsect]
  39050. [section:overload2 ip::basic_address_iterator< address_v4 >::operator-- (2 of 2 overloads)]
  39051. Post-decrement operator.
  39052. basic_address_iterator operator--(
  39053. int );
  39054. [endsect]
  39055. [endsect]
  39056. [section:operator_arrow_ ip::basic_address_iterator< address_v4 >::operator->]
  39057. [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.operator_arrow_..operator->..ip::basic_address_iterator< address_v4 >]
  39058. Dereference the iterator.
  39059. const address_v4 * operator->() const;
  39060. [endsect]
  39061. [section:operator_eq_ ip::basic_address_iterator< address_v4 >::operator=]
  39062. [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.operator_eq_..operator=..ip::basic_address_iterator< address_v4 >]
  39063. Assignment operator.
  39064. basic_address_iterator & operator=(
  39065. const basic_address_iterator & other);
  39066. [endsect]
  39067. [section:operator_eq__eq_ ip::basic_address_iterator< address_v4 >::operator==]
  39068. [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.operator_eq__eq_..operator==..ip::basic_address_iterator< address_v4 >]
  39069. Compare two addresses for equality.
  39070. friend bool operator==(
  39071. const basic_address_iterator & a,
  39072. const basic_address_iterator & b);
  39073. [heading Requirements]
  39074. ['Header: ][^boost/asio/ip/address_v4_iterator.hpp]
  39075. ['Convenience header: ][^boost/asio.hpp]
  39076. [endsect]
  39077. [section:pointer ip::basic_address_iterator< address_v4 >::pointer]
  39078. [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.pointer..pointer..ip::basic_address_iterator< address_v4 >]
  39079. The type of a pointer to an element pointed to by the iterator.
  39080. typedef const address_v4 * pointer;
  39081. [heading Requirements]
  39082. ['Header: ][^boost/asio/ip/address_v4_iterator.hpp]
  39083. ['Convenience header: ][^boost/asio.hpp]
  39084. [endsect]
  39085. [section:reference ip::basic_address_iterator< address_v4 >::reference]
  39086. [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.reference..reference..ip::basic_address_iterator< address_v4 >]
  39087. The type of a reference to an element pointed to by the iterator.
  39088. typedef const address_v4 & reference;
  39089. [heading Types]
  39090. [table
  39091. [[Name][Description]]
  39092. [
  39093. [[link boost_asio.reference.ip__address_v4.bytes_type [*bytes_type]]]
  39094. [The type used to represent an address as an array of bytes. ]
  39095. ]
  39096. [
  39097. [[link boost_asio.reference.ip__address_v4.uint_type [*uint_type]]]
  39098. [The type used to represent an address as an unsigned integer. ]
  39099. ]
  39100. ]
  39101. [heading Member Functions]
  39102. [table
  39103. [[Name][Description]]
  39104. [
  39105. [[link boost_asio.reference.ip__address_v4.address_v4 [*address_v4]]]
  39106. [Default constructor.
  39107. [hr]
  39108. Construct an address from raw bytes.
  39109. [hr]
  39110. Construct an address from an unsigned integer in host byte order.
  39111. [hr]
  39112. Copy constructor. ]
  39113. ]
  39114. [
  39115. [[link boost_asio.reference.ip__address_v4.any [*any]]]
  39116. [Obtain an address object that represents any address. ]
  39117. ]
  39118. [
  39119. [[link boost_asio.reference.ip__address_v4.broadcast [*broadcast]]]
  39120. [Obtain an address object that represents the broadcast address.
  39121. [hr]
  39122. (Deprecated: Use network_v4 class.) Obtain an address object that represents the broadcast address that corresponds to the specified address and netmask. ]
  39123. ]
  39124. [
  39125. [[link boost_asio.reference.ip__address_v4.from_string [*from_string]]]
  39126. [(Deprecated: Use make_address_v4().) Create an address from an IP address string in dotted decimal form. ]
  39127. ]
  39128. [
  39129. [[link boost_asio.reference.ip__address_v4.is_class_a [*is_class_a]]]
  39130. [(Deprecated: Use network_v4 class.) Determine whether the address is a class A address. ]
  39131. ]
  39132. [
  39133. [[link boost_asio.reference.ip__address_v4.is_class_b [*is_class_b]]]
  39134. [(Deprecated: Use network_v4 class.) Determine whether the address is a class B address. ]
  39135. ]
  39136. [
  39137. [[link boost_asio.reference.ip__address_v4.is_class_c [*is_class_c]]]
  39138. [(Deprecated: Use network_v4 class.) Determine whether the address is a class C address. ]
  39139. ]
  39140. [
  39141. [[link boost_asio.reference.ip__address_v4.is_loopback [*is_loopback]]]
  39142. [Determine whether the address is a loopback address. ]
  39143. ]
  39144. [
  39145. [[link boost_asio.reference.ip__address_v4.is_multicast [*is_multicast]]]
  39146. [Determine whether the address is a multicast address. ]
  39147. ]
  39148. [
  39149. [[link boost_asio.reference.ip__address_v4.is_unspecified [*is_unspecified]]]
  39150. [Determine whether the address is unspecified. ]
  39151. ]
  39152. [
  39153. [[link boost_asio.reference.ip__address_v4.loopback [*loopback]]]
  39154. [Obtain an address object that represents the loopback address. ]
  39155. ]
  39156. [
  39157. [[link boost_asio.reference.ip__address_v4.netmask [*netmask]]]
  39158. [(Deprecated: Use network_v4 class.) Obtain the netmask that corresponds to the address, based on its address class. ]
  39159. ]
  39160. [
  39161. [[link boost_asio.reference.ip__address_v4.operator_eq_ [*operator=]]]
  39162. [Assign from another address. ]
  39163. ]
  39164. [
  39165. [[link boost_asio.reference.ip__address_v4.to_bytes [*to_bytes]]]
  39166. [Get the address in bytes, in network byte order. ]
  39167. ]
  39168. [
  39169. [[link boost_asio.reference.ip__address_v4.to_string [*to_string]]]
  39170. [Get the address as a string in dotted decimal format.
  39171. [hr]
  39172. (Deprecated: Use other overload.) Get the address as a string in dotted decimal format. ]
  39173. ]
  39174. [
  39175. [[link boost_asio.reference.ip__address_v4.to_uint [*to_uint]]]
  39176. [Get the address as an unsigned integer in host byte order. ]
  39177. ]
  39178. [
  39179. [[link boost_asio.reference.ip__address_v4.to_ulong [*to_ulong]]]
  39180. [Get the address as an unsigned long in host byte order. ]
  39181. ]
  39182. ]
  39183. [heading Friends]
  39184. [table
  39185. [[Name][Description]]
  39186. [
  39187. [[link boost_asio.reference.ip__address_v4.operator_not__eq_ [*operator!=]]]
  39188. [Compare two addresses for inequality. ]
  39189. ]
  39190. [
  39191. [[link boost_asio.reference.ip__address_v4.operator_lt_ [*operator<]]]
  39192. [Compare addresses for ordering. ]
  39193. ]
  39194. [
  39195. [[link boost_asio.reference.ip__address_v4.operator_lt__eq_ [*operator<=]]]
  39196. [Compare addresses for ordering. ]
  39197. ]
  39198. [
  39199. [[link boost_asio.reference.ip__address_v4.operator_eq__eq_ [*operator==]]]
  39200. [Compare two addresses for equality. ]
  39201. ]
  39202. [
  39203. [[link boost_asio.reference.ip__address_v4.operator_gt_ [*operator>]]]
  39204. [Compare addresses for ordering. ]
  39205. ]
  39206. [
  39207. [[link boost_asio.reference.ip__address_v4.operator_gt__eq_ [*operator>=]]]
  39208. [Compare addresses for ordering. ]
  39209. ]
  39210. ]
  39211. [heading Related Functions]
  39212. [table
  39213. [[Name][Description]]
  39214. [
  39215. [[link boost_asio.reference.ip__address_v4.make_address_v4 [*make_address_v4]]]
  39216. [Create an IPv4 address from raw bytes in network order.
  39217. Create an IPv4 address from an unsigned integer in host byte order.
  39218. Create an IPv4 address from an IP address string in dotted decimal form.
  39219. Create an IPv4 address from a IPv4-mapped IPv6 address. ]
  39220. ]
  39221. [
  39222. [[link boost_asio.reference.ip__address_v4.make_network_v4 [*make_network_v4]]]
  39223. [Create an IPv4 network from an address and prefix length.
  39224. Create an IPv4 network from an address and netmask. ]
  39225. ]
  39226. [
  39227. [[link boost_asio.reference.ip__address_v4.operator_lt__lt_ [*operator<<]]]
  39228. [Output an address as a string.
  39229. Output a network as a string. ]
  39230. ]
  39231. ]
  39232. The [link boost_asio.reference.ip__address_v4 `ip::address_v4`] class provides the ability to use and manipulate IP version 4 addresses.
  39233. [heading Thread Safety]
  39234. ['Distinct] ['objects:] Safe.
  39235. ['Shared] ['objects:] Unsafe.
  39236. [heading Requirements]
  39237. ['Header: ][^boost/asio/ip/address_v4_iterator.hpp]
  39238. ['Convenience header: ][^boost/asio.hpp]
  39239. [endsect]
  39240. [section:value_type ip::basic_address_iterator< address_v4 >::value_type]
  39241. [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v4__gt_.value_type..value_type..ip::basic_address_iterator< address_v4 >]
  39242. The type of the elements pointed to by the iterator.
  39243. typedef address_v4 value_type;
  39244. [heading Types]
  39245. [table
  39246. [[Name][Description]]
  39247. [
  39248. [[link boost_asio.reference.ip__address_v4.bytes_type [*bytes_type]]]
  39249. [The type used to represent an address as an array of bytes. ]
  39250. ]
  39251. [
  39252. [[link boost_asio.reference.ip__address_v4.uint_type [*uint_type]]]
  39253. [The type used to represent an address as an unsigned integer. ]
  39254. ]
  39255. ]
  39256. [heading Member Functions]
  39257. [table
  39258. [[Name][Description]]
  39259. [
  39260. [[link boost_asio.reference.ip__address_v4.address_v4 [*address_v4]]]
  39261. [Default constructor.
  39262. [hr]
  39263. Construct an address from raw bytes.
  39264. [hr]
  39265. Construct an address from an unsigned integer in host byte order.
  39266. [hr]
  39267. Copy constructor. ]
  39268. ]
  39269. [
  39270. [[link boost_asio.reference.ip__address_v4.any [*any]]]
  39271. [Obtain an address object that represents any address. ]
  39272. ]
  39273. [
  39274. [[link boost_asio.reference.ip__address_v4.broadcast [*broadcast]]]
  39275. [Obtain an address object that represents the broadcast address.
  39276. [hr]
  39277. (Deprecated: Use network_v4 class.) Obtain an address object that represents the broadcast address that corresponds to the specified address and netmask. ]
  39278. ]
  39279. [
  39280. [[link boost_asio.reference.ip__address_v4.from_string [*from_string]]]
  39281. [(Deprecated: Use make_address_v4().) Create an address from an IP address string in dotted decimal form. ]
  39282. ]
  39283. [
  39284. [[link boost_asio.reference.ip__address_v4.is_class_a [*is_class_a]]]
  39285. [(Deprecated: Use network_v4 class.) Determine whether the address is a class A address. ]
  39286. ]
  39287. [
  39288. [[link boost_asio.reference.ip__address_v4.is_class_b [*is_class_b]]]
  39289. [(Deprecated: Use network_v4 class.) Determine whether the address is a class B address. ]
  39290. ]
  39291. [
  39292. [[link boost_asio.reference.ip__address_v4.is_class_c [*is_class_c]]]
  39293. [(Deprecated: Use network_v4 class.) Determine whether the address is a class C address. ]
  39294. ]
  39295. [
  39296. [[link boost_asio.reference.ip__address_v4.is_loopback [*is_loopback]]]
  39297. [Determine whether the address is a loopback address. ]
  39298. ]
  39299. [
  39300. [[link boost_asio.reference.ip__address_v4.is_multicast [*is_multicast]]]
  39301. [Determine whether the address is a multicast address. ]
  39302. ]
  39303. [
  39304. [[link boost_asio.reference.ip__address_v4.is_unspecified [*is_unspecified]]]
  39305. [Determine whether the address is unspecified. ]
  39306. ]
  39307. [
  39308. [[link boost_asio.reference.ip__address_v4.loopback [*loopback]]]
  39309. [Obtain an address object that represents the loopback address. ]
  39310. ]
  39311. [
  39312. [[link boost_asio.reference.ip__address_v4.netmask [*netmask]]]
  39313. [(Deprecated: Use network_v4 class.) Obtain the netmask that corresponds to the address, based on its address class. ]
  39314. ]
  39315. [
  39316. [[link boost_asio.reference.ip__address_v4.operator_eq_ [*operator=]]]
  39317. [Assign from another address. ]
  39318. ]
  39319. [
  39320. [[link boost_asio.reference.ip__address_v4.to_bytes [*to_bytes]]]
  39321. [Get the address in bytes, in network byte order. ]
  39322. ]
  39323. [
  39324. [[link boost_asio.reference.ip__address_v4.to_string [*to_string]]]
  39325. [Get the address as a string in dotted decimal format.
  39326. [hr]
  39327. (Deprecated: Use other overload.) Get the address as a string in dotted decimal format. ]
  39328. ]
  39329. [
  39330. [[link boost_asio.reference.ip__address_v4.to_uint [*to_uint]]]
  39331. [Get the address as an unsigned integer in host byte order. ]
  39332. ]
  39333. [
  39334. [[link boost_asio.reference.ip__address_v4.to_ulong [*to_ulong]]]
  39335. [Get the address as an unsigned long in host byte order. ]
  39336. ]
  39337. ]
  39338. [heading Friends]
  39339. [table
  39340. [[Name][Description]]
  39341. [
  39342. [[link boost_asio.reference.ip__address_v4.operator_not__eq_ [*operator!=]]]
  39343. [Compare two addresses for inequality. ]
  39344. ]
  39345. [
  39346. [[link boost_asio.reference.ip__address_v4.operator_lt_ [*operator<]]]
  39347. [Compare addresses for ordering. ]
  39348. ]
  39349. [
  39350. [[link boost_asio.reference.ip__address_v4.operator_lt__eq_ [*operator<=]]]
  39351. [Compare addresses for ordering. ]
  39352. ]
  39353. [
  39354. [[link boost_asio.reference.ip__address_v4.operator_eq__eq_ [*operator==]]]
  39355. [Compare two addresses for equality. ]
  39356. ]
  39357. [
  39358. [[link boost_asio.reference.ip__address_v4.operator_gt_ [*operator>]]]
  39359. [Compare addresses for ordering. ]
  39360. ]
  39361. [
  39362. [[link boost_asio.reference.ip__address_v4.operator_gt__eq_ [*operator>=]]]
  39363. [Compare addresses for ordering. ]
  39364. ]
  39365. ]
  39366. [heading Related Functions]
  39367. [table
  39368. [[Name][Description]]
  39369. [
  39370. [[link boost_asio.reference.ip__address_v4.make_address_v4 [*make_address_v4]]]
  39371. [Create an IPv4 address from raw bytes in network order.
  39372. Create an IPv4 address from an unsigned integer in host byte order.
  39373. Create an IPv4 address from an IP address string in dotted decimal form.
  39374. Create an IPv4 address from a IPv4-mapped IPv6 address. ]
  39375. ]
  39376. [
  39377. [[link boost_asio.reference.ip__address_v4.make_network_v4 [*make_network_v4]]]
  39378. [Create an IPv4 network from an address and prefix length.
  39379. Create an IPv4 network from an address and netmask. ]
  39380. ]
  39381. [
  39382. [[link boost_asio.reference.ip__address_v4.operator_lt__lt_ [*operator<<]]]
  39383. [Output an address as a string.
  39384. Output a network as a string. ]
  39385. ]
  39386. ]
  39387. The [link boost_asio.reference.ip__address_v4 `ip::address_v4`] class provides the ability to use and manipulate IP version 4 addresses.
  39388. [heading Thread Safety]
  39389. ['Distinct] ['objects:] Safe.
  39390. ['Shared] ['objects:] Unsafe.
  39391. [heading Requirements]
  39392. ['Header: ][^boost/asio/ip/address_v4_iterator.hpp]
  39393. ['Convenience header: ][^boost/asio.hpp]
  39394. [endsect]
  39395. [endsect]
  39396. [section:ip__basic_address_iterator_lt__address_v6__gt_ ip::basic_address_iterator< address_v6 >]
  39397. An input iterator that can be used for traversing IPv6 addresses.
  39398. template<>
  39399. class basic_address_iterator< address_v6 >
  39400. [heading Types]
  39401. [table
  39402. [[Name][Description]]
  39403. [
  39404. [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.difference_type [*difference_type]]]
  39405. [Distance between two iterators. ]
  39406. ]
  39407. [
  39408. [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.iterator_category [*iterator_category]]]
  39409. [Denotes that the iterator satisfies the input iterator requirements. ]
  39410. ]
  39411. [
  39412. [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.pointer [*pointer]]]
  39413. [The type of a pointer to an element pointed to by the iterator. ]
  39414. ]
  39415. [
  39416. [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.reference [*reference]]]
  39417. [The type of a reference to an element pointed to by the iterator. ]
  39418. ]
  39419. [
  39420. [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.value_type [*value_type]]]
  39421. [The type of the elements pointed to by the iterator. ]
  39422. ]
  39423. ]
  39424. [heading Member Functions]
  39425. [table
  39426. [[Name][Description]]
  39427. [
  39428. [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.basic_address_iterator [*basic_address_iterator]]]
  39429. [Construct an iterator that points to the specified address.
  39430. [hr]
  39431. Copy constructor. ]
  39432. ]
  39433. [
  39434. [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator__star_ [*operator *]]]
  39435. [Dereference the iterator. ]
  39436. ]
  39437. [
  39438. [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_plus__plus_ [*operator++]]]
  39439. [Pre-increment operator.
  39440. [hr]
  39441. Post-increment operator. ]
  39442. ]
  39443. [
  39444. [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_minus__minus_ [*operator--]]]
  39445. [Pre-decrement operator.
  39446. [hr]
  39447. Post-decrement operator. ]
  39448. ]
  39449. [
  39450. [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_arrow_ [*operator->]]]
  39451. [Dereference the iterator. ]
  39452. ]
  39453. [
  39454. [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_eq_ [*operator=]]]
  39455. [Assignment operator. ]
  39456. ]
  39457. ]
  39458. [heading Friends]
  39459. [table
  39460. [[Name][Description]]
  39461. [
  39462. [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_not__eq_ [*operator!=]]]
  39463. [Compare two addresses for inequality. ]
  39464. ]
  39465. [
  39466. [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_eq__eq_ [*operator==]]]
  39467. [Compare two addresses for equality. ]
  39468. ]
  39469. ]
  39470. In addition to satisfying the input iterator requirements, this iterator also supports decrement.
  39471. [heading Thread Safety]
  39472. ['Distinct] ['objects:] Safe.
  39473. ['Shared] ['objects:] Unsafe.
  39474. [heading Requirements]
  39475. ['Header: ][^boost/asio/ip/address_v6_iterator.hpp]
  39476. ['Convenience header: ][^boost/asio.hpp]
  39477. [section:basic_address_iterator ip::basic_address_iterator< address_v6 >::basic_address_iterator]
  39478. [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.basic_address_iterator..basic_address_iterator..ip::basic_address_iterator< address_v6 >]
  39479. Construct an iterator that points to the specified address.
  39480. ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.basic_address_iterator.overload1 basic_address_iterator]``(
  39481. const address_v6 & addr);
  39482. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.basic_address_iterator.overload1 more...]]``
  39483. Copy constructor.
  39484. ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.basic_address_iterator.overload2 basic_address_iterator]``(
  39485. const basic_address_iterator & other);
  39486. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.basic_address_iterator.overload2 more...]]``
  39487. [section:overload1 ip::basic_address_iterator< address_v6 >::basic_address_iterator (1 of 2 overloads)]
  39488. Construct an iterator that points to the specified address.
  39489. basic_address_iterator(
  39490. const address_v6 & addr);
  39491. [endsect]
  39492. [section:overload2 ip::basic_address_iterator< address_v6 >::basic_address_iterator (2 of 2 overloads)]
  39493. Copy constructor.
  39494. basic_address_iterator(
  39495. const basic_address_iterator & other);
  39496. [endsect]
  39497. [endsect]
  39498. [section:difference_type ip::basic_address_iterator< address_v6 >::difference_type]
  39499. [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.difference_type..difference_type..ip::basic_address_iterator< address_v6 >]
  39500. Distance between two iterators.
  39501. typedef std::ptrdiff_t difference_type;
  39502. [heading Requirements]
  39503. ['Header: ][^boost/asio/ip/address_v6_iterator.hpp]
  39504. ['Convenience header: ][^boost/asio.hpp]
  39505. [endsect]
  39506. [section:iterator_category ip::basic_address_iterator< address_v6 >::iterator_category]
  39507. [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.iterator_category..iterator_category..ip::basic_address_iterator< address_v6 >]
  39508. Denotes that the iterator satisfies the input iterator requirements.
  39509. typedef std::input_iterator_tag iterator_category;
  39510. [heading Requirements]
  39511. ['Header: ][^boost/asio/ip/address_v6_iterator.hpp]
  39512. ['Convenience header: ][^boost/asio.hpp]
  39513. [endsect]
  39514. [section:operator__star_ ip::basic_address_iterator< address_v6 >::operator *]
  39515. [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.operator__star_..operator *..ip::basic_address_iterator< address_v6 >]
  39516. Dereference the iterator.
  39517. const address_v6 & operator *() const;
  39518. [endsect]
  39519. [section:operator_not__eq_ ip::basic_address_iterator< address_v6 >::operator!=]
  39520. [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.operator_not__eq_..operator!=..ip::basic_address_iterator< address_v6 >]
  39521. Compare two addresses for inequality.
  39522. friend bool operator!=(
  39523. const basic_address_iterator & a,
  39524. const basic_address_iterator & b);
  39525. [heading Requirements]
  39526. ['Header: ][^boost/asio/ip/address_v6_iterator.hpp]
  39527. ['Convenience header: ][^boost/asio.hpp]
  39528. [endsect]
  39529. [section:operator_plus__plus_ ip::basic_address_iterator< address_v6 >::operator++]
  39530. [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.operator_plus__plus_..operator++..ip::basic_address_iterator< address_v6 >]
  39531. Pre-increment operator.
  39532. basic_address_iterator & ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_plus__plus_.overload1 operator++]``();
  39533. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_plus__plus_.overload1 more...]]``
  39534. Post-increment operator.
  39535. basic_address_iterator ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_plus__plus_.overload2 operator++]``(
  39536. int );
  39537. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_plus__plus_.overload2 more...]]``
  39538. [section:overload1 ip::basic_address_iterator< address_v6 >::operator++ (1 of 2 overloads)]
  39539. Pre-increment operator.
  39540. basic_address_iterator & operator++();
  39541. [endsect]
  39542. [section:overload2 ip::basic_address_iterator< address_v6 >::operator++ (2 of 2 overloads)]
  39543. Post-increment operator.
  39544. basic_address_iterator operator++(
  39545. int );
  39546. [endsect]
  39547. [endsect]
  39548. [section:operator_minus__minus_ ip::basic_address_iterator< address_v6 >::operator--]
  39549. [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.operator_minus__minus_..operator--..ip::basic_address_iterator< address_v6 >]
  39550. Pre-decrement operator.
  39551. basic_address_iterator & ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_minus__minus_.overload1 operator--]``();
  39552. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_minus__minus_.overload1 more...]]``
  39553. Post-decrement operator.
  39554. basic_address_iterator ``[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_minus__minus_.overload2 operator--]``(
  39555. int );
  39556. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_.operator_minus__minus_.overload2 more...]]``
  39557. [section:overload1 ip::basic_address_iterator< address_v6 >::operator-- (1 of 2 overloads)]
  39558. Pre-decrement operator.
  39559. basic_address_iterator & operator--();
  39560. [endsect]
  39561. [section:overload2 ip::basic_address_iterator< address_v6 >::operator-- (2 of 2 overloads)]
  39562. Post-decrement operator.
  39563. basic_address_iterator operator--(
  39564. int );
  39565. [endsect]
  39566. [endsect]
  39567. [section:operator_arrow_ ip::basic_address_iterator< address_v6 >::operator->]
  39568. [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.operator_arrow_..operator->..ip::basic_address_iterator< address_v6 >]
  39569. Dereference the iterator.
  39570. const address_v6 * operator->() const;
  39571. [endsect]
  39572. [section:operator_eq_ ip::basic_address_iterator< address_v6 >::operator=]
  39573. [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.operator_eq_..operator=..ip::basic_address_iterator< address_v6 >]
  39574. Assignment operator.
  39575. basic_address_iterator & operator=(
  39576. const basic_address_iterator & other);
  39577. [endsect]
  39578. [section:operator_eq__eq_ ip::basic_address_iterator< address_v6 >::operator==]
  39579. [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.operator_eq__eq_..operator==..ip::basic_address_iterator< address_v6 >]
  39580. Compare two addresses for equality.
  39581. friend bool operator==(
  39582. const basic_address_iterator & a,
  39583. const basic_address_iterator & b);
  39584. [heading Requirements]
  39585. ['Header: ][^boost/asio/ip/address_v6_iterator.hpp]
  39586. ['Convenience header: ][^boost/asio.hpp]
  39587. [endsect]
  39588. [section:pointer ip::basic_address_iterator< address_v6 >::pointer]
  39589. [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.pointer..pointer..ip::basic_address_iterator< address_v6 >]
  39590. The type of a pointer to an element pointed to by the iterator.
  39591. typedef const address_v6 * pointer;
  39592. [heading Requirements]
  39593. ['Header: ][^boost/asio/ip/address_v6_iterator.hpp]
  39594. ['Convenience header: ][^boost/asio.hpp]
  39595. [endsect]
  39596. [section:reference ip::basic_address_iterator< address_v6 >::reference]
  39597. [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.reference..reference..ip::basic_address_iterator< address_v6 >]
  39598. The type of a reference to an element pointed to by the iterator.
  39599. typedef const address_v6 & reference;
  39600. [heading Types]
  39601. [table
  39602. [[Name][Description]]
  39603. [
  39604. [[link boost_asio.reference.ip__address_v6.bytes_type [*bytes_type]]]
  39605. [The type used to represent an address as an array of bytes. ]
  39606. ]
  39607. ]
  39608. [heading Member Functions]
  39609. [table
  39610. [[Name][Description]]
  39611. [
  39612. [[link boost_asio.reference.ip__address_v6.address_v6 [*address_v6]]]
  39613. [Default constructor.
  39614. [hr]
  39615. Construct an address from raw bytes and scope ID.
  39616. [hr]
  39617. Copy constructor. ]
  39618. ]
  39619. [
  39620. [[link boost_asio.reference.ip__address_v6.any [*any]]]
  39621. [Obtain an address object that represents any address. ]
  39622. ]
  39623. [
  39624. [[link boost_asio.reference.ip__address_v6.from_string [*from_string]]]
  39625. [(Deprecated: Use make_address_v6().) Create an IPv6 address from an IP address string. ]
  39626. ]
  39627. [
  39628. [[link boost_asio.reference.ip__address_v6.is_link_local [*is_link_local]]]
  39629. [Determine whether the address is link local. ]
  39630. ]
  39631. [
  39632. [[link boost_asio.reference.ip__address_v6.is_loopback [*is_loopback]]]
  39633. [Determine whether the address is a loopback address. ]
  39634. ]
  39635. [
  39636. [[link boost_asio.reference.ip__address_v6.is_multicast [*is_multicast]]]
  39637. [Determine whether the address is a multicast address. ]
  39638. ]
  39639. [
  39640. [[link boost_asio.reference.ip__address_v6.is_multicast_global [*is_multicast_global]]]
  39641. [Determine whether the address is a global multicast address. ]
  39642. ]
  39643. [
  39644. [[link boost_asio.reference.ip__address_v6.is_multicast_link_local [*is_multicast_link_local]]]
  39645. [Determine whether the address is a link-local multicast address. ]
  39646. ]
  39647. [
  39648. [[link boost_asio.reference.ip__address_v6.is_multicast_node_local [*is_multicast_node_local]]]
  39649. [Determine whether the address is a node-local multicast address. ]
  39650. ]
  39651. [
  39652. [[link boost_asio.reference.ip__address_v6.is_multicast_org_local [*is_multicast_org_local]]]
  39653. [Determine whether the address is a org-local multicast address. ]
  39654. ]
  39655. [
  39656. [[link boost_asio.reference.ip__address_v6.is_multicast_site_local [*is_multicast_site_local]]]
  39657. [Determine whether the address is a site-local multicast address. ]
  39658. ]
  39659. [
  39660. [[link boost_asio.reference.ip__address_v6.is_site_local [*is_site_local]]]
  39661. [Determine whether the address is site local. ]
  39662. ]
  39663. [
  39664. [[link boost_asio.reference.ip__address_v6.is_unspecified [*is_unspecified]]]
  39665. [Determine whether the address is unspecified. ]
  39666. ]
  39667. [
  39668. [[link boost_asio.reference.ip__address_v6.is_v4_compatible [*is_v4_compatible]]]
  39669. [(Deprecated: No replacement.) Determine whether the address is an IPv4-compatible address. ]
  39670. ]
  39671. [
  39672. [[link boost_asio.reference.ip__address_v6.is_v4_mapped [*is_v4_mapped]]]
  39673. [Determine whether the address is a mapped IPv4 address. ]
  39674. ]
  39675. [
  39676. [[link boost_asio.reference.ip__address_v6.loopback [*loopback]]]
  39677. [Obtain an address object that represents the loopback address. ]
  39678. ]
  39679. [
  39680. [[link boost_asio.reference.ip__address_v6.operator_eq_ [*operator=]]]
  39681. [Assign from another address. ]
  39682. ]
  39683. [
  39684. [[link boost_asio.reference.ip__address_v6.scope_id [*scope_id]]]
  39685. [The scope ID of the address. ]
  39686. ]
  39687. [
  39688. [[link boost_asio.reference.ip__address_v6.to_bytes [*to_bytes]]]
  39689. [Get the address in bytes, in network byte order. ]
  39690. ]
  39691. [
  39692. [[link boost_asio.reference.ip__address_v6.to_string [*to_string]]]
  39693. [Get the address as a string.
  39694. [hr]
  39695. (Deprecated: Use other overload.) Get the address as a string. ]
  39696. ]
  39697. [
  39698. [[link boost_asio.reference.ip__address_v6.to_v4 [*to_v4]]]
  39699. [(Deprecated: Use make_address_v4().) Converts an IPv4-mapped or IPv4-compatible address to an IPv4 address. ]
  39700. ]
  39701. [
  39702. [[link boost_asio.reference.ip__address_v6.v4_compatible [*v4_compatible]]]
  39703. [(Deprecated: No replacement.) Create an IPv4-compatible IPv6 address. ]
  39704. ]
  39705. [
  39706. [[link boost_asio.reference.ip__address_v6.v4_mapped [*v4_mapped]]]
  39707. [(Deprecated: Use make_address_v6().) Create an IPv4-mapped IPv6 address. ]
  39708. ]
  39709. ]
  39710. [heading Friends]
  39711. [table
  39712. [[Name][Description]]
  39713. [
  39714. [[link boost_asio.reference.ip__address_v6.operator_not__eq_ [*operator!=]]]
  39715. [Compare two addresses for inequality. ]
  39716. ]
  39717. [
  39718. [[link boost_asio.reference.ip__address_v6.operator_lt_ [*operator<]]]
  39719. [Compare addresses for ordering. ]
  39720. ]
  39721. [
  39722. [[link boost_asio.reference.ip__address_v6.operator_lt__eq_ [*operator<=]]]
  39723. [Compare addresses for ordering. ]
  39724. ]
  39725. [
  39726. [[link boost_asio.reference.ip__address_v6.operator_eq__eq_ [*operator==]]]
  39727. [Compare two addresses for equality. ]
  39728. ]
  39729. [
  39730. [[link boost_asio.reference.ip__address_v6.operator_gt_ [*operator>]]]
  39731. [Compare addresses for ordering. ]
  39732. ]
  39733. [
  39734. [[link boost_asio.reference.ip__address_v6.operator_gt__eq_ [*operator>=]]]
  39735. [Compare addresses for ordering. ]
  39736. ]
  39737. ]
  39738. [heading Related Functions]
  39739. [table
  39740. [[Name][Description]]
  39741. [
  39742. [[link boost_asio.reference.ip__address_v6.make_address_v6 [*make_address_v6]]]
  39743. [Create an IPv6 address from raw bytes and scope ID.
  39744. Create an IPv6 address from an IP address string.
  39745. Createan IPv6 address from an IP address string.
  39746. Create an IPv4-mapped IPv6 address from an IPv4 address. ]
  39747. ]
  39748. [
  39749. [[link boost_asio.reference.ip__address_v6.make_network_v6 [*make_network_v6]]]
  39750. [Create an IPv6 network from an address and prefix length. ]
  39751. ]
  39752. [
  39753. [[link boost_asio.reference.ip__address_v6.operator_lt__lt_ [*operator<<]]]
  39754. [Output an address as a string.
  39755. Output a network as a string. ]
  39756. ]
  39757. ]
  39758. The [link boost_asio.reference.ip__address_v6 `ip::address_v6`] class provides the ability to use and manipulate IP version 6 addresses.
  39759. [heading Thread Safety]
  39760. ['Distinct] ['objects:] Safe.
  39761. ['Shared] ['objects:] Unsafe.
  39762. [heading Requirements]
  39763. ['Header: ][^boost/asio/ip/address_v6_iterator.hpp]
  39764. ['Convenience header: ][^boost/asio.hpp]
  39765. [endsect]
  39766. [section:value_type ip::basic_address_iterator< address_v6 >::value_type]
  39767. [indexterm2 boost_asio.indexterm.ip__basic_address_iterator_lt__address_v6__gt_.value_type..value_type..ip::basic_address_iterator< address_v6 >]
  39768. The type of the elements pointed to by the iterator.
  39769. typedef address_v6 value_type;
  39770. [heading Types]
  39771. [table
  39772. [[Name][Description]]
  39773. [
  39774. [[link boost_asio.reference.ip__address_v6.bytes_type [*bytes_type]]]
  39775. [The type used to represent an address as an array of bytes. ]
  39776. ]
  39777. ]
  39778. [heading Member Functions]
  39779. [table
  39780. [[Name][Description]]
  39781. [
  39782. [[link boost_asio.reference.ip__address_v6.address_v6 [*address_v6]]]
  39783. [Default constructor.
  39784. [hr]
  39785. Construct an address from raw bytes and scope ID.
  39786. [hr]
  39787. Copy constructor. ]
  39788. ]
  39789. [
  39790. [[link boost_asio.reference.ip__address_v6.any [*any]]]
  39791. [Obtain an address object that represents any address. ]
  39792. ]
  39793. [
  39794. [[link boost_asio.reference.ip__address_v6.from_string [*from_string]]]
  39795. [(Deprecated: Use make_address_v6().) Create an IPv6 address from an IP address string. ]
  39796. ]
  39797. [
  39798. [[link boost_asio.reference.ip__address_v6.is_link_local [*is_link_local]]]
  39799. [Determine whether the address is link local. ]
  39800. ]
  39801. [
  39802. [[link boost_asio.reference.ip__address_v6.is_loopback [*is_loopback]]]
  39803. [Determine whether the address is a loopback address. ]
  39804. ]
  39805. [
  39806. [[link boost_asio.reference.ip__address_v6.is_multicast [*is_multicast]]]
  39807. [Determine whether the address is a multicast address. ]
  39808. ]
  39809. [
  39810. [[link boost_asio.reference.ip__address_v6.is_multicast_global [*is_multicast_global]]]
  39811. [Determine whether the address is a global multicast address. ]
  39812. ]
  39813. [
  39814. [[link boost_asio.reference.ip__address_v6.is_multicast_link_local [*is_multicast_link_local]]]
  39815. [Determine whether the address is a link-local multicast address. ]
  39816. ]
  39817. [
  39818. [[link boost_asio.reference.ip__address_v6.is_multicast_node_local [*is_multicast_node_local]]]
  39819. [Determine whether the address is a node-local multicast address. ]
  39820. ]
  39821. [
  39822. [[link boost_asio.reference.ip__address_v6.is_multicast_org_local [*is_multicast_org_local]]]
  39823. [Determine whether the address is a org-local multicast address. ]
  39824. ]
  39825. [
  39826. [[link boost_asio.reference.ip__address_v6.is_multicast_site_local [*is_multicast_site_local]]]
  39827. [Determine whether the address is a site-local multicast address. ]
  39828. ]
  39829. [
  39830. [[link boost_asio.reference.ip__address_v6.is_site_local [*is_site_local]]]
  39831. [Determine whether the address is site local. ]
  39832. ]
  39833. [
  39834. [[link boost_asio.reference.ip__address_v6.is_unspecified [*is_unspecified]]]
  39835. [Determine whether the address is unspecified. ]
  39836. ]
  39837. [
  39838. [[link boost_asio.reference.ip__address_v6.is_v4_compatible [*is_v4_compatible]]]
  39839. [(Deprecated: No replacement.) Determine whether the address is an IPv4-compatible address. ]
  39840. ]
  39841. [
  39842. [[link boost_asio.reference.ip__address_v6.is_v4_mapped [*is_v4_mapped]]]
  39843. [Determine whether the address is a mapped IPv4 address. ]
  39844. ]
  39845. [
  39846. [[link boost_asio.reference.ip__address_v6.loopback [*loopback]]]
  39847. [Obtain an address object that represents the loopback address. ]
  39848. ]
  39849. [
  39850. [[link boost_asio.reference.ip__address_v6.operator_eq_ [*operator=]]]
  39851. [Assign from another address. ]
  39852. ]
  39853. [
  39854. [[link boost_asio.reference.ip__address_v6.scope_id [*scope_id]]]
  39855. [The scope ID of the address. ]
  39856. ]
  39857. [
  39858. [[link boost_asio.reference.ip__address_v6.to_bytes [*to_bytes]]]
  39859. [Get the address in bytes, in network byte order. ]
  39860. ]
  39861. [
  39862. [[link boost_asio.reference.ip__address_v6.to_string [*to_string]]]
  39863. [Get the address as a string.
  39864. [hr]
  39865. (Deprecated: Use other overload.) Get the address as a string. ]
  39866. ]
  39867. [
  39868. [[link boost_asio.reference.ip__address_v6.to_v4 [*to_v4]]]
  39869. [(Deprecated: Use make_address_v4().) Converts an IPv4-mapped or IPv4-compatible address to an IPv4 address. ]
  39870. ]
  39871. [
  39872. [[link boost_asio.reference.ip__address_v6.v4_compatible [*v4_compatible]]]
  39873. [(Deprecated: No replacement.) Create an IPv4-compatible IPv6 address. ]
  39874. ]
  39875. [
  39876. [[link boost_asio.reference.ip__address_v6.v4_mapped [*v4_mapped]]]
  39877. [(Deprecated: Use make_address_v6().) Create an IPv4-mapped IPv6 address. ]
  39878. ]
  39879. ]
  39880. [heading Friends]
  39881. [table
  39882. [[Name][Description]]
  39883. [
  39884. [[link boost_asio.reference.ip__address_v6.operator_not__eq_ [*operator!=]]]
  39885. [Compare two addresses for inequality. ]
  39886. ]
  39887. [
  39888. [[link boost_asio.reference.ip__address_v6.operator_lt_ [*operator<]]]
  39889. [Compare addresses for ordering. ]
  39890. ]
  39891. [
  39892. [[link boost_asio.reference.ip__address_v6.operator_lt__eq_ [*operator<=]]]
  39893. [Compare addresses for ordering. ]
  39894. ]
  39895. [
  39896. [[link boost_asio.reference.ip__address_v6.operator_eq__eq_ [*operator==]]]
  39897. [Compare two addresses for equality. ]
  39898. ]
  39899. [
  39900. [[link boost_asio.reference.ip__address_v6.operator_gt_ [*operator>]]]
  39901. [Compare addresses for ordering. ]
  39902. ]
  39903. [
  39904. [[link boost_asio.reference.ip__address_v6.operator_gt__eq_ [*operator>=]]]
  39905. [Compare addresses for ordering. ]
  39906. ]
  39907. ]
  39908. [heading Related Functions]
  39909. [table
  39910. [[Name][Description]]
  39911. [
  39912. [[link boost_asio.reference.ip__address_v6.make_address_v6 [*make_address_v6]]]
  39913. [Create an IPv6 address from raw bytes and scope ID.
  39914. Create an IPv6 address from an IP address string.
  39915. Createan IPv6 address from an IP address string.
  39916. Create an IPv4-mapped IPv6 address from an IPv4 address. ]
  39917. ]
  39918. [
  39919. [[link boost_asio.reference.ip__address_v6.make_network_v6 [*make_network_v6]]]
  39920. [Create an IPv6 network from an address and prefix length. ]
  39921. ]
  39922. [
  39923. [[link boost_asio.reference.ip__address_v6.operator_lt__lt_ [*operator<<]]]
  39924. [Output an address as a string.
  39925. Output a network as a string. ]
  39926. ]
  39927. ]
  39928. The [link boost_asio.reference.ip__address_v6 `ip::address_v6`] class provides the ability to use and manipulate IP version 6 addresses.
  39929. [heading Thread Safety]
  39930. ['Distinct] ['objects:] Safe.
  39931. ['Shared] ['objects:] Unsafe.
  39932. [heading Requirements]
  39933. ['Header: ][^boost/asio/ip/address_v6_iterator.hpp]
  39934. ['Convenience header: ][^boost/asio.hpp]
  39935. [endsect]
  39936. [endsect]
  39937. [section:ip__basic_address_range_lt__address_v4__gt_ ip::basic_address_range< address_v4 >]
  39938. Represents a range of IPv4 addresses.
  39939. template<>
  39940. class basic_address_range< address_v4 >
  39941. [heading Types]
  39942. [table
  39943. [[Name][Description]]
  39944. [
  39945. [[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.iterator [*iterator]]]
  39946. [The type of an iterator that points into the range. ]
  39947. ]
  39948. ]
  39949. [heading Member Functions]
  39950. [table
  39951. [[Name][Description]]
  39952. [
  39953. [[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.basic_address_range [*basic_address_range]]]
  39954. [Construct an empty range.
  39955. [hr]
  39956. Construct an range that represents the given range of addresses.
  39957. [hr]
  39958. Copy constructor. ]
  39959. ]
  39960. [
  39961. [[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.begin [*begin]]]
  39962. [Obtain an iterator that points to the start of the range. ]
  39963. ]
  39964. [
  39965. [[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.empty [*empty]]]
  39966. [Determine whether the range is empty. ]
  39967. ]
  39968. [
  39969. [[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.end [*end]]]
  39970. [Obtain an iterator that points to the end of the range. ]
  39971. ]
  39972. [
  39973. [[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.find [*find]]]
  39974. [Find an address in the range. ]
  39975. ]
  39976. [
  39977. [[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.operator_eq_ [*operator=]]]
  39978. [Assignment operator. ]
  39979. ]
  39980. [
  39981. [[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.size [*size]]]
  39982. [Return the size of the range. ]
  39983. ]
  39984. ]
  39985. [heading Thread Safety]
  39986. ['Distinct] ['objects:] Safe.
  39987. ['Shared] ['objects:] Unsafe.
  39988. [heading Requirements]
  39989. ['Header: ][^boost/asio/ip/address_v4_range.hpp]
  39990. ['Convenience header: ][^boost/asio.hpp]
  39991. [section:basic_address_range ip::basic_address_range< address_v4 >::basic_address_range]
  39992. [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v4__gt_.basic_address_range..basic_address_range..ip::basic_address_range< address_v4 >]
  39993. Construct an empty range.
  39994. ``[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.basic_address_range.overload1 basic_address_range]``();
  39995. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.basic_address_range.overload1 more...]]``
  39996. Construct an range that represents the given range of addresses.
  39997. explicit ``[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.basic_address_range.overload2 basic_address_range]``(
  39998. const iterator & first,
  39999. const iterator & last);
  40000. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.basic_address_range.overload2 more...]]``
  40001. Copy constructor.
  40002. ``[link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.basic_address_range.overload3 basic_address_range]``(
  40003. const basic_address_range & other);
  40004. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_.basic_address_range.overload3 more...]]``
  40005. [section:overload1 ip::basic_address_range< address_v4 >::basic_address_range (1 of 3 overloads)]
  40006. Construct an empty range.
  40007. basic_address_range();
  40008. [endsect]
  40009. [section:overload2 ip::basic_address_range< address_v4 >::basic_address_range (2 of 3 overloads)]
  40010. Construct an range that represents the given range of addresses.
  40011. basic_address_range(
  40012. const iterator & first,
  40013. const iterator & last);
  40014. [endsect]
  40015. [section:overload3 ip::basic_address_range< address_v4 >::basic_address_range (3 of 3 overloads)]
  40016. Copy constructor.
  40017. basic_address_range(
  40018. const basic_address_range & other);
  40019. [endsect]
  40020. [endsect]
  40021. [section:begin ip::basic_address_range< address_v4 >::begin]
  40022. [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v4__gt_.begin..begin..ip::basic_address_range< address_v4 >]
  40023. Obtain an iterator that points to the start of the range.
  40024. iterator begin() const;
  40025. [endsect]
  40026. [section:empty ip::basic_address_range< address_v4 >::empty]
  40027. [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v4__gt_.empty..empty..ip::basic_address_range< address_v4 >]
  40028. Determine whether the range is empty.
  40029. bool empty() const;
  40030. [endsect]
  40031. [section:end ip::basic_address_range< address_v4 >::end]
  40032. [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v4__gt_.end..end..ip::basic_address_range< address_v4 >]
  40033. Obtain an iterator that points to the end of the range.
  40034. iterator end() const;
  40035. [endsect]
  40036. [section:find ip::basic_address_range< address_v4 >::find]
  40037. [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v4__gt_.find..find..ip::basic_address_range< address_v4 >]
  40038. Find an address in the range.
  40039. iterator find(
  40040. const address_v4 & addr) const;
  40041. [endsect]
  40042. [section:iterator ip::basic_address_range< address_v4 >::iterator]
  40043. [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v4__gt_.iterator..iterator..ip::basic_address_range< address_v4 >]
  40044. The type of an iterator that points into the range.
  40045. typedef basic_address_iterator< address_v4 > iterator;
  40046. [heading Requirements]
  40047. ['Header: ][^boost/asio/ip/address_v4_range.hpp]
  40048. ['Convenience header: ][^boost/asio.hpp]
  40049. [endsect]
  40050. [section:operator_eq_ ip::basic_address_range< address_v4 >::operator=]
  40051. [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v4__gt_.operator_eq_..operator=..ip::basic_address_range< address_v4 >]
  40052. Assignment operator.
  40053. basic_address_range & operator=(
  40054. const basic_address_range & other);
  40055. [endsect]
  40056. [section:size ip::basic_address_range< address_v4 >::size]
  40057. [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v4__gt_.size..size..ip::basic_address_range< address_v4 >]
  40058. Return the size of the range.
  40059. std::size_t size() const;
  40060. [endsect]
  40061. [endsect]
  40062. [section:ip__basic_address_range_lt__address_v6__gt_ ip::basic_address_range< address_v6 >]
  40063. Represents a range of IPv6 addresses.
  40064. template<>
  40065. class basic_address_range< address_v6 >
  40066. [heading Types]
  40067. [table
  40068. [[Name][Description]]
  40069. [
  40070. [[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.iterator [*iterator]]]
  40071. [The type of an iterator that points into the range. ]
  40072. ]
  40073. ]
  40074. [heading Member Functions]
  40075. [table
  40076. [[Name][Description]]
  40077. [
  40078. [[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.basic_address_range [*basic_address_range]]]
  40079. [Construct an empty range.
  40080. [hr]
  40081. Construct an range that represents the given range of addresses.
  40082. [hr]
  40083. Copy constructor. ]
  40084. ]
  40085. [
  40086. [[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.begin [*begin]]]
  40087. [Obtain an iterator that points to the start of the range. ]
  40088. ]
  40089. [
  40090. [[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.empty [*empty]]]
  40091. [Determine whether the range is empty. ]
  40092. ]
  40093. [
  40094. [[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.end [*end]]]
  40095. [Obtain an iterator that points to the end of the range. ]
  40096. ]
  40097. [
  40098. [[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.find [*find]]]
  40099. [Find an address in the range. ]
  40100. ]
  40101. [
  40102. [[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.operator_eq_ [*operator=]]]
  40103. [Assignment operator. ]
  40104. ]
  40105. ]
  40106. [heading Thread Safety]
  40107. ['Distinct] ['objects:] Safe.
  40108. ['Shared] ['objects:] Unsafe.
  40109. [heading Requirements]
  40110. ['Header: ][^boost/asio/ip/address_v6_range.hpp]
  40111. ['Convenience header: ][^boost/asio.hpp]
  40112. [section:basic_address_range ip::basic_address_range< address_v6 >::basic_address_range]
  40113. [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v6__gt_.basic_address_range..basic_address_range..ip::basic_address_range< address_v6 >]
  40114. Construct an empty range.
  40115. ``[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.basic_address_range.overload1 basic_address_range]``();
  40116. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.basic_address_range.overload1 more...]]``
  40117. Construct an range that represents the given range of addresses.
  40118. explicit ``[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.basic_address_range.overload2 basic_address_range]``(
  40119. const iterator & first,
  40120. const iterator & last);
  40121. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.basic_address_range.overload2 more...]]``
  40122. Copy constructor.
  40123. ``[link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.basic_address_range.overload3 basic_address_range]``(
  40124. const basic_address_range & other);
  40125. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_.basic_address_range.overload3 more...]]``
  40126. [section:overload1 ip::basic_address_range< address_v6 >::basic_address_range (1 of 3 overloads)]
  40127. Construct an empty range.
  40128. basic_address_range();
  40129. [endsect]
  40130. [section:overload2 ip::basic_address_range< address_v6 >::basic_address_range (2 of 3 overloads)]
  40131. Construct an range that represents the given range of addresses.
  40132. basic_address_range(
  40133. const iterator & first,
  40134. const iterator & last);
  40135. [endsect]
  40136. [section:overload3 ip::basic_address_range< address_v6 >::basic_address_range (3 of 3 overloads)]
  40137. Copy constructor.
  40138. basic_address_range(
  40139. const basic_address_range & other);
  40140. [endsect]
  40141. [endsect]
  40142. [section:begin ip::basic_address_range< address_v6 >::begin]
  40143. [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v6__gt_.begin..begin..ip::basic_address_range< address_v6 >]
  40144. Obtain an iterator that points to the start of the range.
  40145. iterator begin() const;
  40146. [endsect]
  40147. [section:empty ip::basic_address_range< address_v6 >::empty]
  40148. [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v6__gt_.empty..empty..ip::basic_address_range< address_v6 >]
  40149. Determine whether the range is empty.
  40150. bool empty() const;
  40151. [endsect]
  40152. [section:end ip::basic_address_range< address_v6 >::end]
  40153. [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v6__gt_.end..end..ip::basic_address_range< address_v6 >]
  40154. Obtain an iterator that points to the end of the range.
  40155. iterator end() const;
  40156. [endsect]
  40157. [section:find ip::basic_address_range< address_v6 >::find]
  40158. [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v6__gt_.find..find..ip::basic_address_range< address_v6 >]
  40159. Find an address in the range.
  40160. iterator find(
  40161. const address_v6 & addr) const;
  40162. [endsect]
  40163. [section:iterator ip::basic_address_range< address_v6 >::iterator]
  40164. [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v6__gt_.iterator..iterator..ip::basic_address_range< address_v6 >]
  40165. The type of an iterator that points into the range.
  40166. typedef basic_address_iterator< address_v6 > iterator;
  40167. [heading Requirements]
  40168. ['Header: ][^boost/asio/ip/address_v6_range.hpp]
  40169. ['Convenience header: ][^boost/asio.hpp]
  40170. [endsect]
  40171. [section:operator_eq_ ip::basic_address_range< address_v6 >::operator=]
  40172. [indexterm2 boost_asio.indexterm.ip__basic_address_range_lt__address_v6__gt_.operator_eq_..operator=..ip::basic_address_range< address_v6 >]
  40173. Assignment operator.
  40174. basic_address_range & operator=(
  40175. const basic_address_range & other);
  40176. [endsect]
  40177. [endsect]
  40178. [section:ip__basic_endpoint ip::basic_endpoint]
  40179. Describes an endpoint for a version-independent IP socket.
  40180. template<
  40181. typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``>
  40182. class basic_endpoint
  40183. [heading Types]
  40184. [table
  40185. [[Name][Description]]
  40186. [
  40187. [[link boost_asio.reference.ip__basic_endpoint.data_type [*data_type]]]
  40188. [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
  40189. ]
  40190. [
  40191. [[link boost_asio.reference.ip__basic_endpoint.protocol_type [*protocol_type]]]
  40192. [The protocol type associated with the endpoint. ]
  40193. ]
  40194. ]
  40195. [heading Member Functions]
  40196. [table
  40197. [[Name][Description]]
  40198. [
  40199. [[link boost_asio.reference.ip__basic_endpoint.address [*address]]]
  40200. [Get the IP address associated with the endpoint.
  40201. [hr]
  40202. Set the IP address associated with the endpoint. ]
  40203. ]
  40204. [
  40205. [[link boost_asio.reference.ip__basic_endpoint.basic_endpoint [*basic_endpoint]]]
  40206. [Default constructor.
  40207. [hr]
  40208. 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.
  40209. [hr]
  40210. 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.
  40211. [hr]
  40212. Copy constructor.
  40213. [hr]
  40214. Move constructor. ]
  40215. ]
  40216. [
  40217. [[link boost_asio.reference.ip__basic_endpoint.capacity [*capacity]]]
  40218. [Get the capacity of the endpoint in the native type. ]
  40219. ]
  40220. [
  40221. [[link boost_asio.reference.ip__basic_endpoint.data [*data]]]
  40222. [Get the underlying endpoint in the native type. ]
  40223. ]
  40224. [
  40225. [[link boost_asio.reference.ip__basic_endpoint.operator_eq_ [*operator=]]]
  40226. [Assign from another endpoint.
  40227. [hr]
  40228. Move-assign from another endpoint. ]
  40229. ]
  40230. [
  40231. [[link boost_asio.reference.ip__basic_endpoint.port [*port]]]
  40232. [Get the port associated with the endpoint. The port number is always in the host's byte order.
  40233. [hr]
  40234. Set the port associated with the endpoint. The port number is always in the host's byte order. ]
  40235. ]
  40236. [
  40237. [[link boost_asio.reference.ip__basic_endpoint.protocol [*protocol]]]
  40238. [The protocol associated with the endpoint. ]
  40239. ]
  40240. [
  40241. [[link boost_asio.reference.ip__basic_endpoint.resize [*resize]]]
  40242. [Set the underlying size of the endpoint in the native type. ]
  40243. ]
  40244. [
  40245. [[link boost_asio.reference.ip__basic_endpoint.size [*size]]]
  40246. [Get the underlying size of the endpoint in the native type. ]
  40247. ]
  40248. ]
  40249. [heading Friends]
  40250. [table
  40251. [[Name][Description]]
  40252. [
  40253. [[link boost_asio.reference.ip__basic_endpoint.operator_not__eq_ [*operator!=]]]
  40254. [Compare two endpoints for inequality. ]
  40255. ]
  40256. [
  40257. [[link boost_asio.reference.ip__basic_endpoint.operator_lt_ [*operator<]]]
  40258. [Compare endpoints for ordering. ]
  40259. ]
  40260. [
  40261. [[link boost_asio.reference.ip__basic_endpoint.operator_lt__eq_ [*operator<=]]]
  40262. [Compare endpoints for ordering. ]
  40263. ]
  40264. [
  40265. [[link boost_asio.reference.ip__basic_endpoint.operator_eq__eq_ [*operator==]]]
  40266. [Compare two endpoints for equality. ]
  40267. ]
  40268. [
  40269. [[link boost_asio.reference.ip__basic_endpoint.operator_gt_ [*operator>]]]
  40270. [Compare endpoints for ordering. ]
  40271. ]
  40272. [
  40273. [[link boost_asio.reference.ip__basic_endpoint.operator_gt__eq_ [*operator>=]]]
  40274. [Compare endpoints for ordering. ]
  40275. ]
  40276. ]
  40277. [heading Related Functions]
  40278. [table
  40279. [[Name][Description]]
  40280. [
  40281. [[link boost_asio.reference.ip__basic_endpoint.operator_lt__lt_ [*operator<<]]]
  40282. [Output an endpoint as a string. ]
  40283. ]
  40284. ]
  40285. The [link boost_asio.reference.ip__basic_endpoint `ip::basic_endpoint`] class template describes an endpoint that may be associated with a particular socket.
  40286. [heading Thread Safety]
  40287. ['Distinct] ['objects:] Safe.
  40288. ['Shared] ['objects:] Unsafe.
  40289. [heading Requirements]
  40290. ['Header: ][^boost/asio/ip/basic_endpoint.hpp]
  40291. ['Convenience header: ][^boost/asio.hpp]
  40292. [section:address ip::basic_endpoint::address]
  40293. [indexterm2 boost_asio.indexterm.ip__basic_endpoint.address..address..ip::basic_endpoint]
  40294. Get the IP address associated with the endpoint.
  40295. boost::asio::ip::address ``[link boost_asio.reference.ip__basic_endpoint.address.overload1 address]``() const;
  40296. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.address.overload1 more...]]``
  40297. Set the IP address associated with the endpoint.
  40298. void ``[link boost_asio.reference.ip__basic_endpoint.address.overload2 address]``(
  40299. const boost::asio::ip::address & addr);
  40300. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.address.overload2 more...]]``
  40301. [section:overload1 ip::basic_endpoint::address (1 of 2 overloads)]
  40302. Get the IP address associated with the endpoint.
  40303. boost::asio::ip::address address() const;
  40304. [endsect]
  40305. [section:overload2 ip::basic_endpoint::address (2 of 2 overloads)]
  40306. Set the IP address associated with the endpoint.
  40307. void address(
  40308. const boost::asio::ip::address & addr);
  40309. [endsect]
  40310. [endsect]
  40311. [section:basic_endpoint ip::basic_endpoint::basic_endpoint]
  40312. [indexterm2 boost_asio.indexterm.ip__basic_endpoint.basic_endpoint..basic_endpoint..ip::basic_endpoint]
  40313. Default constructor.
  40314. ``[link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload1 basic_endpoint]``();
  40315. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload1 more...]]``
  40316. 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.
  40317. ``[link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload2 basic_endpoint]``(
  40318. const InternetProtocol & internet_protocol,
  40319. unsigned short port_num);
  40320. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload2 more...]]``
  40321. 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.
  40322. ``[link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload3 basic_endpoint]``(
  40323. const boost::asio::ip::address & addr,
  40324. unsigned short port_num);
  40325. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload3 more...]]``
  40326. Copy constructor.
  40327. ``[link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload4 basic_endpoint]``(
  40328. const basic_endpoint & other);
  40329. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload4 more...]]``
  40330. Move constructor.
  40331. ``[link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload5 basic_endpoint]``(
  40332. basic_endpoint && other);
  40333. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload5 more...]]``
  40334. [section:overload1 ip::basic_endpoint::basic_endpoint (1 of 5 overloads)]
  40335. Default constructor.
  40336. basic_endpoint();
  40337. [endsect]
  40338. [section:overload2 ip::basic_endpoint::basic_endpoint (2 of 5 overloads)]
  40339. 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.
  40340. basic_endpoint(
  40341. const InternetProtocol & internet_protocol,
  40342. unsigned short port_num);
  40343. [heading Examples]
  40344. To initialise an IPv4 TCP endpoint for port 1234, use:
  40345. boost::asio::ip::tcp::endpoint ep(boost::asio::ip::tcp::v4(), 1234);
  40346. To specify an IPv6 UDP endpoint for port 9876, use:
  40347. boost::asio::ip::udp::endpoint ep(boost::asio::ip::udp::v6(), 9876);
  40348. [endsect]
  40349. [section:overload3 ip::basic_endpoint::basic_endpoint (3 of 5 overloads)]
  40350. 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.
  40351. basic_endpoint(
  40352. const boost::asio::ip::address & addr,
  40353. unsigned short port_num);
  40354. [endsect]
  40355. [section:overload4 ip::basic_endpoint::basic_endpoint (4 of 5 overloads)]
  40356. Copy constructor.
  40357. basic_endpoint(
  40358. const basic_endpoint & other);
  40359. [endsect]
  40360. [section:overload5 ip::basic_endpoint::basic_endpoint (5 of 5 overloads)]
  40361. Move constructor.
  40362. basic_endpoint(
  40363. basic_endpoint && other);
  40364. [endsect]
  40365. [endsect]
  40366. [section:capacity ip::basic_endpoint::capacity]
  40367. [indexterm2 boost_asio.indexterm.ip__basic_endpoint.capacity..capacity..ip::basic_endpoint]
  40368. Get the capacity of the endpoint in the native type.
  40369. std::size_t capacity() const;
  40370. [endsect]
  40371. [section:data ip::basic_endpoint::data]
  40372. [indexterm2 boost_asio.indexterm.ip__basic_endpoint.data..data..ip::basic_endpoint]
  40373. Get the underlying endpoint in the native type.
  40374. data_type * ``[link boost_asio.reference.ip__basic_endpoint.data.overload1 data]``();
  40375. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.data.overload1 more...]]``
  40376. const data_type * ``[link boost_asio.reference.ip__basic_endpoint.data.overload2 data]``() const;
  40377. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.data.overload2 more...]]``
  40378. [section:overload1 ip::basic_endpoint::data (1 of 2 overloads)]
  40379. Get the underlying endpoint in the native type.
  40380. data_type * data();
  40381. [endsect]
  40382. [section:overload2 ip::basic_endpoint::data (2 of 2 overloads)]
  40383. Get the underlying endpoint in the native type.
  40384. const data_type * data() const;
  40385. [endsect]
  40386. [endsect]
  40387. [section:data_type ip::basic_endpoint::data_type]
  40388. [indexterm2 boost_asio.indexterm.ip__basic_endpoint.data_type..data_type..ip::basic_endpoint]
  40389. The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer.
  40390. typedef implementation_defined data_type;
  40391. [heading Requirements]
  40392. ['Header: ][^boost/asio/ip/basic_endpoint.hpp]
  40393. ['Convenience header: ][^boost/asio.hpp]
  40394. [endsect]
  40395. [section:operator_not__eq_ ip::basic_endpoint::operator!=]
  40396. [indexterm2 boost_asio.indexterm.ip__basic_endpoint.operator_not__eq_..operator!=..ip::basic_endpoint]
  40397. Compare two endpoints for inequality.
  40398. friend bool operator!=(
  40399. const basic_endpoint< InternetProtocol > & e1,
  40400. const basic_endpoint< InternetProtocol > & e2);
  40401. [heading Requirements]
  40402. ['Header: ][^boost/asio/ip/basic_endpoint.hpp]
  40403. ['Convenience header: ][^boost/asio.hpp]
  40404. [endsect]
  40405. [section:operator_lt_ ip::basic_endpoint::operator<]
  40406. [indexterm2 boost_asio.indexterm.ip__basic_endpoint.operator_lt_..operator<..ip::basic_endpoint]
  40407. Compare endpoints for ordering.
  40408. friend bool operator<(
  40409. const basic_endpoint< InternetProtocol > & e1,
  40410. const basic_endpoint< InternetProtocol > & e2);
  40411. [heading Requirements]
  40412. ['Header: ][^boost/asio/ip/basic_endpoint.hpp]
  40413. ['Convenience header: ][^boost/asio.hpp]
  40414. [endsect]
  40415. [section:operator_lt__lt_ ip::basic_endpoint::operator<<]
  40416. [indexterm2 boost_asio.indexterm.ip__basic_endpoint.operator_lt__lt_..operator<<..ip::basic_endpoint]
  40417. Output an endpoint as a string.
  40418. std::basic_ostream< Elem, Traits > & operator<<(
  40419. std::basic_ostream< Elem, Traits > & os,
  40420. const basic_endpoint< InternetProtocol > & endpoint);
  40421. Used to output a human-readable string for a specified endpoint.
  40422. [heading Parameters]
  40423. [variablelist
  40424. [[os][The output stream to which the string will be written.]]
  40425. [[endpoint][The endpoint to be written.]]
  40426. ]
  40427. [heading Return Value]
  40428. The output stream.
  40429. [endsect]
  40430. [section:operator_lt__eq_ ip::basic_endpoint::operator<=]
  40431. [indexterm2 boost_asio.indexterm.ip__basic_endpoint.operator_lt__eq_..operator<=..ip::basic_endpoint]
  40432. Compare endpoints for ordering.
  40433. friend bool operator<=(
  40434. const basic_endpoint< InternetProtocol > & e1,
  40435. const basic_endpoint< InternetProtocol > & e2);
  40436. [heading Requirements]
  40437. ['Header: ][^boost/asio/ip/basic_endpoint.hpp]
  40438. ['Convenience header: ][^boost/asio.hpp]
  40439. [endsect]
  40440. [section:operator_eq_ ip::basic_endpoint::operator=]
  40441. [indexterm2 boost_asio.indexterm.ip__basic_endpoint.operator_eq_..operator=..ip::basic_endpoint]
  40442. Assign from another endpoint.
  40443. basic_endpoint & ``[link boost_asio.reference.ip__basic_endpoint.operator_eq_.overload1 operator=]``(
  40444. const basic_endpoint & other);
  40445. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.operator_eq_.overload1 more...]]``
  40446. Move-assign from another endpoint.
  40447. basic_endpoint & ``[link boost_asio.reference.ip__basic_endpoint.operator_eq_.overload2 operator=]``(
  40448. basic_endpoint && other);
  40449. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.operator_eq_.overload2 more...]]``
  40450. [section:overload1 ip::basic_endpoint::operator= (1 of 2 overloads)]
  40451. Assign from another endpoint.
  40452. basic_endpoint & operator=(
  40453. const basic_endpoint & other);
  40454. [endsect]
  40455. [section:overload2 ip::basic_endpoint::operator= (2 of 2 overloads)]
  40456. Move-assign from another endpoint.
  40457. basic_endpoint & operator=(
  40458. basic_endpoint && other);
  40459. [endsect]
  40460. [endsect]
  40461. [section:operator_eq__eq_ ip::basic_endpoint::operator==]
  40462. [indexterm2 boost_asio.indexterm.ip__basic_endpoint.operator_eq__eq_..operator==..ip::basic_endpoint]
  40463. Compare two endpoints for equality.
  40464. friend bool operator==(
  40465. const basic_endpoint< InternetProtocol > & e1,
  40466. const basic_endpoint< InternetProtocol > & e2);
  40467. [heading Requirements]
  40468. ['Header: ][^boost/asio/ip/basic_endpoint.hpp]
  40469. ['Convenience header: ][^boost/asio.hpp]
  40470. [endsect]
  40471. [section:operator_gt_ ip::basic_endpoint::operator>]
  40472. [indexterm2 boost_asio.indexterm.ip__basic_endpoint.operator_gt_..operator>..ip::basic_endpoint]
  40473. Compare endpoints for ordering.
  40474. friend bool operator>(
  40475. const basic_endpoint< InternetProtocol > & e1,
  40476. const basic_endpoint< InternetProtocol > & e2);
  40477. [heading Requirements]
  40478. ['Header: ][^boost/asio/ip/basic_endpoint.hpp]
  40479. ['Convenience header: ][^boost/asio.hpp]
  40480. [endsect]
  40481. [section:operator_gt__eq_ ip::basic_endpoint::operator>=]
  40482. [indexterm2 boost_asio.indexterm.ip__basic_endpoint.operator_gt__eq_..operator>=..ip::basic_endpoint]
  40483. Compare endpoints for ordering.
  40484. friend bool operator>=(
  40485. const basic_endpoint< InternetProtocol > & e1,
  40486. const basic_endpoint< InternetProtocol > & e2);
  40487. [heading Requirements]
  40488. ['Header: ][^boost/asio/ip/basic_endpoint.hpp]
  40489. ['Convenience header: ][^boost/asio.hpp]
  40490. [endsect]
  40491. [section:port ip::basic_endpoint::port]
  40492. [indexterm2 boost_asio.indexterm.ip__basic_endpoint.port..port..ip::basic_endpoint]
  40493. Get the port associated with the endpoint. The port number is always in the host's byte order.
  40494. unsigned short ``[link boost_asio.reference.ip__basic_endpoint.port.overload1 port]``() const;
  40495. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.port.overload1 more...]]``
  40496. Set the port associated with the endpoint. The port number is always in the host's byte order.
  40497. void ``[link boost_asio.reference.ip__basic_endpoint.port.overload2 port]``(
  40498. unsigned short port_num);
  40499. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.port.overload2 more...]]``
  40500. [section:overload1 ip::basic_endpoint::port (1 of 2 overloads)]
  40501. Get the port associated with the endpoint. The port number is always in the host's byte order.
  40502. unsigned short port() const;
  40503. [endsect]
  40504. [section:overload2 ip::basic_endpoint::port (2 of 2 overloads)]
  40505. Set the port associated with the endpoint. The port number is always in the host's byte order.
  40506. void port(
  40507. unsigned short port_num);
  40508. [endsect]
  40509. [endsect]
  40510. [section:protocol ip::basic_endpoint::protocol]
  40511. [indexterm2 boost_asio.indexterm.ip__basic_endpoint.protocol..protocol..ip::basic_endpoint]
  40512. The protocol associated with the endpoint.
  40513. protocol_type protocol() const;
  40514. [endsect]
  40515. [section:protocol_type ip::basic_endpoint::protocol_type]
  40516. [indexterm2 boost_asio.indexterm.ip__basic_endpoint.protocol_type..protocol_type..ip::basic_endpoint]
  40517. The protocol type associated with the endpoint.
  40518. typedef InternetProtocol protocol_type;
  40519. [heading Requirements]
  40520. ['Header: ][^boost/asio/ip/basic_endpoint.hpp]
  40521. ['Convenience header: ][^boost/asio.hpp]
  40522. [endsect]
  40523. [section:resize ip::basic_endpoint::resize]
  40524. [indexterm2 boost_asio.indexterm.ip__basic_endpoint.resize..resize..ip::basic_endpoint]
  40525. Set the underlying size of the endpoint in the native type.
  40526. void resize(
  40527. std::size_t new_size);
  40528. [endsect]
  40529. [section:size ip::basic_endpoint::size]
  40530. [indexterm2 boost_asio.indexterm.ip__basic_endpoint.size..size..ip::basic_endpoint]
  40531. Get the underlying size of the endpoint in the native type.
  40532. std::size_t size() const;
  40533. [endsect]
  40534. [endsect]
  40535. [section:ip__basic_resolver ip::basic_resolver]
  40536. Provides endpoint resolution functionality.
  40537. template<
  40538. typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``,
  40539. typename ``[link boost_asio.reference.Executor1 Executor]``>
  40540. class basic_resolver :
  40541. public ip::resolver_base
  40542. [heading Types]
  40543. [table
  40544. [[Name][Description]]
  40545. [
  40546. [[link boost_asio.reference.ip__basic_resolver__rebind_executor [*rebind_executor]]]
  40547. [Rebinds the resolver type to another executor. ]
  40548. ]
  40549. [
  40550. [[link boost_asio.reference.ip__basic_resolver.endpoint_type [*endpoint_type]]]
  40551. [The endpoint type. ]
  40552. ]
  40553. [
  40554. [[link boost_asio.reference.ip__basic_resolver.executor_type [*executor_type]]]
  40555. [The type of the executor associated with the object. ]
  40556. ]
  40557. [
  40558. [[link boost_asio.reference.ip__basic_resolver.flags [*flags]]]
  40559. [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
  40560. ]
  40561. [
  40562. [[link boost_asio.reference.ip__basic_resolver.iterator [*iterator]]]
  40563. [(Deprecated.) The iterator type. ]
  40564. ]
  40565. [
  40566. [[link boost_asio.reference.ip__basic_resolver.protocol_type [*protocol_type]]]
  40567. [The protocol type. ]
  40568. ]
  40569. [
  40570. [[link boost_asio.reference.ip__basic_resolver.query [*query]]]
  40571. [(Deprecated.) The query type. ]
  40572. ]
  40573. [
  40574. [[link boost_asio.reference.ip__basic_resolver.results_type [*results_type]]]
  40575. [The results type. ]
  40576. ]
  40577. ]
  40578. [heading Member Functions]
  40579. [table
  40580. [[Name][Description]]
  40581. [
  40582. [[link boost_asio.reference.ip__basic_resolver.async_resolve [*async_resolve]]]
  40583. [(Deprecated: Use overload with separate host and service parameters.) Asynchronously perform forward resolution of a query to a list of entries.
  40584. [hr]
  40585. Asynchronously perform forward resolution of a query to a list of entries.
  40586. [hr]
  40587. Asynchronously perform reverse resolution of an endpoint to a list of entries. ]
  40588. ]
  40589. [
  40590. [[link boost_asio.reference.ip__basic_resolver.basic_resolver [*basic_resolver]]]
  40591. [Construct with executor.
  40592. [hr]
  40593. Construct with execution context.
  40594. [hr]
  40595. Move-construct a basic_resolver from another. ]
  40596. ]
  40597. [
  40598. [[link boost_asio.reference.ip__basic_resolver.cancel [*cancel]]]
  40599. [Cancel any asynchronous operations that are waiting on the resolver. ]
  40600. ]
  40601. [
  40602. [[link boost_asio.reference.ip__basic_resolver.get_executor [*get_executor]]]
  40603. [Get the executor associated with the object. ]
  40604. ]
  40605. [
  40606. [[link boost_asio.reference.ip__basic_resolver.operator_eq_ [*operator=]]]
  40607. [Move-assign a basic_resolver from another. ]
  40608. ]
  40609. [
  40610. [[link boost_asio.reference.ip__basic_resolver.resolve [*resolve]]]
  40611. [(Deprecated: Use overload with separate host and service parameters.) Perform forward resolution of a query to a list of entries.
  40612. [hr]
  40613. Perform forward resolution of a query to a list of entries.
  40614. [hr]
  40615. Perform reverse resolution of an endpoint to a list of entries. ]
  40616. ]
  40617. [
  40618. [[link boost_asio.reference.ip__basic_resolver._basic_resolver [*~basic_resolver]]]
  40619. [Destroys the resolver. ]
  40620. ]
  40621. ]
  40622. [heading Data Members]
  40623. [table
  40624. [[Name][Description]]
  40625. [
  40626. [[link boost_asio.reference.ip__basic_resolver.address_configured [*address_configured]]]
  40627. [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. ]
  40628. ]
  40629. [
  40630. [[link boost_asio.reference.ip__basic_resolver.all_matching [*all_matching]]]
  40631. [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
  40632. ]
  40633. [
  40634. [[link boost_asio.reference.ip__basic_resolver.canonical_name [*canonical_name]]]
  40635. [Determine the canonical name of the host specified in the query. ]
  40636. ]
  40637. [
  40638. [[link boost_asio.reference.ip__basic_resolver.numeric_host [*numeric_host]]]
  40639. [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
  40640. ]
  40641. [
  40642. [[link boost_asio.reference.ip__basic_resolver.numeric_service [*numeric_service]]]
  40643. [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
  40644. ]
  40645. [
  40646. [[link boost_asio.reference.ip__basic_resolver.passive [*passive]]]
  40647. [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
  40648. ]
  40649. [
  40650. [[link boost_asio.reference.ip__basic_resolver.v4_mapped [*v4_mapped]]]
  40651. [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
  40652. ]
  40653. ]
  40654. The [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] class template provides the ability to resolve a query to a list of endpoints.
  40655. [heading Thread Safety]
  40656. ['Distinct] ['objects:] Safe.
  40657. ['Shared] ['objects:] Unsafe.
  40658. [heading Requirements]
  40659. ['Header: ][^boost/asio/ip/basic_resolver.hpp]
  40660. ['Convenience header: ][^boost/asio.hpp]
  40661. [section:address_configured ip::basic_resolver::address_configured]
  40662. ['Inherited from ip::resolver_base.]
  40663. [indexterm2 boost_asio.indexterm.ip__basic_resolver.address_configured..address_configured..ip::basic_resolver]
  40664. 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.
  40665. static const flags address_configured = implementation_defined;
  40666. [endsect]
  40667. [section:all_matching ip::basic_resolver::all_matching]
  40668. ['Inherited from ip::resolver_base.]
  40669. [indexterm2 boost_asio.indexterm.ip__basic_resolver.all_matching..all_matching..ip::basic_resolver]
  40670. If used with v4\_mapped, return all matching IPv6 and IPv4 addresses.
  40671. static const flags all_matching = implementation_defined;
  40672. [endsect]
  40673. [section:async_resolve ip::basic_resolver::async_resolve]
  40674. [indexterm2 boost_asio.indexterm.ip__basic_resolver.async_resolve..async_resolve..ip::basic_resolver]
  40675. (Deprecated: Use overload with separate host and service parameters.) Asynchronously perform forward resolution of a query to a list of entries.
  40676. template<
  40677. typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  40678. ``[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]``(
  40679. const query & q,
  40680. ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  40681. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.async_resolve.overload1 more...]]``
  40682. Asynchronously perform forward resolution of a query to a list of entries.
  40683. template<
  40684. typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  40685. ``[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]``(
  40686. string_view host,
  40687. string_view service,
  40688. ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  40689. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.async_resolve.overload2 more...]]``
  40690. template<
  40691. typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  40692. ``[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]``(
  40693. string_view host,
  40694. string_view service,
  40695. resolver_base::flags resolve_flags,
  40696. ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  40697. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.async_resolve.overload3 more...]]``
  40698. template<
  40699. typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  40700. ``[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]``(
  40701. const protocol_type & protocol,
  40702. string_view host,
  40703. string_view service,
  40704. ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  40705. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.async_resolve.overload4 more...]]``
  40706. template<
  40707. typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  40708. ``[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]``(
  40709. const protocol_type & protocol,
  40710. string_view host,
  40711. string_view service,
  40712. resolver_base::flags resolve_flags,
  40713. ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  40714. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.async_resolve.overload5 more...]]``
  40715. Asynchronously perform reverse resolution of an endpoint to a list of entries.
  40716. template<
  40717. typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  40718. ``[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]``(
  40719. const endpoint_type & e,
  40720. ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  40721. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.async_resolve.overload6 more...]]``
  40722. [section:overload1 ip::basic_resolver::async_resolve (1 of 6 overloads)]
  40723. (Deprecated: Use overload with separate host and service parameters.) Asynchronously perform forward resolution of a query to a list of entries.
  40724. template<
  40725. typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  40726. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_resolve(
  40727. const query & q,
  40728. ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  40729. This function is used to asynchronously resolve a query into a list of endpoint entries.
  40730. [heading Parameters]
  40731. [variablelist
  40732. [[q][A query object that determines what endpoints will be returned.]]
  40733. [[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:
  40734. ``
  40735. void handler(
  40736. const boost::system::error_code& error, // Result of operation.
  40737. resolver::results_type results // Resolved endpoints as a range.
  40738. );
  40739. ``
  40740. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  40741. ]
  40742. A successful resolve operation is guaranteed to pass a non-empty range to the handler.
  40743. [endsect]
  40744. [section:overload2 ip::basic_resolver::async_resolve (2 of 6 overloads)]
  40745. Asynchronously perform forward resolution of a query to a list of entries.
  40746. template<
  40747. typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  40748. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_resolve(
  40749. string_view host,
  40750. string_view service,
  40751. ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  40752. This function is used to resolve host and service names into a list of endpoint entries.
  40753. [heading Parameters]
  40754. [variablelist
  40755. [[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.]]
  40756. [[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.]]
  40757. [[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:
  40758. ``
  40759. void handler(
  40760. const boost::system::error_code& error, // Result of operation.
  40761. resolver::results_type results // Resolved endpoints as a range.
  40762. );
  40763. ``
  40764. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  40765. ]
  40766. A successful resolve operation is guaranteed to pass a non-empty range to the handler.
  40767. [heading Remarks]
  40768. On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
  40769. On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names.
  40770. [endsect]
  40771. [section:overload3 ip::basic_resolver::async_resolve (3 of 6 overloads)]
  40772. Asynchronously perform forward resolution of a query to a list of entries.
  40773. template<
  40774. typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  40775. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_resolve(
  40776. string_view host,
  40777. string_view service,
  40778. resolver_base::flags resolve_flags,
  40779. ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  40780. This function is used to resolve host and service names into a list of endpoint entries.
  40781. [heading Parameters]
  40782. [variablelist
  40783. [[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.]]
  40784. [[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.]]
  40785. [[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.]]
  40786. [[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:
  40787. ``
  40788. void handler(
  40789. const boost::system::error_code& error, // Result of operation.
  40790. resolver::results_type results // Resolved endpoints as a range.
  40791. );
  40792. ``
  40793. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  40794. ]
  40795. A successful resolve operation is guaranteed to pass a non-empty range to the handler.
  40796. [heading Remarks]
  40797. On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
  40798. On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names.
  40799. [endsect]
  40800. [section:overload4 ip::basic_resolver::async_resolve (4 of 6 overloads)]
  40801. Asynchronously perform forward resolution of a query to a list of entries.
  40802. template<
  40803. typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  40804. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_resolve(
  40805. const protocol_type & protocol,
  40806. string_view host,
  40807. string_view service,
  40808. ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  40809. This function is used to resolve host and service names into a list of endpoint entries.
  40810. [heading Parameters]
  40811. [variablelist
  40812. [[protocol][A protocol object, normally representing either the IPv4 or IPv6 version of an internet protocol.]]
  40813. [[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.]]
  40814. [[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.]]
  40815. [[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:
  40816. ``
  40817. void handler(
  40818. const boost::system::error_code& error, // Result of operation.
  40819. resolver::results_type results // Resolved endpoints as a range.
  40820. );
  40821. ``
  40822. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  40823. ]
  40824. A successful resolve operation is guaranteed to pass a non-empty range to the handler.
  40825. [heading Remarks]
  40826. On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
  40827. On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names.
  40828. [endsect]
  40829. [section:overload5 ip::basic_resolver::async_resolve (5 of 6 overloads)]
  40830. Asynchronously perform forward resolution of a query to a list of entries.
  40831. template<
  40832. typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  40833. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_resolve(
  40834. const protocol_type & protocol,
  40835. string_view host,
  40836. string_view service,
  40837. resolver_base::flags resolve_flags,
  40838. ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  40839. This function is used to resolve host and service names into a list of endpoint entries.
  40840. [heading Parameters]
  40841. [variablelist
  40842. [[protocol][A protocol object, normally representing either the IPv4 or IPv6 version of an internet protocol.]]
  40843. [[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.]]
  40844. [[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.]]
  40845. [[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.]]
  40846. [[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:
  40847. ``
  40848. void handler(
  40849. const boost::system::error_code& error, // Result of operation.
  40850. resolver::results_type results // Resolved endpoints as a range.
  40851. );
  40852. ``
  40853. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  40854. ]
  40855. A successful resolve operation is guaranteed to pass a non-empty range to the handler.
  40856. [heading Remarks]
  40857. On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
  40858. On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names.
  40859. [endsect]
  40860. [section:overload6 ip::basic_resolver::async_resolve (6 of 6 overloads)]
  40861. Asynchronously perform reverse resolution of an endpoint to a list of entries.
  40862. template<
  40863. typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  40864. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_resolve(
  40865. const endpoint_type & e,
  40866. ResolveHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  40867. This function is used to asynchronously resolve an endpoint into a list of endpoint entries.
  40868. [heading Parameters]
  40869. [variablelist
  40870. [[e][An endpoint object that determines what endpoints will be returned.]]
  40871. [[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:
  40872. ``
  40873. void handler(
  40874. const boost::system::error_code& error, // Result of operation.
  40875. resolver::results_type results // Resolved endpoints as a range.
  40876. );
  40877. ``
  40878. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  40879. ]
  40880. A successful resolve operation is guaranteed to pass a non-empty range to the handler.
  40881. [endsect]
  40882. [endsect]
  40883. [section:basic_resolver ip::basic_resolver::basic_resolver]
  40884. [indexterm2 boost_asio.indexterm.ip__basic_resolver.basic_resolver..basic_resolver..ip::basic_resolver]
  40885. Construct with executor.
  40886. explicit ``[link boost_asio.reference.ip__basic_resolver.basic_resolver.overload1 basic_resolver]``(
  40887. const executor_type & ex);
  40888. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.basic_resolver.overload1 more...]]``
  40889. Construct with execution context.
  40890. template<
  40891. typename ExecutionContext>
  40892. explicit ``[link boost_asio.reference.ip__basic_resolver.basic_resolver.overload2 basic_resolver]``(
  40893. ExecutionContext & context,
  40894. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  40895. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.basic_resolver.overload2 more...]]``
  40896. Move-construct a [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] from another.
  40897. ``[link boost_asio.reference.ip__basic_resolver.basic_resolver.overload3 basic_resolver]``(
  40898. basic_resolver && other);
  40899. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.basic_resolver.overload3 more...]]``
  40900. [section:overload1 ip::basic_resolver::basic_resolver (1 of 3 overloads)]
  40901. Construct with executor.
  40902. basic_resolver(
  40903. const executor_type & ex);
  40904. This constructor creates a [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`].
  40905. [heading Parameters]
  40906. [variablelist
  40907. [[ex][The I/O executor that the resolver will use, by default, to dispatch handlers for any asynchronous operations performed on the resolver. ]]
  40908. ]
  40909. [endsect]
  40910. [section:overload2 ip::basic_resolver::basic_resolver (2 of 3 overloads)]
  40911. Construct with execution context.
  40912. template<
  40913. typename ExecutionContext>
  40914. basic_resolver(
  40915. ExecutionContext & context,
  40916. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  40917. This constructor creates a [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`].
  40918. [heading Parameters]
  40919. [variablelist
  40920. [[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. ]]
  40921. ]
  40922. [endsect]
  40923. [section:overload3 ip::basic_resolver::basic_resolver (3 of 3 overloads)]
  40924. Move-construct a [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] from another.
  40925. basic_resolver(
  40926. basic_resolver && other);
  40927. This constructor moves a resolver from one object to another.
  40928. [heading Parameters]
  40929. [variablelist
  40930. [[other][The other [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] object from which the move will occur.]]
  40931. ]
  40932. [heading Remarks]
  40933. Following the move, the moved-from object is in the same state as if constructed using the `basic_resolver(const executor_type&) constructor`.
  40934. [endsect]
  40935. [endsect]
  40936. [section:cancel ip::basic_resolver::cancel]
  40937. [indexterm2 boost_asio.indexterm.ip__basic_resolver.cancel..cancel..ip::basic_resolver]
  40938. Cancel any asynchronous operations that are waiting on the resolver.
  40939. void cancel();
  40940. This function forces the completion of any pending asynchronous operations on the host resolver. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
  40941. [endsect]
  40942. [section:canonical_name ip::basic_resolver::canonical_name]
  40943. ['Inherited from ip::resolver_base.]
  40944. [indexterm2 boost_asio.indexterm.ip__basic_resolver.canonical_name..canonical_name..ip::basic_resolver]
  40945. Determine the canonical name of the host specified in the query.
  40946. static const flags canonical_name = implementation_defined;
  40947. [endsect]
  40948. [section:endpoint_type ip::basic_resolver::endpoint_type]
  40949. [indexterm2 boost_asio.indexterm.ip__basic_resolver.endpoint_type..endpoint_type..ip::basic_resolver]
  40950. The endpoint type.
  40951. typedef InternetProtocol::endpoint endpoint_type;
  40952. [heading Requirements]
  40953. ['Header: ][^boost/asio/ip/basic_resolver.hpp]
  40954. ['Convenience header: ][^boost/asio.hpp]
  40955. [endsect]
  40956. [section:executor_type ip::basic_resolver::executor_type]
  40957. [indexterm2 boost_asio.indexterm.ip__basic_resolver.executor_type..executor_type..ip::basic_resolver]
  40958. The type of the executor associated with the object.
  40959. typedef Executor executor_type;
  40960. [heading Requirements]
  40961. ['Header: ][^boost/asio/ip/basic_resolver.hpp]
  40962. ['Convenience header: ][^boost/asio.hpp]
  40963. [endsect]
  40964. [section:flags ip::basic_resolver::flags]
  40965. ['Inherited from ip::resolver_base.]
  40966. [indexterm2 boost_asio.indexterm.ip__basic_resolver.flags..flags..ip::basic_resolver]
  40967. A bitmask type (C++ Std [lib.bitmask.types]).
  40968. typedef unspecified flags;
  40969. [heading Requirements]
  40970. ['Header: ][^boost/asio/ip/basic_resolver.hpp]
  40971. ['Convenience header: ][^boost/asio.hpp]
  40972. [endsect]
  40973. [section:get_executor ip::basic_resolver::get_executor]
  40974. [indexterm2 boost_asio.indexterm.ip__basic_resolver.get_executor..get_executor..ip::basic_resolver]
  40975. Get the executor associated with the object.
  40976. executor_type get_executor();
  40977. [endsect]
  40978. [section:iterator ip::basic_resolver::iterator]
  40979. [indexterm2 boost_asio.indexterm.ip__basic_resolver.iterator..iterator..ip::basic_resolver]
  40980. (Deprecated.) The iterator type.
  40981. typedef basic_resolver_iterator< InternetProtocol > iterator;
  40982. [heading Types]
  40983. [table
  40984. [[Name][Description]]
  40985. [
  40986. [[link boost_asio.reference.ip__basic_resolver_iterator.difference_type [*difference_type]]]
  40987. [The type used for the distance between two iterators. ]
  40988. ]
  40989. [
  40990. [[link boost_asio.reference.ip__basic_resolver_iterator.iterator_category [*iterator_category]]]
  40991. [The iterator category. ]
  40992. ]
  40993. [
  40994. [[link boost_asio.reference.ip__basic_resolver_iterator.pointer [*pointer]]]
  40995. [The type of the result of applying operator->() to the iterator. ]
  40996. ]
  40997. [
  40998. [[link boost_asio.reference.ip__basic_resolver_iterator.reference [*reference]]]
  40999. [The type of the result of applying operator*() to the iterator. ]
  41000. ]
  41001. [
  41002. [[link boost_asio.reference.ip__basic_resolver_iterator.value_type [*value_type]]]
  41003. [The type of the value pointed to by the iterator. ]
  41004. ]
  41005. ]
  41006. [heading Member Functions]
  41007. [table
  41008. [[Name][Description]]
  41009. [
  41010. [[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator [*basic_resolver_iterator]]]
  41011. [Default constructor creates an end iterator.
  41012. [hr]
  41013. Copy constructor.
  41014. [hr]
  41015. Move constructor. ]
  41016. ]
  41017. [
  41018. [[link boost_asio.reference.ip__basic_resolver_iterator.operator__star_ [*operator *]]]
  41019. [Dereference an iterator. ]
  41020. ]
  41021. [
  41022. [[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_ [*operator++]]]
  41023. [Increment operator (prefix).
  41024. [hr]
  41025. Increment operator (postfix). ]
  41026. ]
  41027. [
  41028. [[link boost_asio.reference.ip__basic_resolver_iterator.operator_arrow_ [*operator->]]]
  41029. [Dereference an iterator. ]
  41030. ]
  41031. [
  41032. [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq_ [*operator=]]]
  41033. [Assignment operator.
  41034. [hr]
  41035. Move-assignment operator. ]
  41036. ]
  41037. ]
  41038. [heading Protected Member Functions]
  41039. [table
  41040. [[Name][Description]]
  41041. [
  41042. [[link boost_asio.reference.ip__basic_resolver_iterator.dereference [*dereference]]]
  41043. []
  41044. ]
  41045. [
  41046. [[link boost_asio.reference.ip__basic_resolver_iterator.equal [*equal]]]
  41047. []
  41048. ]
  41049. [
  41050. [[link boost_asio.reference.ip__basic_resolver_iterator.increment [*increment]]]
  41051. []
  41052. ]
  41053. ]
  41054. [heading Protected Data Members]
  41055. [table
  41056. [[Name][Description]]
  41057. [
  41058. [[link boost_asio.reference.ip__basic_resolver_iterator.index_ [*index_]]]
  41059. []
  41060. ]
  41061. [
  41062. [[link boost_asio.reference.ip__basic_resolver_iterator.values_ [*values_]]]
  41063. []
  41064. ]
  41065. ]
  41066. [heading Friends]
  41067. [table
  41068. [[Name][Description]]
  41069. [
  41070. [[link boost_asio.reference.ip__basic_resolver_iterator.operator_not__eq_ [*operator!=]]]
  41071. [Test two iterators for inequality. ]
  41072. ]
  41073. [
  41074. [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq__eq_ [*operator==]]]
  41075. [Test two iterators for equality. ]
  41076. ]
  41077. ]
  41078. The [link boost_asio.reference.ip__basic_resolver_iterator `ip::basic_resolver_iterator`] class template is used to define iterators over the results returned by a resolver.
  41079. The iterator's value\_type, obtained when the iterator is dereferenced, is:
  41080. const basic_resolver_entry<InternetProtocol>
  41081. [heading Thread Safety]
  41082. ['Distinct] ['objects:] Safe.
  41083. ['Shared] ['objects:] Unsafe.
  41084. [heading Requirements]
  41085. ['Header: ][^boost/asio/ip/basic_resolver.hpp]
  41086. ['Convenience header: ][^boost/asio.hpp]
  41087. [endsect]
  41088. [section:numeric_host ip::basic_resolver::numeric_host]
  41089. ['Inherited from ip::resolver_base.]
  41090. [indexterm2 boost_asio.indexterm.ip__basic_resolver.numeric_host..numeric_host..ip::basic_resolver]
  41091. Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted.
  41092. static const flags numeric_host = implementation_defined;
  41093. [endsect]
  41094. [section:numeric_service ip::basic_resolver::numeric_service]
  41095. ['Inherited from ip::resolver_base.]
  41096. [indexterm2 boost_asio.indexterm.ip__basic_resolver.numeric_service..numeric_service..ip::basic_resolver]
  41097. Service name should be treated as a numeric string defining a port number and no name resolution should be attempted.
  41098. static const flags numeric_service = implementation_defined;
  41099. [endsect]
  41100. [section:operator_eq_ ip::basic_resolver::operator=]
  41101. [indexterm2 boost_asio.indexterm.ip__basic_resolver.operator_eq_..operator=..ip::basic_resolver]
  41102. Move-assign a [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] from another.
  41103. basic_resolver & operator=(
  41104. basic_resolver && other);
  41105. This assignment operator moves a resolver from one object to another. Cancels any outstanding asynchronous operations associated with the target object.
  41106. [heading Parameters]
  41107. [variablelist
  41108. [[other][The other [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] object from which the move will occur.]]
  41109. ]
  41110. [heading Remarks]
  41111. Following the move, the moved-from object is in the same state as if constructed using the `basic_resolver(const executor_type&) constructor`.
  41112. [endsect]
  41113. [section:passive ip::basic_resolver::passive]
  41114. ['Inherited from ip::resolver_base.]
  41115. [indexterm2 boost_asio.indexterm.ip__basic_resolver.passive..passive..ip::basic_resolver]
  41116. Indicate that returned endpoint is intended for use as a locally bound socket endpoint.
  41117. static const flags passive = implementation_defined;
  41118. [endsect]
  41119. [section:protocol_type ip::basic_resolver::protocol_type]
  41120. [indexterm2 boost_asio.indexterm.ip__basic_resolver.protocol_type..protocol_type..ip::basic_resolver]
  41121. The protocol type.
  41122. typedef InternetProtocol protocol_type;
  41123. [heading Requirements]
  41124. ['Header: ][^boost/asio/ip/basic_resolver.hpp]
  41125. ['Convenience header: ][^boost/asio.hpp]
  41126. [endsect]
  41127. [section:query ip::basic_resolver::query]
  41128. [indexterm2 boost_asio.indexterm.ip__basic_resolver.query..query..ip::basic_resolver]
  41129. (Deprecated.) The query type.
  41130. typedef basic_resolver_query< InternetProtocol > query;
  41131. [heading Types]
  41132. [table
  41133. [[Name][Description]]
  41134. [
  41135. [[link boost_asio.reference.ip__basic_resolver_query.flags [*flags]]]
  41136. [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
  41137. ]
  41138. [
  41139. [[link boost_asio.reference.ip__basic_resolver_query.protocol_type [*protocol_type]]]
  41140. [The protocol type associated with the endpoint query. ]
  41141. ]
  41142. ]
  41143. [heading Member Functions]
  41144. [table
  41145. [[Name][Description]]
  41146. [
  41147. [[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query [*basic_resolver_query]]]
  41148. [Construct with specified service name for any protocol.
  41149. [hr]
  41150. Construct with specified service name for a given protocol.
  41151. [hr]
  41152. Construct with specified host name and service name for any protocol.
  41153. [hr]
  41154. Construct with specified host name and service name for a given protocol. ]
  41155. ]
  41156. [
  41157. [[link boost_asio.reference.ip__basic_resolver_query.hints [*hints]]]
  41158. [Get the hints associated with the query. ]
  41159. ]
  41160. [
  41161. [[link boost_asio.reference.ip__basic_resolver_query.host_name [*host_name]]]
  41162. [Get the host name associated with the query. ]
  41163. ]
  41164. [
  41165. [[link boost_asio.reference.ip__basic_resolver_query.service_name [*service_name]]]
  41166. [Get the service name associated with the query. ]
  41167. ]
  41168. ]
  41169. [heading Data Members]
  41170. [table
  41171. [[Name][Description]]
  41172. [
  41173. [[link boost_asio.reference.ip__basic_resolver_query.address_configured [*address_configured]]]
  41174. [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. ]
  41175. ]
  41176. [
  41177. [[link boost_asio.reference.ip__basic_resolver_query.all_matching [*all_matching]]]
  41178. [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
  41179. ]
  41180. [
  41181. [[link boost_asio.reference.ip__basic_resolver_query.canonical_name [*canonical_name]]]
  41182. [Determine the canonical name of the host specified in the query. ]
  41183. ]
  41184. [
  41185. [[link boost_asio.reference.ip__basic_resolver_query.numeric_host [*numeric_host]]]
  41186. [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
  41187. ]
  41188. [
  41189. [[link boost_asio.reference.ip__basic_resolver_query.numeric_service [*numeric_service]]]
  41190. [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
  41191. ]
  41192. [
  41193. [[link boost_asio.reference.ip__basic_resolver_query.passive [*passive]]]
  41194. [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
  41195. ]
  41196. [
  41197. [[link boost_asio.reference.ip__basic_resolver_query.v4_mapped [*v4_mapped]]]
  41198. [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
  41199. ]
  41200. ]
  41201. The [link boost_asio.reference.ip__basic_resolver_query `ip::basic_resolver_query`] class template describes a query that can be passed to a resolver.
  41202. [heading Thread Safety]
  41203. ['Distinct] ['objects:] Safe.
  41204. ['Shared] ['objects:] Unsafe.
  41205. [heading Requirements]
  41206. ['Header: ][^boost/asio/ip/basic_resolver.hpp]
  41207. ['Convenience header: ][^boost/asio.hpp]
  41208. [endsect]
  41209. [section:resolve ip::basic_resolver::resolve]
  41210. [indexterm2 boost_asio.indexterm.ip__basic_resolver.resolve..resolve..ip::basic_resolver]
  41211. (Deprecated: Use overload with separate host and service parameters.) Perform forward resolution of a query to a list of entries.
  41212. results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload1 resolve]``(
  41213. const query & q);
  41214. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload1 more...]]``
  41215. results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload2 resolve]``(
  41216. const query & q,
  41217. boost::system::error_code & ec);
  41218. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload2 more...]]``
  41219. Perform forward resolution of a query to a list of entries.
  41220. results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload3 resolve]``(
  41221. string_view host,
  41222. string_view service);
  41223. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload3 more...]]``
  41224. results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload4 resolve]``(
  41225. string_view host,
  41226. string_view service,
  41227. boost::system::error_code & ec);
  41228. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload4 more...]]``
  41229. results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload5 resolve]``(
  41230. string_view host,
  41231. string_view service,
  41232. resolver_base::flags resolve_flags);
  41233. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload5 more...]]``
  41234. results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload6 resolve]``(
  41235. string_view host,
  41236. string_view service,
  41237. resolver_base::flags resolve_flags,
  41238. boost::system::error_code & ec);
  41239. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload6 more...]]``
  41240. results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload7 resolve]``(
  41241. const protocol_type & protocol,
  41242. string_view host,
  41243. string_view service);
  41244. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload7 more...]]``
  41245. results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload8 resolve]``(
  41246. const protocol_type & protocol,
  41247. string_view host,
  41248. string_view service,
  41249. boost::system::error_code & ec);
  41250. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload8 more...]]``
  41251. results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload9 resolve]``(
  41252. const protocol_type & protocol,
  41253. string_view host,
  41254. string_view service,
  41255. resolver_base::flags resolve_flags);
  41256. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload9 more...]]``
  41257. results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload10 resolve]``(
  41258. const protocol_type & protocol,
  41259. string_view host,
  41260. string_view service,
  41261. resolver_base::flags resolve_flags,
  41262. boost::system::error_code & ec);
  41263. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload10 more...]]``
  41264. Perform reverse resolution of an endpoint to a list of entries.
  41265. results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload11 resolve]``(
  41266. const endpoint_type & e);
  41267. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload11 more...]]``
  41268. results_type ``[link boost_asio.reference.ip__basic_resolver.resolve.overload12 resolve]``(
  41269. const endpoint_type & e,
  41270. boost::system::error_code & ec);
  41271. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload12 more...]]``
  41272. [section:overload1 ip::basic_resolver::resolve (1 of 12 overloads)]
  41273. (Deprecated: Use overload with separate host and service parameters.) Perform forward resolution of a query to a list of entries.
  41274. results_type resolve(
  41275. const query & q);
  41276. This function is used to resolve a query into a list of endpoint entries.
  41277. [heading Parameters]
  41278. [variablelist
  41279. [[q][A query object that determines what endpoints will be returned.]]
  41280. ]
  41281. [heading Return Value]
  41282. A range object representing the list of endpoint entries. A successful call to this function is guaranteed to return a non-empty range.
  41283. [heading Exceptions]
  41284. [variablelist
  41285. [[boost::system::system_error][Thrown on failure. ]]
  41286. ]
  41287. [endsect]
  41288. [section:overload2 ip::basic_resolver::resolve (2 of 12 overloads)]
  41289. (Deprecated: Use overload with separate host and service parameters.) Perform forward resolution of a query to a list of entries.
  41290. results_type resolve(
  41291. const query & q,
  41292. boost::system::error_code & ec);
  41293. This function is used to resolve a query into a list of endpoint entries.
  41294. [heading Parameters]
  41295. [variablelist
  41296. [[q][A query object that determines what endpoints will be returned.]]
  41297. [[ec][Set to indicate what error occurred, if any.]]
  41298. ]
  41299. [heading Return Value]
  41300. A range object representing the list of endpoint entries. An empty range is returned if an error occurs. A successful call to this function is guaranteed to return a non-empty range.
  41301. [endsect]
  41302. [section:overload3 ip::basic_resolver::resolve (3 of 12 overloads)]
  41303. Perform forward resolution of a query to a list of entries.
  41304. results_type resolve(
  41305. string_view host,
  41306. string_view service);
  41307. This function is used to resolve host and service names into a list of endpoint entries.
  41308. [heading Parameters]
  41309. [variablelist
  41310. [[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.]]
  41311. [[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.]]
  41312. ]
  41313. [heading Return Value]
  41314. A range object representing the list of endpoint entries. A successful call to this function is guaranteed to return a non-empty range.
  41315. [heading Exceptions]
  41316. [variablelist
  41317. [[boost::system::system_error][Thrown on failure.]]
  41318. ]
  41319. [heading Remarks]
  41320. On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
  41321. On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names.
  41322. [endsect]
  41323. [section:overload4 ip::basic_resolver::resolve (4 of 12 overloads)]
  41324. Perform forward resolution of a query to a list of entries.
  41325. results_type resolve(
  41326. string_view host,
  41327. string_view service,
  41328. boost::system::error_code & ec);
  41329. This function is used to resolve host and service names into a list of endpoint entries.
  41330. [heading Parameters]
  41331. [variablelist
  41332. [[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.]]
  41333. [[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.]]
  41334. [[ec][Set to indicate what error occurred, if any.]]
  41335. ]
  41336. [heading Return Value]
  41337. A range object representing the list of endpoint entries. An empty range is returned if an error occurs. A successful call to this function is guaranteed to return a non-empty range.
  41338. [heading Remarks]
  41339. On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
  41340. On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names.
  41341. [endsect]
  41342. [section:overload5 ip::basic_resolver::resolve (5 of 12 overloads)]
  41343. Perform forward resolution of a query to a list of entries.
  41344. results_type resolve(
  41345. string_view host,
  41346. string_view service,
  41347. resolver_base::flags resolve_flags);
  41348. This function is used to resolve host and service names into a list of endpoint entries.
  41349. [heading Parameters]
  41350. [variablelist
  41351. [[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.]]
  41352. [[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.]]
  41353. [[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.]]
  41354. ]
  41355. [heading Return Value]
  41356. A range object representing the list of endpoint entries. A successful call to this function is guaranteed to return a non-empty range.
  41357. [heading Exceptions]
  41358. [variablelist
  41359. [[boost::system::system_error][Thrown on failure.]]
  41360. ]
  41361. [heading Remarks]
  41362. On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
  41363. On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names.
  41364. [endsect]
  41365. [section:overload6 ip::basic_resolver::resolve (6 of 12 overloads)]
  41366. Perform forward resolution of a query to a list of entries.
  41367. results_type resolve(
  41368. string_view host,
  41369. string_view service,
  41370. resolver_base::flags resolve_flags,
  41371. boost::system::error_code & ec);
  41372. This function is used to resolve host and service names into a list of endpoint entries.
  41373. [heading Parameters]
  41374. [variablelist
  41375. [[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.]]
  41376. [[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.]]
  41377. [[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.]]
  41378. [[ec][Set to indicate what error occurred, if any.]]
  41379. ]
  41380. [heading Return Value]
  41381. A range object representing the list of endpoint entries. An empty range is returned if an error occurs. A successful call to this function is guaranteed to return a non-empty range.
  41382. [heading Remarks]
  41383. On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
  41384. On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names.
  41385. [endsect]
  41386. [section:overload7 ip::basic_resolver::resolve (7 of 12 overloads)]
  41387. Perform forward resolution of a query to a list of entries.
  41388. results_type resolve(
  41389. const protocol_type & protocol,
  41390. string_view host,
  41391. string_view service);
  41392. This function is used to resolve host and service names into a list of endpoint entries.
  41393. [heading Parameters]
  41394. [variablelist
  41395. [[protocol][A protocol object, normally representing either the IPv4 or IPv6 version of an internet protocol.]]
  41396. [[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.]]
  41397. [[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.]]
  41398. ]
  41399. [heading Return Value]
  41400. A range object representing the list of endpoint entries. A successful call to this function is guaranteed to return a non-empty range.
  41401. [heading Exceptions]
  41402. [variablelist
  41403. [[boost::system::system_error][Thrown on failure.]]
  41404. ]
  41405. [heading Remarks]
  41406. On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
  41407. On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names.
  41408. [endsect]
  41409. [section:overload8 ip::basic_resolver::resolve (8 of 12 overloads)]
  41410. Perform forward resolution of a query to a list of entries.
  41411. results_type resolve(
  41412. const protocol_type & protocol,
  41413. string_view host,
  41414. string_view service,
  41415. boost::system::error_code & ec);
  41416. This function is used to resolve host and service names into a list of endpoint entries.
  41417. [heading Parameters]
  41418. [variablelist
  41419. [[protocol][A protocol object, normally representing either the IPv4 or IPv6 version of an internet protocol.]]
  41420. [[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.]]
  41421. [[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.]]
  41422. [[ec][Set to indicate what error occurred, if any.]]
  41423. ]
  41424. [heading Return Value]
  41425. A range object representing the list of endpoint entries. An empty range is returned if an error occurs. A successful call to this function is guaranteed to return a non-empty range.
  41426. [heading Remarks]
  41427. On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
  41428. On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names.
  41429. [endsect]
  41430. [section:overload9 ip::basic_resolver::resolve (9 of 12 overloads)]
  41431. Perform forward resolution of a query to a list of entries.
  41432. results_type resolve(
  41433. const protocol_type & protocol,
  41434. string_view host,
  41435. string_view service,
  41436. resolver_base::flags resolve_flags);
  41437. This function is used to resolve host and service names into a list of endpoint entries.
  41438. [heading Parameters]
  41439. [variablelist
  41440. [[protocol][A protocol object, normally representing either the IPv4 or IPv6 version of an internet protocol.]]
  41441. [[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.]]
  41442. [[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.]]
  41443. [[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.]]
  41444. ]
  41445. [heading Return Value]
  41446. A range object representing the list of endpoint entries. A successful call to this function is guaranteed to return a non-empty range.
  41447. [heading Exceptions]
  41448. [variablelist
  41449. [[boost::system::system_error][Thrown on failure.]]
  41450. ]
  41451. [heading Remarks]
  41452. On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
  41453. On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names.
  41454. [endsect]
  41455. [section:overload10 ip::basic_resolver::resolve (10 of 12 overloads)]
  41456. Perform forward resolution of a query to a list of entries.
  41457. results_type resolve(
  41458. const protocol_type & protocol,
  41459. string_view host,
  41460. string_view service,
  41461. resolver_base::flags resolve_flags,
  41462. boost::system::error_code & ec);
  41463. This function is used to resolve host and service names into a list of endpoint entries.
  41464. [heading Parameters]
  41465. [variablelist
  41466. [[protocol][A protocol object, normally representing either the IPv4 or IPv6 version of an internet protocol.]]
  41467. [[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.]]
  41468. [[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.]]
  41469. [[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.]]
  41470. [[ec][Set to indicate what error occurred, if any.]]
  41471. ]
  41472. [heading Return Value]
  41473. A range object representing the list of endpoint entries. An empty range is returned if an error occurs. A successful call to this function is guaranteed to return a non-empty range.
  41474. [heading Remarks]
  41475. On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
  41476. On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names.
  41477. [endsect]
  41478. [section:overload11 ip::basic_resolver::resolve (11 of 12 overloads)]
  41479. Perform reverse resolution of an endpoint to a list of entries.
  41480. results_type resolve(
  41481. const endpoint_type & e);
  41482. This function is used to resolve an endpoint into a list of endpoint entries.
  41483. [heading Parameters]
  41484. [variablelist
  41485. [[e][An endpoint object that determines what endpoints will be returned.]]
  41486. ]
  41487. [heading Return Value]
  41488. A range object representing the list of endpoint entries. A successful call to this function is guaranteed to return a non-empty range.
  41489. [heading Exceptions]
  41490. [variablelist
  41491. [[boost::system::system_error][Thrown on failure. ]]
  41492. ]
  41493. [endsect]
  41494. [section:overload12 ip::basic_resolver::resolve (12 of 12 overloads)]
  41495. Perform reverse resolution of an endpoint to a list of entries.
  41496. results_type resolve(
  41497. const endpoint_type & e,
  41498. boost::system::error_code & ec);
  41499. This function is used to resolve an endpoint into a list of endpoint entries.
  41500. [heading Parameters]
  41501. [variablelist
  41502. [[e][An endpoint object that determines what endpoints will be returned.]]
  41503. [[ec][Set to indicate what error occurred, if any.]]
  41504. ]
  41505. [heading Return Value]
  41506. A range object representing the list of endpoint entries. An empty range is returned if an error occurs. A successful call to this function is guaranteed to return a non-empty range.
  41507. [endsect]
  41508. [endsect]
  41509. [section:results_type ip::basic_resolver::results_type]
  41510. [indexterm2 boost_asio.indexterm.ip__basic_resolver.results_type..results_type..ip::basic_resolver]
  41511. The results type.
  41512. typedef basic_resolver_results< InternetProtocol > results_type;
  41513. [heading Types]
  41514. [table
  41515. [[Name][Description]]
  41516. [
  41517. [[link boost_asio.reference.ip__basic_resolver_results.const_iterator [*const_iterator]]]
  41518. [The type of an iterator into the range. ]
  41519. ]
  41520. [
  41521. [[link boost_asio.reference.ip__basic_resolver_results.const_reference [*const_reference]]]
  41522. [The type of a const reference to a value in the range. ]
  41523. ]
  41524. [
  41525. [[link boost_asio.reference.ip__basic_resolver_results.difference_type [*difference_type]]]
  41526. [Type used to represent the distance between two iterators in the range. ]
  41527. ]
  41528. [
  41529. [[link boost_asio.reference.ip__basic_resolver_results.endpoint_type [*endpoint_type]]]
  41530. [The endpoint type associated with the results. ]
  41531. ]
  41532. [
  41533. [[link boost_asio.reference.ip__basic_resolver_results.iterator [*iterator]]]
  41534. [The type of an iterator into the range. ]
  41535. ]
  41536. [
  41537. [[link boost_asio.reference.ip__basic_resolver_results.iterator_category [*iterator_category]]]
  41538. [The iterator category. ]
  41539. ]
  41540. [
  41541. [[link boost_asio.reference.ip__basic_resolver_results.pointer [*pointer]]]
  41542. [The type of the result of applying operator->() to the iterator. ]
  41543. ]
  41544. [
  41545. [[link boost_asio.reference.ip__basic_resolver_results.protocol_type [*protocol_type]]]
  41546. [The protocol type associated with the results. ]
  41547. ]
  41548. [
  41549. [[link boost_asio.reference.ip__basic_resolver_results.reference [*reference]]]
  41550. [The type of a non-const reference to a value in the range. ]
  41551. ]
  41552. [
  41553. [[link boost_asio.reference.ip__basic_resolver_results.size_type [*size_type]]]
  41554. [Type used to represent a count of the elements in the range. ]
  41555. ]
  41556. [
  41557. [[link boost_asio.reference.ip__basic_resolver_results.value_type [*value_type]]]
  41558. [The type of a value in the results range. ]
  41559. ]
  41560. ]
  41561. [heading Member Functions]
  41562. [table
  41563. [[Name][Description]]
  41564. [
  41565. [[link boost_asio.reference.ip__basic_resolver_results.basic_resolver_results [*basic_resolver_results]]]
  41566. [Default constructor creates an empty range.
  41567. [hr]
  41568. Copy constructor.
  41569. [hr]
  41570. Move constructor. ]
  41571. ]
  41572. [
  41573. [[link boost_asio.reference.ip__basic_resolver_results.begin [*begin]]]
  41574. [Obtain a begin iterator for the results range. ]
  41575. ]
  41576. [
  41577. [[link boost_asio.reference.ip__basic_resolver_results.cbegin [*cbegin]]]
  41578. [Obtain a begin iterator for the results range. ]
  41579. ]
  41580. [
  41581. [[link boost_asio.reference.ip__basic_resolver_results.cend [*cend]]]
  41582. [Obtain an end iterator for the results range. ]
  41583. ]
  41584. [
  41585. [[link boost_asio.reference.ip__basic_resolver_results.empty [*empty]]]
  41586. [Determine whether the results range is empty. ]
  41587. ]
  41588. [
  41589. [[link boost_asio.reference.ip__basic_resolver_results.end [*end]]]
  41590. [Obtain an end iterator for the results range. ]
  41591. ]
  41592. [
  41593. [[link boost_asio.reference.ip__basic_resolver_results.max_size [*max_size]]]
  41594. [Get the maximum number of entries permitted in a results range. ]
  41595. ]
  41596. [
  41597. [[link boost_asio.reference.ip__basic_resolver_results.operator__star_ [*operator *]]]
  41598. [Dereference an iterator. ]
  41599. ]
  41600. [
  41601. [[link boost_asio.reference.ip__basic_resolver_results.operator_plus__plus_ [*operator++]]]
  41602. [Increment operator (prefix).
  41603. [hr]
  41604. Increment operator (postfix). ]
  41605. ]
  41606. [
  41607. [[link boost_asio.reference.ip__basic_resolver_results.operator_arrow_ [*operator->]]]
  41608. [Dereference an iterator. ]
  41609. ]
  41610. [
  41611. [[link boost_asio.reference.ip__basic_resolver_results.operator_eq_ [*operator=]]]
  41612. [Assignment operator.
  41613. [hr]
  41614. Move-assignment operator. ]
  41615. ]
  41616. [
  41617. [[link boost_asio.reference.ip__basic_resolver_results.size [*size]]]
  41618. [Get the number of entries in the results range. ]
  41619. ]
  41620. [
  41621. [[link boost_asio.reference.ip__basic_resolver_results.swap [*swap]]]
  41622. [Swap the results range with another. ]
  41623. ]
  41624. ]
  41625. [heading Protected Member Functions]
  41626. [table
  41627. [[Name][Description]]
  41628. [
  41629. [[link boost_asio.reference.ip__basic_resolver_results.dereference [*dereference]]]
  41630. []
  41631. ]
  41632. [
  41633. [[link boost_asio.reference.ip__basic_resolver_results.equal [*equal]]]
  41634. []
  41635. ]
  41636. [
  41637. [[link boost_asio.reference.ip__basic_resolver_results.increment [*increment]]]
  41638. []
  41639. ]
  41640. ]
  41641. [heading Protected Data Members]
  41642. [table
  41643. [[Name][Description]]
  41644. [
  41645. [[link boost_asio.reference.ip__basic_resolver_results.index_ [*index_]]]
  41646. []
  41647. ]
  41648. [
  41649. [[link boost_asio.reference.ip__basic_resolver_results.values_ [*values_]]]
  41650. []
  41651. ]
  41652. ]
  41653. [heading Friends]
  41654. [table
  41655. [[Name][Description]]
  41656. [
  41657. [[link boost_asio.reference.ip__basic_resolver_results.operator_not__eq_ [*operator!=]]]
  41658. [Test two iterators for inequality. ]
  41659. ]
  41660. [
  41661. [[link boost_asio.reference.ip__basic_resolver_results.operator_eq__eq_ [*operator==]]]
  41662. [Test two iterators for equality. ]
  41663. ]
  41664. ]
  41665. The [link boost_asio.reference.ip__basic_resolver_results `ip::basic_resolver_results`] class template is used to define a range over the results returned by a resolver.
  41666. The iterator's value\_type, obtained when a results iterator is dereferenced, is:
  41667. const basic_resolver_entry<InternetProtocol>
  41668. [heading Remarks]
  41669. For backward compatibility, [link boost_asio.reference.ip__basic_resolver_results `ip::basic_resolver_results`] is derived from [link boost_asio.reference.ip__basic_resolver_iterator `ip::basic_resolver_iterator`]. This derivation is deprecated.
  41670. [heading Thread Safety]
  41671. ['Distinct] ['objects:] Safe.
  41672. ['Shared] ['objects:] Unsafe.
  41673. [heading Requirements]
  41674. ['Header: ][^boost/asio/ip/basic_resolver.hpp]
  41675. ['Convenience header: ][^boost/asio.hpp]
  41676. [endsect]
  41677. [section:v4_mapped ip::basic_resolver::v4_mapped]
  41678. ['Inherited from ip::resolver_base.]
  41679. [indexterm2 boost_asio.indexterm.ip__basic_resolver.v4_mapped..v4_mapped..ip::basic_resolver]
  41680. If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses.
  41681. static const flags v4_mapped = implementation_defined;
  41682. [endsect]
  41683. [section:_basic_resolver ip::basic_resolver::~basic_resolver]
  41684. [indexterm2 boost_asio.indexterm.ip__basic_resolver._basic_resolver..~basic_resolver..ip::basic_resolver]
  41685. Destroys the resolver.
  41686. ~basic_resolver();
  41687. This function destroys the resolver, cancelling any outstanding asynchronous wait operations associated with the resolver as if by calling `cancel`.
  41688. [endsect]
  41689. [endsect]
  41690. [section:ip__basic_resolver__rebind_executor ip::basic_resolver::rebind_executor]
  41691. Rebinds the resolver type to another executor.
  41692. template<
  41693. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  41694. struct rebind_executor
  41695. [heading Types]
  41696. [table
  41697. [[Name][Description]]
  41698. [
  41699. [[link boost_asio.reference.ip__basic_resolver__rebind_executor.other [*other]]]
  41700. [The resolver type when rebound to the specified executor. ]
  41701. ]
  41702. ]
  41703. [heading Requirements]
  41704. ['Header: ][^boost/asio/ip/basic_resolver.hpp]
  41705. ['Convenience header: ][^boost/asio.hpp]
  41706. [section:other ip::basic_resolver::rebind_executor::other]
  41707. [indexterm2 boost_asio.indexterm.ip__basic_resolver__rebind_executor.other..other..ip::basic_resolver::rebind_executor]
  41708. The resolver type when rebound to the specified executor.
  41709. typedef basic_resolver< InternetProtocol, Executor1 > other;
  41710. [heading Types]
  41711. [table
  41712. [[Name][Description]]
  41713. [
  41714. [[link boost_asio.reference.ip__basic_resolver__rebind_executor [*rebind_executor]]]
  41715. [Rebinds the resolver type to another executor. ]
  41716. ]
  41717. [
  41718. [[link boost_asio.reference.ip__basic_resolver.endpoint_type [*endpoint_type]]]
  41719. [The endpoint type. ]
  41720. ]
  41721. [
  41722. [[link boost_asio.reference.ip__basic_resolver.executor_type [*executor_type]]]
  41723. [The type of the executor associated with the object. ]
  41724. ]
  41725. [
  41726. [[link boost_asio.reference.ip__basic_resolver.flags [*flags]]]
  41727. [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
  41728. ]
  41729. [
  41730. [[link boost_asio.reference.ip__basic_resolver.iterator [*iterator]]]
  41731. [(Deprecated.) The iterator type. ]
  41732. ]
  41733. [
  41734. [[link boost_asio.reference.ip__basic_resolver.protocol_type [*protocol_type]]]
  41735. [The protocol type. ]
  41736. ]
  41737. [
  41738. [[link boost_asio.reference.ip__basic_resolver.query [*query]]]
  41739. [(Deprecated.) The query type. ]
  41740. ]
  41741. [
  41742. [[link boost_asio.reference.ip__basic_resolver.results_type [*results_type]]]
  41743. [The results type. ]
  41744. ]
  41745. ]
  41746. [heading Member Functions]
  41747. [table
  41748. [[Name][Description]]
  41749. [
  41750. [[link boost_asio.reference.ip__basic_resolver.async_resolve [*async_resolve]]]
  41751. [(Deprecated: Use overload with separate host and service parameters.) Asynchronously perform forward resolution of a query to a list of entries.
  41752. [hr]
  41753. Asynchronously perform forward resolution of a query to a list of entries.
  41754. [hr]
  41755. Asynchronously perform reverse resolution of an endpoint to a list of entries. ]
  41756. ]
  41757. [
  41758. [[link boost_asio.reference.ip__basic_resolver.basic_resolver [*basic_resolver]]]
  41759. [Construct with executor.
  41760. [hr]
  41761. Construct with execution context.
  41762. [hr]
  41763. Move-construct a basic_resolver from another. ]
  41764. ]
  41765. [
  41766. [[link boost_asio.reference.ip__basic_resolver.cancel [*cancel]]]
  41767. [Cancel any asynchronous operations that are waiting on the resolver. ]
  41768. ]
  41769. [
  41770. [[link boost_asio.reference.ip__basic_resolver.get_executor [*get_executor]]]
  41771. [Get the executor associated with the object. ]
  41772. ]
  41773. [
  41774. [[link boost_asio.reference.ip__basic_resolver.operator_eq_ [*operator=]]]
  41775. [Move-assign a basic_resolver from another. ]
  41776. ]
  41777. [
  41778. [[link boost_asio.reference.ip__basic_resolver.resolve [*resolve]]]
  41779. [(Deprecated: Use overload with separate host and service parameters.) Perform forward resolution of a query to a list of entries.
  41780. [hr]
  41781. Perform forward resolution of a query to a list of entries.
  41782. [hr]
  41783. Perform reverse resolution of an endpoint to a list of entries. ]
  41784. ]
  41785. [
  41786. [[link boost_asio.reference.ip__basic_resolver._basic_resolver [*~basic_resolver]]]
  41787. [Destroys the resolver. ]
  41788. ]
  41789. ]
  41790. [heading Data Members]
  41791. [table
  41792. [[Name][Description]]
  41793. [
  41794. [[link boost_asio.reference.ip__basic_resolver.address_configured [*address_configured]]]
  41795. [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. ]
  41796. ]
  41797. [
  41798. [[link boost_asio.reference.ip__basic_resolver.all_matching [*all_matching]]]
  41799. [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
  41800. ]
  41801. [
  41802. [[link boost_asio.reference.ip__basic_resolver.canonical_name [*canonical_name]]]
  41803. [Determine the canonical name of the host specified in the query. ]
  41804. ]
  41805. [
  41806. [[link boost_asio.reference.ip__basic_resolver.numeric_host [*numeric_host]]]
  41807. [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
  41808. ]
  41809. [
  41810. [[link boost_asio.reference.ip__basic_resolver.numeric_service [*numeric_service]]]
  41811. [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
  41812. ]
  41813. [
  41814. [[link boost_asio.reference.ip__basic_resolver.passive [*passive]]]
  41815. [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
  41816. ]
  41817. [
  41818. [[link boost_asio.reference.ip__basic_resolver.v4_mapped [*v4_mapped]]]
  41819. [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
  41820. ]
  41821. ]
  41822. The [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] class template provides the ability to resolve a query to a list of endpoints.
  41823. [heading Thread Safety]
  41824. ['Distinct] ['objects:] Safe.
  41825. ['Shared] ['objects:] Unsafe.
  41826. [heading Requirements]
  41827. ['Header: ][^boost/asio/ip/basic_resolver.hpp]
  41828. ['Convenience header: ][^boost/asio.hpp]
  41829. [endsect]
  41830. [endsect]
  41831. [section:ip__basic_resolver_entry ip::basic_resolver_entry]
  41832. An entry produced by a resolver.
  41833. template<
  41834. typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``>
  41835. class basic_resolver_entry
  41836. [heading Types]
  41837. [table
  41838. [[Name][Description]]
  41839. [
  41840. [[link boost_asio.reference.ip__basic_resolver_entry.endpoint_type [*endpoint_type]]]
  41841. [The endpoint type associated with the endpoint entry. ]
  41842. ]
  41843. [
  41844. [[link boost_asio.reference.ip__basic_resolver_entry.protocol_type [*protocol_type]]]
  41845. [The protocol type associated with the endpoint entry. ]
  41846. ]
  41847. ]
  41848. [heading Member Functions]
  41849. [table
  41850. [[Name][Description]]
  41851. [
  41852. [[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry [*basic_resolver_entry]]]
  41853. [Default constructor.
  41854. [hr]
  41855. Construct with specified endpoint, host name and service name. ]
  41856. ]
  41857. [
  41858. [[link boost_asio.reference.ip__basic_resolver_entry.endpoint [*endpoint]]]
  41859. [Get the endpoint associated with the entry. ]
  41860. ]
  41861. [
  41862. [[link boost_asio.reference.ip__basic_resolver_entry.host_name [*host_name]]]
  41863. [Get the host name associated with the entry. ]
  41864. ]
  41865. [
  41866. [[link boost_asio.reference.ip__basic_resolver_entry.operator_endpoint_type [*operator endpoint_type]]]
  41867. [Convert to the endpoint associated with the entry. ]
  41868. ]
  41869. [
  41870. [[link boost_asio.reference.ip__basic_resolver_entry.service_name [*service_name]]]
  41871. [Get the service name associated with the entry. ]
  41872. ]
  41873. ]
  41874. The [link boost_asio.reference.ip__basic_resolver_entry `ip::basic_resolver_entry`] class template describes an entry as returned by a resolver.
  41875. [heading Thread Safety]
  41876. ['Distinct] ['objects:] Safe.
  41877. ['Shared] ['objects:] Unsafe.
  41878. [heading Requirements]
  41879. ['Header: ][^boost/asio/ip/basic_resolver_entry.hpp]
  41880. ['Convenience header: ][^boost/asio.hpp]
  41881. [section:basic_resolver_entry ip::basic_resolver_entry::basic_resolver_entry]
  41882. [indexterm2 boost_asio.indexterm.ip__basic_resolver_entry.basic_resolver_entry..basic_resolver_entry..ip::basic_resolver_entry]
  41883. Default constructor.
  41884. ``[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry.overload1 basic_resolver_entry]``();
  41885. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry.overload1 more...]]``
  41886. Construct with specified endpoint, host name and service name.
  41887. ``[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry.overload2 basic_resolver_entry]``(
  41888. const endpoint_type & ep,
  41889. string_view host,
  41890. string_view service);
  41891. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry.overload2 more...]]``
  41892. [section:overload1 ip::basic_resolver_entry::basic_resolver_entry (1 of 2 overloads)]
  41893. Default constructor.
  41894. basic_resolver_entry();
  41895. [endsect]
  41896. [section:overload2 ip::basic_resolver_entry::basic_resolver_entry (2 of 2 overloads)]
  41897. Construct with specified endpoint, host name and service name.
  41898. basic_resolver_entry(
  41899. const endpoint_type & ep,
  41900. string_view host,
  41901. string_view service);
  41902. [endsect]
  41903. [endsect]
  41904. [section:endpoint ip::basic_resolver_entry::endpoint]
  41905. [indexterm2 boost_asio.indexterm.ip__basic_resolver_entry.endpoint..endpoint..ip::basic_resolver_entry]
  41906. Get the endpoint associated with the entry.
  41907. endpoint_type endpoint() const;
  41908. [endsect]
  41909. [section:endpoint_type ip::basic_resolver_entry::endpoint_type]
  41910. [indexterm2 boost_asio.indexterm.ip__basic_resolver_entry.endpoint_type..endpoint_type..ip::basic_resolver_entry]
  41911. The endpoint type associated with the endpoint entry.
  41912. typedef InternetProtocol::endpoint endpoint_type;
  41913. [heading Requirements]
  41914. ['Header: ][^boost/asio/ip/basic_resolver_entry.hpp]
  41915. ['Convenience header: ][^boost/asio.hpp]
  41916. [endsect]
  41917. [section:host_name ip::basic_resolver_entry::host_name]
  41918. [indexterm2 boost_asio.indexterm.ip__basic_resolver_entry.host_name..host_name..ip::basic_resolver_entry]
  41919. Get the host name associated with the entry.
  41920. std::string ``[link boost_asio.reference.ip__basic_resolver_entry.host_name.overload1 host_name]``() const;
  41921. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_entry.host_name.overload1 more...]]``
  41922. template<
  41923. class Allocator>
  41924. std::basic_string< char, std::char_traits< char >, Allocator > ``[link boost_asio.reference.ip__basic_resolver_entry.host_name.overload2 host_name]``(
  41925. const Allocator & alloc = Allocator()) const;
  41926. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_entry.host_name.overload2 more...]]``
  41927. [section:overload1 ip::basic_resolver_entry::host_name (1 of 2 overloads)]
  41928. Get the host name associated with the entry.
  41929. std::string host_name() const;
  41930. [endsect]
  41931. [section:overload2 ip::basic_resolver_entry::host_name (2 of 2 overloads)]
  41932. Get the host name associated with the entry.
  41933. template<
  41934. class Allocator>
  41935. std::basic_string< char, std::char_traits< char >, Allocator > host_name(
  41936. const Allocator & alloc = Allocator()) const;
  41937. [endsect]
  41938. [endsect]
  41939. [section:operator_endpoint_type ip::basic_resolver_entry::operator endpoint_type]
  41940. [indexterm2 boost_asio.indexterm.ip__basic_resolver_entry.operator_endpoint_type..operator endpoint_type..ip::basic_resolver_entry]
  41941. Convert to the endpoint associated with the entry.
  41942. operator endpoint_type() const;
  41943. [endsect]
  41944. [section:protocol_type ip::basic_resolver_entry::protocol_type]
  41945. [indexterm2 boost_asio.indexterm.ip__basic_resolver_entry.protocol_type..protocol_type..ip::basic_resolver_entry]
  41946. The protocol type associated with the endpoint entry.
  41947. typedef InternetProtocol protocol_type;
  41948. [heading Requirements]
  41949. ['Header: ][^boost/asio/ip/basic_resolver_entry.hpp]
  41950. ['Convenience header: ][^boost/asio.hpp]
  41951. [endsect]
  41952. [section:service_name ip::basic_resolver_entry::service_name]
  41953. [indexterm2 boost_asio.indexterm.ip__basic_resolver_entry.service_name..service_name..ip::basic_resolver_entry]
  41954. Get the service name associated with the entry.
  41955. std::string ``[link boost_asio.reference.ip__basic_resolver_entry.service_name.overload1 service_name]``() const;
  41956. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_entry.service_name.overload1 more...]]``
  41957. template<
  41958. class Allocator>
  41959. std::basic_string< char, std::char_traits< char >, Allocator > ``[link boost_asio.reference.ip__basic_resolver_entry.service_name.overload2 service_name]``(
  41960. const Allocator & alloc = Allocator()) const;
  41961. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_entry.service_name.overload2 more...]]``
  41962. [section:overload1 ip::basic_resolver_entry::service_name (1 of 2 overloads)]
  41963. Get the service name associated with the entry.
  41964. std::string service_name() const;
  41965. [endsect]
  41966. [section:overload2 ip::basic_resolver_entry::service_name (2 of 2 overloads)]
  41967. Get the service name associated with the entry.
  41968. template<
  41969. class Allocator>
  41970. std::basic_string< char, std::char_traits< char >, Allocator > service_name(
  41971. const Allocator & alloc = Allocator()) const;
  41972. [endsect]
  41973. [endsect]
  41974. [endsect]
  41975. [section:ip__basic_resolver_iterator ip::basic_resolver_iterator]
  41976. An iterator over the entries produced by a resolver.
  41977. template<
  41978. typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``>
  41979. class basic_resolver_iterator
  41980. [heading Types]
  41981. [table
  41982. [[Name][Description]]
  41983. [
  41984. [[link boost_asio.reference.ip__basic_resolver_iterator.difference_type [*difference_type]]]
  41985. [The type used for the distance between two iterators. ]
  41986. ]
  41987. [
  41988. [[link boost_asio.reference.ip__basic_resolver_iterator.iterator_category [*iterator_category]]]
  41989. [The iterator category. ]
  41990. ]
  41991. [
  41992. [[link boost_asio.reference.ip__basic_resolver_iterator.pointer [*pointer]]]
  41993. [The type of the result of applying operator->() to the iterator. ]
  41994. ]
  41995. [
  41996. [[link boost_asio.reference.ip__basic_resolver_iterator.reference [*reference]]]
  41997. [The type of the result of applying operator*() to the iterator. ]
  41998. ]
  41999. [
  42000. [[link boost_asio.reference.ip__basic_resolver_iterator.value_type [*value_type]]]
  42001. [The type of the value pointed to by the iterator. ]
  42002. ]
  42003. ]
  42004. [heading Member Functions]
  42005. [table
  42006. [[Name][Description]]
  42007. [
  42008. [[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator [*basic_resolver_iterator]]]
  42009. [Default constructor creates an end iterator.
  42010. [hr]
  42011. Copy constructor.
  42012. [hr]
  42013. Move constructor. ]
  42014. ]
  42015. [
  42016. [[link boost_asio.reference.ip__basic_resolver_iterator.operator__star_ [*operator *]]]
  42017. [Dereference an iterator. ]
  42018. ]
  42019. [
  42020. [[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_ [*operator++]]]
  42021. [Increment operator (prefix).
  42022. [hr]
  42023. Increment operator (postfix). ]
  42024. ]
  42025. [
  42026. [[link boost_asio.reference.ip__basic_resolver_iterator.operator_arrow_ [*operator->]]]
  42027. [Dereference an iterator. ]
  42028. ]
  42029. [
  42030. [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq_ [*operator=]]]
  42031. [Assignment operator.
  42032. [hr]
  42033. Move-assignment operator. ]
  42034. ]
  42035. ]
  42036. [heading Protected Member Functions]
  42037. [table
  42038. [[Name][Description]]
  42039. [
  42040. [[link boost_asio.reference.ip__basic_resolver_iterator.dereference [*dereference]]]
  42041. []
  42042. ]
  42043. [
  42044. [[link boost_asio.reference.ip__basic_resolver_iterator.equal [*equal]]]
  42045. []
  42046. ]
  42047. [
  42048. [[link boost_asio.reference.ip__basic_resolver_iterator.increment [*increment]]]
  42049. []
  42050. ]
  42051. ]
  42052. [heading Protected Data Members]
  42053. [table
  42054. [[Name][Description]]
  42055. [
  42056. [[link boost_asio.reference.ip__basic_resolver_iterator.index_ [*index_]]]
  42057. []
  42058. ]
  42059. [
  42060. [[link boost_asio.reference.ip__basic_resolver_iterator.values_ [*values_]]]
  42061. []
  42062. ]
  42063. ]
  42064. [heading Friends]
  42065. [table
  42066. [[Name][Description]]
  42067. [
  42068. [[link boost_asio.reference.ip__basic_resolver_iterator.operator_not__eq_ [*operator!=]]]
  42069. [Test two iterators for inequality. ]
  42070. ]
  42071. [
  42072. [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq__eq_ [*operator==]]]
  42073. [Test two iterators for equality. ]
  42074. ]
  42075. ]
  42076. The [link boost_asio.reference.ip__basic_resolver_iterator `ip::basic_resolver_iterator`] class template is used to define iterators over the results returned by a resolver.
  42077. The iterator's value\_type, obtained when the iterator is dereferenced, is:
  42078. const basic_resolver_entry<InternetProtocol>
  42079. [heading Thread Safety]
  42080. ['Distinct] ['objects:] Safe.
  42081. ['Shared] ['objects:] Unsafe.
  42082. [heading Requirements]
  42083. ['Header: ][^boost/asio/ip/basic_resolver_iterator.hpp]
  42084. ['Convenience header: ][^boost/asio.hpp]
  42085. [section:basic_resolver_iterator ip::basic_resolver_iterator::basic_resolver_iterator]
  42086. [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.basic_resolver_iterator..basic_resolver_iterator..ip::basic_resolver_iterator]
  42087. Default constructor creates an end iterator.
  42088. ``[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator.overload1 basic_resolver_iterator]``();
  42089. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator.overload1 more...]]``
  42090. Copy constructor.
  42091. ``[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator.overload2 basic_resolver_iterator]``(
  42092. const basic_resolver_iterator & other);
  42093. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator.overload2 more...]]``
  42094. Move constructor.
  42095. ``[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator.overload3 basic_resolver_iterator]``(
  42096. basic_resolver_iterator && other);
  42097. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator.overload3 more...]]``
  42098. [section:overload1 ip::basic_resolver_iterator::basic_resolver_iterator (1 of 3 overloads)]
  42099. Default constructor creates an end iterator.
  42100. basic_resolver_iterator();
  42101. [endsect]
  42102. [section:overload2 ip::basic_resolver_iterator::basic_resolver_iterator (2 of 3 overloads)]
  42103. Copy constructor.
  42104. basic_resolver_iterator(
  42105. const basic_resolver_iterator & other);
  42106. [endsect]
  42107. [section:overload3 ip::basic_resolver_iterator::basic_resolver_iterator (3 of 3 overloads)]
  42108. Move constructor.
  42109. basic_resolver_iterator(
  42110. basic_resolver_iterator && other);
  42111. [endsect]
  42112. [endsect]
  42113. [section:dereference ip::basic_resolver_iterator::dereference]
  42114. [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.dereference..dereference..ip::basic_resolver_iterator]
  42115. const basic_resolver_entry< InternetProtocol > & dereference() const;
  42116. [endsect]
  42117. [section:difference_type ip::basic_resolver_iterator::difference_type]
  42118. [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.difference_type..difference_type..ip::basic_resolver_iterator]
  42119. The type used for the distance between two iterators.
  42120. typedef std::ptrdiff_t difference_type;
  42121. [heading Requirements]
  42122. ['Header: ][^boost/asio/ip/basic_resolver_iterator.hpp]
  42123. ['Convenience header: ][^boost/asio.hpp]
  42124. [endsect]
  42125. [section:equal ip::basic_resolver_iterator::equal]
  42126. [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.equal..equal..ip::basic_resolver_iterator]
  42127. bool equal(
  42128. const basic_resolver_iterator & other) const;
  42129. [endsect]
  42130. [section:increment ip::basic_resolver_iterator::increment]
  42131. [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.increment..increment..ip::basic_resolver_iterator]
  42132. void increment();
  42133. [endsect]
  42134. [section:index_ ip::basic_resolver_iterator::index_]
  42135. [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.index_..index_..ip::basic_resolver_iterator]
  42136. std::size_t index_;
  42137. [endsect]
  42138. [section:iterator_category ip::basic_resolver_iterator::iterator_category]
  42139. [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.iterator_category..iterator_category..ip::basic_resolver_iterator]
  42140. The iterator category.
  42141. typedef std::forward_iterator_tag iterator_category;
  42142. [heading Requirements]
  42143. ['Header: ][^boost/asio/ip/basic_resolver_iterator.hpp]
  42144. ['Convenience header: ][^boost/asio.hpp]
  42145. [endsect]
  42146. [section:operator__star_ ip::basic_resolver_iterator::operator *]
  42147. [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.operator__star_..operator *..ip::basic_resolver_iterator]
  42148. Dereference an iterator.
  42149. const basic_resolver_entry< InternetProtocol > & operator *() const;
  42150. [endsect]
  42151. [section:operator_not__eq_ ip::basic_resolver_iterator::operator!=]
  42152. [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.operator_not__eq_..operator!=..ip::basic_resolver_iterator]
  42153. Test two iterators for inequality.
  42154. friend bool operator!=(
  42155. const basic_resolver_iterator & a,
  42156. const basic_resolver_iterator & b);
  42157. [heading Requirements]
  42158. ['Header: ][^boost/asio/ip/basic_resolver_iterator.hpp]
  42159. ['Convenience header: ][^boost/asio.hpp]
  42160. [endsect]
  42161. [section:operator_plus__plus_ ip::basic_resolver_iterator::operator++]
  42162. [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.operator_plus__plus_..operator++..ip::basic_resolver_iterator]
  42163. Increment operator (prefix).
  42164. basic_resolver_iterator & ``[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_.overload1 operator++]``();
  42165. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_.overload1 more...]]``
  42166. Increment operator (postfix).
  42167. basic_resolver_iterator ``[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_.overload2 operator++]``(
  42168. int );
  42169. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_.overload2 more...]]``
  42170. [section:overload1 ip::basic_resolver_iterator::operator++ (1 of 2 overloads)]
  42171. Increment operator (prefix).
  42172. basic_resolver_iterator & operator++();
  42173. [endsect]
  42174. [section:overload2 ip::basic_resolver_iterator::operator++ (2 of 2 overloads)]
  42175. Increment operator (postfix).
  42176. basic_resolver_iterator operator++(
  42177. int );
  42178. [endsect]
  42179. [endsect]
  42180. [section:operator_arrow_ ip::basic_resolver_iterator::operator->]
  42181. [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.operator_arrow_..operator->..ip::basic_resolver_iterator]
  42182. Dereference an iterator.
  42183. const basic_resolver_entry< InternetProtocol > * operator->() const;
  42184. [endsect]
  42185. [section:operator_eq_ ip::basic_resolver_iterator::operator=]
  42186. [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.operator_eq_..operator=..ip::basic_resolver_iterator]
  42187. Assignment operator.
  42188. basic_resolver_iterator & ``[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq_.overload1 operator=]``(
  42189. const basic_resolver_iterator & other);
  42190. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_iterator.operator_eq_.overload1 more...]]``
  42191. Move-assignment operator.
  42192. basic_resolver_iterator & ``[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq_.overload2 operator=]``(
  42193. basic_resolver_iterator && other);
  42194. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_iterator.operator_eq_.overload2 more...]]``
  42195. [section:overload1 ip::basic_resolver_iterator::operator= (1 of 2 overloads)]
  42196. Assignment operator.
  42197. basic_resolver_iterator & operator=(
  42198. const basic_resolver_iterator & other);
  42199. [endsect]
  42200. [section:overload2 ip::basic_resolver_iterator::operator= (2 of 2 overloads)]
  42201. Move-assignment operator.
  42202. basic_resolver_iterator & operator=(
  42203. basic_resolver_iterator && other);
  42204. [endsect]
  42205. [endsect]
  42206. [section:operator_eq__eq_ ip::basic_resolver_iterator::operator==]
  42207. [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.operator_eq__eq_..operator==..ip::basic_resolver_iterator]
  42208. Test two iterators for equality.
  42209. friend bool operator==(
  42210. const basic_resolver_iterator & a,
  42211. const basic_resolver_iterator & b);
  42212. [heading Requirements]
  42213. ['Header: ][^boost/asio/ip/basic_resolver_iterator.hpp]
  42214. ['Convenience header: ][^boost/asio.hpp]
  42215. [endsect]
  42216. [section:pointer ip::basic_resolver_iterator::pointer]
  42217. [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.pointer..pointer..ip::basic_resolver_iterator]
  42218. The type of the result of applying `operator->()` to the iterator.
  42219. typedef const basic_resolver_entry< InternetProtocol > * pointer;
  42220. [heading Requirements]
  42221. ['Header: ][^boost/asio/ip/basic_resolver_iterator.hpp]
  42222. ['Convenience header: ][^boost/asio.hpp]
  42223. [endsect]
  42224. [section:reference ip::basic_resolver_iterator::reference]
  42225. [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.reference..reference..ip::basic_resolver_iterator]
  42226. The type of the result of applying `operator*()` to the iterator.
  42227. typedef const basic_resolver_entry< InternetProtocol > & reference;
  42228. [heading Types]
  42229. [table
  42230. [[Name][Description]]
  42231. [
  42232. [[link boost_asio.reference.ip__basic_resolver_entry.endpoint_type [*endpoint_type]]]
  42233. [The endpoint type associated with the endpoint entry. ]
  42234. ]
  42235. [
  42236. [[link boost_asio.reference.ip__basic_resolver_entry.protocol_type [*protocol_type]]]
  42237. [The protocol type associated with the endpoint entry. ]
  42238. ]
  42239. ]
  42240. [heading Member Functions]
  42241. [table
  42242. [[Name][Description]]
  42243. [
  42244. [[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry [*basic_resolver_entry]]]
  42245. [Default constructor.
  42246. [hr]
  42247. Construct with specified endpoint, host name and service name. ]
  42248. ]
  42249. [
  42250. [[link boost_asio.reference.ip__basic_resolver_entry.endpoint [*endpoint]]]
  42251. [Get the endpoint associated with the entry. ]
  42252. ]
  42253. [
  42254. [[link boost_asio.reference.ip__basic_resolver_entry.host_name [*host_name]]]
  42255. [Get the host name associated with the entry. ]
  42256. ]
  42257. [
  42258. [[link boost_asio.reference.ip__basic_resolver_entry.operator_endpoint_type [*operator endpoint_type]]]
  42259. [Convert to the endpoint associated with the entry. ]
  42260. ]
  42261. [
  42262. [[link boost_asio.reference.ip__basic_resolver_entry.service_name [*service_name]]]
  42263. [Get the service name associated with the entry. ]
  42264. ]
  42265. ]
  42266. The [link boost_asio.reference.ip__basic_resolver_entry `ip::basic_resolver_entry`] class template describes an entry as returned by a resolver.
  42267. [heading Thread Safety]
  42268. ['Distinct] ['objects:] Safe.
  42269. ['Shared] ['objects:] Unsafe.
  42270. [heading Requirements]
  42271. ['Header: ][^boost/asio/ip/basic_resolver_iterator.hpp]
  42272. ['Convenience header: ][^boost/asio.hpp]
  42273. [endsect]
  42274. [section:value_type ip::basic_resolver_iterator::value_type]
  42275. [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.value_type..value_type..ip::basic_resolver_iterator]
  42276. The type of the value pointed to by the iterator.
  42277. typedef basic_resolver_entry< InternetProtocol > value_type;
  42278. [heading Types]
  42279. [table
  42280. [[Name][Description]]
  42281. [
  42282. [[link boost_asio.reference.ip__basic_resolver_entry.endpoint_type [*endpoint_type]]]
  42283. [The endpoint type associated with the endpoint entry. ]
  42284. ]
  42285. [
  42286. [[link boost_asio.reference.ip__basic_resolver_entry.protocol_type [*protocol_type]]]
  42287. [The protocol type associated with the endpoint entry. ]
  42288. ]
  42289. ]
  42290. [heading Member Functions]
  42291. [table
  42292. [[Name][Description]]
  42293. [
  42294. [[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry [*basic_resolver_entry]]]
  42295. [Default constructor.
  42296. [hr]
  42297. Construct with specified endpoint, host name and service name. ]
  42298. ]
  42299. [
  42300. [[link boost_asio.reference.ip__basic_resolver_entry.endpoint [*endpoint]]]
  42301. [Get the endpoint associated with the entry. ]
  42302. ]
  42303. [
  42304. [[link boost_asio.reference.ip__basic_resolver_entry.host_name [*host_name]]]
  42305. [Get the host name associated with the entry. ]
  42306. ]
  42307. [
  42308. [[link boost_asio.reference.ip__basic_resolver_entry.operator_endpoint_type [*operator endpoint_type]]]
  42309. [Convert to the endpoint associated with the entry. ]
  42310. ]
  42311. [
  42312. [[link boost_asio.reference.ip__basic_resolver_entry.service_name [*service_name]]]
  42313. [Get the service name associated with the entry. ]
  42314. ]
  42315. ]
  42316. The [link boost_asio.reference.ip__basic_resolver_entry `ip::basic_resolver_entry`] class template describes an entry as returned by a resolver.
  42317. [heading Thread Safety]
  42318. ['Distinct] ['objects:] Safe.
  42319. ['Shared] ['objects:] Unsafe.
  42320. [heading Requirements]
  42321. ['Header: ][^boost/asio/ip/basic_resolver_iterator.hpp]
  42322. ['Convenience header: ][^boost/asio.hpp]
  42323. [endsect]
  42324. [section:values_ ip::basic_resolver_iterator::values_]
  42325. [indexterm2 boost_asio.indexterm.ip__basic_resolver_iterator.values_..values_..ip::basic_resolver_iterator]
  42326. values_ptr_type values_;
  42327. [endsect]
  42328. [endsect]
  42329. [section:ip__basic_resolver_query ip::basic_resolver_query]
  42330. An query to be passed to a resolver.
  42331. template<
  42332. typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``>
  42333. class basic_resolver_query :
  42334. public ip::resolver_query_base
  42335. [heading Types]
  42336. [table
  42337. [[Name][Description]]
  42338. [
  42339. [[link boost_asio.reference.ip__basic_resolver_query.flags [*flags]]]
  42340. [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
  42341. ]
  42342. [
  42343. [[link boost_asio.reference.ip__basic_resolver_query.protocol_type [*protocol_type]]]
  42344. [The protocol type associated with the endpoint query. ]
  42345. ]
  42346. ]
  42347. [heading Member Functions]
  42348. [table
  42349. [[Name][Description]]
  42350. [
  42351. [[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query [*basic_resolver_query]]]
  42352. [Construct with specified service name for any protocol.
  42353. [hr]
  42354. Construct with specified service name for a given protocol.
  42355. [hr]
  42356. Construct with specified host name and service name for any protocol.
  42357. [hr]
  42358. Construct with specified host name and service name for a given protocol. ]
  42359. ]
  42360. [
  42361. [[link boost_asio.reference.ip__basic_resolver_query.hints [*hints]]]
  42362. [Get the hints associated with the query. ]
  42363. ]
  42364. [
  42365. [[link boost_asio.reference.ip__basic_resolver_query.host_name [*host_name]]]
  42366. [Get the host name associated with the query. ]
  42367. ]
  42368. [
  42369. [[link boost_asio.reference.ip__basic_resolver_query.service_name [*service_name]]]
  42370. [Get the service name associated with the query. ]
  42371. ]
  42372. ]
  42373. [heading Data Members]
  42374. [table
  42375. [[Name][Description]]
  42376. [
  42377. [[link boost_asio.reference.ip__basic_resolver_query.address_configured [*address_configured]]]
  42378. [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. ]
  42379. ]
  42380. [
  42381. [[link boost_asio.reference.ip__basic_resolver_query.all_matching [*all_matching]]]
  42382. [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
  42383. ]
  42384. [
  42385. [[link boost_asio.reference.ip__basic_resolver_query.canonical_name [*canonical_name]]]
  42386. [Determine the canonical name of the host specified in the query. ]
  42387. ]
  42388. [
  42389. [[link boost_asio.reference.ip__basic_resolver_query.numeric_host [*numeric_host]]]
  42390. [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
  42391. ]
  42392. [
  42393. [[link boost_asio.reference.ip__basic_resolver_query.numeric_service [*numeric_service]]]
  42394. [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
  42395. ]
  42396. [
  42397. [[link boost_asio.reference.ip__basic_resolver_query.passive [*passive]]]
  42398. [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
  42399. ]
  42400. [
  42401. [[link boost_asio.reference.ip__basic_resolver_query.v4_mapped [*v4_mapped]]]
  42402. [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
  42403. ]
  42404. ]
  42405. The [link boost_asio.reference.ip__basic_resolver_query `ip::basic_resolver_query`] class template describes a query that can be passed to a resolver.
  42406. [heading Thread Safety]
  42407. ['Distinct] ['objects:] Safe.
  42408. ['Shared] ['objects:] Unsafe.
  42409. [heading Requirements]
  42410. ['Header: ][^boost/asio/ip/basic_resolver_query.hpp]
  42411. ['Convenience header: ][^boost/asio.hpp]
  42412. [section:address_configured ip::basic_resolver_query::address_configured]
  42413. ['Inherited from ip::resolver_base.]
  42414. [indexterm2 boost_asio.indexterm.ip__basic_resolver_query.address_configured..address_configured..ip::basic_resolver_query]
  42415. 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.
  42416. static const flags address_configured = implementation_defined;
  42417. [endsect]
  42418. [section:all_matching ip::basic_resolver_query::all_matching]
  42419. ['Inherited from ip::resolver_base.]
  42420. [indexterm2 boost_asio.indexterm.ip__basic_resolver_query.all_matching..all_matching..ip::basic_resolver_query]
  42421. If used with v4\_mapped, return all matching IPv6 and IPv4 addresses.
  42422. static const flags all_matching = implementation_defined;
  42423. [endsect]
  42424. [section:basic_resolver_query ip::basic_resolver_query::basic_resolver_query]
  42425. [indexterm2 boost_asio.indexterm.ip__basic_resolver_query.basic_resolver_query..basic_resolver_query..ip::basic_resolver_query]
  42426. Construct with specified service name for any protocol.
  42427. ``[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload1 basic_resolver_query]``(
  42428. const std::string & service,
  42429. resolver_query_base::flags resolve_flags = passive|address_configured);
  42430. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload1 more...]]``
  42431. Construct with specified service name for a given protocol.
  42432. ``[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload2 basic_resolver_query]``(
  42433. const protocol_type & protocol,
  42434. const std::string & service,
  42435. resolver_query_base::flags resolve_flags = passive|address_configured);
  42436. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload2 more...]]``
  42437. Construct with specified host name and service name for any protocol.
  42438. ``[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload3 basic_resolver_query]``(
  42439. const std::string & host,
  42440. const std::string & service,
  42441. resolver_query_base::flags resolve_flags = address_configured);
  42442. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload3 more...]]``
  42443. Construct with specified host name and service name for a given protocol.
  42444. ``[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload4 basic_resolver_query]``(
  42445. const protocol_type & protocol,
  42446. const std::string & host,
  42447. const std::string & service,
  42448. resolver_query_base::flags resolve_flags = address_configured);
  42449. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload4 more...]]``
  42450. [section:overload1 ip::basic_resolver_query::basic_resolver_query (1 of 4 overloads)]
  42451. Construct with specified service name for any protocol.
  42452. basic_resolver_query(
  42453. const std::string & service,
  42454. resolver_query_base::flags resolve_flags = passive|address_configured);
  42455. This constructor is typically used to perform name resolution for local service binding.
  42456. [heading Parameters]
  42457. [variablelist
  42458. [[service][A string identifying the requested service. This may be a descriptive name or a numeric string corresponding to a port number.]]
  42459. [[resolve_flags][A set of flags that determine how name resolution should be performed. The default flags are suitable for local service binding.]]
  42460. ]
  42461. [heading Remarks]
  42462. On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names.
  42463. [endsect]
  42464. [section:overload2 ip::basic_resolver_query::basic_resolver_query (2 of 4 overloads)]
  42465. Construct with specified service name for a given protocol.
  42466. basic_resolver_query(
  42467. const protocol_type & protocol,
  42468. const std::string & service,
  42469. resolver_query_base::flags resolve_flags = passive|address_configured);
  42470. This constructor is typically used to perform name resolution for local service binding with a specific protocol version.
  42471. [heading Parameters]
  42472. [variablelist
  42473. [[protocol][A protocol object, normally representing either the IPv4 or IPv6 version of an internet protocol.]]
  42474. [[service][A string identifying the requested service. This may be a descriptive name or a numeric string corresponding to a port number.]]
  42475. [[resolve_flags][A set of flags that determine how name resolution should be performed. The default flags are suitable for local service binding.]]
  42476. ]
  42477. [heading Remarks]
  42478. On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names.
  42479. [endsect]
  42480. [section:overload3 ip::basic_resolver_query::basic_resolver_query (3 of 4 overloads)]
  42481. Construct with specified host name and service name for any protocol.
  42482. basic_resolver_query(
  42483. const std::string & host,
  42484. const std::string & service,
  42485. resolver_query_base::flags resolve_flags = address_configured);
  42486. This constructor is typically used to perform name resolution for communication with remote hosts.
  42487. [heading Parameters]
  42488. [variablelist
  42489. [[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.]]
  42490. [[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.]]
  42491. [[resolve_flags][A set of flags that determine how name resolution should be performed. The default flags are suitable for communication with remote hosts.]]
  42492. ]
  42493. [heading Remarks]
  42494. On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
  42495. On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names.
  42496. [endsect]
  42497. [section:overload4 ip::basic_resolver_query::basic_resolver_query (4 of 4 overloads)]
  42498. Construct with specified host name and service name for a given protocol.
  42499. basic_resolver_query(
  42500. const protocol_type & protocol,
  42501. const std::string & host,
  42502. const std::string & service,
  42503. resolver_query_base::flags resolve_flags = address_configured);
  42504. This constructor is typically used to perform name resolution for communication with remote hosts.
  42505. [heading Parameters]
  42506. [variablelist
  42507. [[protocol][A protocol object, normally representing either the IPv4 or IPv6 version of an internet protocol.]]
  42508. [[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.]]
  42509. [[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.]]
  42510. [[resolve_flags][A set of flags that determine how name resolution should be performed. The default flags are suitable for communication with remote hosts.]]
  42511. ]
  42512. [heading Remarks]
  42513. On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
  42514. On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names.
  42515. [endsect]
  42516. [endsect]
  42517. [section:canonical_name ip::basic_resolver_query::canonical_name]
  42518. ['Inherited from ip::resolver_base.]
  42519. [indexterm2 boost_asio.indexterm.ip__basic_resolver_query.canonical_name..canonical_name..ip::basic_resolver_query]
  42520. Determine the canonical name of the host specified in the query.
  42521. static const flags canonical_name = implementation_defined;
  42522. [endsect]
  42523. [section:flags ip::basic_resolver_query::flags]
  42524. ['Inherited from ip::resolver_base.]
  42525. [indexterm2 boost_asio.indexterm.ip__basic_resolver_query.flags..flags..ip::basic_resolver_query]
  42526. A bitmask type (C++ Std [lib.bitmask.types]).
  42527. typedef unspecified flags;
  42528. [heading Requirements]
  42529. ['Header: ][^boost/asio/ip/basic_resolver_query.hpp]
  42530. ['Convenience header: ][^boost/asio.hpp]
  42531. [endsect]
  42532. [section:hints ip::basic_resolver_query::hints]
  42533. [indexterm2 boost_asio.indexterm.ip__basic_resolver_query.hints..hints..ip::basic_resolver_query]
  42534. Get the hints associated with the query.
  42535. const boost::asio::detail::addrinfo_type & hints() const;
  42536. [endsect]
  42537. [section:host_name ip::basic_resolver_query::host_name]
  42538. [indexterm2 boost_asio.indexterm.ip__basic_resolver_query.host_name..host_name..ip::basic_resolver_query]
  42539. Get the host name associated with the query.
  42540. std::string host_name() const;
  42541. [endsect]
  42542. [section:numeric_host ip::basic_resolver_query::numeric_host]
  42543. ['Inherited from ip::resolver_base.]
  42544. [indexterm2 boost_asio.indexterm.ip__basic_resolver_query.numeric_host..numeric_host..ip::basic_resolver_query]
  42545. Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted.
  42546. static const flags numeric_host = implementation_defined;
  42547. [endsect]
  42548. [section:numeric_service ip::basic_resolver_query::numeric_service]
  42549. ['Inherited from ip::resolver_base.]
  42550. [indexterm2 boost_asio.indexterm.ip__basic_resolver_query.numeric_service..numeric_service..ip::basic_resolver_query]
  42551. Service name should be treated as a numeric string defining a port number and no name resolution should be attempted.
  42552. static const flags numeric_service = implementation_defined;
  42553. [endsect]
  42554. [section:passive ip::basic_resolver_query::passive]
  42555. ['Inherited from ip::resolver_base.]
  42556. [indexterm2 boost_asio.indexterm.ip__basic_resolver_query.passive..passive..ip::basic_resolver_query]
  42557. Indicate that returned endpoint is intended for use as a locally bound socket endpoint.
  42558. static const flags passive = implementation_defined;
  42559. [endsect]
  42560. [section:protocol_type ip::basic_resolver_query::protocol_type]
  42561. [indexterm2 boost_asio.indexterm.ip__basic_resolver_query.protocol_type..protocol_type..ip::basic_resolver_query]
  42562. The protocol type associated with the endpoint query.
  42563. typedef InternetProtocol protocol_type;
  42564. [heading Requirements]
  42565. ['Header: ][^boost/asio/ip/basic_resolver_query.hpp]
  42566. ['Convenience header: ][^boost/asio.hpp]
  42567. [endsect]
  42568. [section:service_name ip::basic_resolver_query::service_name]
  42569. [indexterm2 boost_asio.indexterm.ip__basic_resolver_query.service_name..service_name..ip::basic_resolver_query]
  42570. Get the service name associated with the query.
  42571. std::string service_name() const;
  42572. [endsect]
  42573. [section:v4_mapped ip::basic_resolver_query::v4_mapped]
  42574. ['Inherited from ip::resolver_base.]
  42575. [indexterm2 boost_asio.indexterm.ip__basic_resolver_query.v4_mapped..v4_mapped..ip::basic_resolver_query]
  42576. If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses.
  42577. static const flags v4_mapped = implementation_defined;
  42578. [endsect]
  42579. [endsect]
  42580. [section:ip__basic_resolver_results ip::basic_resolver_results]
  42581. A range of entries produced by a resolver.
  42582. template<
  42583. typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``>
  42584. class basic_resolver_results :
  42585. public ip::basic_resolver_iterator< InternetProtocol >
  42586. [heading Types]
  42587. [table
  42588. [[Name][Description]]
  42589. [
  42590. [[link boost_asio.reference.ip__basic_resolver_results.const_iterator [*const_iterator]]]
  42591. [The type of an iterator into the range. ]
  42592. ]
  42593. [
  42594. [[link boost_asio.reference.ip__basic_resolver_results.const_reference [*const_reference]]]
  42595. [The type of a const reference to a value in the range. ]
  42596. ]
  42597. [
  42598. [[link boost_asio.reference.ip__basic_resolver_results.difference_type [*difference_type]]]
  42599. [Type used to represent the distance between two iterators in the range. ]
  42600. ]
  42601. [
  42602. [[link boost_asio.reference.ip__basic_resolver_results.endpoint_type [*endpoint_type]]]
  42603. [The endpoint type associated with the results. ]
  42604. ]
  42605. [
  42606. [[link boost_asio.reference.ip__basic_resolver_results.iterator [*iterator]]]
  42607. [The type of an iterator into the range. ]
  42608. ]
  42609. [
  42610. [[link boost_asio.reference.ip__basic_resolver_results.iterator_category [*iterator_category]]]
  42611. [The iterator category. ]
  42612. ]
  42613. [
  42614. [[link boost_asio.reference.ip__basic_resolver_results.pointer [*pointer]]]
  42615. [The type of the result of applying operator->() to the iterator. ]
  42616. ]
  42617. [
  42618. [[link boost_asio.reference.ip__basic_resolver_results.protocol_type [*protocol_type]]]
  42619. [The protocol type associated with the results. ]
  42620. ]
  42621. [
  42622. [[link boost_asio.reference.ip__basic_resolver_results.reference [*reference]]]
  42623. [The type of a non-const reference to a value in the range. ]
  42624. ]
  42625. [
  42626. [[link boost_asio.reference.ip__basic_resolver_results.size_type [*size_type]]]
  42627. [Type used to represent a count of the elements in the range. ]
  42628. ]
  42629. [
  42630. [[link boost_asio.reference.ip__basic_resolver_results.value_type [*value_type]]]
  42631. [The type of a value in the results range. ]
  42632. ]
  42633. ]
  42634. [heading Member Functions]
  42635. [table
  42636. [[Name][Description]]
  42637. [
  42638. [[link boost_asio.reference.ip__basic_resolver_results.basic_resolver_results [*basic_resolver_results]]]
  42639. [Default constructor creates an empty range.
  42640. [hr]
  42641. Copy constructor.
  42642. [hr]
  42643. Move constructor. ]
  42644. ]
  42645. [
  42646. [[link boost_asio.reference.ip__basic_resolver_results.begin [*begin]]]
  42647. [Obtain a begin iterator for the results range. ]
  42648. ]
  42649. [
  42650. [[link boost_asio.reference.ip__basic_resolver_results.cbegin [*cbegin]]]
  42651. [Obtain a begin iterator for the results range. ]
  42652. ]
  42653. [
  42654. [[link boost_asio.reference.ip__basic_resolver_results.cend [*cend]]]
  42655. [Obtain an end iterator for the results range. ]
  42656. ]
  42657. [
  42658. [[link boost_asio.reference.ip__basic_resolver_results.empty [*empty]]]
  42659. [Determine whether the results range is empty. ]
  42660. ]
  42661. [
  42662. [[link boost_asio.reference.ip__basic_resolver_results.end [*end]]]
  42663. [Obtain an end iterator for the results range. ]
  42664. ]
  42665. [
  42666. [[link boost_asio.reference.ip__basic_resolver_results.max_size [*max_size]]]
  42667. [Get the maximum number of entries permitted in a results range. ]
  42668. ]
  42669. [
  42670. [[link boost_asio.reference.ip__basic_resolver_results.operator__star_ [*operator *]]]
  42671. [Dereference an iterator. ]
  42672. ]
  42673. [
  42674. [[link boost_asio.reference.ip__basic_resolver_results.operator_plus__plus_ [*operator++]]]
  42675. [Increment operator (prefix).
  42676. [hr]
  42677. Increment operator (postfix). ]
  42678. ]
  42679. [
  42680. [[link boost_asio.reference.ip__basic_resolver_results.operator_arrow_ [*operator->]]]
  42681. [Dereference an iterator. ]
  42682. ]
  42683. [
  42684. [[link boost_asio.reference.ip__basic_resolver_results.operator_eq_ [*operator=]]]
  42685. [Assignment operator.
  42686. [hr]
  42687. Move-assignment operator. ]
  42688. ]
  42689. [
  42690. [[link boost_asio.reference.ip__basic_resolver_results.size [*size]]]
  42691. [Get the number of entries in the results range. ]
  42692. ]
  42693. [
  42694. [[link boost_asio.reference.ip__basic_resolver_results.swap [*swap]]]
  42695. [Swap the results range with another. ]
  42696. ]
  42697. ]
  42698. [heading Protected Member Functions]
  42699. [table
  42700. [[Name][Description]]
  42701. [
  42702. [[link boost_asio.reference.ip__basic_resolver_results.dereference [*dereference]]]
  42703. []
  42704. ]
  42705. [
  42706. [[link boost_asio.reference.ip__basic_resolver_results.equal [*equal]]]
  42707. []
  42708. ]
  42709. [
  42710. [[link boost_asio.reference.ip__basic_resolver_results.increment [*increment]]]
  42711. []
  42712. ]
  42713. ]
  42714. [heading Protected Data Members]
  42715. [table
  42716. [[Name][Description]]
  42717. [
  42718. [[link boost_asio.reference.ip__basic_resolver_results.index_ [*index_]]]
  42719. []
  42720. ]
  42721. [
  42722. [[link boost_asio.reference.ip__basic_resolver_results.values_ [*values_]]]
  42723. []
  42724. ]
  42725. ]
  42726. [heading Friends]
  42727. [table
  42728. [[Name][Description]]
  42729. [
  42730. [[link boost_asio.reference.ip__basic_resolver_results.operator_not__eq_ [*operator!=]]]
  42731. [Test two iterators for inequality. ]
  42732. ]
  42733. [
  42734. [[link boost_asio.reference.ip__basic_resolver_results.operator_eq__eq_ [*operator==]]]
  42735. [Test two iterators for equality. ]
  42736. ]
  42737. ]
  42738. The [link boost_asio.reference.ip__basic_resolver_results `ip::basic_resolver_results`] class template is used to define a range over the results returned by a resolver.
  42739. The iterator's value\_type, obtained when a results iterator is dereferenced, is:
  42740. const basic_resolver_entry<InternetProtocol>
  42741. [heading Remarks]
  42742. For backward compatibility, [link boost_asio.reference.ip__basic_resolver_results `ip::basic_resolver_results`] is derived from [link boost_asio.reference.ip__basic_resolver_iterator `ip::basic_resolver_iterator`]. This derivation is deprecated.
  42743. [heading Thread Safety]
  42744. ['Distinct] ['objects:] Safe.
  42745. ['Shared] ['objects:] Unsafe.
  42746. [heading Requirements]
  42747. ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
  42748. ['Convenience header: ][^boost/asio.hpp]
  42749. [section:basic_resolver_results ip::basic_resolver_results::basic_resolver_results]
  42750. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.basic_resolver_results..basic_resolver_results..ip::basic_resolver_results]
  42751. Default constructor creates an empty range.
  42752. ``[link boost_asio.reference.ip__basic_resolver_results.basic_resolver_results.overload1 basic_resolver_results]``();
  42753. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_results.basic_resolver_results.overload1 more...]]``
  42754. Copy constructor.
  42755. ``[link boost_asio.reference.ip__basic_resolver_results.basic_resolver_results.overload2 basic_resolver_results]``(
  42756. const basic_resolver_results & other);
  42757. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_results.basic_resolver_results.overload2 more...]]``
  42758. Move constructor.
  42759. ``[link boost_asio.reference.ip__basic_resolver_results.basic_resolver_results.overload3 basic_resolver_results]``(
  42760. basic_resolver_results && other);
  42761. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_results.basic_resolver_results.overload3 more...]]``
  42762. [section:overload1 ip::basic_resolver_results::basic_resolver_results (1 of 3 overloads)]
  42763. Default constructor creates an empty range.
  42764. basic_resolver_results();
  42765. [endsect]
  42766. [section:overload2 ip::basic_resolver_results::basic_resolver_results (2 of 3 overloads)]
  42767. Copy constructor.
  42768. basic_resolver_results(
  42769. const basic_resolver_results & other);
  42770. [endsect]
  42771. [section:overload3 ip::basic_resolver_results::basic_resolver_results (3 of 3 overloads)]
  42772. Move constructor.
  42773. basic_resolver_results(
  42774. basic_resolver_results && other);
  42775. [endsect]
  42776. [endsect]
  42777. [section:begin ip::basic_resolver_results::begin]
  42778. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.begin..begin..ip::basic_resolver_results]
  42779. Obtain a begin iterator for the results range.
  42780. const_iterator begin() const;
  42781. [endsect]
  42782. [section:cbegin ip::basic_resolver_results::cbegin]
  42783. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.cbegin..cbegin..ip::basic_resolver_results]
  42784. Obtain a begin iterator for the results range.
  42785. const_iterator cbegin() const;
  42786. [endsect]
  42787. [section:cend ip::basic_resolver_results::cend]
  42788. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.cend..cend..ip::basic_resolver_results]
  42789. Obtain an end iterator for the results range.
  42790. const_iterator cend() const;
  42791. [endsect]
  42792. [section:const_iterator ip::basic_resolver_results::const_iterator]
  42793. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.const_iterator..const_iterator..ip::basic_resolver_results]
  42794. The type of an iterator into the range.
  42795. typedef basic_resolver_iterator< protocol_type > const_iterator;
  42796. [heading Types]
  42797. [table
  42798. [[Name][Description]]
  42799. [
  42800. [[link boost_asio.reference.ip__basic_resolver_iterator.difference_type [*difference_type]]]
  42801. [The type used for the distance between two iterators. ]
  42802. ]
  42803. [
  42804. [[link boost_asio.reference.ip__basic_resolver_iterator.iterator_category [*iterator_category]]]
  42805. [The iterator category. ]
  42806. ]
  42807. [
  42808. [[link boost_asio.reference.ip__basic_resolver_iterator.pointer [*pointer]]]
  42809. [The type of the result of applying operator->() to the iterator. ]
  42810. ]
  42811. [
  42812. [[link boost_asio.reference.ip__basic_resolver_iterator.reference [*reference]]]
  42813. [The type of the result of applying operator*() to the iterator. ]
  42814. ]
  42815. [
  42816. [[link boost_asio.reference.ip__basic_resolver_iterator.value_type [*value_type]]]
  42817. [The type of the value pointed to by the iterator. ]
  42818. ]
  42819. ]
  42820. [heading Member Functions]
  42821. [table
  42822. [[Name][Description]]
  42823. [
  42824. [[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator [*basic_resolver_iterator]]]
  42825. [Default constructor creates an end iterator.
  42826. [hr]
  42827. Copy constructor.
  42828. [hr]
  42829. Move constructor. ]
  42830. ]
  42831. [
  42832. [[link boost_asio.reference.ip__basic_resolver_iterator.operator__star_ [*operator *]]]
  42833. [Dereference an iterator. ]
  42834. ]
  42835. [
  42836. [[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_ [*operator++]]]
  42837. [Increment operator (prefix).
  42838. [hr]
  42839. Increment operator (postfix). ]
  42840. ]
  42841. [
  42842. [[link boost_asio.reference.ip__basic_resolver_iterator.operator_arrow_ [*operator->]]]
  42843. [Dereference an iterator. ]
  42844. ]
  42845. [
  42846. [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq_ [*operator=]]]
  42847. [Assignment operator.
  42848. [hr]
  42849. Move-assignment operator. ]
  42850. ]
  42851. ]
  42852. [heading Protected Member Functions]
  42853. [table
  42854. [[Name][Description]]
  42855. [
  42856. [[link boost_asio.reference.ip__basic_resolver_iterator.dereference [*dereference]]]
  42857. []
  42858. ]
  42859. [
  42860. [[link boost_asio.reference.ip__basic_resolver_iterator.equal [*equal]]]
  42861. []
  42862. ]
  42863. [
  42864. [[link boost_asio.reference.ip__basic_resolver_iterator.increment [*increment]]]
  42865. []
  42866. ]
  42867. ]
  42868. [heading Protected Data Members]
  42869. [table
  42870. [[Name][Description]]
  42871. [
  42872. [[link boost_asio.reference.ip__basic_resolver_iterator.index_ [*index_]]]
  42873. []
  42874. ]
  42875. [
  42876. [[link boost_asio.reference.ip__basic_resolver_iterator.values_ [*values_]]]
  42877. []
  42878. ]
  42879. ]
  42880. [heading Friends]
  42881. [table
  42882. [[Name][Description]]
  42883. [
  42884. [[link boost_asio.reference.ip__basic_resolver_iterator.operator_not__eq_ [*operator!=]]]
  42885. [Test two iterators for inequality. ]
  42886. ]
  42887. [
  42888. [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq__eq_ [*operator==]]]
  42889. [Test two iterators for equality. ]
  42890. ]
  42891. ]
  42892. The [link boost_asio.reference.ip__basic_resolver_iterator `ip::basic_resolver_iterator`] class template is used to define iterators over the results returned by a resolver.
  42893. The iterator's value\_type, obtained when the iterator is dereferenced, is:
  42894. const basic_resolver_entry<InternetProtocol>
  42895. [heading Thread Safety]
  42896. ['Distinct] ['objects:] Safe.
  42897. ['Shared] ['objects:] Unsafe.
  42898. [heading Requirements]
  42899. ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
  42900. ['Convenience header: ][^boost/asio.hpp]
  42901. [endsect]
  42902. [section:const_reference ip::basic_resolver_results::const_reference]
  42903. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.const_reference..const_reference..ip::basic_resolver_results]
  42904. The type of a const reference to a value in the range.
  42905. typedef const value_type & const_reference;
  42906. [heading Types]
  42907. [table
  42908. [[Name][Description]]
  42909. [
  42910. [[link boost_asio.reference.ip__basic_resolver_entry.endpoint_type [*endpoint_type]]]
  42911. [The endpoint type associated with the endpoint entry. ]
  42912. ]
  42913. [
  42914. [[link boost_asio.reference.ip__basic_resolver_entry.protocol_type [*protocol_type]]]
  42915. [The protocol type associated with the endpoint entry. ]
  42916. ]
  42917. ]
  42918. [heading Member Functions]
  42919. [table
  42920. [[Name][Description]]
  42921. [
  42922. [[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry [*basic_resolver_entry]]]
  42923. [Default constructor.
  42924. [hr]
  42925. Construct with specified endpoint, host name and service name. ]
  42926. ]
  42927. [
  42928. [[link boost_asio.reference.ip__basic_resolver_entry.endpoint [*endpoint]]]
  42929. [Get the endpoint associated with the entry. ]
  42930. ]
  42931. [
  42932. [[link boost_asio.reference.ip__basic_resolver_entry.host_name [*host_name]]]
  42933. [Get the host name associated with the entry. ]
  42934. ]
  42935. [
  42936. [[link boost_asio.reference.ip__basic_resolver_entry.operator_endpoint_type [*operator endpoint_type]]]
  42937. [Convert to the endpoint associated with the entry. ]
  42938. ]
  42939. [
  42940. [[link boost_asio.reference.ip__basic_resolver_entry.service_name [*service_name]]]
  42941. [Get the service name associated with the entry. ]
  42942. ]
  42943. ]
  42944. The [link boost_asio.reference.ip__basic_resolver_entry `ip::basic_resolver_entry`] class template describes an entry as returned by a resolver.
  42945. [heading Thread Safety]
  42946. ['Distinct] ['objects:] Safe.
  42947. ['Shared] ['objects:] Unsafe.
  42948. [heading Requirements]
  42949. ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
  42950. ['Convenience header: ][^boost/asio.hpp]
  42951. [endsect]
  42952. [section:dereference ip::basic_resolver_results::dereference]
  42953. ['Inherited from ip::basic_resolver.]
  42954. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.dereference..dereference..ip::basic_resolver_results]
  42955. const basic_resolver_entry< InternetProtocol > & dereference() const;
  42956. [endsect]
  42957. [section:difference_type ip::basic_resolver_results::difference_type]
  42958. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.difference_type..difference_type..ip::basic_resolver_results]
  42959. Type used to represent the distance between two iterators in the range.
  42960. typedef std::ptrdiff_t difference_type;
  42961. [heading Requirements]
  42962. ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
  42963. ['Convenience header: ][^boost/asio.hpp]
  42964. [endsect]
  42965. [section:empty ip::basic_resolver_results::empty]
  42966. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.empty..empty..ip::basic_resolver_results]
  42967. Determine whether the results range is empty.
  42968. bool empty() const;
  42969. [endsect]
  42970. [section:end ip::basic_resolver_results::end]
  42971. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.end..end..ip::basic_resolver_results]
  42972. Obtain an end iterator for the results range.
  42973. const_iterator end() const;
  42974. [endsect]
  42975. [section:endpoint_type ip::basic_resolver_results::endpoint_type]
  42976. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.endpoint_type..endpoint_type..ip::basic_resolver_results]
  42977. The endpoint type associated with the results.
  42978. typedef protocol_type::endpoint endpoint_type;
  42979. [heading Requirements]
  42980. ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
  42981. ['Convenience header: ][^boost/asio.hpp]
  42982. [endsect]
  42983. [section:equal ip::basic_resolver_results::equal]
  42984. ['Inherited from ip::basic_resolver.]
  42985. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.equal..equal..ip::basic_resolver_results]
  42986. bool equal(
  42987. const basic_resolver_iterator & other) const;
  42988. [endsect]
  42989. [section:increment ip::basic_resolver_results::increment]
  42990. ['Inherited from ip::basic_resolver.]
  42991. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.increment..increment..ip::basic_resolver_results]
  42992. void increment();
  42993. [endsect]
  42994. [section:index_ ip::basic_resolver_results::index_]
  42995. ['Inherited from ip::basic_resolver.]
  42996. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.index_..index_..ip::basic_resolver_results]
  42997. std::size_t index_;
  42998. [endsect]
  42999. [section:iterator ip::basic_resolver_results::iterator]
  43000. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.iterator..iterator..ip::basic_resolver_results]
  43001. The type of an iterator into the range.
  43002. typedef const_iterator iterator;
  43003. [heading Types]
  43004. [table
  43005. [[Name][Description]]
  43006. [
  43007. [[link boost_asio.reference.ip__basic_resolver_iterator.difference_type [*difference_type]]]
  43008. [The type used for the distance between two iterators. ]
  43009. ]
  43010. [
  43011. [[link boost_asio.reference.ip__basic_resolver_iterator.iterator_category [*iterator_category]]]
  43012. [The iterator category. ]
  43013. ]
  43014. [
  43015. [[link boost_asio.reference.ip__basic_resolver_iterator.pointer [*pointer]]]
  43016. [The type of the result of applying operator->() to the iterator. ]
  43017. ]
  43018. [
  43019. [[link boost_asio.reference.ip__basic_resolver_iterator.reference [*reference]]]
  43020. [The type of the result of applying operator*() to the iterator. ]
  43021. ]
  43022. [
  43023. [[link boost_asio.reference.ip__basic_resolver_iterator.value_type [*value_type]]]
  43024. [The type of the value pointed to by the iterator. ]
  43025. ]
  43026. ]
  43027. [heading Member Functions]
  43028. [table
  43029. [[Name][Description]]
  43030. [
  43031. [[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator [*basic_resolver_iterator]]]
  43032. [Default constructor creates an end iterator.
  43033. [hr]
  43034. Copy constructor.
  43035. [hr]
  43036. Move constructor. ]
  43037. ]
  43038. [
  43039. [[link boost_asio.reference.ip__basic_resolver_iterator.operator__star_ [*operator *]]]
  43040. [Dereference an iterator. ]
  43041. ]
  43042. [
  43043. [[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_ [*operator++]]]
  43044. [Increment operator (prefix).
  43045. [hr]
  43046. Increment operator (postfix). ]
  43047. ]
  43048. [
  43049. [[link boost_asio.reference.ip__basic_resolver_iterator.operator_arrow_ [*operator->]]]
  43050. [Dereference an iterator. ]
  43051. ]
  43052. [
  43053. [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq_ [*operator=]]]
  43054. [Assignment operator.
  43055. [hr]
  43056. Move-assignment operator. ]
  43057. ]
  43058. ]
  43059. [heading Protected Member Functions]
  43060. [table
  43061. [[Name][Description]]
  43062. [
  43063. [[link boost_asio.reference.ip__basic_resolver_iterator.dereference [*dereference]]]
  43064. []
  43065. ]
  43066. [
  43067. [[link boost_asio.reference.ip__basic_resolver_iterator.equal [*equal]]]
  43068. []
  43069. ]
  43070. [
  43071. [[link boost_asio.reference.ip__basic_resolver_iterator.increment [*increment]]]
  43072. []
  43073. ]
  43074. ]
  43075. [heading Protected Data Members]
  43076. [table
  43077. [[Name][Description]]
  43078. [
  43079. [[link boost_asio.reference.ip__basic_resolver_iterator.index_ [*index_]]]
  43080. []
  43081. ]
  43082. [
  43083. [[link boost_asio.reference.ip__basic_resolver_iterator.values_ [*values_]]]
  43084. []
  43085. ]
  43086. ]
  43087. [heading Friends]
  43088. [table
  43089. [[Name][Description]]
  43090. [
  43091. [[link boost_asio.reference.ip__basic_resolver_iterator.operator_not__eq_ [*operator!=]]]
  43092. [Test two iterators for inequality. ]
  43093. ]
  43094. [
  43095. [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq__eq_ [*operator==]]]
  43096. [Test two iterators for equality. ]
  43097. ]
  43098. ]
  43099. The [link boost_asio.reference.ip__basic_resolver_iterator `ip::basic_resolver_iterator`] class template is used to define iterators over the results returned by a resolver.
  43100. The iterator's value\_type, obtained when the iterator is dereferenced, is:
  43101. const basic_resolver_entry<InternetProtocol>
  43102. [heading Thread Safety]
  43103. ['Distinct] ['objects:] Safe.
  43104. ['Shared] ['objects:] Unsafe.
  43105. [heading Requirements]
  43106. ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
  43107. ['Convenience header: ][^boost/asio.hpp]
  43108. [endsect]
  43109. [section:iterator_category ip::basic_resolver_results::iterator_category]
  43110. ['Inherited from ip::basic_resolver.]
  43111. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.iterator_category..iterator_category..ip::basic_resolver_results]
  43112. The iterator category.
  43113. typedef std::forward_iterator_tag iterator_category;
  43114. [heading Requirements]
  43115. ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
  43116. ['Convenience header: ][^boost/asio.hpp]
  43117. [endsect]
  43118. [section:max_size ip::basic_resolver_results::max_size]
  43119. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.max_size..max_size..ip::basic_resolver_results]
  43120. Get the maximum number of entries permitted in a results range.
  43121. size_type max_size() const;
  43122. [endsect]
  43123. [section:operator__star_ ip::basic_resolver_results::operator *]
  43124. ['Inherited from ip::basic_resolver.]
  43125. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.operator__star_..operator *..ip::basic_resolver_results]
  43126. Dereference an iterator.
  43127. const basic_resolver_entry< InternetProtocol > & operator *() const;
  43128. [endsect]
  43129. [section:operator_not__eq_ ip::basic_resolver_results::operator!=]
  43130. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.operator_not__eq_..operator!=..ip::basic_resolver_results]
  43131. Test two iterators for inequality.
  43132. friend bool ``[link boost_asio.reference.ip__basic_resolver_results.operator_not__eq_.overload1 operator!=]``(
  43133. const basic_resolver_results & a,
  43134. const basic_resolver_results & b);
  43135. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_results.operator_not__eq_.overload1 more...]]``
  43136. friend bool ``[link boost_asio.reference.ip__basic_resolver_results.operator_not__eq_.overload2 operator!=]``(
  43137. const basic_resolver_iterator & a,
  43138. const basic_resolver_iterator & b);
  43139. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_results.operator_not__eq_.overload2 more...]]``
  43140. [section:overload1 ip::basic_resolver_results::operator!= (1 of 2 overloads)]
  43141. Test two iterators for inequality.
  43142. friend bool operator!=(
  43143. const basic_resolver_results & a,
  43144. const basic_resolver_results & b);
  43145. [heading Requirements]
  43146. ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
  43147. ['Convenience header: ][^boost/asio.hpp]
  43148. [endsect]
  43149. [section:overload2 ip::basic_resolver_results::operator!= (2 of 2 overloads)]
  43150. ['Inherited from ip::basic_resolver.]
  43151. Test two iterators for inequality.
  43152. friend bool operator!=(
  43153. const basic_resolver_iterator & a,
  43154. const basic_resolver_iterator & b);
  43155. [heading Requirements]
  43156. ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
  43157. ['Convenience header: ][^boost/asio.hpp]
  43158. [endsect]
  43159. [endsect]
  43160. [section:operator_plus__plus_ ip::basic_resolver_results::operator++]
  43161. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.operator_plus__plus_..operator++..ip::basic_resolver_results]
  43162. Increment operator (prefix).
  43163. basic_resolver_iterator & ``[link boost_asio.reference.ip__basic_resolver_results.operator_plus__plus_.overload1 operator++]``();
  43164. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_results.operator_plus__plus_.overload1 more...]]``
  43165. Increment operator (postfix).
  43166. basic_resolver_iterator ``[link boost_asio.reference.ip__basic_resolver_results.operator_plus__plus_.overload2 operator++]``(
  43167. int );
  43168. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_results.operator_plus__plus_.overload2 more...]]``
  43169. [section:overload1 ip::basic_resolver_results::operator++ (1 of 2 overloads)]
  43170. ['Inherited from ip::basic_resolver.]
  43171. Increment operator (prefix).
  43172. basic_resolver_iterator & operator++();
  43173. [endsect]
  43174. [section:overload2 ip::basic_resolver_results::operator++ (2 of 2 overloads)]
  43175. ['Inherited from ip::basic_resolver.]
  43176. Increment operator (postfix).
  43177. basic_resolver_iterator operator++(
  43178. int );
  43179. [endsect]
  43180. [endsect]
  43181. [section:operator_arrow_ ip::basic_resolver_results::operator->]
  43182. ['Inherited from ip::basic_resolver.]
  43183. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.operator_arrow_..operator->..ip::basic_resolver_results]
  43184. Dereference an iterator.
  43185. const basic_resolver_entry< InternetProtocol > * operator->() const;
  43186. [endsect]
  43187. [section:operator_eq_ ip::basic_resolver_results::operator=]
  43188. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.operator_eq_..operator=..ip::basic_resolver_results]
  43189. Assignment operator.
  43190. basic_resolver_results & ``[link boost_asio.reference.ip__basic_resolver_results.operator_eq_.overload1 operator=]``(
  43191. const basic_resolver_results & other);
  43192. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_results.operator_eq_.overload1 more...]]``
  43193. Move-assignment operator.
  43194. basic_resolver_results & ``[link boost_asio.reference.ip__basic_resolver_results.operator_eq_.overload2 operator=]``(
  43195. basic_resolver_results && other);
  43196. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_results.operator_eq_.overload2 more...]]``
  43197. [section:overload1 ip::basic_resolver_results::operator= (1 of 2 overloads)]
  43198. Assignment operator.
  43199. basic_resolver_results & operator=(
  43200. const basic_resolver_results & other);
  43201. [endsect]
  43202. [section:overload2 ip::basic_resolver_results::operator= (2 of 2 overloads)]
  43203. Move-assignment operator.
  43204. basic_resolver_results & operator=(
  43205. basic_resolver_results && other);
  43206. [endsect]
  43207. [endsect]
  43208. [section:operator_eq__eq_ ip::basic_resolver_results::operator==]
  43209. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.operator_eq__eq_..operator==..ip::basic_resolver_results]
  43210. Test two iterators for equality.
  43211. friend bool ``[link boost_asio.reference.ip__basic_resolver_results.operator_eq__eq_.overload1 operator==]``(
  43212. const basic_resolver_results & a,
  43213. const basic_resolver_results & b);
  43214. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_results.operator_eq__eq_.overload1 more...]]``
  43215. friend bool ``[link boost_asio.reference.ip__basic_resolver_results.operator_eq__eq_.overload2 operator==]``(
  43216. const basic_resolver_iterator & a,
  43217. const basic_resolver_iterator & b);
  43218. `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_results.operator_eq__eq_.overload2 more...]]``
  43219. [section:overload1 ip::basic_resolver_results::operator== (1 of 2 overloads)]
  43220. Test two iterators for equality.
  43221. friend bool operator==(
  43222. const basic_resolver_results & a,
  43223. const basic_resolver_results & b);
  43224. [heading Requirements]
  43225. ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
  43226. ['Convenience header: ][^boost/asio.hpp]
  43227. [endsect]
  43228. [section:overload2 ip::basic_resolver_results::operator== (2 of 2 overloads)]
  43229. ['Inherited from ip::basic_resolver.]
  43230. Test two iterators for equality.
  43231. friend bool operator==(
  43232. const basic_resolver_iterator & a,
  43233. const basic_resolver_iterator & b);
  43234. [heading Requirements]
  43235. ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
  43236. ['Convenience header: ][^boost/asio.hpp]
  43237. [endsect]
  43238. [endsect]
  43239. [section:pointer ip::basic_resolver_results::pointer]
  43240. ['Inherited from ip::basic_resolver.]
  43241. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.pointer..pointer..ip::basic_resolver_results]
  43242. The type of the result of applying `operator->()` to the iterator.
  43243. typedef const basic_resolver_entry< InternetProtocol > * pointer;
  43244. [heading Requirements]
  43245. ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
  43246. ['Convenience header: ][^boost/asio.hpp]
  43247. [endsect]
  43248. [section:protocol_type ip::basic_resolver_results::protocol_type]
  43249. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.protocol_type..protocol_type..ip::basic_resolver_results]
  43250. The protocol type associated with the results.
  43251. typedef InternetProtocol protocol_type;
  43252. [heading Requirements]
  43253. ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
  43254. ['Convenience header: ][^boost/asio.hpp]
  43255. [endsect]
  43256. [section:reference ip::basic_resolver_results::reference]
  43257. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.reference..reference..ip::basic_resolver_results]
  43258. The type of a non-const reference to a value in the range.
  43259. typedef value_type & reference;
  43260. [heading Types]
  43261. [table
  43262. [[Name][Description]]
  43263. [
  43264. [[link boost_asio.reference.ip__basic_resolver_entry.endpoint_type [*endpoint_type]]]
  43265. [The endpoint type associated with the endpoint entry. ]
  43266. ]
  43267. [
  43268. [[link boost_asio.reference.ip__basic_resolver_entry.protocol_type [*protocol_type]]]
  43269. [The protocol type associated with the endpoint entry. ]
  43270. ]
  43271. ]
  43272. [heading Member Functions]
  43273. [table
  43274. [[Name][Description]]
  43275. [
  43276. [[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry [*basic_resolver_entry]]]
  43277. [Default constructor.
  43278. [hr]
  43279. Construct with specified endpoint, host name and service name. ]
  43280. ]
  43281. [
  43282. [[link boost_asio.reference.ip__basic_resolver_entry.endpoint [*endpoint]]]
  43283. [Get the endpoint associated with the entry. ]
  43284. ]
  43285. [
  43286. [[link boost_asio.reference.ip__basic_resolver_entry.host_name [*host_name]]]
  43287. [Get the host name associated with the entry. ]
  43288. ]
  43289. [
  43290. [[link boost_asio.reference.ip__basic_resolver_entry.operator_endpoint_type [*operator endpoint_type]]]
  43291. [Convert to the endpoint associated with the entry. ]
  43292. ]
  43293. [
  43294. [[link boost_asio.reference.ip__basic_resolver_entry.service_name [*service_name]]]
  43295. [Get the service name associated with the entry. ]
  43296. ]
  43297. ]
  43298. The [link boost_asio.reference.ip__basic_resolver_entry `ip::basic_resolver_entry`] class template describes an entry as returned by a resolver.
  43299. [heading Thread Safety]
  43300. ['Distinct] ['objects:] Safe.
  43301. ['Shared] ['objects:] Unsafe.
  43302. [heading Requirements]
  43303. ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
  43304. ['Convenience header: ][^boost/asio.hpp]
  43305. [endsect]
  43306. [section:size ip::basic_resolver_results::size]
  43307. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.size..size..ip::basic_resolver_results]
  43308. Get the number of entries in the results range.
  43309. size_type size() const;
  43310. [endsect]
  43311. [section:size_type ip::basic_resolver_results::size_type]
  43312. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.size_type..size_type..ip::basic_resolver_results]
  43313. Type used to represent a count of the elements in the range.
  43314. typedef std::size_t size_type;
  43315. [heading Requirements]
  43316. ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
  43317. ['Convenience header: ][^boost/asio.hpp]
  43318. [endsect]
  43319. [section:swap ip::basic_resolver_results::swap]
  43320. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.swap..swap..ip::basic_resolver_results]
  43321. Swap the results range with another.
  43322. void swap(
  43323. basic_resolver_results & that);
  43324. [endsect]
  43325. [section:value_type ip::basic_resolver_results::value_type]
  43326. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.value_type..value_type..ip::basic_resolver_results]
  43327. The type of a value in the results range.
  43328. typedef basic_resolver_entry< protocol_type > value_type;
  43329. [heading Types]
  43330. [table
  43331. [[Name][Description]]
  43332. [
  43333. [[link boost_asio.reference.ip__basic_resolver_entry.endpoint_type [*endpoint_type]]]
  43334. [The endpoint type associated with the endpoint entry. ]
  43335. ]
  43336. [
  43337. [[link boost_asio.reference.ip__basic_resolver_entry.protocol_type [*protocol_type]]]
  43338. [The protocol type associated with the endpoint entry. ]
  43339. ]
  43340. ]
  43341. [heading Member Functions]
  43342. [table
  43343. [[Name][Description]]
  43344. [
  43345. [[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry [*basic_resolver_entry]]]
  43346. [Default constructor.
  43347. [hr]
  43348. Construct with specified endpoint, host name and service name. ]
  43349. ]
  43350. [
  43351. [[link boost_asio.reference.ip__basic_resolver_entry.endpoint [*endpoint]]]
  43352. [Get the endpoint associated with the entry. ]
  43353. ]
  43354. [
  43355. [[link boost_asio.reference.ip__basic_resolver_entry.host_name [*host_name]]]
  43356. [Get the host name associated with the entry. ]
  43357. ]
  43358. [
  43359. [[link boost_asio.reference.ip__basic_resolver_entry.operator_endpoint_type [*operator endpoint_type]]]
  43360. [Convert to the endpoint associated with the entry. ]
  43361. ]
  43362. [
  43363. [[link boost_asio.reference.ip__basic_resolver_entry.service_name [*service_name]]]
  43364. [Get the service name associated with the entry. ]
  43365. ]
  43366. ]
  43367. The [link boost_asio.reference.ip__basic_resolver_entry `ip::basic_resolver_entry`] class template describes an entry as returned by a resolver.
  43368. [heading Thread Safety]
  43369. ['Distinct] ['objects:] Safe.
  43370. ['Shared] ['objects:] Unsafe.
  43371. [heading Requirements]
  43372. ['Header: ][^boost/asio/ip/basic_resolver_results.hpp]
  43373. ['Convenience header: ][^boost/asio.hpp]
  43374. [endsect]
  43375. [section:values_ ip::basic_resolver_results::values_]
  43376. ['Inherited from ip::basic_resolver.]
  43377. [indexterm2 boost_asio.indexterm.ip__basic_resolver_results.values_..values_..ip::basic_resolver_results]
  43378. values_ptr_type values_;
  43379. [endsect]
  43380. [endsect]
  43381. [section:ip__host_name ip::host_name]
  43382. [indexterm1 boost_asio.indexterm.ip__host_name..ip::host_name]
  43383. Get the current host name.
  43384. std::string ``[link boost_asio.reference.ip__host_name.overload1 host_name]``();
  43385. `` [''''&raquo;''' [link boost_asio.reference.ip__host_name.overload1 more...]]``
  43386. std::string ``[link boost_asio.reference.ip__host_name.overload2 host_name]``(
  43387. boost::system::error_code & ec);
  43388. `` [''''&raquo;''' [link boost_asio.reference.ip__host_name.overload2 more...]]``
  43389. [heading Requirements]
  43390. ['Header: ][^boost/asio/ip/host_name.hpp]
  43391. ['Convenience header: ][^boost/asio.hpp]
  43392. [section:overload1 ip::host_name (1 of 2 overloads)]
  43393. Get the current host name.
  43394. std::string host_name();
  43395. [endsect]
  43396. [section:overload2 ip::host_name (2 of 2 overloads)]
  43397. Get the current host name.
  43398. std::string host_name(
  43399. boost::system::error_code & ec);
  43400. [endsect]
  43401. [endsect]
  43402. [section:ip__icmp ip::icmp]
  43403. Encapsulates the flags needed for ICMP.
  43404. class icmp
  43405. [heading Types]
  43406. [table
  43407. [[Name][Description]]
  43408. [
  43409. [[link boost_asio.reference.ip__icmp.endpoint [*endpoint]]]
  43410. [The type of a ICMP endpoint. ]
  43411. ]
  43412. [
  43413. [[link boost_asio.reference.ip__icmp.resolver [*resolver]]]
  43414. [The ICMP resolver type. ]
  43415. ]
  43416. [
  43417. [[link boost_asio.reference.ip__icmp.socket [*socket]]]
  43418. [The ICMP socket type. ]
  43419. ]
  43420. ]
  43421. [heading Member Functions]
  43422. [table
  43423. [[Name][Description]]
  43424. [
  43425. [[link boost_asio.reference.ip__icmp.family [*family]]]
  43426. [Obtain an identifier for the protocol family. ]
  43427. ]
  43428. [
  43429. [[link boost_asio.reference.ip__icmp.protocol [*protocol]]]
  43430. [Obtain an identifier for the protocol. ]
  43431. ]
  43432. [
  43433. [[link boost_asio.reference.ip__icmp.type [*type]]]
  43434. [Obtain an identifier for the type of the protocol. ]
  43435. ]
  43436. [
  43437. [[link boost_asio.reference.ip__icmp.v4 [*v4]]]
  43438. [Construct to represent the IPv4 ICMP protocol. ]
  43439. ]
  43440. [
  43441. [[link boost_asio.reference.ip__icmp.v6 [*v6]]]
  43442. [Construct to represent the IPv6 ICMP protocol. ]
  43443. ]
  43444. ]
  43445. [heading Friends]
  43446. [table
  43447. [[Name][Description]]
  43448. [
  43449. [[link boost_asio.reference.ip__icmp.operator_not__eq_ [*operator!=]]]
  43450. [Compare two protocols for inequality. ]
  43451. ]
  43452. [
  43453. [[link boost_asio.reference.ip__icmp.operator_eq__eq_ [*operator==]]]
  43454. [Compare two protocols for equality. ]
  43455. ]
  43456. ]
  43457. The [link boost_asio.reference.ip__icmp `ip::icmp`] class contains flags necessary for ICMP sockets.
  43458. [heading Thread Safety]
  43459. ['Distinct] ['objects:] Safe.
  43460. ['Shared] ['objects:] Safe.
  43461. [heading Requirements]
  43462. ['Header: ][^boost/asio/ip/icmp.hpp]
  43463. ['Convenience header: ][^boost/asio.hpp]
  43464. [section:endpoint ip::icmp::endpoint]
  43465. [indexterm2 boost_asio.indexterm.ip__icmp.endpoint..endpoint..ip::icmp]
  43466. The type of a ICMP endpoint.
  43467. typedef basic_endpoint< icmp > endpoint;
  43468. [heading Types]
  43469. [table
  43470. [[Name][Description]]
  43471. [
  43472. [[link boost_asio.reference.ip__basic_endpoint.data_type [*data_type]]]
  43473. [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
  43474. ]
  43475. [
  43476. [[link boost_asio.reference.ip__basic_endpoint.protocol_type [*protocol_type]]]
  43477. [The protocol type associated with the endpoint. ]
  43478. ]
  43479. ]
  43480. [heading Member Functions]
  43481. [table
  43482. [[Name][Description]]
  43483. [
  43484. [[link boost_asio.reference.ip__basic_endpoint.address [*address]]]
  43485. [Get the IP address associated with the endpoint.
  43486. [hr]
  43487. Set the IP address associated with the endpoint. ]
  43488. ]
  43489. [
  43490. [[link boost_asio.reference.ip__basic_endpoint.basic_endpoint [*basic_endpoint]]]
  43491. [Default constructor.
  43492. [hr]
  43493. 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.
  43494. [hr]
  43495. 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.
  43496. [hr]
  43497. Copy constructor.
  43498. [hr]
  43499. Move constructor. ]
  43500. ]
  43501. [
  43502. [[link boost_asio.reference.ip__basic_endpoint.capacity [*capacity]]]
  43503. [Get the capacity of the endpoint in the native type. ]
  43504. ]
  43505. [
  43506. [[link boost_asio.reference.ip__basic_endpoint.data [*data]]]
  43507. [Get the underlying endpoint in the native type. ]
  43508. ]
  43509. [
  43510. [[link boost_asio.reference.ip__basic_endpoint.operator_eq_ [*operator=]]]
  43511. [Assign from another endpoint.
  43512. [hr]
  43513. Move-assign from another endpoint. ]
  43514. ]
  43515. [
  43516. [[link boost_asio.reference.ip__basic_endpoint.port [*port]]]
  43517. [Get the port associated with the endpoint. The port number is always in the host's byte order.
  43518. [hr]
  43519. Set the port associated with the endpoint. The port number is always in the host's byte order. ]
  43520. ]
  43521. [
  43522. [[link boost_asio.reference.ip__basic_endpoint.protocol [*protocol]]]
  43523. [The protocol associated with the endpoint. ]
  43524. ]
  43525. [
  43526. [[link boost_asio.reference.ip__basic_endpoint.resize [*resize]]]
  43527. [Set the underlying size of the endpoint in the native type. ]
  43528. ]
  43529. [
  43530. [[link boost_asio.reference.ip__basic_endpoint.size [*size]]]
  43531. [Get the underlying size of the endpoint in the native type. ]
  43532. ]
  43533. ]
  43534. [heading Friends]
  43535. [table
  43536. [[Name][Description]]
  43537. [
  43538. [[link boost_asio.reference.ip__basic_endpoint.operator_not__eq_ [*operator!=]]]
  43539. [Compare two endpoints for inequality. ]
  43540. ]
  43541. [
  43542. [[link boost_asio.reference.ip__basic_endpoint.operator_lt_ [*operator<]]]
  43543. [Compare endpoints for ordering. ]
  43544. ]
  43545. [
  43546. [[link boost_asio.reference.ip__basic_endpoint.operator_lt__eq_ [*operator<=]]]
  43547. [Compare endpoints for ordering. ]
  43548. ]
  43549. [
  43550. [[link boost_asio.reference.ip__basic_endpoint.operator_eq__eq_ [*operator==]]]
  43551. [Compare two endpoints for equality. ]
  43552. ]
  43553. [
  43554. [[link boost_asio.reference.ip__basic_endpoint.operator_gt_ [*operator>]]]
  43555. [Compare endpoints for ordering. ]
  43556. ]
  43557. [
  43558. [[link boost_asio.reference.ip__basic_endpoint.operator_gt__eq_ [*operator>=]]]
  43559. [Compare endpoints for ordering. ]
  43560. ]
  43561. ]
  43562. [heading Related Functions]
  43563. [table
  43564. [[Name][Description]]
  43565. [
  43566. [[link boost_asio.reference.ip__basic_endpoint.operator_lt__lt_ [*operator<<]]]
  43567. [Output an endpoint as a string. ]
  43568. ]
  43569. ]
  43570. The [link boost_asio.reference.ip__basic_endpoint `ip::basic_endpoint`] class template describes an endpoint that may be associated with a particular socket.
  43571. [heading Thread Safety]
  43572. ['Distinct] ['objects:] Safe.
  43573. ['Shared] ['objects:] Unsafe.
  43574. [heading Requirements]
  43575. ['Header: ][^boost/asio/ip/icmp.hpp]
  43576. ['Convenience header: ][^boost/asio.hpp]
  43577. [endsect]
  43578. [section:family ip::icmp::family]
  43579. [indexterm2 boost_asio.indexterm.ip__icmp.family..family..ip::icmp]
  43580. Obtain an identifier for the protocol family.
  43581. int family() const;
  43582. [endsect]
  43583. [section:operator_not__eq_ ip::icmp::operator!=]
  43584. [indexterm2 boost_asio.indexterm.ip__icmp.operator_not__eq_..operator!=..ip::icmp]
  43585. Compare two protocols for inequality.
  43586. friend bool operator!=(
  43587. const icmp & p1,
  43588. const icmp & p2);
  43589. [heading Requirements]
  43590. ['Header: ][^boost/asio/ip/icmp.hpp]
  43591. ['Convenience header: ][^boost/asio.hpp]
  43592. [endsect]
  43593. [section:operator_eq__eq_ ip::icmp::operator==]
  43594. [indexterm2 boost_asio.indexterm.ip__icmp.operator_eq__eq_..operator==..ip::icmp]
  43595. Compare two protocols for equality.
  43596. friend bool operator==(
  43597. const icmp & p1,
  43598. const icmp & p2);
  43599. [heading Requirements]
  43600. ['Header: ][^boost/asio/ip/icmp.hpp]
  43601. ['Convenience header: ][^boost/asio.hpp]
  43602. [endsect]
  43603. [section:protocol ip::icmp::protocol]
  43604. [indexterm2 boost_asio.indexterm.ip__icmp.protocol..protocol..ip::icmp]
  43605. Obtain an identifier for the protocol.
  43606. int protocol() const;
  43607. [endsect]
  43608. [section:resolver ip::icmp::resolver]
  43609. [indexterm2 boost_asio.indexterm.ip__icmp.resolver..resolver..ip::icmp]
  43610. The ICMP resolver type.
  43611. typedef basic_resolver< icmp > resolver;
  43612. [heading Types]
  43613. [table
  43614. [[Name][Description]]
  43615. [
  43616. [[link boost_asio.reference.ip__basic_resolver__rebind_executor [*rebind_executor]]]
  43617. [Rebinds the resolver type to another executor. ]
  43618. ]
  43619. [
  43620. [[link boost_asio.reference.ip__basic_resolver.endpoint_type [*endpoint_type]]]
  43621. [The endpoint type. ]
  43622. ]
  43623. [
  43624. [[link boost_asio.reference.ip__basic_resolver.executor_type [*executor_type]]]
  43625. [The type of the executor associated with the object. ]
  43626. ]
  43627. [
  43628. [[link boost_asio.reference.ip__basic_resolver.flags [*flags]]]
  43629. [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
  43630. ]
  43631. [
  43632. [[link boost_asio.reference.ip__basic_resolver.iterator [*iterator]]]
  43633. [(Deprecated.) The iterator type. ]
  43634. ]
  43635. [
  43636. [[link boost_asio.reference.ip__basic_resolver.protocol_type [*protocol_type]]]
  43637. [The protocol type. ]
  43638. ]
  43639. [
  43640. [[link boost_asio.reference.ip__basic_resolver.query [*query]]]
  43641. [(Deprecated.) The query type. ]
  43642. ]
  43643. [
  43644. [[link boost_asio.reference.ip__basic_resolver.results_type [*results_type]]]
  43645. [The results type. ]
  43646. ]
  43647. ]
  43648. [heading Member Functions]
  43649. [table
  43650. [[Name][Description]]
  43651. [
  43652. [[link boost_asio.reference.ip__basic_resolver.async_resolve [*async_resolve]]]
  43653. [(Deprecated: Use overload with separate host and service parameters.) Asynchronously perform forward resolution of a query to a list of entries.
  43654. [hr]
  43655. Asynchronously perform forward resolution of a query to a list of entries.
  43656. [hr]
  43657. Asynchronously perform reverse resolution of an endpoint to a list of entries. ]
  43658. ]
  43659. [
  43660. [[link boost_asio.reference.ip__basic_resolver.basic_resolver [*basic_resolver]]]
  43661. [Construct with executor.
  43662. [hr]
  43663. Construct with execution context.
  43664. [hr]
  43665. Move-construct a basic_resolver from another. ]
  43666. ]
  43667. [
  43668. [[link boost_asio.reference.ip__basic_resolver.cancel [*cancel]]]
  43669. [Cancel any asynchronous operations that are waiting on the resolver. ]
  43670. ]
  43671. [
  43672. [[link boost_asio.reference.ip__basic_resolver.get_executor [*get_executor]]]
  43673. [Get the executor associated with the object. ]
  43674. ]
  43675. [
  43676. [[link boost_asio.reference.ip__basic_resolver.operator_eq_ [*operator=]]]
  43677. [Move-assign a basic_resolver from another. ]
  43678. ]
  43679. [
  43680. [[link boost_asio.reference.ip__basic_resolver.resolve [*resolve]]]
  43681. [(Deprecated: Use overload with separate host and service parameters.) Perform forward resolution of a query to a list of entries.
  43682. [hr]
  43683. Perform forward resolution of a query to a list of entries.
  43684. [hr]
  43685. Perform reverse resolution of an endpoint to a list of entries. ]
  43686. ]
  43687. [
  43688. [[link boost_asio.reference.ip__basic_resolver._basic_resolver [*~basic_resolver]]]
  43689. [Destroys the resolver. ]
  43690. ]
  43691. ]
  43692. [heading Data Members]
  43693. [table
  43694. [[Name][Description]]
  43695. [
  43696. [[link boost_asio.reference.ip__basic_resolver.address_configured [*address_configured]]]
  43697. [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. ]
  43698. ]
  43699. [
  43700. [[link boost_asio.reference.ip__basic_resolver.all_matching [*all_matching]]]
  43701. [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
  43702. ]
  43703. [
  43704. [[link boost_asio.reference.ip__basic_resolver.canonical_name [*canonical_name]]]
  43705. [Determine the canonical name of the host specified in the query. ]
  43706. ]
  43707. [
  43708. [[link boost_asio.reference.ip__basic_resolver.numeric_host [*numeric_host]]]
  43709. [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
  43710. ]
  43711. [
  43712. [[link boost_asio.reference.ip__basic_resolver.numeric_service [*numeric_service]]]
  43713. [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
  43714. ]
  43715. [
  43716. [[link boost_asio.reference.ip__basic_resolver.passive [*passive]]]
  43717. [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
  43718. ]
  43719. [
  43720. [[link boost_asio.reference.ip__basic_resolver.v4_mapped [*v4_mapped]]]
  43721. [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
  43722. ]
  43723. ]
  43724. The [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] class template provides the ability to resolve a query to a list of endpoints.
  43725. [heading Thread Safety]
  43726. ['Distinct] ['objects:] Safe.
  43727. ['Shared] ['objects:] Unsafe.
  43728. [heading Requirements]
  43729. ['Header: ][^boost/asio/ip/icmp.hpp]
  43730. ['Convenience header: ][^boost/asio.hpp]
  43731. [endsect]
  43732. [section:socket ip::icmp::socket]
  43733. [indexterm2 boost_asio.indexterm.ip__icmp.socket..socket..ip::icmp]
  43734. The ICMP socket type.
  43735. typedef basic_raw_socket< icmp > socket;
  43736. [heading Types]
  43737. [table
  43738. [[Name][Description]]
  43739. [
  43740. [[link boost_asio.reference.basic_raw_socket__rebind_executor [*rebind_executor]]]
  43741. [Rebinds the socket type to another executor. ]
  43742. ]
  43743. [
  43744. [[link boost_asio.reference.basic_raw_socket.broadcast [*broadcast]]]
  43745. [Socket option to permit sending of broadcast messages. ]
  43746. ]
  43747. [
  43748. [[link boost_asio.reference.basic_raw_socket.bytes_readable [*bytes_readable]]]
  43749. [IO control command to get the amount of data that can be read without blocking. ]
  43750. ]
  43751. [
  43752. [[link boost_asio.reference.basic_raw_socket.debug [*debug]]]
  43753. [Socket option to enable socket-level debugging. ]
  43754. ]
  43755. [
  43756. [[link boost_asio.reference.basic_raw_socket.do_not_route [*do_not_route]]]
  43757. [Socket option to prevent routing, use local interfaces only. ]
  43758. ]
  43759. [
  43760. [[link boost_asio.reference.basic_raw_socket.enable_connection_aborted [*enable_connection_aborted]]]
  43761. [Socket option to report aborted connections on accept. ]
  43762. ]
  43763. [
  43764. [[link boost_asio.reference.basic_raw_socket.endpoint_type [*endpoint_type]]]
  43765. [The endpoint type. ]
  43766. ]
  43767. [
  43768. [[link boost_asio.reference.basic_raw_socket.executor_type [*executor_type]]]
  43769. [The type of the executor associated with the object. ]
  43770. ]
  43771. [
  43772. [[link boost_asio.reference.basic_raw_socket.keep_alive [*keep_alive]]]
  43773. [Socket option to send keep-alives. ]
  43774. ]
  43775. [
  43776. [[link boost_asio.reference.basic_raw_socket.linger [*linger]]]
  43777. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  43778. ]
  43779. [
  43780. [[link boost_asio.reference.basic_raw_socket.lowest_layer_type [*lowest_layer_type]]]
  43781. [A basic_socket is always the lowest layer. ]
  43782. ]
  43783. [
  43784. [[link boost_asio.reference.basic_raw_socket.message_flags [*message_flags]]]
  43785. [Bitmask type for flags that can be passed to send and receive operations. ]
  43786. ]
  43787. [
  43788. [[link boost_asio.reference.basic_raw_socket.native_handle_type [*native_handle_type]]]
  43789. [The native representation of a socket. ]
  43790. ]
  43791. [
  43792. [[link boost_asio.reference.basic_raw_socket.out_of_band_inline [*out_of_band_inline]]]
  43793. [Socket option for putting received out-of-band data inline. ]
  43794. ]
  43795. [
  43796. [[link boost_asio.reference.basic_raw_socket.protocol_type [*protocol_type]]]
  43797. [The protocol type. ]
  43798. ]
  43799. [
  43800. [[link boost_asio.reference.basic_raw_socket.receive_buffer_size [*receive_buffer_size]]]
  43801. [Socket option for the receive buffer size of a socket. ]
  43802. ]
  43803. [
  43804. [[link boost_asio.reference.basic_raw_socket.receive_low_watermark [*receive_low_watermark]]]
  43805. [Socket option for the receive low watermark. ]
  43806. ]
  43807. [
  43808. [[link boost_asio.reference.basic_raw_socket.reuse_address [*reuse_address]]]
  43809. [Socket option to allow the socket to be bound to an address that is already in use. ]
  43810. ]
  43811. [
  43812. [[link boost_asio.reference.basic_raw_socket.send_buffer_size [*send_buffer_size]]]
  43813. [Socket option for the send buffer size of a socket. ]
  43814. ]
  43815. [
  43816. [[link boost_asio.reference.basic_raw_socket.send_low_watermark [*send_low_watermark]]]
  43817. [Socket option for the send low watermark. ]
  43818. ]
  43819. [
  43820. [[link boost_asio.reference.basic_raw_socket.shutdown_type [*shutdown_type]]]
  43821. [Different ways a socket may be shutdown. ]
  43822. ]
  43823. [
  43824. [[link boost_asio.reference.basic_raw_socket.wait_type [*wait_type]]]
  43825. [Wait types. ]
  43826. ]
  43827. ]
  43828. [heading Member Functions]
  43829. [table
  43830. [[Name][Description]]
  43831. [
  43832. [[link boost_asio.reference.basic_raw_socket.assign [*assign]]]
  43833. [Assign an existing native socket to the socket. ]
  43834. ]
  43835. [
  43836. [[link boost_asio.reference.basic_raw_socket.async_connect [*async_connect]]]
  43837. [Start an asynchronous connect. ]
  43838. ]
  43839. [
  43840. [[link boost_asio.reference.basic_raw_socket.async_receive [*async_receive]]]
  43841. [Start an asynchronous receive on a connected socket. ]
  43842. ]
  43843. [
  43844. [[link boost_asio.reference.basic_raw_socket.async_receive_from [*async_receive_from]]]
  43845. [Start an asynchronous receive. ]
  43846. ]
  43847. [
  43848. [[link boost_asio.reference.basic_raw_socket.async_send [*async_send]]]
  43849. [Start an asynchronous send on a connected socket. ]
  43850. ]
  43851. [
  43852. [[link boost_asio.reference.basic_raw_socket.async_send_to [*async_send_to]]]
  43853. [Start an asynchronous send. ]
  43854. ]
  43855. [
  43856. [[link boost_asio.reference.basic_raw_socket.async_wait [*async_wait]]]
  43857. [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  43858. ]
  43859. [
  43860. [[link boost_asio.reference.basic_raw_socket.at_mark [*at_mark]]]
  43861. [Determine whether the socket is at the out-of-band data mark. ]
  43862. ]
  43863. [
  43864. [[link boost_asio.reference.basic_raw_socket.available [*available]]]
  43865. [Determine the number of bytes available for reading. ]
  43866. ]
  43867. [
  43868. [[link boost_asio.reference.basic_raw_socket.basic_raw_socket [*basic_raw_socket]]]
  43869. [Construct a basic_raw_socket without opening it.
  43870. [hr]
  43871. Construct and open a basic_raw_socket.
  43872. [hr]
  43873. Construct a basic_raw_socket, opening it and binding it to the given local endpoint.
  43874. [hr]
  43875. Construct a basic_raw_socket on an existing native socket.
  43876. [hr]
  43877. Move-construct a basic_raw_socket from another.
  43878. [hr]
  43879. Move-construct a basic_raw_socket from a socket of another protocol type. ]
  43880. ]
  43881. [
  43882. [[link boost_asio.reference.basic_raw_socket.bind [*bind]]]
  43883. [Bind the socket to the given local endpoint. ]
  43884. ]
  43885. [
  43886. [[link boost_asio.reference.basic_raw_socket.cancel [*cancel]]]
  43887. [Cancel all asynchronous operations associated with the socket. ]
  43888. ]
  43889. [
  43890. [[link boost_asio.reference.basic_raw_socket.close [*close]]]
  43891. [Close the socket. ]
  43892. ]
  43893. [
  43894. [[link boost_asio.reference.basic_raw_socket.connect [*connect]]]
  43895. [Connect the socket to the specified endpoint. ]
  43896. ]
  43897. [
  43898. [[link boost_asio.reference.basic_raw_socket.get_executor [*get_executor]]]
  43899. [Get the executor associated with the object. ]
  43900. ]
  43901. [
  43902. [[link boost_asio.reference.basic_raw_socket.get_option [*get_option]]]
  43903. [Get an option from the socket. ]
  43904. ]
  43905. [
  43906. [[link boost_asio.reference.basic_raw_socket.io_control [*io_control]]]
  43907. [Perform an IO control command on the socket. ]
  43908. ]
  43909. [
  43910. [[link boost_asio.reference.basic_raw_socket.is_open [*is_open]]]
  43911. [Determine whether the socket is open. ]
  43912. ]
  43913. [
  43914. [[link boost_asio.reference.basic_raw_socket.local_endpoint [*local_endpoint]]]
  43915. [Get the local endpoint of the socket. ]
  43916. ]
  43917. [
  43918. [[link boost_asio.reference.basic_raw_socket.lowest_layer [*lowest_layer]]]
  43919. [Get a reference to the lowest layer.
  43920. [hr]
  43921. Get a const reference to the lowest layer. ]
  43922. ]
  43923. [
  43924. [[link boost_asio.reference.basic_raw_socket.native_handle [*native_handle]]]
  43925. [Get the native socket representation. ]
  43926. ]
  43927. [
  43928. [[link boost_asio.reference.basic_raw_socket.native_non_blocking [*native_non_blocking]]]
  43929. [Gets the non-blocking mode of the native socket implementation.
  43930. [hr]
  43931. Sets the non-blocking mode of the native socket implementation. ]
  43932. ]
  43933. [
  43934. [[link boost_asio.reference.basic_raw_socket.non_blocking [*non_blocking]]]
  43935. [Gets the non-blocking mode of the socket.
  43936. [hr]
  43937. Sets the non-blocking mode of the socket. ]
  43938. ]
  43939. [
  43940. [[link boost_asio.reference.basic_raw_socket.open [*open]]]
  43941. [Open the socket using the specified protocol. ]
  43942. ]
  43943. [
  43944. [[link boost_asio.reference.basic_raw_socket.operator_eq_ [*operator=]]]
  43945. [Move-assign a basic_raw_socket from another.
  43946. [hr]
  43947. Move-assign a basic_raw_socket from a socket of another protocol type. ]
  43948. ]
  43949. [
  43950. [[link boost_asio.reference.basic_raw_socket.receive [*receive]]]
  43951. [Receive some data on a connected socket. ]
  43952. ]
  43953. [
  43954. [[link boost_asio.reference.basic_raw_socket.receive_from [*receive_from]]]
  43955. [Receive raw data with the endpoint of the sender. ]
  43956. ]
  43957. [
  43958. [[link boost_asio.reference.basic_raw_socket.release [*release]]]
  43959. [Release ownership of the underlying native socket. ]
  43960. ]
  43961. [
  43962. [[link boost_asio.reference.basic_raw_socket.remote_endpoint [*remote_endpoint]]]
  43963. [Get the remote endpoint of the socket. ]
  43964. ]
  43965. [
  43966. [[link boost_asio.reference.basic_raw_socket.send [*send]]]
  43967. [Send some data on a connected socket. ]
  43968. ]
  43969. [
  43970. [[link boost_asio.reference.basic_raw_socket.send_to [*send_to]]]
  43971. [Send raw data to the specified endpoint. ]
  43972. ]
  43973. [
  43974. [[link boost_asio.reference.basic_raw_socket.set_option [*set_option]]]
  43975. [Set an option on the socket. ]
  43976. ]
  43977. [
  43978. [[link boost_asio.reference.basic_raw_socket.shutdown [*shutdown]]]
  43979. [Disable sends or receives on the socket. ]
  43980. ]
  43981. [
  43982. [[link boost_asio.reference.basic_raw_socket.wait [*wait]]]
  43983. [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  43984. ]
  43985. [
  43986. [[link boost_asio.reference.basic_raw_socket._basic_raw_socket [*~basic_raw_socket]]]
  43987. [Destroys the socket. ]
  43988. ]
  43989. ]
  43990. [heading Data Members]
  43991. [table
  43992. [[Name][Description]]
  43993. [
  43994. [[link boost_asio.reference.basic_raw_socket.max_connections [*max_connections]]]
  43995. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  43996. ]
  43997. [
  43998. [[link boost_asio.reference.basic_raw_socket.max_listen_connections [*max_listen_connections]]]
  43999. [The maximum length of the queue of pending incoming connections. ]
  44000. ]
  44001. [
  44002. [[link boost_asio.reference.basic_raw_socket.message_do_not_route [*message_do_not_route]]]
  44003. [Specify that the data should not be subject to routing. ]
  44004. ]
  44005. [
  44006. [[link boost_asio.reference.basic_raw_socket.message_end_of_record [*message_end_of_record]]]
  44007. [Specifies that the data marks the end of a record. ]
  44008. ]
  44009. [
  44010. [[link boost_asio.reference.basic_raw_socket.message_out_of_band [*message_out_of_band]]]
  44011. [Process out-of-band data. ]
  44012. ]
  44013. [
  44014. [[link boost_asio.reference.basic_raw_socket.message_peek [*message_peek]]]
  44015. [Peek at incoming data without removing it from the input queue. ]
  44016. ]
  44017. ]
  44018. [heading Protected Data Members]
  44019. [table
  44020. [[Name][Description]]
  44021. [
  44022. [[link boost_asio.reference.basic_raw_socket.impl_ [*impl_]]]
  44023. []
  44024. ]
  44025. ]
  44026. The [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] class template provides asynchronous and blocking raw-oriented socket functionality.
  44027. [heading Thread Safety]
  44028. ['Distinct] ['objects:] Safe.
  44029. ['Shared] ['objects:] Unsafe.
  44030. [heading Requirements]
  44031. ['Header: ][^boost/asio/ip/icmp.hpp]
  44032. ['Convenience header: ][^boost/asio.hpp]
  44033. [endsect]
  44034. [section:type ip::icmp::type]
  44035. [indexterm2 boost_asio.indexterm.ip__icmp.type..type..ip::icmp]
  44036. Obtain an identifier for the type of the protocol.
  44037. int type() const;
  44038. [endsect]
  44039. [section:v4 ip::icmp::v4]
  44040. [indexterm2 boost_asio.indexterm.ip__icmp.v4..v4..ip::icmp]
  44041. Construct to represent the IPv4 ICMP protocol.
  44042. static icmp v4();
  44043. [endsect]
  44044. [section:v6 ip::icmp::v6]
  44045. [indexterm2 boost_asio.indexterm.ip__icmp.v6..v6..ip::icmp]
  44046. Construct to represent the IPv6 ICMP protocol.
  44047. static icmp v6();
  44048. [endsect]
  44049. [endsect]
  44050. [section:ip__multicast__enable_loopback ip::multicast::enable_loopback]
  44051. [indexterm1 boost_asio.indexterm.ip__multicast__enable_loopback..ip::multicast::enable_loopback]
  44052. Socket option determining whether outgoing multicast packets will be received on the same socket if it is a member of the multicast group.
  44053. typedef implementation_defined enable_loopback;
  44054. Implements the IPPROTO\_IP/IP\_MULTICAST\_LOOP socket option.
  44055. [heading Examples]
  44056. Setting the option:
  44057. boost::asio::ip::udp::socket socket(my_context);
  44058. ...
  44059. boost::asio::ip::multicast::enable_loopback option(true);
  44060. socket.set_option(option);
  44061. Getting the current option value:
  44062. boost::asio::ip::udp::socket socket(my_context);
  44063. ...
  44064. boost::asio::ip::multicast::enable_loopback option;
  44065. socket.get_option(option);
  44066. bool is_set = option.value();
  44067. [heading Requirements]
  44068. ['Header: ][^boost/asio/ip/multicast.hpp]
  44069. ['Convenience header: ][^boost/asio.hpp]
  44070. [endsect]
  44071. [section:ip__multicast__hops ip::multicast::hops]
  44072. [indexterm1 boost_asio.indexterm.ip__multicast__hops..ip::multicast::hops]
  44073. Socket option for time-to-live associated with outgoing multicast packets.
  44074. typedef implementation_defined hops;
  44075. Implements the IPPROTO\_IP/IP\_MULTICAST\_TTL socket option.
  44076. [heading Examples]
  44077. Setting the option:
  44078. boost::asio::ip::udp::socket socket(my_context);
  44079. ...
  44080. boost::asio::ip::multicast::hops option(4);
  44081. socket.set_option(option);
  44082. Getting the current option value:
  44083. boost::asio::ip::udp::socket socket(my_context);
  44084. ...
  44085. boost::asio::ip::multicast::hops option;
  44086. socket.get_option(option);
  44087. int ttl = option.value();
  44088. [heading Requirements]
  44089. ['Header: ][^boost/asio/ip/multicast.hpp]
  44090. ['Convenience header: ][^boost/asio.hpp]
  44091. [endsect]
  44092. [section:ip__multicast__join_group ip::multicast::join_group]
  44093. [indexterm1 boost_asio.indexterm.ip__multicast__join_group..ip::multicast::join_group]
  44094. Socket option to join a multicast group on a specified interface.
  44095. typedef implementation_defined join_group;
  44096. Implements the IPPROTO\_IP/IP\_ADD\_MEMBERSHIP socket option.
  44097. [heading Examples]
  44098. Setting the option to join a multicast group:
  44099. boost::asio::ip::udp::socket socket(my_context);
  44100. ...
  44101. boost::asio::ip::address multicast_address =
  44102. boost::asio::ip::address::from_string("225.0.0.1");
  44103. boost::asio::ip::multicast::join_group option(multicast_address);
  44104. socket.set_option(option);
  44105. [heading Requirements]
  44106. ['Header: ][^boost/asio/ip/multicast.hpp]
  44107. ['Convenience header: ][^boost/asio.hpp]
  44108. [endsect]
  44109. [section:ip__multicast__leave_group ip::multicast::leave_group]
  44110. [indexterm1 boost_asio.indexterm.ip__multicast__leave_group..ip::multicast::leave_group]
  44111. Socket option to leave a multicast group on a specified interface.
  44112. typedef implementation_defined leave_group;
  44113. Implements the IPPROTO\_IP/IP\_DROP\_MEMBERSHIP socket option.
  44114. [heading Examples]
  44115. Setting the option to leave a multicast group:
  44116. boost::asio::ip::udp::socket socket(my_context);
  44117. ...
  44118. boost::asio::ip::address multicast_address =
  44119. boost::asio::ip::address::from_string("225.0.0.1");
  44120. boost::asio::ip::multicast::leave_group option(multicast_address);
  44121. socket.set_option(option);
  44122. [heading Requirements]
  44123. ['Header: ][^boost/asio/ip/multicast.hpp]
  44124. ['Convenience header: ][^boost/asio.hpp]
  44125. [endsect]
  44126. [section:ip__multicast__outbound_interface ip::multicast::outbound_interface]
  44127. [indexterm1 boost_asio.indexterm.ip__multicast__outbound_interface..ip::multicast::outbound_interface]
  44128. Socket option for local interface to use for outgoing multicast packets.
  44129. typedef implementation_defined outbound_interface;
  44130. Implements the IPPROTO\_IP/IP\_MULTICAST\_IF socket option.
  44131. [heading Examples]
  44132. Setting the option:
  44133. boost::asio::ip::udp::socket socket(my_context);
  44134. ...
  44135. boost::asio::ip::address_v4 local_interface =
  44136. boost::asio::ip::address_v4::from_string("1.2.3.4");
  44137. boost::asio::ip::multicast::outbound_interface option(local_interface);
  44138. socket.set_option(option);
  44139. [heading Requirements]
  44140. ['Header: ][^boost/asio/ip/multicast.hpp]
  44141. ['Convenience header: ][^boost/asio.hpp]
  44142. [endsect]
  44143. [section:ip__network_v4 ip::network_v4]
  44144. Represents an IPv4 network.
  44145. class network_v4
  44146. [heading Member Functions]
  44147. [table
  44148. [[Name][Description]]
  44149. [
  44150. [[link boost_asio.reference.ip__network_v4.address [*address]]]
  44151. [Obtain the address object specified when the network object was created. ]
  44152. ]
  44153. [
  44154. [[link boost_asio.reference.ip__network_v4.broadcast [*broadcast]]]
  44155. [Obtain an address object that represents the network's broadcast address. ]
  44156. ]
  44157. [
  44158. [[link boost_asio.reference.ip__network_v4.canonical [*canonical]]]
  44159. [Obtain the true network address, omitting any host bits. ]
  44160. ]
  44161. [
  44162. [[link boost_asio.reference.ip__network_v4.hosts [*hosts]]]
  44163. [Obtain an address range corresponding to the hosts in the network. ]
  44164. ]
  44165. [
  44166. [[link boost_asio.reference.ip__network_v4.is_host [*is_host]]]
  44167. [Test if network is a valid host address. ]
  44168. ]
  44169. [
  44170. [[link boost_asio.reference.ip__network_v4.is_subnet_of [*is_subnet_of]]]
  44171. [Test if a network is a real subnet of another network. ]
  44172. ]
  44173. [
  44174. [[link boost_asio.reference.ip__network_v4.netmask [*netmask]]]
  44175. [Obtain the netmask that was specified when the network object was created. ]
  44176. ]
  44177. [
  44178. [[link boost_asio.reference.ip__network_v4.network [*network]]]
  44179. [Obtain an address object that represents the network address. ]
  44180. ]
  44181. [
  44182. [[link boost_asio.reference.ip__network_v4.network_v4 [*network_v4]]]
  44183. [Default constructor.
  44184. [hr]
  44185. Construct a network based on the specified address and prefix length.
  44186. [hr]
  44187. Construct network based on the specified address and netmask.
  44188. [hr]
  44189. Copy constructor. ]
  44190. ]
  44191. [
  44192. [[link boost_asio.reference.ip__network_v4.operator_eq_ [*operator=]]]
  44193. [Assign from another network. ]
  44194. ]
  44195. [
  44196. [[link boost_asio.reference.ip__network_v4.prefix_length [*prefix_length]]]
  44197. [Obtain the prefix length that was specified when the network object was created. ]
  44198. ]
  44199. [
  44200. [[link boost_asio.reference.ip__network_v4.to_string [*to_string]]]
  44201. [Get the network as an address in dotted decimal format. ]
  44202. ]
  44203. ]
  44204. [heading Friends]
  44205. [table
  44206. [[Name][Description]]
  44207. [
  44208. [[link boost_asio.reference.ip__network_v4.operator_not__eq_ [*operator!=]]]
  44209. [Compare two networks for inequality. ]
  44210. ]
  44211. [
  44212. [[link boost_asio.reference.ip__network_v4.operator_eq__eq_ [*operator==]]]
  44213. [Compare two networks for equality. ]
  44214. ]
  44215. ]
  44216. [heading Related Functions]
  44217. [table
  44218. [[Name][Description]]
  44219. [
  44220. [[link boost_asio.reference.ip__network_v4.make_network_v4 [*make_network_v4]]]
  44221. [Create an IPv4 network from a string containing IP address and prefix length. ]
  44222. ]
  44223. ]
  44224. The [link boost_asio.reference.ip__network_v4 `ip::network_v4`] class provides the ability to use and manipulate IP version 4 networks.
  44225. [heading Thread Safety]
  44226. ['Distinct] ['objects:] Safe.
  44227. ['Shared] ['objects:] Unsafe.
  44228. [heading Requirements]
  44229. ['Header: ][^boost/asio/ip/network_v4.hpp]
  44230. ['Convenience header: ][^boost/asio.hpp]
  44231. [section:address ip::network_v4::address]
  44232. [indexterm2 boost_asio.indexterm.ip__network_v4.address..address..ip::network_v4]
  44233. Obtain the address object specified when the network object was created.
  44234. address_v4 address() const;
  44235. [endsect]
  44236. [section:broadcast ip::network_v4::broadcast]
  44237. [indexterm2 boost_asio.indexterm.ip__network_v4.broadcast..broadcast..ip::network_v4]
  44238. Obtain an address object that represents the network's broadcast address.
  44239. address_v4 broadcast() const;
  44240. [endsect]
  44241. [section:canonical ip::network_v4::canonical]
  44242. [indexterm2 boost_asio.indexterm.ip__network_v4.canonical..canonical..ip::network_v4]
  44243. Obtain the true network address, omitting any host bits.
  44244. network_v4 canonical() const;
  44245. [endsect]
  44246. [section:hosts ip::network_v4::hosts]
  44247. [indexterm2 boost_asio.indexterm.ip__network_v4.hosts..hosts..ip::network_v4]
  44248. Obtain an address range corresponding to the hosts in the network.
  44249. address_v4_range hosts() const;
  44250. [endsect]
  44251. [section:is_host ip::network_v4::is_host]
  44252. [indexterm2 boost_asio.indexterm.ip__network_v4.is_host..is_host..ip::network_v4]
  44253. Test if network is a valid host address.
  44254. bool is_host() const;
  44255. [endsect]
  44256. [section:is_subnet_of ip::network_v4::is_subnet_of]
  44257. [indexterm2 boost_asio.indexterm.ip__network_v4.is_subnet_of..is_subnet_of..ip::network_v4]
  44258. Test if a network is a real subnet of another network.
  44259. bool is_subnet_of(
  44260. const network_v4 & other) const;
  44261. [endsect]
  44262. [section:make_network_v4 ip::network_v4::make_network_v4]
  44263. [indexterm2 boost_asio.indexterm.ip__network_v4.make_network_v4..make_network_v4..ip::network_v4]
  44264. Create an IPv4 network from a string containing IP address and prefix length.
  44265. network_v4 ``[link boost_asio.reference.ip__network_v4.make_network_v4.overload1 make_network_v4]``(
  44266. const char * str);
  44267. `` [''''&raquo;''' [link boost_asio.reference.ip__network_v4.make_network_v4.overload1 more...]]``
  44268. network_v4 ``[link boost_asio.reference.ip__network_v4.make_network_v4.overload2 make_network_v4]``(
  44269. const char * str,
  44270. boost::system::error_code & ec);
  44271. `` [''''&raquo;''' [link boost_asio.reference.ip__network_v4.make_network_v4.overload2 more...]]``
  44272. network_v4 ``[link boost_asio.reference.ip__network_v4.make_network_v4.overload3 make_network_v4]``(
  44273. const std::string & str);
  44274. `` [''''&raquo;''' [link boost_asio.reference.ip__network_v4.make_network_v4.overload3 more...]]``
  44275. network_v4 ``[link boost_asio.reference.ip__network_v4.make_network_v4.overload4 make_network_v4]``(
  44276. const std::string & str,
  44277. boost::system::error_code & ec);
  44278. `` [''''&raquo;''' [link boost_asio.reference.ip__network_v4.make_network_v4.overload4 more...]]``
  44279. network_v4 ``[link boost_asio.reference.ip__network_v4.make_network_v4.overload5 make_network_v4]``(
  44280. string_view str);
  44281. `` [''''&raquo;''' [link boost_asio.reference.ip__network_v4.make_network_v4.overload5 more...]]``
  44282. network_v4 ``[link boost_asio.reference.ip__network_v4.make_network_v4.overload6 make_network_v4]``(
  44283. string_view str,
  44284. boost::system::error_code & ec);
  44285. `` [''''&raquo;''' [link boost_asio.reference.ip__network_v4.make_network_v4.overload6 more...]]``
  44286. [section:overload1 ip::network_v4::make_network_v4 (1 of 6 overloads)]
  44287. Create an IPv4 network from a string containing IP address and prefix length.
  44288. network_v4 make_network_v4(
  44289. const char * str);
  44290. [endsect]
  44291. [section:overload2 ip::network_v4::make_network_v4 (2 of 6 overloads)]
  44292. Create an IPv4 network from a string containing IP address and prefix length.
  44293. network_v4 make_network_v4(
  44294. const char * str,
  44295. boost::system::error_code & ec);
  44296. [endsect]
  44297. [section:overload3 ip::network_v4::make_network_v4 (3 of 6 overloads)]
  44298. Create an IPv4 network from a string containing IP address and prefix length.
  44299. network_v4 make_network_v4(
  44300. const std::string & str);
  44301. [endsect]
  44302. [section:overload4 ip::network_v4::make_network_v4 (4 of 6 overloads)]
  44303. Create an IPv4 network from a string containing IP address and prefix length.
  44304. network_v4 make_network_v4(
  44305. const std::string & str,
  44306. boost::system::error_code & ec);
  44307. [endsect]
  44308. [section:overload5 ip::network_v4::make_network_v4 (5 of 6 overloads)]
  44309. Create an IPv4 network from a string containing IP address and prefix length.
  44310. network_v4 make_network_v4(
  44311. string_view str);
  44312. [endsect]
  44313. [section:overload6 ip::network_v4::make_network_v4 (6 of 6 overloads)]
  44314. Create an IPv4 network from a string containing IP address and prefix length.
  44315. network_v4 make_network_v4(
  44316. string_view str,
  44317. boost::system::error_code & ec);
  44318. [endsect]
  44319. [endsect]
  44320. [section:netmask ip::network_v4::netmask]
  44321. [indexterm2 boost_asio.indexterm.ip__network_v4.netmask..netmask..ip::network_v4]
  44322. Obtain the netmask that was specified when the network object was created.
  44323. address_v4 netmask() const;
  44324. [endsect]
  44325. [section:network ip::network_v4::network]
  44326. [indexterm2 boost_asio.indexterm.ip__network_v4.network..network..ip::network_v4]
  44327. Obtain an address object that represents the network address.
  44328. address_v4 network() const;
  44329. [endsect]
  44330. [section:network_v4 ip::network_v4::network_v4]
  44331. [indexterm2 boost_asio.indexterm.ip__network_v4.network_v4..network_v4..ip::network_v4]
  44332. Default constructor.
  44333. ``[link boost_asio.reference.ip__network_v4.network_v4.overload1 network_v4]``();
  44334. `` [''''&raquo;''' [link boost_asio.reference.ip__network_v4.network_v4.overload1 more...]]``
  44335. Construct a network based on the specified address and prefix length.
  44336. ``[link boost_asio.reference.ip__network_v4.network_v4.overload2 network_v4]``(
  44337. const address_v4 & addr,
  44338. unsigned short prefix_len);
  44339. `` [''''&raquo;''' [link boost_asio.reference.ip__network_v4.network_v4.overload2 more...]]``
  44340. Construct network based on the specified address and netmask.
  44341. ``[link boost_asio.reference.ip__network_v4.network_v4.overload3 network_v4]``(
  44342. const address_v4 & addr,
  44343. const address_v4 & mask);
  44344. `` [''''&raquo;''' [link boost_asio.reference.ip__network_v4.network_v4.overload3 more...]]``
  44345. Copy constructor.
  44346. ``[link boost_asio.reference.ip__network_v4.network_v4.overload4 network_v4]``(
  44347. const network_v4 & other);
  44348. `` [''''&raquo;''' [link boost_asio.reference.ip__network_v4.network_v4.overload4 more...]]``
  44349. [section:overload1 ip::network_v4::network_v4 (1 of 4 overloads)]
  44350. Default constructor.
  44351. network_v4();
  44352. [endsect]
  44353. [section:overload2 ip::network_v4::network_v4 (2 of 4 overloads)]
  44354. Construct a network based on the specified address and prefix length.
  44355. network_v4(
  44356. const address_v4 & addr,
  44357. unsigned short prefix_len);
  44358. [endsect]
  44359. [section:overload3 ip::network_v4::network_v4 (3 of 4 overloads)]
  44360. Construct network based on the specified address and netmask.
  44361. network_v4(
  44362. const address_v4 & addr,
  44363. const address_v4 & mask);
  44364. [endsect]
  44365. [section:overload4 ip::network_v4::network_v4 (4 of 4 overloads)]
  44366. Copy constructor.
  44367. network_v4(
  44368. const network_v4 & other);
  44369. [endsect]
  44370. [endsect]
  44371. [section:operator_not__eq_ ip::network_v4::operator!=]
  44372. [indexterm2 boost_asio.indexterm.ip__network_v4.operator_not__eq_..operator!=..ip::network_v4]
  44373. Compare two networks for inequality.
  44374. friend bool operator!=(
  44375. const network_v4 & a,
  44376. const network_v4 & b);
  44377. [heading Requirements]
  44378. ['Header: ][^boost/asio/ip/network_v4.hpp]
  44379. ['Convenience header: ][^boost/asio.hpp]
  44380. [endsect]
  44381. [section:operator_eq_ ip::network_v4::operator=]
  44382. [indexterm2 boost_asio.indexterm.ip__network_v4.operator_eq_..operator=..ip::network_v4]
  44383. Assign from another network.
  44384. network_v4 & operator=(
  44385. const network_v4 & other);
  44386. [endsect]
  44387. [section:operator_eq__eq_ ip::network_v4::operator==]
  44388. [indexterm2 boost_asio.indexterm.ip__network_v4.operator_eq__eq_..operator==..ip::network_v4]
  44389. Compare two networks for equality.
  44390. friend bool operator==(
  44391. const network_v4 & a,
  44392. const network_v4 & b);
  44393. [heading Requirements]
  44394. ['Header: ][^boost/asio/ip/network_v4.hpp]
  44395. ['Convenience header: ][^boost/asio.hpp]
  44396. [endsect]
  44397. [section:prefix_length ip::network_v4::prefix_length]
  44398. [indexterm2 boost_asio.indexterm.ip__network_v4.prefix_length..prefix_length..ip::network_v4]
  44399. Obtain the prefix length that was specified when the network object was created.
  44400. unsigned short prefix_length() const;
  44401. [endsect]
  44402. [section:to_string ip::network_v4::to_string]
  44403. [indexterm2 boost_asio.indexterm.ip__network_v4.to_string..to_string..ip::network_v4]
  44404. Get the network as an address in dotted decimal format.
  44405. std::string ``[link boost_asio.reference.ip__network_v4.to_string.overload1 to_string]``() const;
  44406. `` [''''&raquo;''' [link boost_asio.reference.ip__network_v4.to_string.overload1 more...]]``
  44407. std::string ``[link boost_asio.reference.ip__network_v4.to_string.overload2 to_string]``(
  44408. boost::system::error_code & ec) const;
  44409. `` [''''&raquo;''' [link boost_asio.reference.ip__network_v4.to_string.overload2 more...]]``
  44410. [section:overload1 ip::network_v4::to_string (1 of 2 overloads)]
  44411. Get the network as an address in dotted decimal format.
  44412. std::string to_string() const;
  44413. [endsect]
  44414. [section:overload2 ip::network_v4::to_string (2 of 2 overloads)]
  44415. Get the network as an address in dotted decimal format.
  44416. std::string to_string(
  44417. boost::system::error_code & ec) const;
  44418. [endsect]
  44419. [endsect]
  44420. [endsect]
  44421. [section:ip__network_v6 ip::network_v6]
  44422. Represents an IPv6 network.
  44423. class network_v6
  44424. [heading Member Functions]
  44425. [table
  44426. [[Name][Description]]
  44427. [
  44428. [[link boost_asio.reference.ip__network_v6.address [*address]]]
  44429. [Obtain the address object specified when the network object was created. ]
  44430. ]
  44431. [
  44432. [[link boost_asio.reference.ip__network_v6.canonical [*canonical]]]
  44433. [Obtain the true network address, omitting any host bits. ]
  44434. ]
  44435. [
  44436. [[link boost_asio.reference.ip__network_v6.hosts [*hosts]]]
  44437. [Obtain an address range corresponding to the hosts in the network. ]
  44438. ]
  44439. [
  44440. [[link boost_asio.reference.ip__network_v6.is_host [*is_host]]]
  44441. [Test if network is a valid host address. ]
  44442. ]
  44443. [
  44444. [[link boost_asio.reference.ip__network_v6.is_subnet_of [*is_subnet_of]]]
  44445. [Test if a network is a real subnet of another network. ]
  44446. ]
  44447. [
  44448. [[link boost_asio.reference.ip__network_v6.network [*network]]]
  44449. [Obtain an address object that represents the network address. ]
  44450. ]
  44451. [
  44452. [[link boost_asio.reference.ip__network_v6.network_v6 [*network_v6]]]
  44453. [Default constructor.
  44454. [hr]
  44455. Construct a network based on the specified address and prefix length.
  44456. [hr]
  44457. Copy constructor. ]
  44458. ]
  44459. [
  44460. [[link boost_asio.reference.ip__network_v6.operator_eq_ [*operator=]]]
  44461. [Assign from another network. ]
  44462. ]
  44463. [
  44464. [[link boost_asio.reference.ip__network_v6.prefix_length [*prefix_length]]]
  44465. [Obtain the prefix length that was specified when the network object was created. ]
  44466. ]
  44467. [
  44468. [[link boost_asio.reference.ip__network_v6.to_string [*to_string]]]
  44469. [Get the network as an address in dotted decimal format. ]
  44470. ]
  44471. ]
  44472. [heading Friends]
  44473. [table
  44474. [[Name][Description]]
  44475. [
  44476. [[link boost_asio.reference.ip__network_v6.operator_not__eq_ [*operator!=]]]
  44477. [Compare two networks for inequality. ]
  44478. ]
  44479. [
  44480. [[link boost_asio.reference.ip__network_v6.operator_eq__eq_ [*operator==]]]
  44481. [Compare two networks for equality. ]
  44482. ]
  44483. ]
  44484. [heading Related Functions]
  44485. [table
  44486. [[Name][Description]]
  44487. [
  44488. [[link boost_asio.reference.ip__network_v6.make_network_v6 [*make_network_v6]]]
  44489. [Create an IPv6 network from a string containing IP address and prefix length. ]
  44490. ]
  44491. ]
  44492. The [link boost_asio.reference.ip__network_v6 `ip::network_v6`] class provides the ability to use and manipulate IP version 6 networks.
  44493. [heading Thread Safety]
  44494. ['Distinct] ['objects:] Safe.
  44495. ['Shared] ['objects:] Unsafe.
  44496. [heading Requirements]
  44497. ['Header: ][^boost/asio/ip/network_v6.hpp]
  44498. ['Convenience header: ][^boost/asio.hpp]
  44499. [section:address ip::network_v6::address]
  44500. [indexterm2 boost_asio.indexterm.ip__network_v6.address..address..ip::network_v6]
  44501. Obtain the address object specified when the network object was created.
  44502. address_v6 address() const;
  44503. [endsect]
  44504. [section:canonical ip::network_v6::canonical]
  44505. [indexterm2 boost_asio.indexterm.ip__network_v6.canonical..canonical..ip::network_v6]
  44506. Obtain the true network address, omitting any host bits.
  44507. network_v6 canonical() const;
  44508. [endsect]
  44509. [section:hosts ip::network_v6::hosts]
  44510. [indexterm2 boost_asio.indexterm.ip__network_v6.hosts..hosts..ip::network_v6]
  44511. Obtain an address range corresponding to the hosts in the network.
  44512. address_v6_range hosts() const;
  44513. [endsect]
  44514. [section:is_host ip::network_v6::is_host]
  44515. [indexterm2 boost_asio.indexterm.ip__network_v6.is_host..is_host..ip::network_v6]
  44516. Test if network is a valid host address.
  44517. bool is_host() const;
  44518. [endsect]
  44519. [section:is_subnet_of ip::network_v6::is_subnet_of]
  44520. [indexterm2 boost_asio.indexterm.ip__network_v6.is_subnet_of..is_subnet_of..ip::network_v6]
  44521. Test if a network is a real subnet of another network.
  44522. bool is_subnet_of(
  44523. const network_v6 & other) const;
  44524. [endsect]
  44525. [section:make_network_v6 ip::network_v6::make_network_v6]
  44526. [indexterm2 boost_asio.indexterm.ip__network_v6.make_network_v6..make_network_v6..ip::network_v6]
  44527. Create an IPv6 network from a string containing IP address and prefix length.
  44528. network_v6 ``[link boost_asio.reference.ip__network_v6.make_network_v6.overload1 make_network_v6]``(
  44529. const char * str);
  44530. `` [''''&raquo;''' [link boost_asio.reference.ip__network_v6.make_network_v6.overload1 more...]]``
  44531. network_v6 ``[link boost_asio.reference.ip__network_v6.make_network_v6.overload2 make_network_v6]``(
  44532. const char * str,
  44533. boost::system::error_code & ec);
  44534. `` [''''&raquo;''' [link boost_asio.reference.ip__network_v6.make_network_v6.overload2 more...]]``
  44535. network_v6 ``[link boost_asio.reference.ip__network_v6.make_network_v6.overload3 make_network_v6]``(
  44536. const std::string & str);
  44537. `` [''''&raquo;''' [link boost_asio.reference.ip__network_v6.make_network_v6.overload3 more...]]``
  44538. network_v6 ``[link boost_asio.reference.ip__network_v6.make_network_v6.overload4 make_network_v6]``(
  44539. const std::string & str,
  44540. boost::system::error_code & ec);
  44541. `` [''''&raquo;''' [link boost_asio.reference.ip__network_v6.make_network_v6.overload4 more...]]``
  44542. network_v6 ``[link boost_asio.reference.ip__network_v6.make_network_v6.overload5 make_network_v6]``(
  44543. string_view str);
  44544. `` [''''&raquo;''' [link boost_asio.reference.ip__network_v6.make_network_v6.overload5 more...]]``
  44545. network_v6 ``[link boost_asio.reference.ip__network_v6.make_network_v6.overload6 make_network_v6]``(
  44546. string_view str,
  44547. boost::system::error_code & ec);
  44548. `` [''''&raquo;''' [link boost_asio.reference.ip__network_v6.make_network_v6.overload6 more...]]``
  44549. [section:overload1 ip::network_v6::make_network_v6 (1 of 6 overloads)]
  44550. Create an IPv6 network from a string containing IP address and prefix length.
  44551. network_v6 make_network_v6(
  44552. const char * str);
  44553. [endsect]
  44554. [section:overload2 ip::network_v6::make_network_v6 (2 of 6 overloads)]
  44555. Create an IPv6 network from a string containing IP address and prefix length.
  44556. network_v6 make_network_v6(
  44557. const char * str,
  44558. boost::system::error_code & ec);
  44559. [endsect]
  44560. [section:overload3 ip::network_v6::make_network_v6 (3 of 6 overloads)]
  44561. Create an IPv6 network from a string containing IP address and prefix length.
  44562. network_v6 make_network_v6(
  44563. const std::string & str);
  44564. [endsect]
  44565. [section:overload4 ip::network_v6::make_network_v6 (4 of 6 overloads)]
  44566. Create an IPv6 network from a string containing IP address and prefix length.
  44567. network_v6 make_network_v6(
  44568. const std::string & str,
  44569. boost::system::error_code & ec);
  44570. [endsect]
  44571. [section:overload5 ip::network_v6::make_network_v6 (5 of 6 overloads)]
  44572. Create an IPv6 network from a string containing IP address and prefix length.
  44573. network_v6 make_network_v6(
  44574. string_view str);
  44575. [endsect]
  44576. [section:overload6 ip::network_v6::make_network_v6 (6 of 6 overloads)]
  44577. Create an IPv6 network from a string containing IP address and prefix length.
  44578. network_v6 make_network_v6(
  44579. string_view str,
  44580. boost::system::error_code & ec);
  44581. [endsect]
  44582. [endsect]
  44583. [section:network ip::network_v6::network]
  44584. [indexterm2 boost_asio.indexterm.ip__network_v6.network..network..ip::network_v6]
  44585. Obtain an address object that represents the network address.
  44586. address_v6 network() const;
  44587. [endsect]
  44588. [section:network_v6 ip::network_v6::network_v6]
  44589. [indexterm2 boost_asio.indexterm.ip__network_v6.network_v6..network_v6..ip::network_v6]
  44590. Default constructor.
  44591. ``[link boost_asio.reference.ip__network_v6.network_v6.overload1 network_v6]``();
  44592. `` [''''&raquo;''' [link boost_asio.reference.ip__network_v6.network_v6.overload1 more...]]``
  44593. Construct a network based on the specified address and prefix length.
  44594. ``[link boost_asio.reference.ip__network_v6.network_v6.overload2 network_v6]``(
  44595. const address_v6 & addr,
  44596. unsigned short prefix_len);
  44597. `` [''''&raquo;''' [link boost_asio.reference.ip__network_v6.network_v6.overload2 more...]]``
  44598. Copy constructor.
  44599. ``[link boost_asio.reference.ip__network_v6.network_v6.overload3 network_v6]``(
  44600. const network_v6 & other);
  44601. `` [''''&raquo;''' [link boost_asio.reference.ip__network_v6.network_v6.overload3 more...]]``
  44602. [section:overload1 ip::network_v6::network_v6 (1 of 3 overloads)]
  44603. Default constructor.
  44604. network_v6();
  44605. [endsect]
  44606. [section:overload2 ip::network_v6::network_v6 (2 of 3 overloads)]
  44607. Construct a network based on the specified address and prefix length.
  44608. network_v6(
  44609. const address_v6 & addr,
  44610. unsigned short prefix_len);
  44611. [endsect]
  44612. [section:overload3 ip::network_v6::network_v6 (3 of 3 overloads)]
  44613. Copy constructor.
  44614. network_v6(
  44615. const network_v6 & other);
  44616. [endsect]
  44617. [endsect]
  44618. [section:operator_not__eq_ ip::network_v6::operator!=]
  44619. [indexterm2 boost_asio.indexterm.ip__network_v6.operator_not__eq_..operator!=..ip::network_v6]
  44620. Compare two networks for inequality.
  44621. friend bool operator!=(
  44622. const network_v6 & a,
  44623. const network_v6 & b);
  44624. [heading Requirements]
  44625. ['Header: ][^boost/asio/ip/network_v6.hpp]
  44626. ['Convenience header: ][^boost/asio.hpp]
  44627. [endsect]
  44628. [section:operator_eq_ ip::network_v6::operator=]
  44629. [indexterm2 boost_asio.indexterm.ip__network_v6.operator_eq_..operator=..ip::network_v6]
  44630. Assign from another network.
  44631. network_v6 & operator=(
  44632. const network_v6 & other);
  44633. [endsect]
  44634. [section:operator_eq__eq_ ip::network_v6::operator==]
  44635. [indexterm2 boost_asio.indexterm.ip__network_v6.operator_eq__eq_..operator==..ip::network_v6]
  44636. Compare two networks for equality.
  44637. friend bool operator==(
  44638. const network_v6 & a,
  44639. const network_v6 & b);
  44640. [heading Requirements]
  44641. ['Header: ][^boost/asio/ip/network_v6.hpp]
  44642. ['Convenience header: ][^boost/asio.hpp]
  44643. [endsect]
  44644. [section:prefix_length ip::network_v6::prefix_length]
  44645. [indexterm2 boost_asio.indexterm.ip__network_v6.prefix_length..prefix_length..ip::network_v6]
  44646. Obtain the prefix length that was specified when the network object was created.
  44647. unsigned short prefix_length() const;
  44648. [endsect]
  44649. [section:to_string ip::network_v6::to_string]
  44650. [indexterm2 boost_asio.indexterm.ip__network_v6.to_string..to_string..ip::network_v6]
  44651. Get the network as an address in dotted decimal format.
  44652. std::string ``[link boost_asio.reference.ip__network_v6.to_string.overload1 to_string]``() const;
  44653. `` [''''&raquo;''' [link boost_asio.reference.ip__network_v6.to_string.overload1 more...]]``
  44654. std::string ``[link boost_asio.reference.ip__network_v6.to_string.overload2 to_string]``(
  44655. boost::system::error_code & ec) const;
  44656. `` [''''&raquo;''' [link boost_asio.reference.ip__network_v6.to_string.overload2 more...]]``
  44657. [section:overload1 ip::network_v6::to_string (1 of 2 overloads)]
  44658. Get the network as an address in dotted decimal format.
  44659. std::string to_string() const;
  44660. [endsect]
  44661. [section:overload2 ip::network_v6::to_string (2 of 2 overloads)]
  44662. Get the network as an address in dotted decimal format.
  44663. std::string to_string(
  44664. boost::system::error_code & ec) const;
  44665. [endsect]
  44666. [endsect]
  44667. [endsect]
  44668. [section:ip__resolver_base ip::resolver_base]
  44669. The [link boost_asio.reference.ip__resolver_base `ip::resolver_base`] class is used as a base for the [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] class templates to provide a common place to define the flag constants.
  44670. class resolver_base
  44671. [heading Types]
  44672. [table
  44673. [[Name][Description]]
  44674. [
  44675. [[link boost_asio.reference.ip__resolver_base.flags [*flags]]]
  44676. [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
  44677. ]
  44678. ]
  44679. [heading Protected Member Functions]
  44680. [table
  44681. [[Name][Description]]
  44682. [
  44683. [[link boost_asio.reference.ip__resolver_base._resolver_base [*~resolver_base]]]
  44684. [Protected destructor to prevent deletion through this type. ]
  44685. ]
  44686. ]
  44687. [heading Data Members]
  44688. [table
  44689. [[Name][Description]]
  44690. [
  44691. [[link boost_asio.reference.ip__resolver_base.address_configured [*address_configured]]]
  44692. [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. ]
  44693. ]
  44694. [
  44695. [[link boost_asio.reference.ip__resolver_base.all_matching [*all_matching]]]
  44696. [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
  44697. ]
  44698. [
  44699. [[link boost_asio.reference.ip__resolver_base.canonical_name [*canonical_name]]]
  44700. [Determine the canonical name of the host specified in the query. ]
  44701. ]
  44702. [
  44703. [[link boost_asio.reference.ip__resolver_base.numeric_host [*numeric_host]]]
  44704. [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
  44705. ]
  44706. [
  44707. [[link boost_asio.reference.ip__resolver_base.numeric_service [*numeric_service]]]
  44708. [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
  44709. ]
  44710. [
  44711. [[link boost_asio.reference.ip__resolver_base.passive [*passive]]]
  44712. [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
  44713. ]
  44714. [
  44715. [[link boost_asio.reference.ip__resolver_base.v4_mapped [*v4_mapped]]]
  44716. [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
  44717. ]
  44718. ]
  44719. [heading Requirements]
  44720. ['Header: ][^boost/asio/ip/resolver_base.hpp]
  44721. ['Convenience header: ][^boost/asio.hpp]
  44722. [section:address_configured ip::resolver_base::address_configured]
  44723. [indexterm2 boost_asio.indexterm.ip__resolver_base.address_configured..address_configured..ip::resolver_base]
  44724. 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.
  44725. static const flags address_configured = implementation_defined;
  44726. [endsect]
  44727. [section:all_matching ip::resolver_base::all_matching]
  44728. [indexterm2 boost_asio.indexterm.ip__resolver_base.all_matching..all_matching..ip::resolver_base]
  44729. If used with v4\_mapped, return all matching IPv6 and IPv4 addresses.
  44730. static const flags all_matching = implementation_defined;
  44731. [endsect]
  44732. [section:canonical_name ip::resolver_base::canonical_name]
  44733. [indexterm2 boost_asio.indexterm.ip__resolver_base.canonical_name..canonical_name..ip::resolver_base]
  44734. Determine the canonical name of the host specified in the query.
  44735. static const flags canonical_name = implementation_defined;
  44736. [endsect]
  44737. [section:flags ip::resolver_base::flags]
  44738. [indexterm2 boost_asio.indexterm.ip__resolver_base.flags..flags..ip::resolver_base]
  44739. A bitmask type (C++ Std [lib.bitmask.types]).
  44740. typedef unspecified flags;
  44741. [heading Requirements]
  44742. ['Header: ][^boost/asio/ip/resolver_base.hpp]
  44743. ['Convenience header: ][^boost/asio.hpp]
  44744. [endsect]
  44745. [section:numeric_host ip::resolver_base::numeric_host]
  44746. [indexterm2 boost_asio.indexterm.ip__resolver_base.numeric_host..numeric_host..ip::resolver_base]
  44747. Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted.
  44748. static const flags numeric_host = implementation_defined;
  44749. [endsect]
  44750. [section:numeric_service ip::resolver_base::numeric_service]
  44751. [indexterm2 boost_asio.indexterm.ip__resolver_base.numeric_service..numeric_service..ip::resolver_base]
  44752. Service name should be treated as a numeric string defining a port number and no name resolution should be attempted.
  44753. static const flags numeric_service = implementation_defined;
  44754. [endsect]
  44755. [section:passive ip::resolver_base::passive]
  44756. [indexterm2 boost_asio.indexterm.ip__resolver_base.passive..passive..ip::resolver_base]
  44757. Indicate that returned endpoint is intended for use as a locally bound socket endpoint.
  44758. static const flags passive = implementation_defined;
  44759. [endsect]
  44760. [section:v4_mapped ip::resolver_base::v4_mapped]
  44761. [indexterm2 boost_asio.indexterm.ip__resolver_base.v4_mapped..v4_mapped..ip::resolver_base]
  44762. If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses.
  44763. static const flags v4_mapped = implementation_defined;
  44764. [endsect]
  44765. [section:_resolver_base ip::resolver_base::~resolver_base]
  44766. [indexterm2 boost_asio.indexterm.ip__resolver_base._resolver_base..~resolver_base..ip::resolver_base]
  44767. Protected destructor to prevent deletion through this type.
  44768. ~resolver_base();
  44769. [endsect]
  44770. [endsect]
  44771. [section:ip__resolver_query_base ip::resolver_query_base]
  44772. The [link boost_asio.reference.ip__resolver_query_base `ip::resolver_query_base`] class is used as a base for the [link boost_asio.reference.ip__basic_resolver_query `ip::basic_resolver_query`] class templates to provide a common place to define the flag constants.
  44773. class resolver_query_base :
  44774. public ip::resolver_base
  44775. [heading Types]
  44776. [table
  44777. [[Name][Description]]
  44778. [
  44779. [[link boost_asio.reference.ip__resolver_query_base.flags [*flags]]]
  44780. [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
  44781. ]
  44782. ]
  44783. [heading Protected Member Functions]
  44784. [table
  44785. [[Name][Description]]
  44786. [
  44787. [[link boost_asio.reference.ip__resolver_query_base._resolver_query_base [*~resolver_query_base]]]
  44788. [Protected destructor to prevent deletion through this type. ]
  44789. ]
  44790. ]
  44791. [heading Data Members]
  44792. [table
  44793. [[Name][Description]]
  44794. [
  44795. [[link boost_asio.reference.ip__resolver_query_base.address_configured [*address_configured]]]
  44796. [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. ]
  44797. ]
  44798. [
  44799. [[link boost_asio.reference.ip__resolver_query_base.all_matching [*all_matching]]]
  44800. [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
  44801. ]
  44802. [
  44803. [[link boost_asio.reference.ip__resolver_query_base.canonical_name [*canonical_name]]]
  44804. [Determine the canonical name of the host specified in the query. ]
  44805. ]
  44806. [
  44807. [[link boost_asio.reference.ip__resolver_query_base.numeric_host [*numeric_host]]]
  44808. [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
  44809. ]
  44810. [
  44811. [[link boost_asio.reference.ip__resolver_query_base.numeric_service [*numeric_service]]]
  44812. [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
  44813. ]
  44814. [
  44815. [[link boost_asio.reference.ip__resolver_query_base.passive [*passive]]]
  44816. [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
  44817. ]
  44818. [
  44819. [[link boost_asio.reference.ip__resolver_query_base.v4_mapped [*v4_mapped]]]
  44820. [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
  44821. ]
  44822. ]
  44823. [heading Requirements]
  44824. ['Header: ][^boost/asio/ip/resolver_query_base.hpp]
  44825. ['Convenience header: ][^boost/asio.hpp]
  44826. [section:address_configured ip::resolver_query_base::address_configured]
  44827. ['Inherited from ip::resolver_base.]
  44828. [indexterm2 boost_asio.indexterm.ip__resolver_query_base.address_configured..address_configured..ip::resolver_query_base]
  44829. 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.
  44830. static const flags address_configured = implementation_defined;
  44831. [endsect]
  44832. [section:all_matching ip::resolver_query_base::all_matching]
  44833. ['Inherited from ip::resolver_base.]
  44834. [indexterm2 boost_asio.indexterm.ip__resolver_query_base.all_matching..all_matching..ip::resolver_query_base]
  44835. If used with v4\_mapped, return all matching IPv6 and IPv4 addresses.
  44836. static const flags all_matching = implementation_defined;
  44837. [endsect]
  44838. [section:canonical_name ip::resolver_query_base::canonical_name]
  44839. ['Inherited from ip::resolver_base.]
  44840. [indexterm2 boost_asio.indexterm.ip__resolver_query_base.canonical_name..canonical_name..ip::resolver_query_base]
  44841. Determine the canonical name of the host specified in the query.
  44842. static const flags canonical_name = implementation_defined;
  44843. [endsect]
  44844. [section:flags ip::resolver_query_base::flags]
  44845. ['Inherited from ip::resolver_base.]
  44846. [indexterm2 boost_asio.indexterm.ip__resolver_query_base.flags..flags..ip::resolver_query_base]
  44847. A bitmask type (C++ Std [lib.bitmask.types]).
  44848. typedef unspecified flags;
  44849. [heading Requirements]
  44850. ['Header: ][^boost/asio/ip/resolver_query_base.hpp]
  44851. ['Convenience header: ][^boost/asio.hpp]
  44852. [endsect]
  44853. [section:numeric_host ip::resolver_query_base::numeric_host]
  44854. ['Inherited from ip::resolver_base.]
  44855. [indexterm2 boost_asio.indexterm.ip__resolver_query_base.numeric_host..numeric_host..ip::resolver_query_base]
  44856. Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted.
  44857. static const flags numeric_host = implementation_defined;
  44858. [endsect]
  44859. [section:numeric_service ip::resolver_query_base::numeric_service]
  44860. ['Inherited from ip::resolver_base.]
  44861. [indexterm2 boost_asio.indexterm.ip__resolver_query_base.numeric_service..numeric_service..ip::resolver_query_base]
  44862. Service name should be treated as a numeric string defining a port number and no name resolution should be attempted.
  44863. static const flags numeric_service = implementation_defined;
  44864. [endsect]
  44865. [section:passive ip::resolver_query_base::passive]
  44866. ['Inherited from ip::resolver_base.]
  44867. [indexterm2 boost_asio.indexterm.ip__resolver_query_base.passive..passive..ip::resolver_query_base]
  44868. Indicate that returned endpoint is intended for use as a locally bound socket endpoint.
  44869. static const flags passive = implementation_defined;
  44870. [endsect]
  44871. [section:v4_mapped ip::resolver_query_base::v4_mapped]
  44872. ['Inherited from ip::resolver_base.]
  44873. [indexterm2 boost_asio.indexterm.ip__resolver_query_base.v4_mapped..v4_mapped..ip::resolver_query_base]
  44874. If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses.
  44875. static const flags v4_mapped = implementation_defined;
  44876. [endsect]
  44877. [section:_resolver_query_base ip::resolver_query_base::~resolver_query_base]
  44878. [indexterm2 boost_asio.indexterm.ip__resolver_query_base._resolver_query_base..~resolver_query_base..ip::resolver_query_base]
  44879. Protected destructor to prevent deletion through this type.
  44880. ~resolver_query_base();
  44881. [endsect]
  44882. [endsect]
  44883. [section:ip__tcp ip::tcp]
  44884. Encapsulates the flags needed for TCP.
  44885. class tcp
  44886. [heading Types]
  44887. [table
  44888. [[Name][Description]]
  44889. [
  44890. [[link boost_asio.reference.ip__tcp.acceptor [*acceptor]]]
  44891. [The TCP acceptor type. ]
  44892. ]
  44893. [
  44894. [[link boost_asio.reference.ip__tcp.endpoint [*endpoint]]]
  44895. [The type of a TCP endpoint. ]
  44896. ]
  44897. [
  44898. [[link boost_asio.reference.ip__tcp.iostream [*iostream]]]
  44899. [The TCP iostream type. ]
  44900. ]
  44901. [
  44902. [[link boost_asio.reference.ip__tcp.no_delay [*no_delay]]]
  44903. [Socket option for disabling the Nagle algorithm. ]
  44904. ]
  44905. [
  44906. [[link boost_asio.reference.ip__tcp.resolver [*resolver]]]
  44907. [The TCP resolver type. ]
  44908. ]
  44909. [
  44910. [[link boost_asio.reference.ip__tcp.socket [*socket]]]
  44911. [The TCP socket type. ]
  44912. ]
  44913. ]
  44914. [heading Member Functions]
  44915. [table
  44916. [[Name][Description]]
  44917. [
  44918. [[link boost_asio.reference.ip__tcp.family [*family]]]
  44919. [Obtain an identifier for the protocol family. ]
  44920. ]
  44921. [
  44922. [[link boost_asio.reference.ip__tcp.protocol [*protocol]]]
  44923. [Obtain an identifier for the protocol. ]
  44924. ]
  44925. [
  44926. [[link boost_asio.reference.ip__tcp.type [*type]]]
  44927. [Obtain an identifier for the type of the protocol. ]
  44928. ]
  44929. [
  44930. [[link boost_asio.reference.ip__tcp.v4 [*v4]]]
  44931. [Construct to represent the IPv4 TCP protocol. ]
  44932. ]
  44933. [
  44934. [[link boost_asio.reference.ip__tcp.v6 [*v6]]]
  44935. [Construct to represent the IPv6 TCP protocol. ]
  44936. ]
  44937. ]
  44938. [heading Friends]
  44939. [table
  44940. [[Name][Description]]
  44941. [
  44942. [[link boost_asio.reference.ip__tcp.operator_not__eq_ [*operator!=]]]
  44943. [Compare two protocols for inequality. ]
  44944. ]
  44945. [
  44946. [[link boost_asio.reference.ip__tcp.operator_eq__eq_ [*operator==]]]
  44947. [Compare two protocols for equality. ]
  44948. ]
  44949. ]
  44950. The [link boost_asio.reference.ip__tcp `ip::tcp`] class contains flags necessary for TCP sockets.
  44951. [heading Thread Safety]
  44952. ['Distinct] ['objects:] Safe.
  44953. ['Shared] ['objects:] Safe.
  44954. [heading Requirements]
  44955. ['Header: ][^boost/asio/ip/tcp.hpp]
  44956. ['Convenience header: ][^boost/asio.hpp]
  44957. [section:acceptor ip::tcp::acceptor]
  44958. [indexterm2 boost_asio.indexterm.ip__tcp.acceptor..acceptor..ip::tcp]
  44959. The TCP acceptor type.
  44960. typedef basic_socket_acceptor< tcp > acceptor;
  44961. [heading Types]
  44962. [table
  44963. [[Name][Description]]
  44964. [
  44965. [[link boost_asio.reference.basic_socket_acceptor__rebind_executor [*rebind_executor]]]
  44966. [Rebinds the acceptor type to another executor. ]
  44967. ]
  44968. [
  44969. [[link boost_asio.reference.basic_socket_acceptor.broadcast [*broadcast]]]
  44970. [Socket option to permit sending of broadcast messages. ]
  44971. ]
  44972. [
  44973. [[link boost_asio.reference.basic_socket_acceptor.bytes_readable [*bytes_readable]]]
  44974. [IO control command to get the amount of data that can be read without blocking. ]
  44975. ]
  44976. [
  44977. [[link boost_asio.reference.basic_socket_acceptor.debug [*debug]]]
  44978. [Socket option to enable socket-level debugging. ]
  44979. ]
  44980. [
  44981. [[link boost_asio.reference.basic_socket_acceptor.do_not_route [*do_not_route]]]
  44982. [Socket option to prevent routing, use local interfaces only. ]
  44983. ]
  44984. [
  44985. [[link boost_asio.reference.basic_socket_acceptor.enable_connection_aborted [*enable_connection_aborted]]]
  44986. [Socket option to report aborted connections on accept. ]
  44987. ]
  44988. [
  44989. [[link boost_asio.reference.basic_socket_acceptor.endpoint_type [*endpoint_type]]]
  44990. [The endpoint type. ]
  44991. ]
  44992. [
  44993. [[link boost_asio.reference.basic_socket_acceptor.executor_type [*executor_type]]]
  44994. [The type of the executor associated with the object. ]
  44995. ]
  44996. [
  44997. [[link boost_asio.reference.basic_socket_acceptor.keep_alive [*keep_alive]]]
  44998. [Socket option to send keep-alives. ]
  44999. ]
  45000. [
  45001. [[link boost_asio.reference.basic_socket_acceptor.linger [*linger]]]
  45002. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  45003. ]
  45004. [
  45005. [[link boost_asio.reference.basic_socket_acceptor.message_flags [*message_flags]]]
  45006. [Bitmask type for flags that can be passed to send and receive operations. ]
  45007. ]
  45008. [
  45009. [[link boost_asio.reference.basic_socket_acceptor.native_handle_type [*native_handle_type]]]
  45010. [The native representation of an acceptor. ]
  45011. ]
  45012. [
  45013. [[link boost_asio.reference.basic_socket_acceptor.out_of_band_inline [*out_of_band_inline]]]
  45014. [Socket option for putting received out-of-band data inline. ]
  45015. ]
  45016. [
  45017. [[link boost_asio.reference.basic_socket_acceptor.protocol_type [*protocol_type]]]
  45018. [The protocol type. ]
  45019. ]
  45020. [
  45021. [[link boost_asio.reference.basic_socket_acceptor.receive_buffer_size [*receive_buffer_size]]]
  45022. [Socket option for the receive buffer size of a socket. ]
  45023. ]
  45024. [
  45025. [[link boost_asio.reference.basic_socket_acceptor.receive_low_watermark [*receive_low_watermark]]]
  45026. [Socket option for the receive low watermark. ]
  45027. ]
  45028. [
  45029. [[link boost_asio.reference.basic_socket_acceptor.reuse_address [*reuse_address]]]
  45030. [Socket option to allow the socket to be bound to an address that is already in use. ]
  45031. ]
  45032. [
  45033. [[link boost_asio.reference.basic_socket_acceptor.send_buffer_size [*send_buffer_size]]]
  45034. [Socket option for the send buffer size of a socket. ]
  45035. ]
  45036. [
  45037. [[link boost_asio.reference.basic_socket_acceptor.send_low_watermark [*send_low_watermark]]]
  45038. [Socket option for the send low watermark. ]
  45039. ]
  45040. [
  45041. [[link boost_asio.reference.basic_socket_acceptor.shutdown_type [*shutdown_type]]]
  45042. [Different ways a socket may be shutdown. ]
  45043. ]
  45044. [
  45045. [[link boost_asio.reference.basic_socket_acceptor.wait_type [*wait_type]]]
  45046. [Wait types. ]
  45047. ]
  45048. ]
  45049. [heading Member Functions]
  45050. [table
  45051. [[Name][Description]]
  45052. [
  45053. [[link boost_asio.reference.basic_socket_acceptor.accept [*accept]]]
  45054. [Accept a new connection.
  45055. [hr]
  45056. Accept a new connection and obtain the endpoint of the peer. ]
  45057. ]
  45058. [
  45059. [[link boost_asio.reference.basic_socket_acceptor.assign [*assign]]]
  45060. [Assigns an existing native acceptor to the acceptor. ]
  45061. ]
  45062. [
  45063. [[link boost_asio.reference.basic_socket_acceptor.async_accept [*async_accept]]]
  45064. [Start an asynchronous accept. ]
  45065. ]
  45066. [
  45067. [[link boost_asio.reference.basic_socket_acceptor.async_wait [*async_wait]]]
  45068. [Asynchronously wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. ]
  45069. ]
  45070. [
  45071. [[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor [*basic_socket_acceptor]]]
  45072. [Construct an acceptor without opening it.
  45073. [hr]
  45074. Construct an open acceptor.
  45075. [hr]
  45076. Construct an acceptor opened on the given endpoint.
  45077. [hr]
  45078. Construct a basic_socket_acceptor on an existing native acceptor.
  45079. [hr]
  45080. Move-construct a basic_socket_acceptor from another.
  45081. [hr]
  45082. Move-construct a basic_socket_acceptor from an acceptor of another protocol type. ]
  45083. ]
  45084. [
  45085. [[link boost_asio.reference.basic_socket_acceptor.bind [*bind]]]
  45086. [Bind the acceptor to the given local endpoint. ]
  45087. ]
  45088. [
  45089. [[link boost_asio.reference.basic_socket_acceptor.cancel [*cancel]]]
  45090. [Cancel all asynchronous operations associated with the acceptor. ]
  45091. ]
  45092. [
  45093. [[link boost_asio.reference.basic_socket_acceptor.close [*close]]]
  45094. [Close the acceptor. ]
  45095. ]
  45096. [
  45097. [[link boost_asio.reference.basic_socket_acceptor.get_executor [*get_executor]]]
  45098. [Get the executor associated with the object. ]
  45099. ]
  45100. [
  45101. [[link boost_asio.reference.basic_socket_acceptor.get_option [*get_option]]]
  45102. [Get an option from the acceptor. ]
  45103. ]
  45104. [
  45105. [[link boost_asio.reference.basic_socket_acceptor.io_control [*io_control]]]
  45106. [Perform an IO control command on the acceptor. ]
  45107. ]
  45108. [
  45109. [[link boost_asio.reference.basic_socket_acceptor.is_open [*is_open]]]
  45110. [Determine whether the acceptor is open. ]
  45111. ]
  45112. [
  45113. [[link boost_asio.reference.basic_socket_acceptor.listen [*listen]]]
  45114. [Place the acceptor into the state where it will listen for new connections. ]
  45115. ]
  45116. [
  45117. [[link boost_asio.reference.basic_socket_acceptor.local_endpoint [*local_endpoint]]]
  45118. [Get the local endpoint of the acceptor. ]
  45119. ]
  45120. [
  45121. [[link boost_asio.reference.basic_socket_acceptor.native_handle [*native_handle]]]
  45122. [Get the native acceptor representation. ]
  45123. ]
  45124. [
  45125. [[link boost_asio.reference.basic_socket_acceptor.native_non_blocking [*native_non_blocking]]]
  45126. [Gets the non-blocking mode of the native acceptor implementation.
  45127. [hr]
  45128. Sets the non-blocking mode of the native acceptor implementation. ]
  45129. ]
  45130. [
  45131. [[link boost_asio.reference.basic_socket_acceptor.non_blocking [*non_blocking]]]
  45132. [Gets the non-blocking mode of the acceptor.
  45133. [hr]
  45134. Sets the non-blocking mode of the acceptor. ]
  45135. ]
  45136. [
  45137. [[link boost_asio.reference.basic_socket_acceptor.open [*open]]]
  45138. [Open the acceptor using the specified protocol. ]
  45139. ]
  45140. [
  45141. [[link boost_asio.reference.basic_socket_acceptor.operator_eq_ [*operator=]]]
  45142. [Move-assign a basic_socket_acceptor from another.
  45143. [hr]
  45144. Move-assign a basic_socket_acceptor from an acceptor of another protocol type. ]
  45145. ]
  45146. [
  45147. [[link boost_asio.reference.basic_socket_acceptor.release [*release]]]
  45148. [Release ownership of the underlying native acceptor. ]
  45149. ]
  45150. [
  45151. [[link boost_asio.reference.basic_socket_acceptor.set_option [*set_option]]]
  45152. [Set an option on the acceptor. ]
  45153. ]
  45154. [
  45155. [[link boost_asio.reference.basic_socket_acceptor.wait [*wait]]]
  45156. [Wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. ]
  45157. ]
  45158. [
  45159. [[link boost_asio.reference.basic_socket_acceptor._basic_socket_acceptor [*~basic_socket_acceptor]]]
  45160. [Destroys the acceptor. ]
  45161. ]
  45162. ]
  45163. [heading Data Members]
  45164. [table
  45165. [[Name][Description]]
  45166. [
  45167. [[link boost_asio.reference.basic_socket_acceptor.max_connections [*max_connections]]]
  45168. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  45169. ]
  45170. [
  45171. [[link boost_asio.reference.basic_socket_acceptor.max_listen_connections [*max_listen_connections]]]
  45172. [The maximum length of the queue of pending incoming connections. ]
  45173. ]
  45174. [
  45175. [[link boost_asio.reference.basic_socket_acceptor.message_do_not_route [*message_do_not_route]]]
  45176. [Specify that the data should not be subject to routing. ]
  45177. ]
  45178. [
  45179. [[link boost_asio.reference.basic_socket_acceptor.message_end_of_record [*message_end_of_record]]]
  45180. [Specifies that the data marks the end of a record. ]
  45181. ]
  45182. [
  45183. [[link boost_asio.reference.basic_socket_acceptor.message_out_of_band [*message_out_of_band]]]
  45184. [Process out-of-band data. ]
  45185. ]
  45186. [
  45187. [[link boost_asio.reference.basic_socket_acceptor.message_peek [*message_peek]]]
  45188. [Peek at incoming data without removing it from the input queue. ]
  45189. ]
  45190. ]
  45191. The [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] class template is used for accepting new socket connections.
  45192. [heading Thread Safety]
  45193. ['Distinct] ['objects:] Safe.
  45194. ['Shared] ['objects:] Unsafe.
  45195. [heading Example]
  45196. Opening a socket acceptor with the SO\_REUSEADDR option enabled:
  45197. boost::asio::ip::tcp::acceptor acceptor(my_context);
  45198. boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), port);
  45199. acceptor.open(endpoint.protocol());
  45200. acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
  45201. acceptor.bind(endpoint);
  45202. acceptor.listen();
  45203. [heading Requirements]
  45204. ['Header: ][^boost/asio/ip/tcp.hpp]
  45205. ['Convenience header: ][^boost/asio.hpp]
  45206. [endsect]
  45207. [section:endpoint ip::tcp::endpoint]
  45208. [indexterm2 boost_asio.indexterm.ip__tcp.endpoint..endpoint..ip::tcp]
  45209. The type of a TCP endpoint.
  45210. typedef basic_endpoint< tcp > endpoint;
  45211. [heading Types]
  45212. [table
  45213. [[Name][Description]]
  45214. [
  45215. [[link boost_asio.reference.ip__basic_endpoint.data_type [*data_type]]]
  45216. [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
  45217. ]
  45218. [
  45219. [[link boost_asio.reference.ip__basic_endpoint.protocol_type [*protocol_type]]]
  45220. [The protocol type associated with the endpoint. ]
  45221. ]
  45222. ]
  45223. [heading Member Functions]
  45224. [table
  45225. [[Name][Description]]
  45226. [
  45227. [[link boost_asio.reference.ip__basic_endpoint.address [*address]]]
  45228. [Get the IP address associated with the endpoint.
  45229. [hr]
  45230. Set the IP address associated with the endpoint. ]
  45231. ]
  45232. [
  45233. [[link boost_asio.reference.ip__basic_endpoint.basic_endpoint [*basic_endpoint]]]
  45234. [Default constructor.
  45235. [hr]
  45236. 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.
  45237. [hr]
  45238. 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.
  45239. [hr]
  45240. Copy constructor.
  45241. [hr]
  45242. Move constructor. ]
  45243. ]
  45244. [
  45245. [[link boost_asio.reference.ip__basic_endpoint.capacity [*capacity]]]
  45246. [Get the capacity of the endpoint in the native type. ]
  45247. ]
  45248. [
  45249. [[link boost_asio.reference.ip__basic_endpoint.data [*data]]]
  45250. [Get the underlying endpoint in the native type. ]
  45251. ]
  45252. [
  45253. [[link boost_asio.reference.ip__basic_endpoint.operator_eq_ [*operator=]]]
  45254. [Assign from another endpoint.
  45255. [hr]
  45256. Move-assign from another endpoint. ]
  45257. ]
  45258. [
  45259. [[link boost_asio.reference.ip__basic_endpoint.port [*port]]]
  45260. [Get the port associated with the endpoint. The port number is always in the host's byte order.
  45261. [hr]
  45262. Set the port associated with the endpoint. The port number is always in the host's byte order. ]
  45263. ]
  45264. [
  45265. [[link boost_asio.reference.ip__basic_endpoint.protocol [*protocol]]]
  45266. [The protocol associated with the endpoint. ]
  45267. ]
  45268. [
  45269. [[link boost_asio.reference.ip__basic_endpoint.resize [*resize]]]
  45270. [Set the underlying size of the endpoint in the native type. ]
  45271. ]
  45272. [
  45273. [[link boost_asio.reference.ip__basic_endpoint.size [*size]]]
  45274. [Get the underlying size of the endpoint in the native type. ]
  45275. ]
  45276. ]
  45277. [heading Friends]
  45278. [table
  45279. [[Name][Description]]
  45280. [
  45281. [[link boost_asio.reference.ip__basic_endpoint.operator_not__eq_ [*operator!=]]]
  45282. [Compare two endpoints for inequality. ]
  45283. ]
  45284. [
  45285. [[link boost_asio.reference.ip__basic_endpoint.operator_lt_ [*operator<]]]
  45286. [Compare endpoints for ordering. ]
  45287. ]
  45288. [
  45289. [[link boost_asio.reference.ip__basic_endpoint.operator_lt__eq_ [*operator<=]]]
  45290. [Compare endpoints for ordering. ]
  45291. ]
  45292. [
  45293. [[link boost_asio.reference.ip__basic_endpoint.operator_eq__eq_ [*operator==]]]
  45294. [Compare two endpoints for equality. ]
  45295. ]
  45296. [
  45297. [[link boost_asio.reference.ip__basic_endpoint.operator_gt_ [*operator>]]]
  45298. [Compare endpoints for ordering. ]
  45299. ]
  45300. [
  45301. [[link boost_asio.reference.ip__basic_endpoint.operator_gt__eq_ [*operator>=]]]
  45302. [Compare endpoints for ordering. ]
  45303. ]
  45304. ]
  45305. [heading Related Functions]
  45306. [table
  45307. [[Name][Description]]
  45308. [
  45309. [[link boost_asio.reference.ip__basic_endpoint.operator_lt__lt_ [*operator<<]]]
  45310. [Output an endpoint as a string. ]
  45311. ]
  45312. ]
  45313. The [link boost_asio.reference.ip__basic_endpoint `ip::basic_endpoint`] class template describes an endpoint that may be associated with a particular socket.
  45314. [heading Thread Safety]
  45315. ['Distinct] ['objects:] Safe.
  45316. ['Shared] ['objects:] Unsafe.
  45317. [heading Requirements]
  45318. ['Header: ][^boost/asio/ip/tcp.hpp]
  45319. ['Convenience header: ][^boost/asio.hpp]
  45320. [endsect]
  45321. [section:family ip::tcp::family]
  45322. [indexterm2 boost_asio.indexterm.ip__tcp.family..family..ip::tcp]
  45323. Obtain an identifier for the protocol family.
  45324. int family() const;
  45325. [endsect]
  45326. [section:iostream ip::tcp::iostream]
  45327. [indexterm2 boost_asio.indexterm.ip__tcp.iostream..iostream..ip::tcp]
  45328. The TCP iostream type.
  45329. typedef basic_socket_iostream< tcp > iostream;
  45330. [heading Types]
  45331. [table
  45332. [[Name][Description]]
  45333. [
  45334. [[link boost_asio.reference.basic_socket_iostream.clock_type [*clock_type]]]
  45335. [The clock type. ]
  45336. ]
  45337. [
  45338. [[link boost_asio.reference.basic_socket_iostream.duration [*duration]]]
  45339. [The duration type. ]
  45340. ]
  45341. [
  45342. [[link boost_asio.reference.basic_socket_iostream.duration_type [*duration_type]]]
  45343. [(Deprecated: Use duration.) The duration type. ]
  45344. ]
  45345. [
  45346. [[link boost_asio.reference.basic_socket_iostream.endpoint_type [*endpoint_type]]]
  45347. [The endpoint type. ]
  45348. ]
  45349. [
  45350. [[link boost_asio.reference.basic_socket_iostream.protocol_type [*protocol_type]]]
  45351. [The protocol type. ]
  45352. ]
  45353. [
  45354. [[link boost_asio.reference.basic_socket_iostream.time_point [*time_point]]]
  45355. [The time type. ]
  45356. ]
  45357. [
  45358. [[link boost_asio.reference.basic_socket_iostream.time_type [*time_type]]]
  45359. [(Deprecated: Use time_point.) The time type. ]
  45360. ]
  45361. ]
  45362. [heading Member Functions]
  45363. [table
  45364. [[Name][Description]]
  45365. [
  45366. [[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream [*basic_socket_iostream]]]
  45367. [Construct a basic_socket_iostream without establishing a connection.
  45368. [hr]
  45369. Construct a basic_socket_iostream from the supplied socket.
  45370. [hr]
  45371. Move-construct a basic_socket_iostream from another.
  45372. [hr]
  45373. Establish a connection to an endpoint corresponding to a resolver query. ]
  45374. ]
  45375. [
  45376. [[link boost_asio.reference.basic_socket_iostream.close [*close]]]
  45377. [Close the connection. ]
  45378. ]
  45379. [
  45380. [[link boost_asio.reference.basic_socket_iostream.connect [*connect]]]
  45381. [Establish a connection to an endpoint corresponding to a resolver query. ]
  45382. ]
  45383. [
  45384. [[link boost_asio.reference.basic_socket_iostream.error [*error]]]
  45385. [Get the last error associated with the stream. ]
  45386. ]
  45387. [
  45388. [[link boost_asio.reference.basic_socket_iostream.expires_after [*expires_after]]]
  45389. [Set the stream's expiry time relative to now. ]
  45390. ]
  45391. [
  45392. [[link boost_asio.reference.basic_socket_iostream.expires_at [*expires_at]]]
  45393. [(Deprecated: Use expiry().) Get the stream's expiry time as an absolute time.
  45394. [hr]
  45395. Set the stream's expiry time as an absolute time. ]
  45396. ]
  45397. [
  45398. [[link boost_asio.reference.basic_socket_iostream.expires_from_now [*expires_from_now]]]
  45399. [(Deprecated: Use expiry().) Get the stream's expiry time relative to now.
  45400. [hr]
  45401. (Deprecated: Use expires_after().) Set the stream's expiry time relative to now. ]
  45402. ]
  45403. [
  45404. [[link boost_asio.reference.basic_socket_iostream.expiry [*expiry]]]
  45405. [Get the stream's expiry time as an absolute time. ]
  45406. ]
  45407. [
  45408. [[link boost_asio.reference.basic_socket_iostream.operator_eq_ [*operator=]]]
  45409. [Move-assign a basic_socket_iostream from another. ]
  45410. ]
  45411. [
  45412. [[link boost_asio.reference.basic_socket_iostream.rdbuf [*rdbuf]]]
  45413. [Return a pointer to the underlying streambuf. ]
  45414. ]
  45415. [
  45416. [[link boost_asio.reference.basic_socket_iostream.socket [*socket]]]
  45417. [Get a reference to the underlying socket. ]
  45418. ]
  45419. ]
  45420. [heading Requirements]
  45421. ['Header: ][^boost/asio/ip/tcp.hpp]
  45422. ['Convenience header: ][^boost/asio.hpp]
  45423. [endsect]
  45424. [section:no_delay ip::tcp::no_delay]
  45425. [indexterm2 boost_asio.indexterm.ip__tcp.no_delay..no_delay..ip::tcp]
  45426. Socket option for disabling the Nagle algorithm.
  45427. typedef implementation_defined no_delay;
  45428. Implements the IPPROTO\_TCP/TCP\_NODELAY socket option.
  45429. [heading Examples]
  45430. Setting the option:
  45431. boost::asio::ip::tcp::socket socket(my_context);
  45432. ...
  45433. boost::asio::ip::tcp::no_delay option(true);
  45434. socket.set_option(option);
  45435. Getting the current option value:
  45436. boost::asio::ip::tcp::socket socket(my_context);
  45437. ...
  45438. boost::asio::ip::tcp::no_delay option;
  45439. socket.get_option(option);
  45440. bool is_set = option.value();
  45441. [heading Requirements]
  45442. ['Header: ][^boost/asio/ip/tcp.hpp]
  45443. ['Convenience header: ][^boost/asio.hpp]
  45444. [endsect]
  45445. [section:operator_not__eq_ ip::tcp::operator!=]
  45446. [indexterm2 boost_asio.indexterm.ip__tcp.operator_not__eq_..operator!=..ip::tcp]
  45447. Compare two protocols for inequality.
  45448. friend bool operator!=(
  45449. const tcp & p1,
  45450. const tcp & p2);
  45451. [heading Requirements]
  45452. ['Header: ][^boost/asio/ip/tcp.hpp]
  45453. ['Convenience header: ][^boost/asio.hpp]
  45454. [endsect]
  45455. [section:operator_eq__eq_ ip::tcp::operator==]
  45456. [indexterm2 boost_asio.indexterm.ip__tcp.operator_eq__eq_..operator==..ip::tcp]
  45457. Compare two protocols for equality.
  45458. friend bool operator==(
  45459. const tcp & p1,
  45460. const tcp & p2);
  45461. [heading Requirements]
  45462. ['Header: ][^boost/asio/ip/tcp.hpp]
  45463. ['Convenience header: ][^boost/asio.hpp]
  45464. [endsect]
  45465. [section:protocol ip::tcp::protocol]
  45466. [indexterm2 boost_asio.indexterm.ip__tcp.protocol..protocol..ip::tcp]
  45467. Obtain an identifier for the protocol.
  45468. int protocol() const;
  45469. [endsect]
  45470. [section:resolver ip::tcp::resolver]
  45471. [indexterm2 boost_asio.indexterm.ip__tcp.resolver..resolver..ip::tcp]
  45472. The TCP resolver type.
  45473. typedef basic_resolver< tcp > resolver;
  45474. [heading Types]
  45475. [table
  45476. [[Name][Description]]
  45477. [
  45478. [[link boost_asio.reference.ip__basic_resolver__rebind_executor [*rebind_executor]]]
  45479. [Rebinds the resolver type to another executor. ]
  45480. ]
  45481. [
  45482. [[link boost_asio.reference.ip__basic_resolver.endpoint_type [*endpoint_type]]]
  45483. [The endpoint type. ]
  45484. ]
  45485. [
  45486. [[link boost_asio.reference.ip__basic_resolver.executor_type [*executor_type]]]
  45487. [The type of the executor associated with the object. ]
  45488. ]
  45489. [
  45490. [[link boost_asio.reference.ip__basic_resolver.flags [*flags]]]
  45491. [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
  45492. ]
  45493. [
  45494. [[link boost_asio.reference.ip__basic_resolver.iterator [*iterator]]]
  45495. [(Deprecated.) The iterator type. ]
  45496. ]
  45497. [
  45498. [[link boost_asio.reference.ip__basic_resolver.protocol_type [*protocol_type]]]
  45499. [The protocol type. ]
  45500. ]
  45501. [
  45502. [[link boost_asio.reference.ip__basic_resolver.query [*query]]]
  45503. [(Deprecated.) The query type. ]
  45504. ]
  45505. [
  45506. [[link boost_asio.reference.ip__basic_resolver.results_type [*results_type]]]
  45507. [The results type. ]
  45508. ]
  45509. ]
  45510. [heading Member Functions]
  45511. [table
  45512. [[Name][Description]]
  45513. [
  45514. [[link boost_asio.reference.ip__basic_resolver.async_resolve [*async_resolve]]]
  45515. [(Deprecated: Use overload with separate host and service parameters.) Asynchronously perform forward resolution of a query to a list of entries.
  45516. [hr]
  45517. Asynchronously perform forward resolution of a query to a list of entries.
  45518. [hr]
  45519. Asynchronously perform reverse resolution of an endpoint to a list of entries. ]
  45520. ]
  45521. [
  45522. [[link boost_asio.reference.ip__basic_resolver.basic_resolver [*basic_resolver]]]
  45523. [Construct with executor.
  45524. [hr]
  45525. Construct with execution context.
  45526. [hr]
  45527. Move-construct a basic_resolver from another. ]
  45528. ]
  45529. [
  45530. [[link boost_asio.reference.ip__basic_resolver.cancel [*cancel]]]
  45531. [Cancel any asynchronous operations that are waiting on the resolver. ]
  45532. ]
  45533. [
  45534. [[link boost_asio.reference.ip__basic_resolver.get_executor [*get_executor]]]
  45535. [Get the executor associated with the object. ]
  45536. ]
  45537. [
  45538. [[link boost_asio.reference.ip__basic_resolver.operator_eq_ [*operator=]]]
  45539. [Move-assign a basic_resolver from another. ]
  45540. ]
  45541. [
  45542. [[link boost_asio.reference.ip__basic_resolver.resolve [*resolve]]]
  45543. [(Deprecated: Use overload with separate host and service parameters.) Perform forward resolution of a query to a list of entries.
  45544. [hr]
  45545. Perform forward resolution of a query to a list of entries.
  45546. [hr]
  45547. Perform reverse resolution of an endpoint to a list of entries. ]
  45548. ]
  45549. [
  45550. [[link boost_asio.reference.ip__basic_resolver._basic_resolver [*~basic_resolver]]]
  45551. [Destroys the resolver. ]
  45552. ]
  45553. ]
  45554. [heading Data Members]
  45555. [table
  45556. [[Name][Description]]
  45557. [
  45558. [[link boost_asio.reference.ip__basic_resolver.address_configured [*address_configured]]]
  45559. [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. ]
  45560. ]
  45561. [
  45562. [[link boost_asio.reference.ip__basic_resolver.all_matching [*all_matching]]]
  45563. [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
  45564. ]
  45565. [
  45566. [[link boost_asio.reference.ip__basic_resolver.canonical_name [*canonical_name]]]
  45567. [Determine the canonical name of the host specified in the query. ]
  45568. ]
  45569. [
  45570. [[link boost_asio.reference.ip__basic_resolver.numeric_host [*numeric_host]]]
  45571. [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
  45572. ]
  45573. [
  45574. [[link boost_asio.reference.ip__basic_resolver.numeric_service [*numeric_service]]]
  45575. [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
  45576. ]
  45577. [
  45578. [[link boost_asio.reference.ip__basic_resolver.passive [*passive]]]
  45579. [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
  45580. ]
  45581. [
  45582. [[link boost_asio.reference.ip__basic_resolver.v4_mapped [*v4_mapped]]]
  45583. [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
  45584. ]
  45585. ]
  45586. The [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] class template provides the ability to resolve a query to a list of endpoints.
  45587. [heading Thread Safety]
  45588. ['Distinct] ['objects:] Safe.
  45589. ['Shared] ['objects:] Unsafe.
  45590. [heading Requirements]
  45591. ['Header: ][^boost/asio/ip/tcp.hpp]
  45592. ['Convenience header: ][^boost/asio.hpp]
  45593. [endsect]
  45594. [section:socket ip::tcp::socket]
  45595. [indexterm2 boost_asio.indexterm.ip__tcp.socket..socket..ip::tcp]
  45596. The TCP socket type.
  45597. typedef basic_stream_socket< tcp > socket;
  45598. [heading Types]
  45599. [table
  45600. [[Name][Description]]
  45601. [
  45602. [[link boost_asio.reference.basic_stream_socket__rebind_executor [*rebind_executor]]]
  45603. [Rebinds the socket type to another executor. ]
  45604. ]
  45605. [
  45606. [[link boost_asio.reference.basic_stream_socket.broadcast [*broadcast]]]
  45607. [Socket option to permit sending of broadcast messages. ]
  45608. ]
  45609. [
  45610. [[link boost_asio.reference.basic_stream_socket.bytes_readable [*bytes_readable]]]
  45611. [IO control command to get the amount of data that can be read without blocking. ]
  45612. ]
  45613. [
  45614. [[link boost_asio.reference.basic_stream_socket.debug [*debug]]]
  45615. [Socket option to enable socket-level debugging. ]
  45616. ]
  45617. [
  45618. [[link boost_asio.reference.basic_stream_socket.do_not_route [*do_not_route]]]
  45619. [Socket option to prevent routing, use local interfaces only. ]
  45620. ]
  45621. [
  45622. [[link boost_asio.reference.basic_stream_socket.enable_connection_aborted [*enable_connection_aborted]]]
  45623. [Socket option to report aborted connections on accept. ]
  45624. ]
  45625. [
  45626. [[link boost_asio.reference.basic_stream_socket.endpoint_type [*endpoint_type]]]
  45627. [The endpoint type. ]
  45628. ]
  45629. [
  45630. [[link boost_asio.reference.basic_stream_socket.executor_type [*executor_type]]]
  45631. [The type of the executor associated with the object. ]
  45632. ]
  45633. [
  45634. [[link boost_asio.reference.basic_stream_socket.keep_alive [*keep_alive]]]
  45635. [Socket option to send keep-alives. ]
  45636. ]
  45637. [
  45638. [[link boost_asio.reference.basic_stream_socket.linger [*linger]]]
  45639. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  45640. ]
  45641. [
  45642. [[link boost_asio.reference.basic_stream_socket.lowest_layer_type [*lowest_layer_type]]]
  45643. [A basic_socket is always the lowest layer. ]
  45644. ]
  45645. [
  45646. [[link boost_asio.reference.basic_stream_socket.message_flags [*message_flags]]]
  45647. [Bitmask type for flags that can be passed to send and receive operations. ]
  45648. ]
  45649. [
  45650. [[link boost_asio.reference.basic_stream_socket.native_handle_type [*native_handle_type]]]
  45651. [The native representation of a socket. ]
  45652. ]
  45653. [
  45654. [[link boost_asio.reference.basic_stream_socket.out_of_band_inline [*out_of_band_inline]]]
  45655. [Socket option for putting received out-of-band data inline. ]
  45656. ]
  45657. [
  45658. [[link boost_asio.reference.basic_stream_socket.protocol_type [*protocol_type]]]
  45659. [The protocol type. ]
  45660. ]
  45661. [
  45662. [[link boost_asio.reference.basic_stream_socket.receive_buffer_size [*receive_buffer_size]]]
  45663. [Socket option for the receive buffer size of a socket. ]
  45664. ]
  45665. [
  45666. [[link boost_asio.reference.basic_stream_socket.receive_low_watermark [*receive_low_watermark]]]
  45667. [Socket option for the receive low watermark. ]
  45668. ]
  45669. [
  45670. [[link boost_asio.reference.basic_stream_socket.reuse_address [*reuse_address]]]
  45671. [Socket option to allow the socket to be bound to an address that is already in use. ]
  45672. ]
  45673. [
  45674. [[link boost_asio.reference.basic_stream_socket.send_buffer_size [*send_buffer_size]]]
  45675. [Socket option for the send buffer size of a socket. ]
  45676. ]
  45677. [
  45678. [[link boost_asio.reference.basic_stream_socket.send_low_watermark [*send_low_watermark]]]
  45679. [Socket option for the send low watermark. ]
  45680. ]
  45681. [
  45682. [[link boost_asio.reference.basic_stream_socket.shutdown_type [*shutdown_type]]]
  45683. [Different ways a socket may be shutdown. ]
  45684. ]
  45685. [
  45686. [[link boost_asio.reference.basic_stream_socket.wait_type [*wait_type]]]
  45687. [Wait types. ]
  45688. ]
  45689. ]
  45690. [heading Member Functions]
  45691. [table
  45692. [[Name][Description]]
  45693. [
  45694. [[link boost_asio.reference.basic_stream_socket.assign [*assign]]]
  45695. [Assign an existing native socket to the socket. ]
  45696. ]
  45697. [
  45698. [[link boost_asio.reference.basic_stream_socket.async_connect [*async_connect]]]
  45699. [Start an asynchronous connect. ]
  45700. ]
  45701. [
  45702. [[link boost_asio.reference.basic_stream_socket.async_read_some [*async_read_some]]]
  45703. [Start an asynchronous read. ]
  45704. ]
  45705. [
  45706. [[link boost_asio.reference.basic_stream_socket.async_receive [*async_receive]]]
  45707. [Start an asynchronous receive. ]
  45708. ]
  45709. [
  45710. [[link boost_asio.reference.basic_stream_socket.async_send [*async_send]]]
  45711. [Start an asynchronous send. ]
  45712. ]
  45713. [
  45714. [[link boost_asio.reference.basic_stream_socket.async_wait [*async_wait]]]
  45715. [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  45716. ]
  45717. [
  45718. [[link boost_asio.reference.basic_stream_socket.async_write_some [*async_write_some]]]
  45719. [Start an asynchronous write. ]
  45720. ]
  45721. [
  45722. [[link boost_asio.reference.basic_stream_socket.at_mark [*at_mark]]]
  45723. [Determine whether the socket is at the out-of-band data mark. ]
  45724. ]
  45725. [
  45726. [[link boost_asio.reference.basic_stream_socket.available [*available]]]
  45727. [Determine the number of bytes available for reading. ]
  45728. ]
  45729. [
  45730. [[link boost_asio.reference.basic_stream_socket.basic_stream_socket [*basic_stream_socket]]]
  45731. [Construct a basic_stream_socket without opening it.
  45732. [hr]
  45733. Construct and open a basic_stream_socket.
  45734. [hr]
  45735. Construct a basic_stream_socket, opening it and binding it to the given local endpoint.
  45736. [hr]
  45737. Construct a basic_stream_socket on an existing native socket.
  45738. [hr]
  45739. Move-construct a basic_stream_socket from another.
  45740. [hr]
  45741. Move-construct a basic_stream_socket from a socket of another protocol type. ]
  45742. ]
  45743. [
  45744. [[link boost_asio.reference.basic_stream_socket.bind [*bind]]]
  45745. [Bind the socket to the given local endpoint. ]
  45746. ]
  45747. [
  45748. [[link boost_asio.reference.basic_stream_socket.cancel [*cancel]]]
  45749. [Cancel all asynchronous operations associated with the socket. ]
  45750. ]
  45751. [
  45752. [[link boost_asio.reference.basic_stream_socket.close [*close]]]
  45753. [Close the socket. ]
  45754. ]
  45755. [
  45756. [[link boost_asio.reference.basic_stream_socket.connect [*connect]]]
  45757. [Connect the socket to the specified endpoint. ]
  45758. ]
  45759. [
  45760. [[link boost_asio.reference.basic_stream_socket.get_executor [*get_executor]]]
  45761. [Get the executor associated with the object. ]
  45762. ]
  45763. [
  45764. [[link boost_asio.reference.basic_stream_socket.get_option [*get_option]]]
  45765. [Get an option from the socket. ]
  45766. ]
  45767. [
  45768. [[link boost_asio.reference.basic_stream_socket.io_control [*io_control]]]
  45769. [Perform an IO control command on the socket. ]
  45770. ]
  45771. [
  45772. [[link boost_asio.reference.basic_stream_socket.is_open [*is_open]]]
  45773. [Determine whether the socket is open. ]
  45774. ]
  45775. [
  45776. [[link boost_asio.reference.basic_stream_socket.local_endpoint [*local_endpoint]]]
  45777. [Get the local endpoint of the socket. ]
  45778. ]
  45779. [
  45780. [[link boost_asio.reference.basic_stream_socket.lowest_layer [*lowest_layer]]]
  45781. [Get a reference to the lowest layer.
  45782. [hr]
  45783. Get a const reference to the lowest layer. ]
  45784. ]
  45785. [
  45786. [[link boost_asio.reference.basic_stream_socket.native_handle [*native_handle]]]
  45787. [Get the native socket representation. ]
  45788. ]
  45789. [
  45790. [[link boost_asio.reference.basic_stream_socket.native_non_blocking [*native_non_blocking]]]
  45791. [Gets the non-blocking mode of the native socket implementation.
  45792. [hr]
  45793. Sets the non-blocking mode of the native socket implementation. ]
  45794. ]
  45795. [
  45796. [[link boost_asio.reference.basic_stream_socket.non_blocking [*non_blocking]]]
  45797. [Gets the non-blocking mode of the socket.
  45798. [hr]
  45799. Sets the non-blocking mode of the socket. ]
  45800. ]
  45801. [
  45802. [[link boost_asio.reference.basic_stream_socket.open [*open]]]
  45803. [Open the socket using the specified protocol. ]
  45804. ]
  45805. [
  45806. [[link boost_asio.reference.basic_stream_socket.operator_eq_ [*operator=]]]
  45807. [Move-assign a basic_stream_socket from another.
  45808. [hr]
  45809. Move-assign a basic_stream_socket from a socket of another protocol type. ]
  45810. ]
  45811. [
  45812. [[link boost_asio.reference.basic_stream_socket.read_some [*read_some]]]
  45813. [Read some data from the socket. ]
  45814. ]
  45815. [
  45816. [[link boost_asio.reference.basic_stream_socket.receive [*receive]]]
  45817. [Receive some data on the socket.
  45818. [hr]
  45819. Receive some data on a connected socket. ]
  45820. ]
  45821. [
  45822. [[link boost_asio.reference.basic_stream_socket.release [*release]]]
  45823. [Release ownership of the underlying native socket. ]
  45824. ]
  45825. [
  45826. [[link boost_asio.reference.basic_stream_socket.remote_endpoint [*remote_endpoint]]]
  45827. [Get the remote endpoint of the socket. ]
  45828. ]
  45829. [
  45830. [[link boost_asio.reference.basic_stream_socket.send [*send]]]
  45831. [Send some data on the socket. ]
  45832. ]
  45833. [
  45834. [[link boost_asio.reference.basic_stream_socket.set_option [*set_option]]]
  45835. [Set an option on the socket. ]
  45836. ]
  45837. [
  45838. [[link boost_asio.reference.basic_stream_socket.shutdown [*shutdown]]]
  45839. [Disable sends or receives on the socket. ]
  45840. ]
  45841. [
  45842. [[link boost_asio.reference.basic_stream_socket.wait [*wait]]]
  45843. [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  45844. ]
  45845. [
  45846. [[link boost_asio.reference.basic_stream_socket.write_some [*write_some]]]
  45847. [Write some data to the socket. ]
  45848. ]
  45849. [
  45850. [[link boost_asio.reference.basic_stream_socket._basic_stream_socket [*~basic_stream_socket]]]
  45851. [Destroys the socket. ]
  45852. ]
  45853. ]
  45854. [heading Data Members]
  45855. [table
  45856. [[Name][Description]]
  45857. [
  45858. [[link boost_asio.reference.basic_stream_socket.max_connections [*max_connections]]]
  45859. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  45860. ]
  45861. [
  45862. [[link boost_asio.reference.basic_stream_socket.max_listen_connections [*max_listen_connections]]]
  45863. [The maximum length of the queue of pending incoming connections. ]
  45864. ]
  45865. [
  45866. [[link boost_asio.reference.basic_stream_socket.message_do_not_route [*message_do_not_route]]]
  45867. [Specify that the data should not be subject to routing. ]
  45868. ]
  45869. [
  45870. [[link boost_asio.reference.basic_stream_socket.message_end_of_record [*message_end_of_record]]]
  45871. [Specifies that the data marks the end of a record. ]
  45872. ]
  45873. [
  45874. [[link boost_asio.reference.basic_stream_socket.message_out_of_band [*message_out_of_band]]]
  45875. [Process out-of-band data. ]
  45876. ]
  45877. [
  45878. [[link boost_asio.reference.basic_stream_socket.message_peek [*message_peek]]]
  45879. [Peek at incoming data without removing it from the input queue. ]
  45880. ]
  45881. ]
  45882. [heading Protected Data Members]
  45883. [table
  45884. [[Name][Description]]
  45885. [
  45886. [[link boost_asio.reference.basic_stream_socket.impl_ [*impl_]]]
  45887. []
  45888. ]
  45889. ]
  45890. The [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] class template provides asynchronous and blocking stream-oriented socket functionality.
  45891. [heading Thread Safety]
  45892. ['Distinct] ['objects:] Safe.
  45893. ['Shared] ['objects:] Unsafe.
  45894. [heading Requirements]
  45895. ['Header: ][^boost/asio/ip/tcp.hpp]
  45896. ['Convenience header: ][^boost/asio.hpp]
  45897. [endsect]
  45898. [section:type ip::tcp::type]
  45899. [indexterm2 boost_asio.indexterm.ip__tcp.type..type..ip::tcp]
  45900. Obtain an identifier for the type of the protocol.
  45901. int type() const;
  45902. [endsect]
  45903. [section:v4 ip::tcp::v4]
  45904. [indexterm2 boost_asio.indexterm.ip__tcp.v4..v4..ip::tcp]
  45905. Construct to represent the IPv4 TCP protocol.
  45906. static tcp v4();
  45907. [endsect]
  45908. [section:v6 ip::tcp::v6]
  45909. [indexterm2 boost_asio.indexterm.ip__tcp.v6..v6..ip::tcp]
  45910. Construct to represent the IPv6 TCP protocol.
  45911. static tcp v6();
  45912. [endsect]
  45913. [endsect]
  45914. [section:ip__udp ip::udp]
  45915. Encapsulates the flags needed for UDP.
  45916. class udp
  45917. [heading Types]
  45918. [table
  45919. [[Name][Description]]
  45920. [
  45921. [[link boost_asio.reference.ip__udp.endpoint [*endpoint]]]
  45922. [The type of a UDP endpoint. ]
  45923. ]
  45924. [
  45925. [[link boost_asio.reference.ip__udp.resolver [*resolver]]]
  45926. [The UDP resolver type. ]
  45927. ]
  45928. [
  45929. [[link boost_asio.reference.ip__udp.socket [*socket]]]
  45930. [The UDP socket type. ]
  45931. ]
  45932. ]
  45933. [heading Member Functions]
  45934. [table
  45935. [[Name][Description]]
  45936. [
  45937. [[link boost_asio.reference.ip__udp.family [*family]]]
  45938. [Obtain an identifier for the protocol family. ]
  45939. ]
  45940. [
  45941. [[link boost_asio.reference.ip__udp.protocol [*protocol]]]
  45942. [Obtain an identifier for the protocol. ]
  45943. ]
  45944. [
  45945. [[link boost_asio.reference.ip__udp.type [*type]]]
  45946. [Obtain an identifier for the type of the protocol. ]
  45947. ]
  45948. [
  45949. [[link boost_asio.reference.ip__udp.v4 [*v4]]]
  45950. [Construct to represent the IPv4 UDP protocol. ]
  45951. ]
  45952. [
  45953. [[link boost_asio.reference.ip__udp.v6 [*v6]]]
  45954. [Construct to represent the IPv6 UDP protocol. ]
  45955. ]
  45956. ]
  45957. [heading Friends]
  45958. [table
  45959. [[Name][Description]]
  45960. [
  45961. [[link boost_asio.reference.ip__udp.operator_not__eq_ [*operator!=]]]
  45962. [Compare two protocols for inequality. ]
  45963. ]
  45964. [
  45965. [[link boost_asio.reference.ip__udp.operator_eq__eq_ [*operator==]]]
  45966. [Compare two protocols for equality. ]
  45967. ]
  45968. ]
  45969. The [link boost_asio.reference.ip__udp `ip::udp`] class contains flags necessary for UDP sockets.
  45970. [heading Thread Safety]
  45971. ['Distinct] ['objects:] Safe.
  45972. ['Shared] ['objects:] Safe.
  45973. [heading Requirements]
  45974. ['Header: ][^boost/asio/ip/udp.hpp]
  45975. ['Convenience header: ][^boost/asio.hpp]
  45976. [section:endpoint ip::udp::endpoint]
  45977. [indexterm2 boost_asio.indexterm.ip__udp.endpoint..endpoint..ip::udp]
  45978. The type of a UDP endpoint.
  45979. typedef basic_endpoint< udp > endpoint;
  45980. [heading Types]
  45981. [table
  45982. [[Name][Description]]
  45983. [
  45984. [[link boost_asio.reference.ip__basic_endpoint.data_type [*data_type]]]
  45985. [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
  45986. ]
  45987. [
  45988. [[link boost_asio.reference.ip__basic_endpoint.protocol_type [*protocol_type]]]
  45989. [The protocol type associated with the endpoint. ]
  45990. ]
  45991. ]
  45992. [heading Member Functions]
  45993. [table
  45994. [[Name][Description]]
  45995. [
  45996. [[link boost_asio.reference.ip__basic_endpoint.address [*address]]]
  45997. [Get the IP address associated with the endpoint.
  45998. [hr]
  45999. Set the IP address associated with the endpoint. ]
  46000. ]
  46001. [
  46002. [[link boost_asio.reference.ip__basic_endpoint.basic_endpoint [*basic_endpoint]]]
  46003. [Default constructor.
  46004. [hr]
  46005. 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.
  46006. [hr]
  46007. 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.
  46008. [hr]
  46009. Copy constructor.
  46010. [hr]
  46011. Move constructor. ]
  46012. ]
  46013. [
  46014. [[link boost_asio.reference.ip__basic_endpoint.capacity [*capacity]]]
  46015. [Get the capacity of the endpoint in the native type. ]
  46016. ]
  46017. [
  46018. [[link boost_asio.reference.ip__basic_endpoint.data [*data]]]
  46019. [Get the underlying endpoint in the native type. ]
  46020. ]
  46021. [
  46022. [[link boost_asio.reference.ip__basic_endpoint.operator_eq_ [*operator=]]]
  46023. [Assign from another endpoint.
  46024. [hr]
  46025. Move-assign from another endpoint. ]
  46026. ]
  46027. [
  46028. [[link boost_asio.reference.ip__basic_endpoint.port [*port]]]
  46029. [Get the port associated with the endpoint. The port number is always in the host's byte order.
  46030. [hr]
  46031. Set the port associated with the endpoint. The port number is always in the host's byte order. ]
  46032. ]
  46033. [
  46034. [[link boost_asio.reference.ip__basic_endpoint.protocol [*protocol]]]
  46035. [The protocol associated with the endpoint. ]
  46036. ]
  46037. [
  46038. [[link boost_asio.reference.ip__basic_endpoint.resize [*resize]]]
  46039. [Set the underlying size of the endpoint in the native type. ]
  46040. ]
  46041. [
  46042. [[link boost_asio.reference.ip__basic_endpoint.size [*size]]]
  46043. [Get the underlying size of the endpoint in the native type. ]
  46044. ]
  46045. ]
  46046. [heading Friends]
  46047. [table
  46048. [[Name][Description]]
  46049. [
  46050. [[link boost_asio.reference.ip__basic_endpoint.operator_not__eq_ [*operator!=]]]
  46051. [Compare two endpoints for inequality. ]
  46052. ]
  46053. [
  46054. [[link boost_asio.reference.ip__basic_endpoint.operator_lt_ [*operator<]]]
  46055. [Compare endpoints for ordering. ]
  46056. ]
  46057. [
  46058. [[link boost_asio.reference.ip__basic_endpoint.operator_lt__eq_ [*operator<=]]]
  46059. [Compare endpoints for ordering. ]
  46060. ]
  46061. [
  46062. [[link boost_asio.reference.ip__basic_endpoint.operator_eq__eq_ [*operator==]]]
  46063. [Compare two endpoints for equality. ]
  46064. ]
  46065. [
  46066. [[link boost_asio.reference.ip__basic_endpoint.operator_gt_ [*operator>]]]
  46067. [Compare endpoints for ordering. ]
  46068. ]
  46069. [
  46070. [[link boost_asio.reference.ip__basic_endpoint.operator_gt__eq_ [*operator>=]]]
  46071. [Compare endpoints for ordering. ]
  46072. ]
  46073. ]
  46074. [heading Related Functions]
  46075. [table
  46076. [[Name][Description]]
  46077. [
  46078. [[link boost_asio.reference.ip__basic_endpoint.operator_lt__lt_ [*operator<<]]]
  46079. [Output an endpoint as a string. ]
  46080. ]
  46081. ]
  46082. The [link boost_asio.reference.ip__basic_endpoint `ip::basic_endpoint`] class template describes an endpoint that may be associated with a particular socket.
  46083. [heading Thread Safety]
  46084. ['Distinct] ['objects:] Safe.
  46085. ['Shared] ['objects:] Unsafe.
  46086. [heading Requirements]
  46087. ['Header: ][^boost/asio/ip/udp.hpp]
  46088. ['Convenience header: ][^boost/asio.hpp]
  46089. [endsect]
  46090. [section:family ip::udp::family]
  46091. [indexterm2 boost_asio.indexterm.ip__udp.family..family..ip::udp]
  46092. Obtain an identifier for the protocol family.
  46093. int family() const;
  46094. [endsect]
  46095. [section:operator_not__eq_ ip::udp::operator!=]
  46096. [indexterm2 boost_asio.indexterm.ip__udp.operator_not__eq_..operator!=..ip::udp]
  46097. Compare two protocols for inequality.
  46098. friend bool operator!=(
  46099. const udp & p1,
  46100. const udp & p2);
  46101. [heading Requirements]
  46102. ['Header: ][^boost/asio/ip/udp.hpp]
  46103. ['Convenience header: ][^boost/asio.hpp]
  46104. [endsect]
  46105. [section:operator_eq__eq_ ip::udp::operator==]
  46106. [indexterm2 boost_asio.indexterm.ip__udp.operator_eq__eq_..operator==..ip::udp]
  46107. Compare two protocols for equality.
  46108. friend bool operator==(
  46109. const udp & p1,
  46110. const udp & p2);
  46111. [heading Requirements]
  46112. ['Header: ][^boost/asio/ip/udp.hpp]
  46113. ['Convenience header: ][^boost/asio.hpp]
  46114. [endsect]
  46115. [section:protocol ip::udp::protocol]
  46116. [indexterm2 boost_asio.indexterm.ip__udp.protocol..protocol..ip::udp]
  46117. Obtain an identifier for the protocol.
  46118. int protocol() const;
  46119. [endsect]
  46120. [section:resolver ip::udp::resolver]
  46121. [indexterm2 boost_asio.indexterm.ip__udp.resolver..resolver..ip::udp]
  46122. The UDP resolver type.
  46123. typedef basic_resolver< udp > resolver;
  46124. [heading Types]
  46125. [table
  46126. [[Name][Description]]
  46127. [
  46128. [[link boost_asio.reference.ip__basic_resolver__rebind_executor [*rebind_executor]]]
  46129. [Rebinds the resolver type to another executor. ]
  46130. ]
  46131. [
  46132. [[link boost_asio.reference.ip__basic_resolver.endpoint_type [*endpoint_type]]]
  46133. [The endpoint type. ]
  46134. ]
  46135. [
  46136. [[link boost_asio.reference.ip__basic_resolver.executor_type [*executor_type]]]
  46137. [The type of the executor associated with the object. ]
  46138. ]
  46139. [
  46140. [[link boost_asio.reference.ip__basic_resolver.flags [*flags]]]
  46141. [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
  46142. ]
  46143. [
  46144. [[link boost_asio.reference.ip__basic_resolver.iterator [*iterator]]]
  46145. [(Deprecated.) The iterator type. ]
  46146. ]
  46147. [
  46148. [[link boost_asio.reference.ip__basic_resolver.protocol_type [*protocol_type]]]
  46149. [The protocol type. ]
  46150. ]
  46151. [
  46152. [[link boost_asio.reference.ip__basic_resolver.query [*query]]]
  46153. [(Deprecated.) The query type. ]
  46154. ]
  46155. [
  46156. [[link boost_asio.reference.ip__basic_resolver.results_type [*results_type]]]
  46157. [The results type. ]
  46158. ]
  46159. ]
  46160. [heading Member Functions]
  46161. [table
  46162. [[Name][Description]]
  46163. [
  46164. [[link boost_asio.reference.ip__basic_resolver.async_resolve [*async_resolve]]]
  46165. [(Deprecated: Use overload with separate host and service parameters.) Asynchronously perform forward resolution of a query to a list of entries.
  46166. [hr]
  46167. Asynchronously perform forward resolution of a query to a list of entries.
  46168. [hr]
  46169. Asynchronously perform reverse resolution of an endpoint to a list of entries. ]
  46170. ]
  46171. [
  46172. [[link boost_asio.reference.ip__basic_resolver.basic_resolver [*basic_resolver]]]
  46173. [Construct with executor.
  46174. [hr]
  46175. Construct with execution context.
  46176. [hr]
  46177. Move-construct a basic_resolver from another. ]
  46178. ]
  46179. [
  46180. [[link boost_asio.reference.ip__basic_resolver.cancel [*cancel]]]
  46181. [Cancel any asynchronous operations that are waiting on the resolver. ]
  46182. ]
  46183. [
  46184. [[link boost_asio.reference.ip__basic_resolver.get_executor [*get_executor]]]
  46185. [Get the executor associated with the object. ]
  46186. ]
  46187. [
  46188. [[link boost_asio.reference.ip__basic_resolver.operator_eq_ [*operator=]]]
  46189. [Move-assign a basic_resolver from another. ]
  46190. ]
  46191. [
  46192. [[link boost_asio.reference.ip__basic_resolver.resolve [*resolve]]]
  46193. [(Deprecated: Use overload with separate host and service parameters.) Perform forward resolution of a query to a list of entries.
  46194. [hr]
  46195. Perform forward resolution of a query to a list of entries.
  46196. [hr]
  46197. Perform reverse resolution of an endpoint to a list of entries. ]
  46198. ]
  46199. [
  46200. [[link boost_asio.reference.ip__basic_resolver._basic_resolver [*~basic_resolver]]]
  46201. [Destroys the resolver. ]
  46202. ]
  46203. ]
  46204. [heading Data Members]
  46205. [table
  46206. [[Name][Description]]
  46207. [
  46208. [[link boost_asio.reference.ip__basic_resolver.address_configured [*address_configured]]]
  46209. [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. ]
  46210. ]
  46211. [
  46212. [[link boost_asio.reference.ip__basic_resolver.all_matching [*all_matching]]]
  46213. [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
  46214. ]
  46215. [
  46216. [[link boost_asio.reference.ip__basic_resolver.canonical_name [*canonical_name]]]
  46217. [Determine the canonical name of the host specified in the query. ]
  46218. ]
  46219. [
  46220. [[link boost_asio.reference.ip__basic_resolver.numeric_host [*numeric_host]]]
  46221. [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
  46222. ]
  46223. [
  46224. [[link boost_asio.reference.ip__basic_resolver.numeric_service [*numeric_service]]]
  46225. [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
  46226. ]
  46227. [
  46228. [[link boost_asio.reference.ip__basic_resolver.passive [*passive]]]
  46229. [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
  46230. ]
  46231. [
  46232. [[link boost_asio.reference.ip__basic_resolver.v4_mapped [*v4_mapped]]]
  46233. [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
  46234. ]
  46235. ]
  46236. The [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] class template provides the ability to resolve a query to a list of endpoints.
  46237. [heading Thread Safety]
  46238. ['Distinct] ['objects:] Safe.
  46239. ['Shared] ['objects:] Unsafe.
  46240. [heading Requirements]
  46241. ['Header: ][^boost/asio/ip/udp.hpp]
  46242. ['Convenience header: ][^boost/asio.hpp]
  46243. [endsect]
  46244. [section:socket ip::udp::socket]
  46245. [indexterm2 boost_asio.indexterm.ip__udp.socket..socket..ip::udp]
  46246. The UDP socket type.
  46247. typedef basic_datagram_socket< udp > socket;
  46248. [heading Types]
  46249. [table
  46250. [[Name][Description]]
  46251. [
  46252. [[link boost_asio.reference.basic_datagram_socket__rebind_executor [*rebind_executor]]]
  46253. [Rebinds the socket type to another executor. ]
  46254. ]
  46255. [
  46256. [[link boost_asio.reference.basic_datagram_socket.broadcast [*broadcast]]]
  46257. [Socket option to permit sending of broadcast messages. ]
  46258. ]
  46259. [
  46260. [[link boost_asio.reference.basic_datagram_socket.bytes_readable [*bytes_readable]]]
  46261. [IO control command to get the amount of data that can be read without blocking. ]
  46262. ]
  46263. [
  46264. [[link boost_asio.reference.basic_datagram_socket.debug [*debug]]]
  46265. [Socket option to enable socket-level debugging. ]
  46266. ]
  46267. [
  46268. [[link boost_asio.reference.basic_datagram_socket.do_not_route [*do_not_route]]]
  46269. [Socket option to prevent routing, use local interfaces only. ]
  46270. ]
  46271. [
  46272. [[link boost_asio.reference.basic_datagram_socket.enable_connection_aborted [*enable_connection_aborted]]]
  46273. [Socket option to report aborted connections on accept. ]
  46274. ]
  46275. [
  46276. [[link boost_asio.reference.basic_datagram_socket.endpoint_type [*endpoint_type]]]
  46277. [The endpoint type. ]
  46278. ]
  46279. [
  46280. [[link boost_asio.reference.basic_datagram_socket.executor_type [*executor_type]]]
  46281. [The type of the executor associated with the object. ]
  46282. ]
  46283. [
  46284. [[link boost_asio.reference.basic_datagram_socket.keep_alive [*keep_alive]]]
  46285. [Socket option to send keep-alives. ]
  46286. ]
  46287. [
  46288. [[link boost_asio.reference.basic_datagram_socket.linger [*linger]]]
  46289. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  46290. ]
  46291. [
  46292. [[link boost_asio.reference.basic_datagram_socket.lowest_layer_type [*lowest_layer_type]]]
  46293. [A basic_socket is always the lowest layer. ]
  46294. ]
  46295. [
  46296. [[link boost_asio.reference.basic_datagram_socket.message_flags [*message_flags]]]
  46297. [Bitmask type for flags that can be passed to send and receive operations. ]
  46298. ]
  46299. [
  46300. [[link boost_asio.reference.basic_datagram_socket.native_handle_type [*native_handle_type]]]
  46301. [The native representation of a socket. ]
  46302. ]
  46303. [
  46304. [[link boost_asio.reference.basic_datagram_socket.out_of_band_inline [*out_of_band_inline]]]
  46305. [Socket option for putting received out-of-band data inline. ]
  46306. ]
  46307. [
  46308. [[link boost_asio.reference.basic_datagram_socket.protocol_type [*protocol_type]]]
  46309. [The protocol type. ]
  46310. ]
  46311. [
  46312. [[link boost_asio.reference.basic_datagram_socket.receive_buffer_size [*receive_buffer_size]]]
  46313. [Socket option for the receive buffer size of a socket. ]
  46314. ]
  46315. [
  46316. [[link boost_asio.reference.basic_datagram_socket.receive_low_watermark [*receive_low_watermark]]]
  46317. [Socket option for the receive low watermark. ]
  46318. ]
  46319. [
  46320. [[link boost_asio.reference.basic_datagram_socket.reuse_address [*reuse_address]]]
  46321. [Socket option to allow the socket to be bound to an address that is already in use. ]
  46322. ]
  46323. [
  46324. [[link boost_asio.reference.basic_datagram_socket.send_buffer_size [*send_buffer_size]]]
  46325. [Socket option for the send buffer size of a socket. ]
  46326. ]
  46327. [
  46328. [[link boost_asio.reference.basic_datagram_socket.send_low_watermark [*send_low_watermark]]]
  46329. [Socket option for the send low watermark. ]
  46330. ]
  46331. [
  46332. [[link boost_asio.reference.basic_datagram_socket.shutdown_type [*shutdown_type]]]
  46333. [Different ways a socket may be shutdown. ]
  46334. ]
  46335. [
  46336. [[link boost_asio.reference.basic_datagram_socket.wait_type [*wait_type]]]
  46337. [Wait types. ]
  46338. ]
  46339. ]
  46340. [heading Member Functions]
  46341. [table
  46342. [[Name][Description]]
  46343. [
  46344. [[link boost_asio.reference.basic_datagram_socket.assign [*assign]]]
  46345. [Assign an existing native socket to the socket. ]
  46346. ]
  46347. [
  46348. [[link boost_asio.reference.basic_datagram_socket.async_connect [*async_connect]]]
  46349. [Start an asynchronous connect. ]
  46350. ]
  46351. [
  46352. [[link boost_asio.reference.basic_datagram_socket.async_receive [*async_receive]]]
  46353. [Start an asynchronous receive on a connected socket. ]
  46354. ]
  46355. [
  46356. [[link boost_asio.reference.basic_datagram_socket.async_receive_from [*async_receive_from]]]
  46357. [Start an asynchronous receive. ]
  46358. ]
  46359. [
  46360. [[link boost_asio.reference.basic_datagram_socket.async_send [*async_send]]]
  46361. [Start an asynchronous send on a connected socket. ]
  46362. ]
  46363. [
  46364. [[link boost_asio.reference.basic_datagram_socket.async_send_to [*async_send_to]]]
  46365. [Start an asynchronous send. ]
  46366. ]
  46367. [
  46368. [[link boost_asio.reference.basic_datagram_socket.async_wait [*async_wait]]]
  46369. [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  46370. ]
  46371. [
  46372. [[link boost_asio.reference.basic_datagram_socket.at_mark [*at_mark]]]
  46373. [Determine whether the socket is at the out-of-band data mark. ]
  46374. ]
  46375. [
  46376. [[link boost_asio.reference.basic_datagram_socket.available [*available]]]
  46377. [Determine the number of bytes available for reading. ]
  46378. ]
  46379. [
  46380. [[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket [*basic_datagram_socket]]]
  46381. [Construct a basic_datagram_socket without opening it.
  46382. [hr]
  46383. Construct and open a basic_datagram_socket.
  46384. [hr]
  46385. Construct a basic_datagram_socket, opening it and binding it to the given local endpoint.
  46386. [hr]
  46387. Construct a basic_datagram_socket on an existing native socket.
  46388. [hr]
  46389. Move-construct a basic_datagram_socket from another.
  46390. [hr]
  46391. Move-construct a basic_datagram_socket from a socket of another protocol type. ]
  46392. ]
  46393. [
  46394. [[link boost_asio.reference.basic_datagram_socket.bind [*bind]]]
  46395. [Bind the socket to the given local endpoint. ]
  46396. ]
  46397. [
  46398. [[link boost_asio.reference.basic_datagram_socket.cancel [*cancel]]]
  46399. [Cancel all asynchronous operations associated with the socket. ]
  46400. ]
  46401. [
  46402. [[link boost_asio.reference.basic_datagram_socket.close [*close]]]
  46403. [Close the socket. ]
  46404. ]
  46405. [
  46406. [[link boost_asio.reference.basic_datagram_socket.connect [*connect]]]
  46407. [Connect the socket to the specified endpoint. ]
  46408. ]
  46409. [
  46410. [[link boost_asio.reference.basic_datagram_socket.get_executor [*get_executor]]]
  46411. [Get the executor associated with the object. ]
  46412. ]
  46413. [
  46414. [[link boost_asio.reference.basic_datagram_socket.get_option [*get_option]]]
  46415. [Get an option from the socket. ]
  46416. ]
  46417. [
  46418. [[link boost_asio.reference.basic_datagram_socket.io_control [*io_control]]]
  46419. [Perform an IO control command on the socket. ]
  46420. ]
  46421. [
  46422. [[link boost_asio.reference.basic_datagram_socket.is_open [*is_open]]]
  46423. [Determine whether the socket is open. ]
  46424. ]
  46425. [
  46426. [[link boost_asio.reference.basic_datagram_socket.local_endpoint [*local_endpoint]]]
  46427. [Get the local endpoint of the socket. ]
  46428. ]
  46429. [
  46430. [[link boost_asio.reference.basic_datagram_socket.lowest_layer [*lowest_layer]]]
  46431. [Get a reference to the lowest layer.
  46432. [hr]
  46433. Get a const reference to the lowest layer. ]
  46434. ]
  46435. [
  46436. [[link boost_asio.reference.basic_datagram_socket.native_handle [*native_handle]]]
  46437. [Get the native socket representation. ]
  46438. ]
  46439. [
  46440. [[link boost_asio.reference.basic_datagram_socket.native_non_blocking [*native_non_blocking]]]
  46441. [Gets the non-blocking mode of the native socket implementation.
  46442. [hr]
  46443. Sets the non-blocking mode of the native socket implementation. ]
  46444. ]
  46445. [
  46446. [[link boost_asio.reference.basic_datagram_socket.non_blocking [*non_blocking]]]
  46447. [Gets the non-blocking mode of the socket.
  46448. [hr]
  46449. Sets the non-blocking mode of the socket. ]
  46450. ]
  46451. [
  46452. [[link boost_asio.reference.basic_datagram_socket.open [*open]]]
  46453. [Open the socket using the specified protocol. ]
  46454. ]
  46455. [
  46456. [[link boost_asio.reference.basic_datagram_socket.operator_eq_ [*operator=]]]
  46457. [Move-assign a basic_datagram_socket from another.
  46458. [hr]
  46459. Move-assign a basic_datagram_socket from a socket of another protocol type. ]
  46460. ]
  46461. [
  46462. [[link boost_asio.reference.basic_datagram_socket.receive [*receive]]]
  46463. [Receive some data on a connected socket. ]
  46464. ]
  46465. [
  46466. [[link boost_asio.reference.basic_datagram_socket.receive_from [*receive_from]]]
  46467. [Receive a datagram with the endpoint of the sender. ]
  46468. ]
  46469. [
  46470. [[link boost_asio.reference.basic_datagram_socket.release [*release]]]
  46471. [Release ownership of the underlying native socket. ]
  46472. ]
  46473. [
  46474. [[link boost_asio.reference.basic_datagram_socket.remote_endpoint [*remote_endpoint]]]
  46475. [Get the remote endpoint of the socket. ]
  46476. ]
  46477. [
  46478. [[link boost_asio.reference.basic_datagram_socket.send [*send]]]
  46479. [Send some data on a connected socket. ]
  46480. ]
  46481. [
  46482. [[link boost_asio.reference.basic_datagram_socket.send_to [*send_to]]]
  46483. [Send a datagram to the specified endpoint. ]
  46484. ]
  46485. [
  46486. [[link boost_asio.reference.basic_datagram_socket.set_option [*set_option]]]
  46487. [Set an option on the socket. ]
  46488. ]
  46489. [
  46490. [[link boost_asio.reference.basic_datagram_socket.shutdown [*shutdown]]]
  46491. [Disable sends or receives on the socket. ]
  46492. ]
  46493. [
  46494. [[link boost_asio.reference.basic_datagram_socket.wait [*wait]]]
  46495. [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  46496. ]
  46497. [
  46498. [[link boost_asio.reference.basic_datagram_socket._basic_datagram_socket [*~basic_datagram_socket]]]
  46499. [Destroys the socket. ]
  46500. ]
  46501. ]
  46502. [heading Data Members]
  46503. [table
  46504. [[Name][Description]]
  46505. [
  46506. [[link boost_asio.reference.basic_datagram_socket.max_connections [*max_connections]]]
  46507. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  46508. ]
  46509. [
  46510. [[link boost_asio.reference.basic_datagram_socket.max_listen_connections [*max_listen_connections]]]
  46511. [The maximum length of the queue of pending incoming connections. ]
  46512. ]
  46513. [
  46514. [[link boost_asio.reference.basic_datagram_socket.message_do_not_route [*message_do_not_route]]]
  46515. [Specify that the data should not be subject to routing. ]
  46516. ]
  46517. [
  46518. [[link boost_asio.reference.basic_datagram_socket.message_end_of_record [*message_end_of_record]]]
  46519. [Specifies that the data marks the end of a record. ]
  46520. ]
  46521. [
  46522. [[link boost_asio.reference.basic_datagram_socket.message_out_of_band [*message_out_of_band]]]
  46523. [Process out-of-band data. ]
  46524. ]
  46525. [
  46526. [[link boost_asio.reference.basic_datagram_socket.message_peek [*message_peek]]]
  46527. [Peek at incoming data without removing it from the input queue. ]
  46528. ]
  46529. ]
  46530. [heading Protected Data Members]
  46531. [table
  46532. [[Name][Description]]
  46533. [
  46534. [[link boost_asio.reference.basic_datagram_socket.impl_ [*impl_]]]
  46535. []
  46536. ]
  46537. ]
  46538. The [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] class template provides asynchronous and blocking datagram-oriented socket functionality.
  46539. [heading Thread Safety]
  46540. ['Distinct] ['objects:] Safe.
  46541. ['Shared] ['objects:] Unsafe.
  46542. [heading Requirements]
  46543. ['Header: ][^boost/asio/ip/udp.hpp]
  46544. ['Convenience header: ][^boost/asio.hpp]
  46545. [endsect]
  46546. [section:type ip::udp::type]
  46547. [indexterm2 boost_asio.indexterm.ip__udp.type..type..ip::udp]
  46548. Obtain an identifier for the type of the protocol.
  46549. int type() const;
  46550. [endsect]
  46551. [section:v4 ip::udp::v4]
  46552. [indexterm2 boost_asio.indexterm.ip__udp.v4..v4..ip::udp]
  46553. Construct to represent the IPv4 UDP protocol.
  46554. static udp v4();
  46555. [endsect]
  46556. [section:v6 ip::udp::v6]
  46557. [indexterm2 boost_asio.indexterm.ip__udp.v6..v6..ip::udp]
  46558. Construct to represent the IPv6 UDP protocol.
  46559. static udp v6();
  46560. [endsect]
  46561. [endsect]
  46562. [section:ip__unicast__hops ip::unicast::hops]
  46563. [indexterm1 boost_asio.indexterm.ip__unicast__hops..ip::unicast::hops]
  46564. Socket option for time-to-live associated with outgoing unicast packets.
  46565. typedef implementation_defined hops;
  46566. Implements the IPPROTO\_IP/IP\_UNICAST\_TTL socket option.
  46567. [heading Examples]
  46568. Setting the option:
  46569. boost::asio::ip::udp::socket socket(my_context);
  46570. ...
  46571. boost::asio::ip::unicast::hops option(4);
  46572. socket.set_option(option);
  46573. Getting the current option value:
  46574. boost::asio::ip::udp::socket socket(my_context);
  46575. ...
  46576. boost::asio::ip::unicast::hops option;
  46577. socket.get_option(option);
  46578. int ttl = option.value();
  46579. [heading Requirements]
  46580. ['Header: ][^boost/asio/ip/unicast.hpp]
  46581. ['Convenience header: ][^boost/asio.hpp]
  46582. [endsect]
  46583. [section:ip__v4_mapped_t ip::v4_mapped_t]
  46584. [indexterm1 boost_asio.indexterm.ip__v4_mapped_t..ip::v4_mapped_t]
  46585. Tag type used for distinguishing overloads that deal in IPv4-mapped IPv6 addresses.
  46586. enum v4_mapped_t
  46587. [indexterm2 boost_asio.indexterm.ip__v4_mapped_t.v4_mapped..v4_mapped..ip::v4_mapped_t]
  46588. [heading Values]
  46589. [variablelist
  46590. [
  46591. [v4_mapped]
  46592. []
  46593. ]
  46594. ]
  46595. [heading Requirements]
  46596. ['Header: ][^boost/asio/ip/address_v6.hpp]
  46597. ['Convenience header: ][^boost/asio.hpp]
  46598. [endsect]
  46599. [section:ip__v6_only ip::v6_only]
  46600. [indexterm1 boost_asio.indexterm.ip__v6_only..ip::v6_only]
  46601. Socket option for determining whether an IPv6 socket supports IPv6 communication only.
  46602. typedef implementation_defined v6_only;
  46603. Implements the IPPROTO\_IPV6/IP\_V6ONLY socket option.
  46604. [heading Examples]
  46605. Setting the option:
  46606. boost::asio::ip::tcp::socket socket(my_context);
  46607. ...
  46608. boost::asio::ip::v6_only option(true);
  46609. socket.set_option(option);
  46610. Getting the current option value:
  46611. boost::asio::ip::tcp::socket socket(my_context);
  46612. ...
  46613. boost::asio::ip::v6_only option;
  46614. socket.get_option(option);
  46615. bool v6_only = option.value();
  46616. [heading Requirements]
  46617. ['Header: ][^boost/asio/ip/v6_only.hpp]
  46618. ['Convenience header: ][^boost/asio.hpp]
  46619. [endsect]
  46620. [section:is_const_buffer_sequence is_const_buffer_sequence]
  46621. Trait to determine whether a type satisfies the ConstBufferSequence requirements.
  46622. template<
  46623. typename T>
  46624. struct is_const_buffer_sequence
  46625. [heading Requirements]
  46626. ['Header: ][^boost/asio/buffer.hpp]
  46627. ['Convenience header: ][^boost/asio.hpp]
  46628. [endsect]
  46629. [section:is_dynamic_buffer is_dynamic_buffer]
  46630. Trait to determine whether a type satisfies the DynamicBuffer requirements.
  46631. template<
  46632. typename T>
  46633. struct is_dynamic_buffer
  46634. If `BOOST_ASIO_NO_DYNAMIC_BUFFER_V1` is not defined, determines whether the type satisfies the DynamicBuffer\_v1 requirements. Otherwise, if `BOOST_ASIO_NO_DYNAMIC_BUFFER_V1` is defined, determines whether the type satisfies the DynamicBuffer\_v2 requirements.
  46635. [heading Requirements]
  46636. ['Header: ][^boost/asio/buffer.hpp]
  46637. ['Convenience header: ][^boost/asio.hpp]
  46638. [endsect]
  46639. [section:is_dynamic_buffer_v1 is_dynamic_buffer_v1]
  46640. Trait to determine whether a type satisfies the DynamicBuffer\_v1 requirements.
  46641. template<
  46642. typename T>
  46643. struct is_dynamic_buffer_v1
  46644. [heading Requirements]
  46645. ['Header: ][^boost/asio/buffer.hpp]
  46646. ['Convenience header: ][^boost/asio.hpp]
  46647. [endsect]
  46648. [section:is_dynamic_buffer_v2 is_dynamic_buffer_v2]
  46649. Trait to determine whether a type satisfies the DynamicBuffer\_v2 requirements.
  46650. template<
  46651. typename T>
  46652. struct is_dynamic_buffer_v2
  46653. [heading Requirements]
  46654. ['Header: ][^boost/asio/buffer.hpp]
  46655. ['Convenience header: ][^boost/asio.hpp]
  46656. [endsect]
  46657. [section:is_endpoint_sequence is_endpoint_sequence]
  46658. Type trait used to determine whether a type is an endpoint sequence that can be used with with `connect` and `async_connect`.
  46659. template<
  46660. typename T>
  46661. struct is_endpoint_sequence
  46662. [heading Data Members]
  46663. [table
  46664. [[Name][Description]]
  46665. [
  46666. [[link boost_asio.reference.is_endpoint_sequence.value [*value]]]
  46667. [The value member is true if the type may be used as an endpoint sequence. ]
  46668. ]
  46669. ]
  46670. [heading Requirements]
  46671. ['Header: ][^boost/asio/connect.hpp]
  46672. ['Convenience header: ][^boost/asio.hpp]
  46673. [section:value is_endpoint_sequence::value]
  46674. [indexterm2 boost_asio.indexterm.is_endpoint_sequence.value..value..is_endpoint_sequence]
  46675. The value member is true if the type may be used as an endpoint sequence.
  46676. static const bool value;
  46677. [endsect]
  46678. [endsect]
  46679. [section:is_executor is_executor]
  46680. The [link boost_asio.reference.is_executor `is_executor`] trait detects whether a type T meets the Executor type requirements.
  46681. template<
  46682. typename T>
  46683. struct is_executor
  46684. Class template `is_executor` is a UnaryTypeTrait that is derived from `true_type` if the type `T` meets the syntactic requirements for Executor, otherwise `false_type`.
  46685. [heading Requirements]
  46686. ['Header: ][^boost/asio/is_executor.hpp]
  46687. ['Convenience header: ][^boost/asio.hpp]
  46688. [endsect]
  46689. [section:is_match_condition is_match_condition]
  46690. Type trait used to determine whether a type can be used as a match condition function with read\_until and async\_read\_until.
  46691. template<
  46692. typename T>
  46693. struct is_match_condition
  46694. [heading Data Members]
  46695. [table
  46696. [[Name][Description]]
  46697. [
  46698. [[link boost_asio.reference.is_match_condition.value [*value]]]
  46699. [The value member is true if the type may be used as a match condition. ]
  46700. ]
  46701. ]
  46702. [heading Requirements]
  46703. ['Header: ][^boost/asio/read_until.hpp]
  46704. ['Convenience header: ][^boost/asio.hpp]
  46705. [section:value is_match_condition::value]
  46706. [indexterm2 boost_asio.indexterm.is_match_condition.value..value..is_match_condition]
  46707. The value member is true if the type may be used as a match condition.
  46708. static const bool value;
  46709. [endsect]
  46710. [endsect]
  46711. [section:is_mutable_buffer_sequence is_mutable_buffer_sequence]
  46712. Trait to determine whether a type satisfies the MutableBufferSequence requirements.
  46713. template<
  46714. typename T>
  46715. struct is_mutable_buffer_sequence
  46716. [heading Requirements]
  46717. ['Header: ][^boost/asio/buffer.hpp]
  46718. ['Convenience header: ][^boost/asio.hpp]
  46719. [endsect]
  46720. [section:is_read_buffered is_read_buffered]
  46721. The [link boost_asio.reference.is_read_buffered `is_read_buffered`] class is a traits class that may be used to determine whether a stream type supports buffering of read data.
  46722. template<
  46723. typename Stream>
  46724. class is_read_buffered
  46725. [heading Data Members]
  46726. [table
  46727. [[Name][Description]]
  46728. [
  46729. [[link boost_asio.reference.is_read_buffered.value [*value]]]
  46730. [The value member is true only if the Stream type supports buffering of read data. ]
  46731. ]
  46732. ]
  46733. [heading Requirements]
  46734. ['Header: ][^boost/asio/is_read_buffered.hpp]
  46735. ['Convenience header: ][^boost/asio.hpp]
  46736. [section:value is_read_buffered::value]
  46737. [indexterm2 boost_asio.indexterm.is_read_buffered.value..value..is_read_buffered]
  46738. The value member is true only if the Stream type supports buffering of read data.
  46739. static const bool value;
  46740. [endsect]
  46741. [endsect]
  46742. [section:is_write_buffered is_write_buffered]
  46743. The [link boost_asio.reference.is_write_buffered `is_write_buffered`] class is a traits class that may be used to determine whether a stream type supports buffering of written data.
  46744. template<
  46745. typename Stream>
  46746. class is_write_buffered
  46747. [heading Data Members]
  46748. [table
  46749. [[Name][Description]]
  46750. [
  46751. [[link boost_asio.reference.is_write_buffered.value [*value]]]
  46752. [The value member is true only if the Stream type supports buffering of written data. ]
  46753. ]
  46754. ]
  46755. [heading Requirements]
  46756. ['Header: ][^boost/asio/is_write_buffered.hpp]
  46757. ['Convenience header: ][^boost/asio.hpp]
  46758. [section:value is_write_buffered::value]
  46759. [indexterm2 boost_asio.indexterm.is_write_buffered.value..value..is_write_buffered]
  46760. The value member is true only if the Stream type supports buffering of written data.
  46761. static const bool value;
  46762. [endsect]
  46763. [endsect]
  46764. [section:local__basic_endpoint local::basic_endpoint]
  46765. Describes an endpoint for a UNIX socket.
  46766. template<
  46767. typename ``[link boost_asio.reference.Protocol Protocol]``>
  46768. class basic_endpoint
  46769. [heading Types]
  46770. [table
  46771. [[Name][Description]]
  46772. [
  46773. [[link boost_asio.reference.local__basic_endpoint.data_type [*data_type]]]
  46774. [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
  46775. ]
  46776. [
  46777. [[link boost_asio.reference.local__basic_endpoint.protocol_type [*protocol_type]]]
  46778. [The protocol type associated with the endpoint. ]
  46779. ]
  46780. ]
  46781. [heading Member Functions]
  46782. [table
  46783. [[Name][Description]]
  46784. [
  46785. [[link boost_asio.reference.local__basic_endpoint.basic_endpoint [*basic_endpoint]]]
  46786. [Default constructor.
  46787. [hr]
  46788. Construct an endpoint using the specified path name.
  46789. [hr]
  46790. Copy constructor. ]
  46791. ]
  46792. [
  46793. [[link boost_asio.reference.local__basic_endpoint.capacity [*capacity]]]
  46794. [Get the capacity of the endpoint in the native type. ]
  46795. ]
  46796. [
  46797. [[link boost_asio.reference.local__basic_endpoint.data [*data]]]
  46798. [Get the underlying endpoint in the native type. ]
  46799. ]
  46800. [
  46801. [[link boost_asio.reference.local__basic_endpoint.operator_eq_ [*operator=]]]
  46802. [Assign from another endpoint. ]
  46803. ]
  46804. [
  46805. [[link boost_asio.reference.local__basic_endpoint.path [*path]]]
  46806. [Get the path associated with the endpoint.
  46807. [hr]
  46808. Set the path associated with the endpoint. ]
  46809. ]
  46810. [
  46811. [[link boost_asio.reference.local__basic_endpoint.protocol [*protocol]]]
  46812. [The protocol associated with the endpoint. ]
  46813. ]
  46814. [
  46815. [[link boost_asio.reference.local__basic_endpoint.resize [*resize]]]
  46816. [Set the underlying size of the endpoint in the native type. ]
  46817. ]
  46818. [
  46819. [[link boost_asio.reference.local__basic_endpoint.size [*size]]]
  46820. [Get the underlying size of the endpoint in the native type. ]
  46821. ]
  46822. ]
  46823. [heading Friends]
  46824. [table
  46825. [[Name][Description]]
  46826. [
  46827. [[link boost_asio.reference.local__basic_endpoint.operator_not__eq_ [*operator!=]]]
  46828. [Compare two endpoints for inequality. ]
  46829. ]
  46830. [
  46831. [[link boost_asio.reference.local__basic_endpoint.operator_lt_ [*operator<]]]
  46832. [Compare endpoints for ordering. ]
  46833. ]
  46834. [
  46835. [[link boost_asio.reference.local__basic_endpoint.operator_lt__eq_ [*operator<=]]]
  46836. [Compare endpoints for ordering. ]
  46837. ]
  46838. [
  46839. [[link boost_asio.reference.local__basic_endpoint.operator_eq__eq_ [*operator==]]]
  46840. [Compare two endpoints for equality. ]
  46841. ]
  46842. [
  46843. [[link boost_asio.reference.local__basic_endpoint.operator_gt_ [*operator>]]]
  46844. [Compare endpoints for ordering. ]
  46845. ]
  46846. [
  46847. [[link boost_asio.reference.local__basic_endpoint.operator_gt__eq_ [*operator>=]]]
  46848. [Compare endpoints for ordering. ]
  46849. ]
  46850. ]
  46851. [heading Related Functions]
  46852. [table
  46853. [[Name][Description]]
  46854. [
  46855. [[link boost_asio.reference.local__basic_endpoint.operator_lt__lt_ [*operator<<]]]
  46856. [Output an endpoint as a string. ]
  46857. ]
  46858. ]
  46859. The [link boost_asio.reference.local__basic_endpoint `local::basic_endpoint`] class template describes an endpoint that may be associated with a particular UNIX socket.
  46860. [heading Thread Safety]
  46861. ['Distinct] ['objects:] Safe.
  46862. ['Shared] ['objects:] Unsafe.
  46863. [heading Requirements]
  46864. ['Header: ][^boost/asio/local/basic_endpoint.hpp]
  46865. ['Convenience header: ][^boost/asio.hpp]
  46866. [section:basic_endpoint local::basic_endpoint::basic_endpoint]
  46867. [indexterm2 boost_asio.indexterm.local__basic_endpoint.basic_endpoint..basic_endpoint..local::basic_endpoint]
  46868. Default constructor.
  46869. ``[link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload1 basic_endpoint]``();
  46870. `` [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload1 more...]]``
  46871. Construct an endpoint using the specified path name.
  46872. ``[link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload2 basic_endpoint]``(
  46873. const char * path_name);
  46874. `` [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload2 more...]]``
  46875. ``[link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload3 basic_endpoint]``(
  46876. const std::string & path_name);
  46877. `` [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload3 more...]]``
  46878. Copy constructor.
  46879. ``[link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload4 basic_endpoint]``(
  46880. const basic_endpoint & other);
  46881. `` [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload4 more...]]``
  46882. [section:overload1 local::basic_endpoint::basic_endpoint (1 of 4 overloads)]
  46883. Default constructor.
  46884. basic_endpoint();
  46885. [endsect]
  46886. [section:overload2 local::basic_endpoint::basic_endpoint (2 of 4 overloads)]
  46887. Construct an endpoint using the specified path name.
  46888. basic_endpoint(
  46889. const char * path_name);
  46890. [endsect]
  46891. [section:overload3 local::basic_endpoint::basic_endpoint (3 of 4 overloads)]
  46892. Construct an endpoint using the specified path name.
  46893. basic_endpoint(
  46894. const std::string & path_name);
  46895. [endsect]
  46896. [section:overload4 local::basic_endpoint::basic_endpoint (4 of 4 overloads)]
  46897. Copy constructor.
  46898. basic_endpoint(
  46899. const basic_endpoint & other);
  46900. [endsect]
  46901. [endsect]
  46902. [section:capacity local::basic_endpoint::capacity]
  46903. [indexterm2 boost_asio.indexterm.local__basic_endpoint.capacity..capacity..local::basic_endpoint]
  46904. Get the capacity of the endpoint in the native type.
  46905. std::size_t capacity() const;
  46906. [endsect]
  46907. [section:data local::basic_endpoint::data]
  46908. [indexterm2 boost_asio.indexterm.local__basic_endpoint.data..data..local::basic_endpoint]
  46909. Get the underlying endpoint in the native type.
  46910. data_type * ``[link boost_asio.reference.local__basic_endpoint.data.overload1 data]``();
  46911. `` [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.data.overload1 more...]]``
  46912. const data_type * ``[link boost_asio.reference.local__basic_endpoint.data.overload2 data]``() const;
  46913. `` [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.data.overload2 more...]]``
  46914. [section:overload1 local::basic_endpoint::data (1 of 2 overloads)]
  46915. Get the underlying endpoint in the native type.
  46916. data_type * data();
  46917. [endsect]
  46918. [section:overload2 local::basic_endpoint::data (2 of 2 overloads)]
  46919. Get the underlying endpoint in the native type.
  46920. const data_type * data() const;
  46921. [endsect]
  46922. [endsect]
  46923. [section:data_type local::basic_endpoint::data_type]
  46924. [indexterm2 boost_asio.indexterm.local__basic_endpoint.data_type..data_type..local::basic_endpoint]
  46925. The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer.
  46926. typedef implementation_defined data_type;
  46927. [heading Requirements]
  46928. ['Header: ][^boost/asio/local/basic_endpoint.hpp]
  46929. ['Convenience header: ][^boost/asio.hpp]
  46930. [endsect]
  46931. [section:operator_not__eq_ local::basic_endpoint::operator!=]
  46932. [indexterm2 boost_asio.indexterm.local__basic_endpoint.operator_not__eq_..operator!=..local::basic_endpoint]
  46933. Compare two endpoints for inequality.
  46934. friend bool operator!=(
  46935. const basic_endpoint< Protocol > & e1,
  46936. const basic_endpoint< Protocol > & e2);
  46937. [heading Requirements]
  46938. ['Header: ][^boost/asio/local/basic_endpoint.hpp]
  46939. ['Convenience header: ][^boost/asio.hpp]
  46940. [endsect]
  46941. [section:operator_lt_ local::basic_endpoint::operator<]
  46942. [indexterm2 boost_asio.indexterm.local__basic_endpoint.operator_lt_..operator<..local::basic_endpoint]
  46943. Compare endpoints for ordering.
  46944. friend bool operator<(
  46945. const basic_endpoint< Protocol > & e1,
  46946. const basic_endpoint< Protocol > & e2);
  46947. [heading Requirements]
  46948. ['Header: ][^boost/asio/local/basic_endpoint.hpp]
  46949. ['Convenience header: ][^boost/asio.hpp]
  46950. [endsect]
  46951. [section:operator_lt__lt_ local::basic_endpoint::operator<<]
  46952. [indexterm2 boost_asio.indexterm.local__basic_endpoint.operator_lt__lt_..operator<<..local::basic_endpoint]
  46953. Output an endpoint as a string.
  46954. std::basic_ostream< Elem, Traits > & operator<<(
  46955. std::basic_ostream< Elem, Traits > & os,
  46956. const basic_endpoint< Protocol > & endpoint);
  46957. Used to output a human-readable string for a specified endpoint.
  46958. [heading Parameters]
  46959. [variablelist
  46960. [[os][The output stream to which the string will be written.]]
  46961. [[endpoint][The endpoint to be written.]]
  46962. ]
  46963. [heading Return Value]
  46964. The output stream.
  46965. [endsect]
  46966. [section:operator_lt__eq_ local::basic_endpoint::operator<=]
  46967. [indexterm2 boost_asio.indexterm.local__basic_endpoint.operator_lt__eq_..operator<=..local::basic_endpoint]
  46968. Compare endpoints for ordering.
  46969. friend bool operator<=(
  46970. const basic_endpoint< Protocol > & e1,
  46971. const basic_endpoint< Protocol > & e2);
  46972. [heading Requirements]
  46973. ['Header: ][^boost/asio/local/basic_endpoint.hpp]
  46974. ['Convenience header: ][^boost/asio.hpp]
  46975. [endsect]
  46976. [section:operator_eq_ local::basic_endpoint::operator=]
  46977. [indexterm2 boost_asio.indexterm.local__basic_endpoint.operator_eq_..operator=..local::basic_endpoint]
  46978. Assign from another endpoint.
  46979. basic_endpoint & operator=(
  46980. const basic_endpoint & other);
  46981. [endsect]
  46982. [section:operator_eq__eq_ local::basic_endpoint::operator==]
  46983. [indexterm2 boost_asio.indexterm.local__basic_endpoint.operator_eq__eq_..operator==..local::basic_endpoint]
  46984. Compare two endpoints for equality.
  46985. friend bool operator==(
  46986. const basic_endpoint< Protocol > & e1,
  46987. const basic_endpoint< Protocol > & e2);
  46988. [heading Requirements]
  46989. ['Header: ][^boost/asio/local/basic_endpoint.hpp]
  46990. ['Convenience header: ][^boost/asio.hpp]
  46991. [endsect]
  46992. [section:operator_gt_ local::basic_endpoint::operator>]
  46993. [indexterm2 boost_asio.indexterm.local__basic_endpoint.operator_gt_..operator>..local::basic_endpoint]
  46994. Compare endpoints for ordering.
  46995. friend bool operator>(
  46996. const basic_endpoint< Protocol > & e1,
  46997. const basic_endpoint< Protocol > & e2);
  46998. [heading Requirements]
  46999. ['Header: ][^boost/asio/local/basic_endpoint.hpp]
  47000. ['Convenience header: ][^boost/asio.hpp]
  47001. [endsect]
  47002. [section:operator_gt__eq_ local::basic_endpoint::operator>=]
  47003. [indexterm2 boost_asio.indexterm.local__basic_endpoint.operator_gt__eq_..operator>=..local::basic_endpoint]
  47004. Compare endpoints for ordering.
  47005. friend bool operator>=(
  47006. const basic_endpoint< Protocol > & e1,
  47007. const basic_endpoint< Protocol > & e2);
  47008. [heading Requirements]
  47009. ['Header: ][^boost/asio/local/basic_endpoint.hpp]
  47010. ['Convenience header: ][^boost/asio.hpp]
  47011. [endsect]
  47012. [section:path local::basic_endpoint::path]
  47013. [indexterm2 boost_asio.indexterm.local__basic_endpoint.path..path..local::basic_endpoint]
  47014. Get the path associated with the endpoint.
  47015. std::string ``[link boost_asio.reference.local__basic_endpoint.path.overload1 path]``() const;
  47016. `` [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.path.overload1 more...]]``
  47017. Set the path associated with the endpoint.
  47018. void ``[link boost_asio.reference.local__basic_endpoint.path.overload2 path]``(
  47019. const char * p);
  47020. `` [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.path.overload2 more...]]``
  47021. void ``[link boost_asio.reference.local__basic_endpoint.path.overload3 path]``(
  47022. const std::string & p);
  47023. `` [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.path.overload3 more...]]``
  47024. [section:overload1 local::basic_endpoint::path (1 of 3 overloads)]
  47025. Get the path associated with the endpoint.
  47026. std::string path() const;
  47027. [endsect]
  47028. [section:overload2 local::basic_endpoint::path (2 of 3 overloads)]
  47029. Set the path associated with the endpoint.
  47030. void path(
  47031. const char * p);
  47032. [endsect]
  47033. [section:overload3 local::basic_endpoint::path (3 of 3 overloads)]
  47034. Set the path associated with the endpoint.
  47035. void path(
  47036. const std::string & p);
  47037. [endsect]
  47038. [endsect]
  47039. [section:protocol local::basic_endpoint::protocol]
  47040. [indexterm2 boost_asio.indexterm.local__basic_endpoint.protocol..protocol..local::basic_endpoint]
  47041. The protocol associated with the endpoint.
  47042. protocol_type protocol() const;
  47043. [endsect]
  47044. [section:protocol_type local::basic_endpoint::protocol_type]
  47045. [indexterm2 boost_asio.indexterm.local__basic_endpoint.protocol_type..protocol_type..local::basic_endpoint]
  47046. The protocol type associated with the endpoint.
  47047. typedef Protocol protocol_type;
  47048. [heading Requirements]
  47049. ['Header: ][^boost/asio/local/basic_endpoint.hpp]
  47050. ['Convenience header: ][^boost/asio.hpp]
  47051. [endsect]
  47052. [section:resize local::basic_endpoint::resize]
  47053. [indexterm2 boost_asio.indexterm.local__basic_endpoint.resize..resize..local::basic_endpoint]
  47054. Set the underlying size of the endpoint in the native type.
  47055. void resize(
  47056. std::size_t new_size);
  47057. [endsect]
  47058. [section:size local::basic_endpoint::size]
  47059. [indexterm2 boost_asio.indexterm.local__basic_endpoint.size..size..local::basic_endpoint]
  47060. Get the underlying size of the endpoint in the native type.
  47061. std::size_t size() const;
  47062. [endsect]
  47063. [endsect]
  47064. [section:local__connect_pair local::connect_pair]
  47065. [indexterm1 boost_asio.indexterm.local__connect_pair..local::connect_pair]
  47066. Create a pair of connected sockets.
  47067. template<
  47068. typename ``[link boost_asio.reference.Protocol Protocol]``,
  47069. typename ``[link boost_asio.reference.Executor1 Executor1]``,
  47070. typename ``[link boost_asio.reference.Executor1 Executor2]``>
  47071. void ``[link boost_asio.reference.local__connect_pair.overload1 connect_pair]``(
  47072. basic_socket< Protocol, Executor1 > & socket1,
  47073. basic_socket< Protocol, Executor2 > & socket2);
  47074. `` [''''&raquo;''' [link boost_asio.reference.local__connect_pair.overload1 more...]]``
  47075. template<
  47076. typename ``[link boost_asio.reference.Protocol Protocol]``,
  47077. typename ``[link boost_asio.reference.Executor1 Executor1]``,
  47078. typename ``[link boost_asio.reference.Executor1 Executor2]``>
  47079. void ``[link boost_asio.reference.local__connect_pair.overload2 connect_pair]``(
  47080. basic_socket< Protocol, Executor1 > & socket1,
  47081. basic_socket< Protocol, Executor2 > & socket2,
  47082. boost::system::error_code & ec);
  47083. `` [''''&raquo;''' [link boost_asio.reference.local__connect_pair.overload2 more...]]``
  47084. [heading Requirements]
  47085. ['Header: ][^boost/asio/local/connect_pair.hpp]
  47086. ['Convenience header: ][^boost/asio.hpp]
  47087. [section:overload1 local::connect_pair (1 of 2 overloads)]
  47088. Create a pair of connected sockets.
  47089. template<
  47090. typename ``[link boost_asio.reference.Protocol Protocol]``,
  47091. typename ``[link boost_asio.reference.Executor1 Executor1]``,
  47092. typename ``[link boost_asio.reference.Executor1 Executor2]``>
  47093. void connect_pair(
  47094. basic_socket< Protocol, Executor1 > & socket1,
  47095. basic_socket< Protocol, Executor2 > & socket2);
  47096. [endsect]
  47097. [section:overload2 local::connect_pair (2 of 2 overloads)]
  47098. Create a pair of connected sockets.
  47099. template<
  47100. typename ``[link boost_asio.reference.Protocol Protocol]``,
  47101. typename ``[link boost_asio.reference.Executor1 Executor1]``,
  47102. typename ``[link boost_asio.reference.Executor1 Executor2]``>
  47103. void connect_pair(
  47104. basic_socket< Protocol, Executor1 > & socket1,
  47105. basic_socket< Protocol, Executor2 > & socket2,
  47106. boost::system::error_code & ec);
  47107. [endsect]
  47108. [endsect]
  47109. [section:local__datagram_protocol local::datagram_protocol]
  47110. Encapsulates the flags needed for datagram-oriented UNIX sockets.
  47111. class datagram_protocol
  47112. [heading Types]
  47113. [table
  47114. [[Name][Description]]
  47115. [
  47116. [[link boost_asio.reference.local__datagram_protocol.endpoint [*endpoint]]]
  47117. [The type of a UNIX domain endpoint. ]
  47118. ]
  47119. [
  47120. [[link boost_asio.reference.local__datagram_protocol.socket [*socket]]]
  47121. [The UNIX domain socket type. ]
  47122. ]
  47123. ]
  47124. [heading Member Functions]
  47125. [table
  47126. [[Name][Description]]
  47127. [
  47128. [[link boost_asio.reference.local__datagram_protocol.family [*family]]]
  47129. [Obtain an identifier for the protocol family. ]
  47130. ]
  47131. [
  47132. [[link boost_asio.reference.local__datagram_protocol.protocol [*protocol]]]
  47133. [Obtain an identifier for the protocol. ]
  47134. ]
  47135. [
  47136. [[link boost_asio.reference.local__datagram_protocol.type [*type]]]
  47137. [Obtain an identifier for the type of the protocol. ]
  47138. ]
  47139. ]
  47140. The [link boost_asio.reference.local__datagram_protocol `local::datagram_protocol`] class contains flags necessary for datagram-oriented UNIX domain sockets.
  47141. [heading Thread Safety]
  47142. ['Distinct] ['objects:] Safe.
  47143. ['Shared] ['objects:] Safe.
  47144. [heading Requirements]
  47145. ['Header: ][^boost/asio/local/datagram_protocol.hpp]
  47146. ['Convenience header: ][^boost/asio.hpp]
  47147. [section:endpoint local::datagram_protocol::endpoint]
  47148. [indexterm2 boost_asio.indexterm.local__datagram_protocol.endpoint..endpoint..local::datagram_protocol]
  47149. The type of a UNIX domain endpoint.
  47150. typedef basic_endpoint< datagram_protocol > endpoint;
  47151. [heading Types]
  47152. [table
  47153. [[Name][Description]]
  47154. [
  47155. [[link boost_asio.reference.local__basic_endpoint.data_type [*data_type]]]
  47156. [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
  47157. ]
  47158. [
  47159. [[link boost_asio.reference.local__basic_endpoint.protocol_type [*protocol_type]]]
  47160. [The protocol type associated with the endpoint. ]
  47161. ]
  47162. ]
  47163. [heading Member Functions]
  47164. [table
  47165. [[Name][Description]]
  47166. [
  47167. [[link boost_asio.reference.local__basic_endpoint.basic_endpoint [*basic_endpoint]]]
  47168. [Default constructor.
  47169. [hr]
  47170. Construct an endpoint using the specified path name.
  47171. [hr]
  47172. Copy constructor. ]
  47173. ]
  47174. [
  47175. [[link boost_asio.reference.local__basic_endpoint.capacity [*capacity]]]
  47176. [Get the capacity of the endpoint in the native type. ]
  47177. ]
  47178. [
  47179. [[link boost_asio.reference.local__basic_endpoint.data [*data]]]
  47180. [Get the underlying endpoint in the native type. ]
  47181. ]
  47182. [
  47183. [[link boost_asio.reference.local__basic_endpoint.operator_eq_ [*operator=]]]
  47184. [Assign from another endpoint. ]
  47185. ]
  47186. [
  47187. [[link boost_asio.reference.local__basic_endpoint.path [*path]]]
  47188. [Get the path associated with the endpoint.
  47189. [hr]
  47190. Set the path associated with the endpoint. ]
  47191. ]
  47192. [
  47193. [[link boost_asio.reference.local__basic_endpoint.protocol [*protocol]]]
  47194. [The protocol associated with the endpoint. ]
  47195. ]
  47196. [
  47197. [[link boost_asio.reference.local__basic_endpoint.resize [*resize]]]
  47198. [Set the underlying size of the endpoint in the native type. ]
  47199. ]
  47200. [
  47201. [[link boost_asio.reference.local__basic_endpoint.size [*size]]]
  47202. [Get the underlying size of the endpoint in the native type. ]
  47203. ]
  47204. ]
  47205. [heading Friends]
  47206. [table
  47207. [[Name][Description]]
  47208. [
  47209. [[link boost_asio.reference.local__basic_endpoint.operator_not__eq_ [*operator!=]]]
  47210. [Compare two endpoints for inequality. ]
  47211. ]
  47212. [
  47213. [[link boost_asio.reference.local__basic_endpoint.operator_lt_ [*operator<]]]
  47214. [Compare endpoints for ordering. ]
  47215. ]
  47216. [
  47217. [[link boost_asio.reference.local__basic_endpoint.operator_lt__eq_ [*operator<=]]]
  47218. [Compare endpoints for ordering. ]
  47219. ]
  47220. [
  47221. [[link boost_asio.reference.local__basic_endpoint.operator_eq__eq_ [*operator==]]]
  47222. [Compare two endpoints for equality. ]
  47223. ]
  47224. [
  47225. [[link boost_asio.reference.local__basic_endpoint.operator_gt_ [*operator>]]]
  47226. [Compare endpoints for ordering. ]
  47227. ]
  47228. [
  47229. [[link boost_asio.reference.local__basic_endpoint.operator_gt__eq_ [*operator>=]]]
  47230. [Compare endpoints for ordering. ]
  47231. ]
  47232. ]
  47233. [heading Related Functions]
  47234. [table
  47235. [[Name][Description]]
  47236. [
  47237. [[link boost_asio.reference.local__basic_endpoint.operator_lt__lt_ [*operator<<]]]
  47238. [Output an endpoint as a string. ]
  47239. ]
  47240. ]
  47241. The [link boost_asio.reference.local__basic_endpoint `local::basic_endpoint`] class template describes an endpoint that may be associated with a particular UNIX socket.
  47242. [heading Thread Safety]
  47243. ['Distinct] ['objects:] Safe.
  47244. ['Shared] ['objects:] Unsafe.
  47245. [heading Requirements]
  47246. ['Header: ][^boost/asio/local/datagram_protocol.hpp]
  47247. ['Convenience header: ][^boost/asio.hpp]
  47248. [endsect]
  47249. [section:family local::datagram_protocol::family]
  47250. [indexterm2 boost_asio.indexterm.local__datagram_protocol.family..family..local::datagram_protocol]
  47251. Obtain an identifier for the protocol family.
  47252. int family() const;
  47253. [endsect]
  47254. [section:protocol local::datagram_protocol::protocol]
  47255. [indexterm2 boost_asio.indexterm.local__datagram_protocol.protocol..protocol..local::datagram_protocol]
  47256. Obtain an identifier for the protocol.
  47257. int protocol() const;
  47258. [endsect]
  47259. [section:socket local::datagram_protocol::socket]
  47260. [indexterm2 boost_asio.indexterm.local__datagram_protocol.socket..socket..local::datagram_protocol]
  47261. The UNIX domain socket type.
  47262. typedef basic_datagram_socket< datagram_protocol > socket;
  47263. [heading Types]
  47264. [table
  47265. [[Name][Description]]
  47266. [
  47267. [[link boost_asio.reference.basic_datagram_socket__rebind_executor [*rebind_executor]]]
  47268. [Rebinds the socket type to another executor. ]
  47269. ]
  47270. [
  47271. [[link boost_asio.reference.basic_datagram_socket.broadcast [*broadcast]]]
  47272. [Socket option to permit sending of broadcast messages. ]
  47273. ]
  47274. [
  47275. [[link boost_asio.reference.basic_datagram_socket.bytes_readable [*bytes_readable]]]
  47276. [IO control command to get the amount of data that can be read without blocking. ]
  47277. ]
  47278. [
  47279. [[link boost_asio.reference.basic_datagram_socket.debug [*debug]]]
  47280. [Socket option to enable socket-level debugging. ]
  47281. ]
  47282. [
  47283. [[link boost_asio.reference.basic_datagram_socket.do_not_route [*do_not_route]]]
  47284. [Socket option to prevent routing, use local interfaces only. ]
  47285. ]
  47286. [
  47287. [[link boost_asio.reference.basic_datagram_socket.enable_connection_aborted [*enable_connection_aborted]]]
  47288. [Socket option to report aborted connections on accept. ]
  47289. ]
  47290. [
  47291. [[link boost_asio.reference.basic_datagram_socket.endpoint_type [*endpoint_type]]]
  47292. [The endpoint type. ]
  47293. ]
  47294. [
  47295. [[link boost_asio.reference.basic_datagram_socket.executor_type [*executor_type]]]
  47296. [The type of the executor associated with the object. ]
  47297. ]
  47298. [
  47299. [[link boost_asio.reference.basic_datagram_socket.keep_alive [*keep_alive]]]
  47300. [Socket option to send keep-alives. ]
  47301. ]
  47302. [
  47303. [[link boost_asio.reference.basic_datagram_socket.linger [*linger]]]
  47304. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  47305. ]
  47306. [
  47307. [[link boost_asio.reference.basic_datagram_socket.lowest_layer_type [*lowest_layer_type]]]
  47308. [A basic_socket is always the lowest layer. ]
  47309. ]
  47310. [
  47311. [[link boost_asio.reference.basic_datagram_socket.message_flags [*message_flags]]]
  47312. [Bitmask type for flags that can be passed to send and receive operations. ]
  47313. ]
  47314. [
  47315. [[link boost_asio.reference.basic_datagram_socket.native_handle_type [*native_handle_type]]]
  47316. [The native representation of a socket. ]
  47317. ]
  47318. [
  47319. [[link boost_asio.reference.basic_datagram_socket.out_of_band_inline [*out_of_band_inline]]]
  47320. [Socket option for putting received out-of-band data inline. ]
  47321. ]
  47322. [
  47323. [[link boost_asio.reference.basic_datagram_socket.protocol_type [*protocol_type]]]
  47324. [The protocol type. ]
  47325. ]
  47326. [
  47327. [[link boost_asio.reference.basic_datagram_socket.receive_buffer_size [*receive_buffer_size]]]
  47328. [Socket option for the receive buffer size of a socket. ]
  47329. ]
  47330. [
  47331. [[link boost_asio.reference.basic_datagram_socket.receive_low_watermark [*receive_low_watermark]]]
  47332. [Socket option for the receive low watermark. ]
  47333. ]
  47334. [
  47335. [[link boost_asio.reference.basic_datagram_socket.reuse_address [*reuse_address]]]
  47336. [Socket option to allow the socket to be bound to an address that is already in use. ]
  47337. ]
  47338. [
  47339. [[link boost_asio.reference.basic_datagram_socket.send_buffer_size [*send_buffer_size]]]
  47340. [Socket option for the send buffer size of a socket. ]
  47341. ]
  47342. [
  47343. [[link boost_asio.reference.basic_datagram_socket.send_low_watermark [*send_low_watermark]]]
  47344. [Socket option for the send low watermark. ]
  47345. ]
  47346. [
  47347. [[link boost_asio.reference.basic_datagram_socket.shutdown_type [*shutdown_type]]]
  47348. [Different ways a socket may be shutdown. ]
  47349. ]
  47350. [
  47351. [[link boost_asio.reference.basic_datagram_socket.wait_type [*wait_type]]]
  47352. [Wait types. ]
  47353. ]
  47354. ]
  47355. [heading Member Functions]
  47356. [table
  47357. [[Name][Description]]
  47358. [
  47359. [[link boost_asio.reference.basic_datagram_socket.assign [*assign]]]
  47360. [Assign an existing native socket to the socket. ]
  47361. ]
  47362. [
  47363. [[link boost_asio.reference.basic_datagram_socket.async_connect [*async_connect]]]
  47364. [Start an asynchronous connect. ]
  47365. ]
  47366. [
  47367. [[link boost_asio.reference.basic_datagram_socket.async_receive [*async_receive]]]
  47368. [Start an asynchronous receive on a connected socket. ]
  47369. ]
  47370. [
  47371. [[link boost_asio.reference.basic_datagram_socket.async_receive_from [*async_receive_from]]]
  47372. [Start an asynchronous receive. ]
  47373. ]
  47374. [
  47375. [[link boost_asio.reference.basic_datagram_socket.async_send [*async_send]]]
  47376. [Start an asynchronous send on a connected socket. ]
  47377. ]
  47378. [
  47379. [[link boost_asio.reference.basic_datagram_socket.async_send_to [*async_send_to]]]
  47380. [Start an asynchronous send. ]
  47381. ]
  47382. [
  47383. [[link boost_asio.reference.basic_datagram_socket.async_wait [*async_wait]]]
  47384. [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  47385. ]
  47386. [
  47387. [[link boost_asio.reference.basic_datagram_socket.at_mark [*at_mark]]]
  47388. [Determine whether the socket is at the out-of-band data mark. ]
  47389. ]
  47390. [
  47391. [[link boost_asio.reference.basic_datagram_socket.available [*available]]]
  47392. [Determine the number of bytes available for reading. ]
  47393. ]
  47394. [
  47395. [[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket [*basic_datagram_socket]]]
  47396. [Construct a basic_datagram_socket without opening it.
  47397. [hr]
  47398. Construct and open a basic_datagram_socket.
  47399. [hr]
  47400. Construct a basic_datagram_socket, opening it and binding it to the given local endpoint.
  47401. [hr]
  47402. Construct a basic_datagram_socket on an existing native socket.
  47403. [hr]
  47404. Move-construct a basic_datagram_socket from another.
  47405. [hr]
  47406. Move-construct a basic_datagram_socket from a socket of another protocol type. ]
  47407. ]
  47408. [
  47409. [[link boost_asio.reference.basic_datagram_socket.bind [*bind]]]
  47410. [Bind the socket to the given local endpoint. ]
  47411. ]
  47412. [
  47413. [[link boost_asio.reference.basic_datagram_socket.cancel [*cancel]]]
  47414. [Cancel all asynchronous operations associated with the socket. ]
  47415. ]
  47416. [
  47417. [[link boost_asio.reference.basic_datagram_socket.close [*close]]]
  47418. [Close the socket. ]
  47419. ]
  47420. [
  47421. [[link boost_asio.reference.basic_datagram_socket.connect [*connect]]]
  47422. [Connect the socket to the specified endpoint. ]
  47423. ]
  47424. [
  47425. [[link boost_asio.reference.basic_datagram_socket.get_executor [*get_executor]]]
  47426. [Get the executor associated with the object. ]
  47427. ]
  47428. [
  47429. [[link boost_asio.reference.basic_datagram_socket.get_option [*get_option]]]
  47430. [Get an option from the socket. ]
  47431. ]
  47432. [
  47433. [[link boost_asio.reference.basic_datagram_socket.io_control [*io_control]]]
  47434. [Perform an IO control command on the socket. ]
  47435. ]
  47436. [
  47437. [[link boost_asio.reference.basic_datagram_socket.is_open [*is_open]]]
  47438. [Determine whether the socket is open. ]
  47439. ]
  47440. [
  47441. [[link boost_asio.reference.basic_datagram_socket.local_endpoint [*local_endpoint]]]
  47442. [Get the local endpoint of the socket. ]
  47443. ]
  47444. [
  47445. [[link boost_asio.reference.basic_datagram_socket.lowest_layer [*lowest_layer]]]
  47446. [Get a reference to the lowest layer.
  47447. [hr]
  47448. Get a const reference to the lowest layer. ]
  47449. ]
  47450. [
  47451. [[link boost_asio.reference.basic_datagram_socket.native_handle [*native_handle]]]
  47452. [Get the native socket representation. ]
  47453. ]
  47454. [
  47455. [[link boost_asio.reference.basic_datagram_socket.native_non_blocking [*native_non_blocking]]]
  47456. [Gets the non-blocking mode of the native socket implementation.
  47457. [hr]
  47458. Sets the non-blocking mode of the native socket implementation. ]
  47459. ]
  47460. [
  47461. [[link boost_asio.reference.basic_datagram_socket.non_blocking [*non_blocking]]]
  47462. [Gets the non-blocking mode of the socket.
  47463. [hr]
  47464. Sets the non-blocking mode of the socket. ]
  47465. ]
  47466. [
  47467. [[link boost_asio.reference.basic_datagram_socket.open [*open]]]
  47468. [Open the socket using the specified protocol. ]
  47469. ]
  47470. [
  47471. [[link boost_asio.reference.basic_datagram_socket.operator_eq_ [*operator=]]]
  47472. [Move-assign a basic_datagram_socket from another.
  47473. [hr]
  47474. Move-assign a basic_datagram_socket from a socket of another protocol type. ]
  47475. ]
  47476. [
  47477. [[link boost_asio.reference.basic_datagram_socket.receive [*receive]]]
  47478. [Receive some data on a connected socket. ]
  47479. ]
  47480. [
  47481. [[link boost_asio.reference.basic_datagram_socket.receive_from [*receive_from]]]
  47482. [Receive a datagram with the endpoint of the sender. ]
  47483. ]
  47484. [
  47485. [[link boost_asio.reference.basic_datagram_socket.release [*release]]]
  47486. [Release ownership of the underlying native socket. ]
  47487. ]
  47488. [
  47489. [[link boost_asio.reference.basic_datagram_socket.remote_endpoint [*remote_endpoint]]]
  47490. [Get the remote endpoint of the socket. ]
  47491. ]
  47492. [
  47493. [[link boost_asio.reference.basic_datagram_socket.send [*send]]]
  47494. [Send some data on a connected socket. ]
  47495. ]
  47496. [
  47497. [[link boost_asio.reference.basic_datagram_socket.send_to [*send_to]]]
  47498. [Send a datagram to the specified endpoint. ]
  47499. ]
  47500. [
  47501. [[link boost_asio.reference.basic_datagram_socket.set_option [*set_option]]]
  47502. [Set an option on the socket. ]
  47503. ]
  47504. [
  47505. [[link boost_asio.reference.basic_datagram_socket.shutdown [*shutdown]]]
  47506. [Disable sends or receives on the socket. ]
  47507. ]
  47508. [
  47509. [[link boost_asio.reference.basic_datagram_socket.wait [*wait]]]
  47510. [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  47511. ]
  47512. [
  47513. [[link boost_asio.reference.basic_datagram_socket._basic_datagram_socket [*~basic_datagram_socket]]]
  47514. [Destroys the socket. ]
  47515. ]
  47516. ]
  47517. [heading Data Members]
  47518. [table
  47519. [[Name][Description]]
  47520. [
  47521. [[link boost_asio.reference.basic_datagram_socket.max_connections [*max_connections]]]
  47522. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  47523. ]
  47524. [
  47525. [[link boost_asio.reference.basic_datagram_socket.max_listen_connections [*max_listen_connections]]]
  47526. [The maximum length of the queue of pending incoming connections. ]
  47527. ]
  47528. [
  47529. [[link boost_asio.reference.basic_datagram_socket.message_do_not_route [*message_do_not_route]]]
  47530. [Specify that the data should not be subject to routing. ]
  47531. ]
  47532. [
  47533. [[link boost_asio.reference.basic_datagram_socket.message_end_of_record [*message_end_of_record]]]
  47534. [Specifies that the data marks the end of a record. ]
  47535. ]
  47536. [
  47537. [[link boost_asio.reference.basic_datagram_socket.message_out_of_band [*message_out_of_band]]]
  47538. [Process out-of-band data. ]
  47539. ]
  47540. [
  47541. [[link boost_asio.reference.basic_datagram_socket.message_peek [*message_peek]]]
  47542. [Peek at incoming data without removing it from the input queue. ]
  47543. ]
  47544. ]
  47545. [heading Protected Data Members]
  47546. [table
  47547. [[Name][Description]]
  47548. [
  47549. [[link boost_asio.reference.basic_datagram_socket.impl_ [*impl_]]]
  47550. []
  47551. ]
  47552. ]
  47553. The [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] class template provides asynchronous and blocking datagram-oriented socket functionality.
  47554. [heading Thread Safety]
  47555. ['Distinct] ['objects:] Safe.
  47556. ['Shared] ['objects:] Unsafe.
  47557. [heading Requirements]
  47558. ['Header: ][^boost/asio/local/datagram_protocol.hpp]
  47559. ['Convenience header: ][^boost/asio.hpp]
  47560. [endsect]
  47561. [section:type local::datagram_protocol::type]
  47562. [indexterm2 boost_asio.indexterm.local__datagram_protocol.type..type..local::datagram_protocol]
  47563. Obtain an identifier for the type of the protocol.
  47564. int type() const;
  47565. [endsect]
  47566. [endsect]
  47567. [section:local__stream_protocol local::stream_protocol]
  47568. Encapsulates the flags needed for stream-oriented UNIX sockets.
  47569. class stream_protocol
  47570. [heading Types]
  47571. [table
  47572. [[Name][Description]]
  47573. [
  47574. [[link boost_asio.reference.local__stream_protocol.acceptor [*acceptor]]]
  47575. [The UNIX domain acceptor type. ]
  47576. ]
  47577. [
  47578. [[link boost_asio.reference.local__stream_protocol.endpoint [*endpoint]]]
  47579. [The type of a UNIX domain endpoint. ]
  47580. ]
  47581. [
  47582. [[link boost_asio.reference.local__stream_protocol.iostream [*iostream]]]
  47583. [The UNIX domain iostream type. ]
  47584. ]
  47585. [
  47586. [[link boost_asio.reference.local__stream_protocol.socket [*socket]]]
  47587. [The UNIX domain socket type. ]
  47588. ]
  47589. ]
  47590. [heading Member Functions]
  47591. [table
  47592. [[Name][Description]]
  47593. [
  47594. [[link boost_asio.reference.local__stream_protocol.family [*family]]]
  47595. [Obtain an identifier for the protocol family. ]
  47596. ]
  47597. [
  47598. [[link boost_asio.reference.local__stream_protocol.protocol [*protocol]]]
  47599. [Obtain an identifier for the protocol. ]
  47600. ]
  47601. [
  47602. [[link boost_asio.reference.local__stream_protocol.type [*type]]]
  47603. [Obtain an identifier for the type of the protocol. ]
  47604. ]
  47605. ]
  47606. The [link boost_asio.reference.local__stream_protocol `local::stream_protocol`] class contains flags necessary for stream-oriented UNIX domain sockets.
  47607. [heading Thread Safety]
  47608. ['Distinct] ['objects:] Safe.
  47609. ['Shared] ['objects:] Safe.
  47610. [heading Requirements]
  47611. ['Header: ][^boost/asio/local/stream_protocol.hpp]
  47612. ['Convenience header: ][^boost/asio.hpp]
  47613. [section:acceptor local::stream_protocol::acceptor]
  47614. [indexterm2 boost_asio.indexterm.local__stream_protocol.acceptor..acceptor..local::stream_protocol]
  47615. The UNIX domain acceptor type.
  47616. typedef basic_socket_acceptor< stream_protocol > acceptor;
  47617. [heading Types]
  47618. [table
  47619. [[Name][Description]]
  47620. [
  47621. [[link boost_asio.reference.basic_socket_acceptor__rebind_executor [*rebind_executor]]]
  47622. [Rebinds the acceptor type to another executor. ]
  47623. ]
  47624. [
  47625. [[link boost_asio.reference.basic_socket_acceptor.broadcast [*broadcast]]]
  47626. [Socket option to permit sending of broadcast messages. ]
  47627. ]
  47628. [
  47629. [[link boost_asio.reference.basic_socket_acceptor.bytes_readable [*bytes_readable]]]
  47630. [IO control command to get the amount of data that can be read without blocking. ]
  47631. ]
  47632. [
  47633. [[link boost_asio.reference.basic_socket_acceptor.debug [*debug]]]
  47634. [Socket option to enable socket-level debugging. ]
  47635. ]
  47636. [
  47637. [[link boost_asio.reference.basic_socket_acceptor.do_not_route [*do_not_route]]]
  47638. [Socket option to prevent routing, use local interfaces only. ]
  47639. ]
  47640. [
  47641. [[link boost_asio.reference.basic_socket_acceptor.enable_connection_aborted [*enable_connection_aborted]]]
  47642. [Socket option to report aborted connections on accept. ]
  47643. ]
  47644. [
  47645. [[link boost_asio.reference.basic_socket_acceptor.endpoint_type [*endpoint_type]]]
  47646. [The endpoint type. ]
  47647. ]
  47648. [
  47649. [[link boost_asio.reference.basic_socket_acceptor.executor_type [*executor_type]]]
  47650. [The type of the executor associated with the object. ]
  47651. ]
  47652. [
  47653. [[link boost_asio.reference.basic_socket_acceptor.keep_alive [*keep_alive]]]
  47654. [Socket option to send keep-alives. ]
  47655. ]
  47656. [
  47657. [[link boost_asio.reference.basic_socket_acceptor.linger [*linger]]]
  47658. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  47659. ]
  47660. [
  47661. [[link boost_asio.reference.basic_socket_acceptor.message_flags [*message_flags]]]
  47662. [Bitmask type for flags that can be passed to send and receive operations. ]
  47663. ]
  47664. [
  47665. [[link boost_asio.reference.basic_socket_acceptor.native_handle_type [*native_handle_type]]]
  47666. [The native representation of an acceptor. ]
  47667. ]
  47668. [
  47669. [[link boost_asio.reference.basic_socket_acceptor.out_of_band_inline [*out_of_band_inline]]]
  47670. [Socket option for putting received out-of-band data inline. ]
  47671. ]
  47672. [
  47673. [[link boost_asio.reference.basic_socket_acceptor.protocol_type [*protocol_type]]]
  47674. [The protocol type. ]
  47675. ]
  47676. [
  47677. [[link boost_asio.reference.basic_socket_acceptor.receive_buffer_size [*receive_buffer_size]]]
  47678. [Socket option for the receive buffer size of a socket. ]
  47679. ]
  47680. [
  47681. [[link boost_asio.reference.basic_socket_acceptor.receive_low_watermark [*receive_low_watermark]]]
  47682. [Socket option for the receive low watermark. ]
  47683. ]
  47684. [
  47685. [[link boost_asio.reference.basic_socket_acceptor.reuse_address [*reuse_address]]]
  47686. [Socket option to allow the socket to be bound to an address that is already in use. ]
  47687. ]
  47688. [
  47689. [[link boost_asio.reference.basic_socket_acceptor.send_buffer_size [*send_buffer_size]]]
  47690. [Socket option for the send buffer size of a socket. ]
  47691. ]
  47692. [
  47693. [[link boost_asio.reference.basic_socket_acceptor.send_low_watermark [*send_low_watermark]]]
  47694. [Socket option for the send low watermark. ]
  47695. ]
  47696. [
  47697. [[link boost_asio.reference.basic_socket_acceptor.shutdown_type [*shutdown_type]]]
  47698. [Different ways a socket may be shutdown. ]
  47699. ]
  47700. [
  47701. [[link boost_asio.reference.basic_socket_acceptor.wait_type [*wait_type]]]
  47702. [Wait types. ]
  47703. ]
  47704. ]
  47705. [heading Member Functions]
  47706. [table
  47707. [[Name][Description]]
  47708. [
  47709. [[link boost_asio.reference.basic_socket_acceptor.accept [*accept]]]
  47710. [Accept a new connection.
  47711. [hr]
  47712. Accept a new connection and obtain the endpoint of the peer. ]
  47713. ]
  47714. [
  47715. [[link boost_asio.reference.basic_socket_acceptor.assign [*assign]]]
  47716. [Assigns an existing native acceptor to the acceptor. ]
  47717. ]
  47718. [
  47719. [[link boost_asio.reference.basic_socket_acceptor.async_accept [*async_accept]]]
  47720. [Start an asynchronous accept. ]
  47721. ]
  47722. [
  47723. [[link boost_asio.reference.basic_socket_acceptor.async_wait [*async_wait]]]
  47724. [Asynchronously wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. ]
  47725. ]
  47726. [
  47727. [[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor [*basic_socket_acceptor]]]
  47728. [Construct an acceptor without opening it.
  47729. [hr]
  47730. Construct an open acceptor.
  47731. [hr]
  47732. Construct an acceptor opened on the given endpoint.
  47733. [hr]
  47734. Construct a basic_socket_acceptor on an existing native acceptor.
  47735. [hr]
  47736. Move-construct a basic_socket_acceptor from another.
  47737. [hr]
  47738. Move-construct a basic_socket_acceptor from an acceptor of another protocol type. ]
  47739. ]
  47740. [
  47741. [[link boost_asio.reference.basic_socket_acceptor.bind [*bind]]]
  47742. [Bind the acceptor to the given local endpoint. ]
  47743. ]
  47744. [
  47745. [[link boost_asio.reference.basic_socket_acceptor.cancel [*cancel]]]
  47746. [Cancel all asynchronous operations associated with the acceptor. ]
  47747. ]
  47748. [
  47749. [[link boost_asio.reference.basic_socket_acceptor.close [*close]]]
  47750. [Close the acceptor. ]
  47751. ]
  47752. [
  47753. [[link boost_asio.reference.basic_socket_acceptor.get_executor [*get_executor]]]
  47754. [Get the executor associated with the object. ]
  47755. ]
  47756. [
  47757. [[link boost_asio.reference.basic_socket_acceptor.get_option [*get_option]]]
  47758. [Get an option from the acceptor. ]
  47759. ]
  47760. [
  47761. [[link boost_asio.reference.basic_socket_acceptor.io_control [*io_control]]]
  47762. [Perform an IO control command on the acceptor. ]
  47763. ]
  47764. [
  47765. [[link boost_asio.reference.basic_socket_acceptor.is_open [*is_open]]]
  47766. [Determine whether the acceptor is open. ]
  47767. ]
  47768. [
  47769. [[link boost_asio.reference.basic_socket_acceptor.listen [*listen]]]
  47770. [Place the acceptor into the state where it will listen for new connections. ]
  47771. ]
  47772. [
  47773. [[link boost_asio.reference.basic_socket_acceptor.local_endpoint [*local_endpoint]]]
  47774. [Get the local endpoint of the acceptor. ]
  47775. ]
  47776. [
  47777. [[link boost_asio.reference.basic_socket_acceptor.native_handle [*native_handle]]]
  47778. [Get the native acceptor representation. ]
  47779. ]
  47780. [
  47781. [[link boost_asio.reference.basic_socket_acceptor.native_non_blocking [*native_non_blocking]]]
  47782. [Gets the non-blocking mode of the native acceptor implementation.
  47783. [hr]
  47784. Sets the non-blocking mode of the native acceptor implementation. ]
  47785. ]
  47786. [
  47787. [[link boost_asio.reference.basic_socket_acceptor.non_blocking [*non_blocking]]]
  47788. [Gets the non-blocking mode of the acceptor.
  47789. [hr]
  47790. Sets the non-blocking mode of the acceptor. ]
  47791. ]
  47792. [
  47793. [[link boost_asio.reference.basic_socket_acceptor.open [*open]]]
  47794. [Open the acceptor using the specified protocol. ]
  47795. ]
  47796. [
  47797. [[link boost_asio.reference.basic_socket_acceptor.operator_eq_ [*operator=]]]
  47798. [Move-assign a basic_socket_acceptor from another.
  47799. [hr]
  47800. Move-assign a basic_socket_acceptor from an acceptor of another protocol type. ]
  47801. ]
  47802. [
  47803. [[link boost_asio.reference.basic_socket_acceptor.release [*release]]]
  47804. [Release ownership of the underlying native acceptor. ]
  47805. ]
  47806. [
  47807. [[link boost_asio.reference.basic_socket_acceptor.set_option [*set_option]]]
  47808. [Set an option on the acceptor. ]
  47809. ]
  47810. [
  47811. [[link boost_asio.reference.basic_socket_acceptor.wait [*wait]]]
  47812. [Wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. ]
  47813. ]
  47814. [
  47815. [[link boost_asio.reference.basic_socket_acceptor._basic_socket_acceptor [*~basic_socket_acceptor]]]
  47816. [Destroys the acceptor. ]
  47817. ]
  47818. ]
  47819. [heading Data Members]
  47820. [table
  47821. [[Name][Description]]
  47822. [
  47823. [[link boost_asio.reference.basic_socket_acceptor.max_connections [*max_connections]]]
  47824. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  47825. ]
  47826. [
  47827. [[link boost_asio.reference.basic_socket_acceptor.max_listen_connections [*max_listen_connections]]]
  47828. [The maximum length of the queue of pending incoming connections. ]
  47829. ]
  47830. [
  47831. [[link boost_asio.reference.basic_socket_acceptor.message_do_not_route [*message_do_not_route]]]
  47832. [Specify that the data should not be subject to routing. ]
  47833. ]
  47834. [
  47835. [[link boost_asio.reference.basic_socket_acceptor.message_end_of_record [*message_end_of_record]]]
  47836. [Specifies that the data marks the end of a record. ]
  47837. ]
  47838. [
  47839. [[link boost_asio.reference.basic_socket_acceptor.message_out_of_band [*message_out_of_band]]]
  47840. [Process out-of-band data. ]
  47841. ]
  47842. [
  47843. [[link boost_asio.reference.basic_socket_acceptor.message_peek [*message_peek]]]
  47844. [Peek at incoming data without removing it from the input queue. ]
  47845. ]
  47846. ]
  47847. The [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] class template is used for accepting new socket connections.
  47848. [heading Thread Safety]
  47849. ['Distinct] ['objects:] Safe.
  47850. ['Shared] ['objects:] Unsafe.
  47851. [heading Example]
  47852. Opening a socket acceptor with the SO\_REUSEADDR option enabled:
  47853. boost::asio::ip::tcp::acceptor acceptor(my_context);
  47854. boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), port);
  47855. acceptor.open(endpoint.protocol());
  47856. acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
  47857. acceptor.bind(endpoint);
  47858. acceptor.listen();
  47859. [heading Requirements]
  47860. ['Header: ][^boost/asio/local/stream_protocol.hpp]
  47861. ['Convenience header: ][^boost/asio.hpp]
  47862. [endsect]
  47863. [section:endpoint local::stream_protocol::endpoint]
  47864. [indexterm2 boost_asio.indexterm.local__stream_protocol.endpoint..endpoint..local::stream_protocol]
  47865. The type of a UNIX domain endpoint.
  47866. typedef basic_endpoint< stream_protocol > endpoint;
  47867. [heading Types]
  47868. [table
  47869. [[Name][Description]]
  47870. [
  47871. [[link boost_asio.reference.local__basic_endpoint.data_type [*data_type]]]
  47872. [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
  47873. ]
  47874. [
  47875. [[link boost_asio.reference.local__basic_endpoint.protocol_type [*protocol_type]]]
  47876. [The protocol type associated with the endpoint. ]
  47877. ]
  47878. ]
  47879. [heading Member Functions]
  47880. [table
  47881. [[Name][Description]]
  47882. [
  47883. [[link boost_asio.reference.local__basic_endpoint.basic_endpoint [*basic_endpoint]]]
  47884. [Default constructor.
  47885. [hr]
  47886. Construct an endpoint using the specified path name.
  47887. [hr]
  47888. Copy constructor. ]
  47889. ]
  47890. [
  47891. [[link boost_asio.reference.local__basic_endpoint.capacity [*capacity]]]
  47892. [Get the capacity of the endpoint in the native type. ]
  47893. ]
  47894. [
  47895. [[link boost_asio.reference.local__basic_endpoint.data [*data]]]
  47896. [Get the underlying endpoint in the native type. ]
  47897. ]
  47898. [
  47899. [[link boost_asio.reference.local__basic_endpoint.operator_eq_ [*operator=]]]
  47900. [Assign from another endpoint. ]
  47901. ]
  47902. [
  47903. [[link boost_asio.reference.local__basic_endpoint.path [*path]]]
  47904. [Get the path associated with the endpoint.
  47905. [hr]
  47906. Set the path associated with the endpoint. ]
  47907. ]
  47908. [
  47909. [[link boost_asio.reference.local__basic_endpoint.protocol [*protocol]]]
  47910. [The protocol associated with the endpoint. ]
  47911. ]
  47912. [
  47913. [[link boost_asio.reference.local__basic_endpoint.resize [*resize]]]
  47914. [Set the underlying size of the endpoint in the native type. ]
  47915. ]
  47916. [
  47917. [[link boost_asio.reference.local__basic_endpoint.size [*size]]]
  47918. [Get the underlying size of the endpoint in the native type. ]
  47919. ]
  47920. ]
  47921. [heading Friends]
  47922. [table
  47923. [[Name][Description]]
  47924. [
  47925. [[link boost_asio.reference.local__basic_endpoint.operator_not__eq_ [*operator!=]]]
  47926. [Compare two endpoints for inequality. ]
  47927. ]
  47928. [
  47929. [[link boost_asio.reference.local__basic_endpoint.operator_lt_ [*operator<]]]
  47930. [Compare endpoints for ordering. ]
  47931. ]
  47932. [
  47933. [[link boost_asio.reference.local__basic_endpoint.operator_lt__eq_ [*operator<=]]]
  47934. [Compare endpoints for ordering. ]
  47935. ]
  47936. [
  47937. [[link boost_asio.reference.local__basic_endpoint.operator_eq__eq_ [*operator==]]]
  47938. [Compare two endpoints for equality. ]
  47939. ]
  47940. [
  47941. [[link boost_asio.reference.local__basic_endpoint.operator_gt_ [*operator>]]]
  47942. [Compare endpoints for ordering. ]
  47943. ]
  47944. [
  47945. [[link boost_asio.reference.local__basic_endpoint.operator_gt__eq_ [*operator>=]]]
  47946. [Compare endpoints for ordering. ]
  47947. ]
  47948. ]
  47949. [heading Related Functions]
  47950. [table
  47951. [[Name][Description]]
  47952. [
  47953. [[link boost_asio.reference.local__basic_endpoint.operator_lt__lt_ [*operator<<]]]
  47954. [Output an endpoint as a string. ]
  47955. ]
  47956. ]
  47957. The [link boost_asio.reference.local__basic_endpoint `local::basic_endpoint`] class template describes an endpoint that may be associated with a particular UNIX socket.
  47958. [heading Thread Safety]
  47959. ['Distinct] ['objects:] Safe.
  47960. ['Shared] ['objects:] Unsafe.
  47961. [heading Requirements]
  47962. ['Header: ][^boost/asio/local/stream_protocol.hpp]
  47963. ['Convenience header: ][^boost/asio.hpp]
  47964. [endsect]
  47965. [section:family local::stream_protocol::family]
  47966. [indexterm2 boost_asio.indexterm.local__stream_protocol.family..family..local::stream_protocol]
  47967. Obtain an identifier for the protocol family.
  47968. int family() const;
  47969. [endsect]
  47970. [section:iostream local::stream_protocol::iostream]
  47971. [indexterm2 boost_asio.indexterm.local__stream_protocol.iostream..iostream..local::stream_protocol]
  47972. The UNIX domain iostream type.
  47973. typedef basic_socket_iostream< stream_protocol > iostream;
  47974. [heading Types]
  47975. [table
  47976. [[Name][Description]]
  47977. [
  47978. [[link boost_asio.reference.basic_socket_iostream.clock_type [*clock_type]]]
  47979. [The clock type. ]
  47980. ]
  47981. [
  47982. [[link boost_asio.reference.basic_socket_iostream.duration [*duration]]]
  47983. [The duration type. ]
  47984. ]
  47985. [
  47986. [[link boost_asio.reference.basic_socket_iostream.duration_type [*duration_type]]]
  47987. [(Deprecated: Use duration.) The duration type. ]
  47988. ]
  47989. [
  47990. [[link boost_asio.reference.basic_socket_iostream.endpoint_type [*endpoint_type]]]
  47991. [The endpoint type. ]
  47992. ]
  47993. [
  47994. [[link boost_asio.reference.basic_socket_iostream.protocol_type [*protocol_type]]]
  47995. [The protocol type. ]
  47996. ]
  47997. [
  47998. [[link boost_asio.reference.basic_socket_iostream.time_point [*time_point]]]
  47999. [The time type. ]
  48000. ]
  48001. [
  48002. [[link boost_asio.reference.basic_socket_iostream.time_type [*time_type]]]
  48003. [(Deprecated: Use time_point.) The time type. ]
  48004. ]
  48005. ]
  48006. [heading Member Functions]
  48007. [table
  48008. [[Name][Description]]
  48009. [
  48010. [[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream [*basic_socket_iostream]]]
  48011. [Construct a basic_socket_iostream without establishing a connection.
  48012. [hr]
  48013. Construct a basic_socket_iostream from the supplied socket.
  48014. [hr]
  48015. Move-construct a basic_socket_iostream from another.
  48016. [hr]
  48017. Establish a connection to an endpoint corresponding to a resolver query. ]
  48018. ]
  48019. [
  48020. [[link boost_asio.reference.basic_socket_iostream.close [*close]]]
  48021. [Close the connection. ]
  48022. ]
  48023. [
  48024. [[link boost_asio.reference.basic_socket_iostream.connect [*connect]]]
  48025. [Establish a connection to an endpoint corresponding to a resolver query. ]
  48026. ]
  48027. [
  48028. [[link boost_asio.reference.basic_socket_iostream.error [*error]]]
  48029. [Get the last error associated with the stream. ]
  48030. ]
  48031. [
  48032. [[link boost_asio.reference.basic_socket_iostream.expires_after [*expires_after]]]
  48033. [Set the stream's expiry time relative to now. ]
  48034. ]
  48035. [
  48036. [[link boost_asio.reference.basic_socket_iostream.expires_at [*expires_at]]]
  48037. [(Deprecated: Use expiry().) Get the stream's expiry time as an absolute time.
  48038. [hr]
  48039. Set the stream's expiry time as an absolute time. ]
  48040. ]
  48041. [
  48042. [[link boost_asio.reference.basic_socket_iostream.expires_from_now [*expires_from_now]]]
  48043. [(Deprecated: Use expiry().) Get the stream's expiry time relative to now.
  48044. [hr]
  48045. (Deprecated: Use expires_after().) Set the stream's expiry time relative to now. ]
  48046. ]
  48047. [
  48048. [[link boost_asio.reference.basic_socket_iostream.expiry [*expiry]]]
  48049. [Get the stream's expiry time as an absolute time. ]
  48050. ]
  48051. [
  48052. [[link boost_asio.reference.basic_socket_iostream.operator_eq_ [*operator=]]]
  48053. [Move-assign a basic_socket_iostream from another. ]
  48054. ]
  48055. [
  48056. [[link boost_asio.reference.basic_socket_iostream.rdbuf [*rdbuf]]]
  48057. [Return a pointer to the underlying streambuf. ]
  48058. ]
  48059. [
  48060. [[link boost_asio.reference.basic_socket_iostream.socket [*socket]]]
  48061. [Get a reference to the underlying socket. ]
  48062. ]
  48063. ]
  48064. [heading Requirements]
  48065. ['Header: ][^boost/asio/local/stream_protocol.hpp]
  48066. ['Convenience header: ][^boost/asio.hpp]
  48067. [endsect]
  48068. [section:protocol local::stream_protocol::protocol]
  48069. [indexterm2 boost_asio.indexterm.local__stream_protocol.protocol..protocol..local::stream_protocol]
  48070. Obtain an identifier for the protocol.
  48071. int protocol() const;
  48072. [endsect]
  48073. [section:socket local::stream_protocol::socket]
  48074. [indexterm2 boost_asio.indexterm.local__stream_protocol.socket..socket..local::stream_protocol]
  48075. The UNIX domain socket type.
  48076. typedef basic_stream_socket< stream_protocol > socket;
  48077. [heading Types]
  48078. [table
  48079. [[Name][Description]]
  48080. [
  48081. [[link boost_asio.reference.basic_stream_socket__rebind_executor [*rebind_executor]]]
  48082. [Rebinds the socket type to another executor. ]
  48083. ]
  48084. [
  48085. [[link boost_asio.reference.basic_stream_socket.broadcast [*broadcast]]]
  48086. [Socket option to permit sending of broadcast messages. ]
  48087. ]
  48088. [
  48089. [[link boost_asio.reference.basic_stream_socket.bytes_readable [*bytes_readable]]]
  48090. [IO control command to get the amount of data that can be read without blocking. ]
  48091. ]
  48092. [
  48093. [[link boost_asio.reference.basic_stream_socket.debug [*debug]]]
  48094. [Socket option to enable socket-level debugging. ]
  48095. ]
  48096. [
  48097. [[link boost_asio.reference.basic_stream_socket.do_not_route [*do_not_route]]]
  48098. [Socket option to prevent routing, use local interfaces only. ]
  48099. ]
  48100. [
  48101. [[link boost_asio.reference.basic_stream_socket.enable_connection_aborted [*enable_connection_aborted]]]
  48102. [Socket option to report aborted connections on accept. ]
  48103. ]
  48104. [
  48105. [[link boost_asio.reference.basic_stream_socket.endpoint_type [*endpoint_type]]]
  48106. [The endpoint type. ]
  48107. ]
  48108. [
  48109. [[link boost_asio.reference.basic_stream_socket.executor_type [*executor_type]]]
  48110. [The type of the executor associated with the object. ]
  48111. ]
  48112. [
  48113. [[link boost_asio.reference.basic_stream_socket.keep_alive [*keep_alive]]]
  48114. [Socket option to send keep-alives. ]
  48115. ]
  48116. [
  48117. [[link boost_asio.reference.basic_stream_socket.linger [*linger]]]
  48118. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  48119. ]
  48120. [
  48121. [[link boost_asio.reference.basic_stream_socket.lowest_layer_type [*lowest_layer_type]]]
  48122. [A basic_socket is always the lowest layer. ]
  48123. ]
  48124. [
  48125. [[link boost_asio.reference.basic_stream_socket.message_flags [*message_flags]]]
  48126. [Bitmask type for flags that can be passed to send and receive operations. ]
  48127. ]
  48128. [
  48129. [[link boost_asio.reference.basic_stream_socket.native_handle_type [*native_handle_type]]]
  48130. [The native representation of a socket. ]
  48131. ]
  48132. [
  48133. [[link boost_asio.reference.basic_stream_socket.out_of_band_inline [*out_of_band_inline]]]
  48134. [Socket option for putting received out-of-band data inline. ]
  48135. ]
  48136. [
  48137. [[link boost_asio.reference.basic_stream_socket.protocol_type [*protocol_type]]]
  48138. [The protocol type. ]
  48139. ]
  48140. [
  48141. [[link boost_asio.reference.basic_stream_socket.receive_buffer_size [*receive_buffer_size]]]
  48142. [Socket option for the receive buffer size of a socket. ]
  48143. ]
  48144. [
  48145. [[link boost_asio.reference.basic_stream_socket.receive_low_watermark [*receive_low_watermark]]]
  48146. [Socket option for the receive low watermark. ]
  48147. ]
  48148. [
  48149. [[link boost_asio.reference.basic_stream_socket.reuse_address [*reuse_address]]]
  48150. [Socket option to allow the socket to be bound to an address that is already in use. ]
  48151. ]
  48152. [
  48153. [[link boost_asio.reference.basic_stream_socket.send_buffer_size [*send_buffer_size]]]
  48154. [Socket option for the send buffer size of a socket. ]
  48155. ]
  48156. [
  48157. [[link boost_asio.reference.basic_stream_socket.send_low_watermark [*send_low_watermark]]]
  48158. [Socket option for the send low watermark. ]
  48159. ]
  48160. [
  48161. [[link boost_asio.reference.basic_stream_socket.shutdown_type [*shutdown_type]]]
  48162. [Different ways a socket may be shutdown. ]
  48163. ]
  48164. [
  48165. [[link boost_asio.reference.basic_stream_socket.wait_type [*wait_type]]]
  48166. [Wait types. ]
  48167. ]
  48168. ]
  48169. [heading Member Functions]
  48170. [table
  48171. [[Name][Description]]
  48172. [
  48173. [[link boost_asio.reference.basic_stream_socket.assign [*assign]]]
  48174. [Assign an existing native socket to the socket. ]
  48175. ]
  48176. [
  48177. [[link boost_asio.reference.basic_stream_socket.async_connect [*async_connect]]]
  48178. [Start an asynchronous connect. ]
  48179. ]
  48180. [
  48181. [[link boost_asio.reference.basic_stream_socket.async_read_some [*async_read_some]]]
  48182. [Start an asynchronous read. ]
  48183. ]
  48184. [
  48185. [[link boost_asio.reference.basic_stream_socket.async_receive [*async_receive]]]
  48186. [Start an asynchronous receive. ]
  48187. ]
  48188. [
  48189. [[link boost_asio.reference.basic_stream_socket.async_send [*async_send]]]
  48190. [Start an asynchronous send. ]
  48191. ]
  48192. [
  48193. [[link boost_asio.reference.basic_stream_socket.async_wait [*async_wait]]]
  48194. [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  48195. ]
  48196. [
  48197. [[link boost_asio.reference.basic_stream_socket.async_write_some [*async_write_some]]]
  48198. [Start an asynchronous write. ]
  48199. ]
  48200. [
  48201. [[link boost_asio.reference.basic_stream_socket.at_mark [*at_mark]]]
  48202. [Determine whether the socket is at the out-of-band data mark. ]
  48203. ]
  48204. [
  48205. [[link boost_asio.reference.basic_stream_socket.available [*available]]]
  48206. [Determine the number of bytes available for reading. ]
  48207. ]
  48208. [
  48209. [[link boost_asio.reference.basic_stream_socket.basic_stream_socket [*basic_stream_socket]]]
  48210. [Construct a basic_stream_socket without opening it.
  48211. [hr]
  48212. Construct and open a basic_stream_socket.
  48213. [hr]
  48214. Construct a basic_stream_socket, opening it and binding it to the given local endpoint.
  48215. [hr]
  48216. Construct a basic_stream_socket on an existing native socket.
  48217. [hr]
  48218. Move-construct a basic_stream_socket from another.
  48219. [hr]
  48220. Move-construct a basic_stream_socket from a socket of another protocol type. ]
  48221. ]
  48222. [
  48223. [[link boost_asio.reference.basic_stream_socket.bind [*bind]]]
  48224. [Bind the socket to the given local endpoint. ]
  48225. ]
  48226. [
  48227. [[link boost_asio.reference.basic_stream_socket.cancel [*cancel]]]
  48228. [Cancel all asynchronous operations associated with the socket. ]
  48229. ]
  48230. [
  48231. [[link boost_asio.reference.basic_stream_socket.close [*close]]]
  48232. [Close the socket. ]
  48233. ]
  48234. [
  48235. [[link boost_asio.reference.basic_stream_socket.connect [*connect]]]
  48236. [Connect the socket to the specified endpoint. ]
  48237. ]
  48238. [
  48239. [[link boost_asio.reference.basic_stream_socket.get_executor [*get_executor]]]
  48240. [Get the executor associated with the object. ]
  48241. ]
  48242. [
  48243. [[link boost_asio.reference.basic_stream_socket.get_option [*get_option]]]
  48244. [Get an option from the socket. ]
  48245. ]
  48246. [
  48247. [[link boost_asio.reference.basic_stream_socket.io_control [*io_control]]]
  48248. [Perform an IO control command on the socket. ]
  48249. ]
  48250. [
  48251. [[link boost_asio.reference.basic_stream_socket.is_open [*is_open]]]
  48252. [Determine whether the socket is open. ]
  48253. ]
  48254. [
  48255. [[link boost_asio.reference.basic_stream_socket.local_endpoint [*local_endpoint]]]
  48256. [Get the local endpoint of the socket. ]
  48257. ]
  48258. [
  48259. [[link boost_asio.reference.basic_stream_socket.lowest_layer [*lowest_layer]]]
  48260. [Get a reference to the lowest layer.
  48261. [hr]
  48262. Get a const reference to the lowest layer. ]
  48263. ]
  48264. [
  48265. [[link boost_asio.reference.basic_stream_socket.native_handle [*native_handle]]]
  48266. [Get the native socket representation. ]
  48267. ]
  48268. [
  48269. [[link boost_asio.reference.basic_stream_socket.native_non_blocking [*native_non_blocking]]]
  48270. [Gets the non-blocking mode of the native socket implementation.
  48271. [hr]
  48272. Sets the non-blocking mode of the native socket implementation. ]
  48273. ]
  48274. [
  48275. [[link boost_asio.reference.basic_stream_socket.non_blocking [*non_blocking]]]
  48276. [Gets the non-blocking mode of the socket.
  48277. [hr]
  48278. Sets the non-blocking mode of the socket. ]
  48279. ]
  48280. [
  48281. [[link boost_asio.reference.basic_stream_socket.open [*open]]]
  48282. [Open the socket using the specified protocol. ]
  48283. ]
  48284. [
  48285. [[link boost_asio.reference.basic_stream_socket.operator_eq_ [*operator=]]]
  48286. [Move-assign a basic_stream_socket from another.
  48287. [hr]
  48288. Move-assign a basic_stream_socket from a socket of another protocol type. ]
  48289. ]
  48290. [
  48291. [[link boost_asio.reference.basic_stream_socket.read_some [*read_some]]]
  48292. [Read some data from the socket. ]
  48293. ]
  48294. [
  48295. [[link boost_asio.reference.basic_stream_socket.receive [*receive]]]
  48296. [Receive some data on the socket.
  48297. [hr]
  48298. Receive some data on a connected socket. ]
  48299. ]
  48300. [
  48301. [[link boost_asio.reference.basic_stream_socket.release [*release]]]
  48302. [Release ownership of the underlying native socket. ]
  48303. ]
  48304. [
  48305. [[link boost_asio.reference.basic_stream_socket.remote_endpoint [*remote_endpoint]]]
  48306. [Get the remote endpoint of the socket. ]
  48307. ]
  48308. [
  48309. [[link boost_asio.reference.basic_stream_socket.send [*send]]]
  48310. [Send some data on the socket. ]
  48311. ]
  48312. [
  48313. [[link boost_asio.reference.basic_stream_socket.set_option [*set_option]]]
  48314. [Set an option on the socket. ]
  48315. ]
  48316. [
  48317. [[link boost_asio.reference.basic_stream_socket.shutdown [*shutdown]]]
  48318. [Disable sends or receives on the socket. ]
  48319. ]
  48320. [
  48321. [[link boost_asio.reference.basic_stream_socket.wait [*wait]]]
  48322. [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ]
  48323. ]
  48324. [
  48325. [[link boost_asio.reference.basic_stream_socket.write_some [*write_some]]]
  48326. [Write some data to the socket. ]
  48327. ]
  48328. [
  48329. [[link boost_asio.reference.basic_stream_socket._basic_stream_socket [*~basic_stream_socket]]]
  48330. [Destroys the socket. ]
  48331. ]
  48332. ]
  48333. [heading Data Members]
  48334. [table
  48335. [[Name][Description]]
  48336. [
  48337. [[link boost_asio.reference.basic_stream_socket.max_connections [*max_connections]]]
  48338. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  48339. ]
  48340. [
  48341. [[link boost_asio.reference.basic_stream_socket.max_listen_connections [*max_listen_connections]]]
  48342. [The maximum length of the queue of pending incoming connections. ]
  48343. ]
  48344. [
  48345. [[link boost_asio.reference.basic_stream_socket.message_do_not_route [*message_do_not_route]]]
  48346. [Specify that the data should not be subject to routing. ]
  48347. ]
  48348. [
  48349. [[link boost_asio.reference.basic_stream_socket.message_end_of_record [*message_end_of_record]]]
  48350. [Specifies that the data marks the end of a record. ]
  48351. ]
  48352. [
  48353. [[link boost_asio.reference.basic_stream_socket.message_out_of_band [*message_out_of_band]]]
  48354. [Process out-of-band data. ]
  48355. ]
  48356. [
  48357. [[link boost_asio.reference.basic_stream_socket.message_peek [*message_peek]]]
  48358. [Peek at incoming data without removing it from the input queue. ]
  48359. ]
  48360. ]
  48361. [heading Protected Data Members]
  48362. [table
  48363. [[Name][Description]]
  48364. [
  48365. [[link boost_asio.reference.basic_stream_socket.impl_ [*impl_]]]
  48366. []
  48367. ]
  48368. ]
  48369. The [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] class template provides asynchronous and blocking stream-oriented socket functionality.
  48370. [heading Thread Safety]
  48371. ['Distinct] ['objects:] Safe.
  48372. ['Shared] ['objects:] Unsafe.
  48373. [heading Requirements]
  48374. ['Header: ][^boost/asio/local/stream_protocol.hpp]
  48375. ['Convenience header: ][^boost/asio.hpp]
  48376. [endsect]
  48377. [section:type local::stream_protocol::type]
  48378. [indexterm2 boost_asio.indexterm.local__stream_protocol.type..type..local::stream_protocol]
  48379. Obtain an identifier for the type of the protocol.
  48380. int type() const;
  48381. [endsect]
  48382. [endsect]
  48383. [section:make_strand make_strand]
  48384. [indexterm1 boost_asio.indexterm.make_strand..make_strand]
  48385. The `boost::asio::make_strand` function creates a [link boost_asio.reference.strand `strand`] object for an executor or execution context.
  48386. Create a [link boost_asio.reference.strand `strand`] object for an executor.
  48387. template<
  48388. typename ``[link boost_asio.reference.Executor1 Executor]``>
  48389. strand< Executor > ``[link boost_asio.reference.make_strand.overload1 make_strand]``(
  48390. const Executor & ex,
  48391. typename enable_if< is_executor< Executor >::value >::type * = 0);
  48392. `` [''''&raquo;''' [link boost_asio.reference.make_strand.overload1 more...]]``
  48393. Create a [link boost_asio.reference.strand `strand`] object for an execution context.
  48394. template<
  48395. typename ExecutionContext>
  48396. strand< typename ExecutionContext::executor_type > ``[link boost_asio.reference.make_strand.overload2 make_strand]``(
  48397. ExecutionContext & ctx,
  48398. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  48399. `` [''''&raquo;''' [link boost_asio.reference.make_strand.overload2 more...]]``
  48400. [heading Requirements]
  48401. ['Header: ][^boost/asio/strand.hpp]
  48402. ['Convenience header: ][^boost/asio.hpp]
  48403. [section:overload1 make_strand (1 of 2 overloads)]
  48404. Create a [link boost_asio.reference.strand `strand`] object for an executor.
  48405. template<
  48406. typename ``[link boost_asio.reference.Executor1 Executor]``>
  48407. strand< Executor > make_strand(
  48408. const Executor & ex,
  48409. typename enable_if< is_executor< Executor >::value >::type * = 0);
  48410. [endsect]
  48411. [section:overload2 make_strand (2 of 2 overloads)]
  48412. Create a [link boost_asio.reference.strand `strand`] object for an execution context.
  48413. template<
  48414. typename ExecutionContext>
  48415. strand< typename ExecutionContext::executor_type > make_strand(
  48416. ExecutionContext & ctx,
  48417. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  48418. [endsect]
  48419. [endsect]
  48420. [section:make_work_guard make_work_guard]
  48421. [indexterm1 boost_asio.indexterm.make_work_guard..make_work_guard]
  48422. Create an [link boost_asio.reference.executor_work_guard `executor_work_guard`] object.
  48423. template<
  48424. typename ``[link boost_asio.reference.Executor1 Executor]``>
  48425. executor_work_guard< Executor > ``[link boost_asio.reference.make_work_guard.overload1 make_work_guard]``(
  48426. const Executor & ex,
  48427. typename enable_if< is_executor< Executor >::value >::type * = 0);
  48428. `` [''''&raquo;''' [link boost_asio.reference.make_work_guard.overload1 more...]]``
  48429. template<
  48430. typename ExecutionContext>
  48431. executor_work_guard< typename ExecutionContext::executor_type > ``[link boost_asio.reference.make_work_guard.overload2 make_work_guard]``(
  48432. ExecutionContext & ctx,
  48433. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  48434. `` [''''&raquo;''' [link boost_asio.reference.make_work_guard.overload2 more...]]``
  48435. template<
  48436. typename T>
  48437. executor_work_guard< typename associated_executor< T >::type > ``[link boost_asio.reference.make_work_guard.overload3 make_work_guard]``(
  48438. const T & t,
  48439. typename enable_if<!is_executor< T >::value &&!is_convertible< T &, execution_context & >::value >::type * = 0);
  48440. `` [''''&raquo;''' [link boost_asio.reference.make_work_guard.overload3 more...]]``
  48441. template<
  48442. typename T,
  48443. typename ``[link boost_asio.reference.Executor1 Executor]``>
  48444. executor_work_guard< typename associated_executor< T, Executor >::type > ``[link boost_asio.reference.make_work_guard.overload4 make_work_guard]``(
  48445. const T & t,
  48446. const Executor & ex,
  48447. typename enable_if< is_executor< Executor >::value >::type * = 0);
  48448. `` [''''&raquo;''' [link boost_asio.reference.make_work_guard.overload4 more...]]``
  48449. template<
  48450. typename T,
  48451. typename ExecutionContext>
  48452. executor_work_guard< typename associated_executor< T, typename ExecutionContext::executor_type >::type > ``[link boost_asio.reference.make_work_guard.overload5 make_work_guard]``(
  48453. const T & t,
  48454. ExecutionContext & ctx,
  48455. typename enable_if<!is_executor< T >::value &&!is_convertible< T &, execution_context & >::value &&is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  48456. `` [''''&raquo;''' [link boost_asio.reference.make_work_guard.overload5 more...]]``
  48457. [heading Requirements]
  48458. ['Header: ][^boost/asio/executor_work_guard.hpp]
  48459. ['Convenience header: ][^boost/asio.hpp]
  48460. [section:overload1 make_work_guard (1 of 5 overloads)]
  48461. Create an [link boost_asio.reference.executor_work_guard `executor_work_guard`] object.
  48462. template<
  48463. typename ``[link boost_asio.reference.Executor1 Executor]``>
  48464. executor_work_guard< Executor > make_work_guard(
  48465. const Executor & ex,
  48466. typename enable_if< is_executor< Executor >::value >::type * = 0);
  48467. [endsect]
  48468. [section:overload2 make_work_guard (2 of 5 overloads)]
  48469. Create an [link boost_asio.reference.executor_work_guard `executor_work_guard`] object.
  48470. template<
  48471. typename ExecutionContext>
  48472. executor_work_guard< typename ExecutionContext::executor_type > make_work_guard(
  48473. ExecutionContext & ctx,
  48474. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  48475. [endsect]
  48476. [section:overload3 make_work_guard (3 of 5 overloads)]
  48477. Create an [link boost_asio.reference.executor_work_guard `executor_work_guard`] object.
  48478. template<
  48479. typename T>
  48480. executor_work_guard< typename associated_executor< T >::type > make_work_guard(
  48481. const T & t,
  48482. typename enable_if<!is_executor< T >::value &&!is_convertible< T &, execution_context & >::value >::type * = 0);
  48483. [endsect]
  48484. [section:overload4 make_work_guard (4 of 5 overloads)]
  48485. Create an [link boost_asio.reference.executor_work_guard `executor_work_guard`] object.
  48486. template<
  48487. typename T,
  48488. typename ``[link boost_asio.reference.Executor1 Executor]``>
  48489. executor_work_guard< typename associated_executor< T, Executor >::type > make_work_guard(
  48490. const T & t,
  48491. const Executor & ex,
  48492. typename enable_if< is_executor< Executor >::value >::type * = 0);
  48493. [endsect]
  48494. [section:overload5 make_work_guard (5 of 5 overloads)]
  48495. Create an [link boost_asio.reference.executor_work_guard `executor_work_guard`] object.
  48496. template<
  48497. typename T,
  48498. typename ExecutionContext>
  48499. executor_work_guard< typename associated_executor< T, typename ExecutionContext::executor_type >::type > make_work_guard(
  48500. const T & t,
  48501. ExecutionContext & ctx,
  48502. typename enable_if<!is_executor< T >::value &&!is_convertible< T &, execution_context & >::value &&is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  48503. [endsect]
  48504. [endsect]
  48505. [section:mutable_buffer mutable_buffer]
  48506. Holds a buffer that can be modified.
  48507. class mutable_buffer
  48508. [heading Member Functions]
  48509. [table
  48510. [[Name][Description]]
  48511. [
  48512. [[link boost_asio.reference.mutable_buffer.data [*data]]]
  48513. [Get a pointer to the beginning of the memory range. ]
  48514. ]
  48515. [
  48516. [[link boost_asio.reference.mutable_buffer.mutable_buffer [*mutable_buffer]]]
  48517. [Construct an empty buffer.
  48518. [hr]
  48519. Construct a buffer to represent a given memory range. ]
  48520. ]
  48521. [
  48522. [[link boost_asio.reference.mutable_buffer.operator_plus__eq_ [*operator+=]]]
  48523. [Move the start of the buffer by the specified number of bytes. ]
  48524. ]
  48525. [
  48526. [[link boost_asio.reference.mutable_buffer.size [*size]]]
  48527. [Get the size of the memory range. ]
  48528. ]
  48529. ]
  48530. [heading Related Functions]
  48531. [table
  48532. [[Name][Description]]
  48533. [
  48534. [[link boost_asio.reference.mutable_buffer.operator_plus_ [*operator+]]]
  48535. [Create a new modifiable buffer that is offset from the start of another. ]
  48536. ]
  48537. ]
  48538. The [link boost_asio.reference.mutable_buffer `mutable_buffer`] class provides a safe representation of a buffer that can be modified. It does not own the underlying data, and so is cheap to copy or assign.
  48539. [heading Accessing Buffer Contents]
  48540. The contents of a buffer may be accessed using the `data()` and `size()` member functions:
  48541. boost::asio::mutable_buffer b1 = ...;
  48542. std::size_t s1 = b1.size();
  48543. unsigned char* p1 = static_cast<unsigned char*>(b1.data());
  48544. The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered.
  48545. [heading Requirements]
  48546. ['Header: ][^boost/asio/buffer.hpp]
  48547. ['Convenience header: ][^boost/asio.hpp]
  48548. [section:data mutable_buffer::data]
  48549. [indexterm2 boost_asio.indexterm.mutable_buffer.data..data..mutable_buffer]
  48550. Get a pointer to the beginning of the memory range.
  48551. void * data() const;
  48552. [endsect]
  48553. [section:mutable_buffer mutable_buffer::mutable_buffer]
  48554. [indexterm2 boost_asio.indexterm.mutable_buffer.mutable_buffer..mutable_buffer..mutable_buffer]
  48555. Construct an empty buffer.
  48556. ``[link boost_asio.reference.mutable_buffer.mutable_buffer.overload1 mutable_buffer]``();
  48557. `` [''''&raquo;''' [link boost_asio.reference.mutable_buffer.mutable_buffer.overload1 more...]]``
  48558. Construct a buffer to represent a given memory range.
  48559. ``[link boost_asio.reference.mutable_buffer.mutable_buffer.overload2 mutable_buffer]``(
  48560. void * data,
  48561. std::size_t size);
  48562. `` [''''&raquo;''' [link boost_asio.reference.mutable_buffer.mutable_buffer.overload2 more...]]``
  48563. [section:overload1 mutable_buffer::mutable_buffer (1 of 2 overloads)]
  48564. Construct an empty buffer.
  48565. mutable_buffer();
  48566. [endsect]
  48567. [section:overload2 mutable_buffer::mutable_buffer (2 of 2 overloads)]
  48568. Construct a buffer to represent a given memory range.
  48569. mutable_buffer(
  48570. void * data,
  48571. std::size_t size);
  48572. [endsect]
  48573. [endsect]
  48574. [section:operator_plus_ mutable_buffer::operator+]
  48575. [indexterm2 boost_asio.indexterm.mutable_buffer.operator_plus_..operator+..mutable_buffer]
  48576. Create a new modifiable buffer that is offset from the start of another.
  48577. mutable_buffer ``[link boost_asio.reference.mutable_buffer.operator_plus_.overload1 operator+]``(
  48578. const mutable_buffer & b,
  48579. std::size_t n);
  48580. `` [''''&raquo;''' [link boost_asio.reference.mutable_buffer.operator_plus_.overload1 more...]]``
  48581. mutable_buffer ``[link boost_asio.reference.mutable_buffer.operator_plus_.overload2 operator+]``(
  48582. std::size_t n,
  48583. const mutable_buffer & b);
  48584. `` [''''&raquo;''' [link boost_asio.reference.mutable_buffer.operator_plus_.overload2 more...]]``
  48585. [section:overload1 mutable_buffer::operator+ (1 of 2 overloads)]
  48586. Create a new modifiable buffer that is offset from the start of another.
  48587. mutable_buffer operator+(
  48588. const mutable_buffer & b,
  48589. std::size_t n);
  48590. [endsect]
  48591. [section:overload2 mutable_buffer::operator+ (2 of 2 overloads)]
  48592. Create a new modifiable buffer that is offset from the start of another.
  48593. mutable_buffer operator+(
  48594. std::size_t n,
  48595. const mutable_buffer & b);
  48596. [endsect]
  48597. [endsect]
  48598. [section:operator_plus__eq_ mutable_buffer::operator+=]
  48599. [indexterm2 boost_asio.indexterm.mutable_buffer.operator_plus__eq_..operator+=..mutable_buffer]
  48600. Move the start of the buffer by the specified number of bytes.
  48601. mutable_buffer & operator+=(
  48602. std::size_t n);
  48603. [endsect]
  48604. [section:size mutable_buffer::size]
  48605. [indexterm2 boost_asio.indexterm.mutable_buffer.size..size..mutable_buffer]
  48606. Get the size of the memory range.
  48607. std::size_t size() const;
  48608. [endsect]
  48609. [endsect]
  48610. [section:mutable_buffers_1 mutable_buffers_1]
  48611. (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.
  48612. class mutable_buffers_1 :
  48613. public mutable_buffer
  48614. [heading Types]
  48615. [table
  48616. [[Name][Description]]
  48617. [
  48618. [[link boost_asio.reference.mutable_buffers_1.const_iterator [*const_iterator]]]
  48619. [A random-access iterator type that may be used to read elements. ]
  48620. ]
  48621. [
  48622. [[link boost_asio.reference.mutable_buffers_1.value_type [*value_type]]]
  48623. [The type for each element in the list of buffers. ]
  48624. ]
  48625. ]
  48626. [heading Member Functions]
  48627. [table
  48628. [[Name][Description]]
  48629. [
  48630. [[link boost_asio.reference.mutable_buffers_1.begin [*begin]]]
  48631. [Get a random-access iterator to the first element. ]
  48632. ]
  48633. [
  48634. [[link boost_asio.reference.mutable_buffers_1.data [*data]]]
  48635. [Get a pointer to the beginning of the memory range. ]
  48636. ]
  48637. [
  48638. [[link boost_asio.reference.mutable_buffers_1.end [*end]]]
  48639. [Get a random-access iterator for one past the last element. ]
  48640. ]
  48641. [
  48642. [[link boost_asio.reference.mutable_buffers_1.mutable_buffers_1 [*mutable_buffers_1]]]
  48643. [Construct to represent a given memory range.
  48644. [hr]
  48645. Construct to represent a single modifiable buffer. ]
  48646. ]
  48647. [
  48648. [[link boost_asio.reference.mutable_buffers_1.operator_plus__eq_ [*operator+=]]]
  48649. [Move the start of the buffer by the specified number of bytes. ]
  48650. ]
  48651. [
  48652. [[link boost_asio.reference.mutable_buffers_1.size [*size]]]
  48653. [Get the size of the memory range. ]
  48654. ]
  48655. ]
  48656. [heading Related Functions]
  48657. [table
  48658. [[Name][Description]]
  48659. [
  48660. [[link boost_asio.reference.mutable_buffers_1.operator_plus_ [*operator+]]]
  48661. [Create a new modifiable buffer that is offset from the start of another. ]
  48662. ]
  48663. ]
  48664. [heading Requirements]
  48665. ['Header: ][^boost/asio/buffer.hpp]
  48666. ['Convenience header: ][^boost/asio.hpp]
  48667. [section:begin mutable_buffers_1::begin]
  48668. [indexterm2 boost_asio.indexterm.mutable_buffers_1.begin..begin..mutable_buffers_1]
  48669. Get a random-access iterator to the first element.
  48670. const_iterator begin() const;
  48671. [endsect]
  48672. [section:const_iterator mutable_buffers_1::const_iterator]
  48673. [indexterm2 boost_asio.indexterm.mutable_buffers_1.const_iterator..const_iterator..mutable_buffers_1]
  48674. A random-access iterator type that may be used to read elements.
  48675. typedef const mutable_buffer * const_iterator;
  48676. [heading Requirements]
  48677. ['Header: ][^boost/asio/buffer.hpp]
  48678. ['Convenience header: ][^boost/asio.hpp]
  48679. [endsect]
  48680. [section:data mutable_buffers_1::data]
  48681. ['Inherited from mutable_buffer.]
  48682. [indexterm2 boost_asio.indexterm.mutable_buffers_1.data..data..mutable_buffers_1]
  48683. Get a pointer to the beginning of the memory range.
  48684. void * data() const;
  48685. [endsect]
  48686. [section:end mutable_buffers_1::end]
  48687. [indexterm2 boost_asio.indexterm.mutable_buffers_1.end..end..mutable_buffers_1]
  48688. Get a random-access iterator for one past the last element.
  48689. const_iterator end() const;
  48690. [endsect]
  48691. [section:mutable_buffers_1 mutable_buffers_1::mutable_buffers_1]
  48692. [indexterm2 boost_asio.indexterm.mutable_buffers_1.mutable_buffers_1..mutable_buffers_1..mutable_buffers_1]
  48693. Construct to represent a given memory range.
  48694. ``[link boost_asio.reference.mutable_buffers_1.mutable_buffers_1.overload1 mutable_buffers_1]``(
  48695. void * data,
  48696. std::size_t size);
  48697. `` [''''&raquo;''' [link boost_asio.reference.mutable_buffers_1.mutable_buffers_1.overload1 more...]]``
  48698. Construct to represent a single modifiable buffer.
  48699. explicit ``[link boost_asio.reference.mutable_buffers_1.mutable_buffers_1.overload2 mutable_buffers_1]``(
  48700. const mutable_buffer & b);
  48701. `` [''''&raquo;''' [link boost_asio.reference.mutable_buffers_1.mutable_buffers_1.overload2 more...]]``
  48702. [section:overload1 mutable_buffers_1::mutable_buffers_1 (1 of 2 overloads)]
  48703. Construct to represent a given memory range.
  48704. mutable_buffers_1(
  48705. void * data,
  48706. std::size_t size);
  48707. [endsect]
  48708. [section:overload2 mutable_buffers_1::mutable_buffers_1 (2 of 2 overloads)]
  48709. Construct to represent a single modifiable buffer.
  48710. mutable_buffers_1(
  48711. const mutable_buffer & b);
  48712. [endsect]
  48713. [endsect]
  48714. [section:operator_plus_ mutable_buffers_1::operator+]
  48715. [indexterm2 boost_asio.indexterm.mutable_buffers_1.operator_plus_..operator+..mutable_buffers_1]
  48716. Create a new modifiable buffer that is offset from the start of another.
  48717. mutable_buffer ``[link boost_asio.reference.mutable_buffers_1.operator_plus_.overload1 operator+]``(
  48718. const mutable_buffer & b,
  48719. std::size_t n);
  48720. `` [''''&raquo;''' [link boost_asio.reference.mutable_buffers_1.operator_plus_.overload1 more...]]``
  48721. mutable_buffer ``[link boost_asio.reference.mutable_buffers_1.operator_plus_.overload2 operator+]``(
  48722. std::size_t n,
  48723. const mutable_buffer & b);
  48724. `` [''''&raquo;''' [link boost_asio.reference.mutable_buffers_1.operator_plus_.overload2 more...]]``
  48725. [section:overload1 mutable_buffers_1::operator+ (1 of 2 overloads)]
  48726. ['Inherited from mutable_buffer.]
  48727. Create a new modifiable buffer that is offset from the start of another.
  48728. mutable_buffer operator+(
  48729. const mutable_buffer & b,
  48730. std::size_t n);
  48731. [endsect]
  48732. [section:overload2 mutable_buffers_1::operator+ (2 of 2 overloads)]
  48733. ['Inherited from mutable_buffer.]
  48734. Create a new modifiable buffer that is offset from the start of another.
  48735. mutable_buffer operator+(
  48736. std::size_t n,
  48737. const mutable_buffer & b);
  48738. [endsect]
  48739. [endsect]
  48740. [section:operator_plus__eq_ mutable_buffers_1::operator+=]
  48741. ['Inherited from mutable_buffer.]
  48742. [indexterm2 boost_asio.indexterm.mutable_buffers_1.operator_plus__eq_..operator+=..mutable_buffers_1]
  48743. Move the start of the buffer by the specified number of bytes.
  48744. mutable_buffer & operator+=(
  48745. std::size_t n);
  48746. [endsect]
  48747. [section:size mutable_buffers_1::size]
  48748. ['Inherited from mutable_buffer.]
  48749. [indexterm2 boost_asio.indexterm.mutable_buffers_1.size..size..mutable_buffers_1]
  48750. Get the size of the memory range.
  48751. std::size_t size() const;
  48752. [endsect]
  48753. [section:value_type mutable_buffers_1::value_type]
  48754. [indexterm2 boost_asio.indexterm.mutable_buffers_1.value_type..value_type..mutable_buffers_1]
  48755. The type for each element in the list of buffers.
  48756. typedef mutable_buffer value_type;
  48757. [heading Member Functions]
  48758. [table
  48759. [[Name][Description]]
  48760. [
  48761. [[link boost_asio.reference.mutable_buffer.data [*data]]]
  48762. [Get a pointer to the beginning of the memory range. ]
  48763. ]
  48764. [
  48765. [[link boost_asio.reference.mutable_buffer.mutable_buffer [*mutable_buffer]]]
  48766. [Construct an empty buffer.
  48767. [hr]
  48768. Construct a buffer to represent a given memory range. ]
  48769. ]
  48770. [
  48771. [[link boost_asio.reference.mutable_buffer.operator_plus__eq_ [*operator+=]]]
  48772. [Move the start of the buffer by the specified number of bytes. ]
  48773. ]
  48774. [
  48775. [[link boost_asio.reference.mutable_buffer.size [*size]]]
  48776. [Get the size of the memory range. ]
  48777. ]
  48778. ]
  48779. [heading Related Functions]
  48780. [table
  48781. [[Name][Description]]
  48782. [
  48783. [[link boost_asio.reference.mutable_buffer.operator_plus_ [*operator+]]]
  48784. [Create a new modifiable buffer that is offset from the start of another. ]
  48785. ]
  48786. ]
  48787. The [link boost_asio.reference.mutable_buffer `mutable_buffer`] class provides a safe representation of a buffer that can be modified. It does not own the underlying data, and so is cheap to copy or assign.
  48788. [heading Accessing Buffer Contents]
  48789. The contents of a buffer may be accessed using the `data()` and `size()` member functions:
  48790. boost::asio::mutable_buffer b1 = ...;
  48791. std::size_t s1 = b1.size();
  48792. unsigned char* p1 = static_cast<unsigned char*>(b1.data());
  48793. The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered.
  48794. [heading Requirements]
  48795. ['Header: ][^boost/asio/buffer.hpp]
  48796. ['Convenience header: ][^boost/asio.hpp]
  48797. [endsect]
  48798. [endsect]
  48799. [section:null_buffers null_buffers]
  48800. (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.
  48801. class null_buffers
  48802. [heading Types]
  48803. [table
  48804. [[Name][Description]]
  48805. [
  48806. [[link boost_asio.reference.null_buffers.const_iterator [*const_iterator]]]
  48807. [A random-access iterator type that may be used to read elements. ]
  48808. ]
  48809. [
  48810. [[link boost_asio.reference.null_buffers.value_type [*value_type]]]
  48811. [The type for each element in the list of buffers. ]
  48812. ]
  48813. ]
  48814. [heading Member Functions]
  48815. [table
  48816. [[Name][Description]]
  48817. [
  48818. [[link boost_asio.reference.null_buffers.begin [*begin]]]
  48819. [Get a random-access iterator to the first element. ]
  48820. ]
  48821. [
  48822. [[link boost_asio.reference.null_buffers.end [*end]]]
  48823. [Get a random-access iterator for one past the last element. ]
  48824. ]
  48825. ]
  48826. [heading Requirements]
  48827. ['Header: ][^boost/asio/buffer.hpp]
  48828. ['Convenience header: ][^boost/asio.hpp]
  48829. [section:begin null_buffers::begin]
  48830. [indexterm2 boost_asio.indexterm.null_buffers.begin..begin..null_buffers]
  48831. Get a random-access iterator to the first element.
  48832. const_iterator begin() const;
  48833. [endsect]
  48834. [section:const_iterator null_buffers::const_iterator]
  48835. [indexterm2 boost_asio.indexterm.null_buffers.const_iterator..const_iterator..null_buffers]
  48836. A random-access iterator type that may be used to read elements.
  48837. typedef const mutable_buffer * const_iterator;
  48838. [heading Requirements]
  48839. ['Header: ][^boost/asio/buffer.hpp]
  48840. ['Convenience header: ][^boost/asio.hpp]
  48841. [endsect]
  48842. [section:end null_buffers::end]
  48843. [indexterm2 boost_asio.indexterm.null_buffers.end..end..null_buffers]
  48844. Get a random-access iterator for one past the last element.
  48845. const_iterator end() const;
  48846. [endsect]
  48847. [section:value_type null_buffers::value_type]
  48848. [indexterm2 boost_asio.indexterm.null_buffers.value_type..value_type..null_buffers]
  48849. The type for each element in the list of buffers.
  48850. typedef mutable_buffer value_type;
  48851. [heading Member Functions]
  48852. [table
  48853. [[Name][Description]]
  48854. [
  48855. [[link boost_asio.reference.mutable_buffer.data [*data]]]
  48856. [Get a pointer to the beginning of the memory range. ]
  48857. ]
  48858. [
  48859. [[link boost_asio.reference.mutable_buffer.mutable_buffer [*mutable_buffer]]]
  48860. [Construct an empty buffer.
  48861. [hr]
  48862. Construct a buffer to represent a given memory range. ]
  48863. ]
  48864. [
  48865. [[link boost_asio.reference.mutable_buffer.operator_plus__eq_ [*operator+=]]]
  48866. [Move the start of the buffer by the specified number of bytes. ]
  48867. ]
  48868. [
  48869. [[link boost_asio.reference.mutable_buffer.size [*size]]]
  48870. [Get the size of the memory range. ]
  48871. ]
  48872. ]
  48873. [heading Related Functions]
  48874. [table
  48875. [[Name][Description]]
  48876. [
  48877. [[link boost_asio.reference.mutable_buffer.operator_plus_ [*operator+]]]
  48878. [Create a new modifiable buffer that is offset from the start of another. ]
  48879. ]
  48880. ]
  48881. The [link boost_asio.reference.mutable_buffer `mutable_buffer`] class provides a safe representation of a buffer that can be modified. It does not own the underlying data, and so is cheap to copy or assign.
  48882. [heading Accessing Buffer Contents]
  48883. The contents of a buffer may be accessed using the `data()` and `size()` member functions:
  48884. boost::asio::mutable_buffer b1 = ...;
  48885. std::size_t s1 = b1.size();
  48886. unsigned char* p1 = static_cast<unsigned char*>(b1.data());
  48887. The `data()` member function permits violations of type safety, so uses of it in application code should be carefully considered.
  48888. [heading Requirements]
  48889. ['Header: ][^boost/asio/buffer.hpp]
  48890. ['Convenience header: ][^boost/asio.hpp]
  48891. [endsect]
  48892. [endsect]
  48893. [section:placeholders__bytes_transferred placeholders::bytes_transferred]
  48894. [indexterm1 boost_asio.indexterm.placeholders__bytes_transferred..placeholders::bytes_transferred]
  48895. An argument placeholder, for use with boost::bind(), that corresponds to the bytes\_transferred argument of a handler for asynchronous functions such as `boost::asio::basic_stream_socket::async_write_some` or `boost::asio::async_write`.
  48896. unspecified bytes_transferred;
  48897. [heading Requirements]
  48898. ['Header: ][^boost/asio/placeholders.hpp]
  48899. ['Convenience header: ][^boost/asio.hpp]
  48900. [endsect]
  48901. [section:placeholders__endpoint placeholders::endpoint]
  48902. [indexterm1 boost_asio.indexterm.placeholders__endpoint..placeholders::endpoint]
  48903. An argument placeholder, for use with boost::bind(), that corresponds to the results argument of a handler for asynchronous functions such as `boost::asio::async_connect`.
  48904. unspecified endpoint;
  48905. [heading Requirements]
  48906. ['Header: ][^boost/asio/placeholders.hpp]
  48907. ['Convenience header: ][^boost/asio.hpp]
  48908. [endsect]
  48909. [section:placeholders__error placeholders::error]
  48910. [indexterm1 boost_asio.indexterm.placeholders__error..placeholders::error]
  48911. An argument placeholder, for use with boost::bind(), that corresponds to the error argument of a handler for any of the asynchronous functions.
  48912. unspecified error;
  48913. [heading Requirements]
  48914. ['Header: ][^boost/asio/placeholders.hpp]
  48915. ['Convenience header: ][^boost/asio.hpp]
  48916. [endsect]
  48917. [section:placeholders__iterator placeholders::iterator]
  48918. [indexterm1 boost_asio.indexterm.placeholders__iterator..placeholders::iterator]
  48919. An argument placeholder, for use with boost::bind(), that corresponds to the iterator argument of a handler for asynchronous functions such as `boost::asio::async_connect`.
  48920. unspecified iterator;
  48921. [heading Requirements]
  48922. ['Header: ][^boost/asio/placeholders.hpp]
  48923. ['Convenience header: ][^boost/asio.hpp]
  48924. [endsect]
  48925. [section:placeholders__results placeholders::results]
  48926. [indexterm1 boost_asio.indexterm.placeholders__results..placeholders::results]
  48927. An argument placeholder, for use with boost::bind(), that corresponds to the results argument of a handler for asynchronous functions such as boost::asio::basic\_resolver::async\_resolve.
  48928. unspecified results;
  48929. [heading Requirements]
  48930. ['Header: ][^boost/asio/placeholders.hpp]
  48931. ['Convenience header: ][^boost/asio.hpp]
  48932. [endsect]
  48933. [section:placeholders__signal_number placeholders::signal_number]
  48934. [indexterm1 boost_asio.indexterm.placeholders__signal_number..placeholders::signal_number]
  48935. An argument placeholder, for use with boost::bind(), that corresponds to the signal\_number argument of a handler for asynchronous functions such as `boost::asio::signal_set::async_wait`.
  48936. unspecified signal_number;
  48937. [heading Requirements]
  48938. ['Header: ][^boost/asio/placeholders.hpp]
  48939. ['Convenience header: ][^boost/asio.hpp]
  48940. [endsect]
  48941. [section:posix__basic_descriptor posix::basic_descriptor]
  48942. Provides POSIX descriptor functionality.
  48943. template<
  48944. typename ``[link boost_asio.reference.Executor1 Executor]`` = executor>
  48945. class basic_descriptor :
  48946. public posix::descriptor_base
  48947. [heading Types]
  48948. [table
  48949. [[Name][Description]]
  48950. [
  48951. [[link boost_asio.reference.posix__basic_descriptor__rebind_executor [*rebind_executor]]]
  48952. [Rebinds the descriptor type to another executor. ]
  48953. ]
  48954. [
  48955. [[link boost_asio.reference.posix__basic_descriptor.bytes_readable [*bytes_readable]]]
  48956. [IO control command to get the amount of data that can be read without blocking. ]
  48957. ]
  48958. [
  48959. [[link boost_asio.reference.posix__basic_descriptor.executor_type [*executor_type]]]
  48960. [The type of the executor associated with the object. ]
  48961. ]
  48962. [
  48963. [[link boost_asio.reference.posix__basic_descriptor.lowest_layer_type [*lowest_layer_type]]]
  48964. [A descriptor is always the lowest layer. ]
  48965. ]
  48966. [
  48967. [[link boost_asio.reference.posix__basic_descriptor.native_handle_type [*native_handle_type]]]
  48968. [The native representation of a descriptor. ]
  48969. ]
  48970. [
  48971. [[link boost_asio.reference.posix__basic_descriptor.wait_type [*wait_type]]]
  48972. [Wait types. ]
  48973. ]
  48974. ]
  48975. [heading Member Functions]
  48976. [table
  48977. [[Name][Description]]
  48978. [
  48979. [[link boost_asio.reference.posix__basic_descriptor.assign [*assign]]]
  48980. [Assign an existing native descriptor to the descriptor. ]
  48981. ]
  48982. [
  48983. [[link boost_asio.reference.posix__basic_descriptor.async_wait [*async_wait]]]
  48984. [Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
  48985. ]
  48986. [
  48987. [[link boost_asio.reference.posix__basic_descriptor.basic_descriptor [*basic_descriptor]]]
  48988. [Construct a descriptor without opening it.
  48989. [hr]
  48990. Construct a descriptor on an existing native descriptor.
  48991. [hr]
  48992. Move-construct a descriptor from another. ]
  48993. ]
  48994. [
  48995. [[link boost_asio.reference.posix__basic_descriptor.cancel [*cancel]]]
  48996. [Cancel all asynchronous operations associated with the descriptor. ]
  48997. ]
  48998. [
  48999. [[link boost_asio.reference.posix__basic_descriptor.close [*close]]]
  49000. [Close the descriptor. ]
  49001. ]
  49002. [
  49003. [[link boost_asio.reference.posix__basic_descriptor.get_executor [*get_executor]]]
  49004. [Get the executor associated with the object. ]
  49005. ]
  49006. [
  49007. [[link boost_asio.reference.posix__basic_descriptor.io_control [*io_control]]]
  49008. [Perform an IO control command on the descriptor. ]
  49009. ]
  49010. [
  49011. [[link boost_asio.reference.posix__basic_descriptor.is_open [*is_open]]]
  49012. [Determine whether the descriptor is open. ]
  49013. ]
  49014. [
  49015. [[link boost_asio.reference.posix__basic_descriptor.lowest_layer [*lowest_layer]]]
  49016. [Get a reference to the lowest layer.
  49017. [hr]
  49018. Get a const reference to the lowest layer. ]
  49019. ]
  49020. [
  49021. [[link boost_asio.reference.posix__basic_descriptor.native_handle [*native_handle]]]
  49022. [Get the native descriptor representation. ]
  49023. ]
  49024. [
  49025. [[link boost_asio.reference.posix__basic_descriptor.native_non_blocking [*native_non_blocking]]]
  49026. [Gets the non-blocking mode of the native descriptor implementation.
  49027. [hr]
  49028. Sets the non-blocking mode of the native descriptor implementation. ]
  49029. ]
  49030. [
  49031. [[link boost_asio.reference.posix__basic_descriptor.non_blocking [*non_blocking]]]
  49032. [Gets the non-blocking mode of the descriptor.
  49033. [hr]
  49034. Sets the non-blocking mode of the descriptor. ]
  49035. ]
  49036. [
  49037. [[link boost_asio.reference.posix__basic_descriptor.operator_eq_ [*operator=]]]
  49038. [Move-assign a descriptor from another. ]
  49039. ]
  49040. [
  49041. [[link boost_asio.reference.posix__basic_descriptor.release [*release]]]
  49042. [Release ownership of the native descriptor implementation. ]
  49043. ]
  49044. [
  49045. [[link boost_asio.reference.posix__basic_descriptor.wait [*wait]]]
  49046. [Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
  49047. ]
  49048. ]
  49049. [heading Protected Member Functions]
  49050. [table
  49051. [[Name][Description]]
  49052. [
  49053. [[link boost_asio.reference.posix__basic_descriptor._basic_descriptor [*~basic_descriptor]]]
  49054. [Protected destructor to prevent deletion through this type. ]
  49055. ]
  49056. ]
  49057. [heading Protected Data Members]
  49058. [table
  49059. [[Name][Description]]
  49060. [
  49061. [[link boost_asio.reference.posix__basic_descriptor.impl_ [*impl_]]]
  49062. []
  49063. ]
  49064. ]
  49065. The [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] class template provides the ability to wrap a POSIX descriptor.
  49066. [heading Thread Safety]
  49067. ['Distinct] ['objects:] Safe.
  49068. ['Shared] ['objects:] Unsafe.
  49069. [heading Requirements]
  49070. ['Header: ][^boost/asio/posix/basic_descriptor.hpp]
  49071. ['Convenience header: ][^boost/asio.hpp]
  49072. [section:assign posix::basic_descriptor::assign]
  49073. [indexterm2 boost_asio.indexterm.posix__basic_descriptor.assign..assign..posix::basic_descriptor]
  49074. Assign an existing native descriptor to the descriptor.
  49075. void ``[link boost_asio.reference.posix__basic_descriptor.assign.overload1 assign]``(
  49076. const native_handle_type & native_descriptor);
  49077. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.assign.overload1 more...]]``
  49078. void ``[link boost_asio.reference.posix__basic_descriptor.assign.overload2 assign]``(
  49079. const native_handle_type & native_descriptor,
  49080. boost::system::error_code & ec);
  49081. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.assign.overload2 more...]]``
  49082. [section:overload1 posix::basic_descriptor::assign (1 of 2 overloads)]
  49083. Assign an existing native descriptor to the descriptor.
  49084. void assign(
  49085. const native_handle_type & native_descriptor);
  49086. [endsect]
  49087. [section:overload2 posix::basic_descriptor::assign (2 of 2 overloads)]
  49088. Assign an existing native descriptor to the descriptor.
  49089. void assign(
  49090. const native_handle_type & native_descriptor,
  49091. boost::system::error_code & ec);
  49092. [endsect]
  49093. [endsect]
  49094. [section:async_wait posix::basic_descriptor::async_wait]
  49095. [indexterm2 boost_asio.indexterm.posix__basic_descriptor.async_wait..async_wait..posix::basic_descriptor]
  49096. Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions.
  49097. template<
  49098. typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  49099. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait(
  49100. wait_type w,
  49101. WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  49102. This function is used to perform an asynchronous wait for a descriptor to enter a ready to read, write or error condition state.
  49103. [heading Parameters]
  49104. [variablelist
  49105. [[w][Specifies the desired descriptor state.]]
  49106. [[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:
  49107. ``
  49108. void handler(
  49109. const boost::system::error_code& error // Result of operation
  49110. );
  49111. ``
  49112. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  49113. ]
  49114. [heading Example]
  49115. void wait_handler(const boost::system::error_code& error)
  49116. {
  49117. if (!error)
  49118. {
  49119. // Wait succeeded.
  49120. }
  49121. }
  49122. ...
  49123. boost::asio::posix::stream_descriptor descriptor(my_context);
  49124. ...
  49125. descriptor.async_wait(
  49126. boost::asio::posix::stream_descriptor::wait_read,
  49127. wait_handler);
  49128. [endsect]
  49129. [section:basic_descriptor posix::basic_descriptor::basic_descriptor]
  49130. [indexterm2 boost_asio.indexterm.posix__basic_descriptor.basic_descriptor..basic_descriptor..posix::basic_descriptor]
  49131. Construct a descriptor without opening it.
  49132. explicit ``[link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload1 basic_descriptor]``(
  49133. const executor_type & ex);
  49134. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload1 more...]]``
  49135. template<
  49136. typename ExecutionContext>
  49137. explicit ``[link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload2 basic_descriptor]``(
  49138. ExecutionContext & context,
  49139. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  49140. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload2 more...]]``
  49141. Construct a descriptor on an existing native descriptor.
  49142. ``[link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload3 basic_descriptor]``(
  49143. const executor_type & ex,
  49144. const native_handle_type & native_descriptor);
  49145. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload3 more...]]``
  49146. template<
  49147. typename ExecutionContext>
  49148. ``[link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload4 basic_descriptor]``(
  49149. ExecutionContext & context,
  49150. const native_handle_type & native_descriptor,
  49151. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  49152. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload4 more...]]``
  49153. Move-construct a descriptor from another.
  49154. ``[link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload5 basic_descriptor]``(
  49155. basic_descriptor && other);
  49156. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload5 more...]]``
  49157. [section:overload1 posix::basic_descriptor::basic_descriptor (1 of 5 overloads)]
  49158. Construct a descriptor without opening it.
  49159. basic_descriptor(
  49160. const executor_type & ex);
  49161. This constructor creates a descriptor without opening it.
  49162. [heading Parameters]
  49163. [variablelist
  49164. [[ex][The I/O executor that the descriptor will use, by default, to dispatch handlers for any asynchronous operations performed on the descriptor. ]]
  49165. ]
  49166. [endsect]
  49167. [section:overload2 posix::basic_descriptor::basic_descriptor (2 of 5 overloads)]
  49168. Construct a descriptor without opening it.
  49169. template<
  49170. typename ExecutionContext>
  49171. basic_descriptor(
  49172. ExecutionContext & context,
  49173. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  49174. This constructor creates a descriptor without opening it.
  49175. [heading Parameters]
  49176. [variablelist
  49177. [[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. ]]
  49178. ]
  49179. [endsect]
  49180. [section:overload3 posix::basic_descriptor::basic_descriptor (3 of 5 overloads)]
  49181. Construct a descriptor on an existing native descriptor.
  49182. basic_descriptor(
  49183. const executor_type & ex,
  49184. const native_handle_type & native_descriptor);
  49185. This constructor creates a descriptor object to hold an existing native descriptor.
  49186. [heading Parameters]
  49187. [variablelist
  49188. [[ex][The I/O executor that the descriptor will use, by default, to dispatch handlers for any asynchronous operations performed on the descriptor.]]
  49189. [[native_descriptor][A native descriptor.]]
  49190. ]
  49191. [heading Exceptions]
  49192. [variablelist
  49193. [[boost::system::system_error][Thrown on failure. ]]
  49194. ]
  49195. [endsect]
  49196. [section:overload4 posix::basic_descriptor::basic_descriptor (4 of 5 overloads)]
  49197. Construct a descriptor on an existing native descriptor.
  49198. template<
  49199. typename ExecutionContext>
  49200. basic_descriptor(
  49201. ExecutionContext & context,
  49202. const native_handle_type & native_descriptor,
  49203. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  49204. This constructor creates a descriptor object to hold an existing native descriptor.
  49205. [heading Parameters]
  49206. [variablelist
  49207. [[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.]]
  49208. [[native_descriptor][A native descriptor.]]
  49209. ]
  49210. [heading Exceptions]
  49211. [variablelist
  49212. [[boost::system::system_error][Thrown on failure. ]]
  49213. ]
  49214. [endsect]
  49215. [section:overload5 posix::basic_descriptor::basic_descriptor (5 of 5 overloads)]
  49216. Move-construct a descriptor from another.
  49217. basic_descriptor(
  49218. basic_descriptor && other);
  49219. This constructor moves a descriptor from one object to another.
  49220. [heading Parameters]
  49221. [variablelist
  49222. [[other][The other descriptor object from which the move will occur.]]
  49223. ]
  49224. [heading Remarks]
  49225. Following the move, the moved-from object is in the same state as if constructed using the `basic_descriptor(const executor_type&)` constructor.
  49226. [endsect]
  49227. [endsect]
  49228. [section:bytes_readable posix::basic_descriptor::bytes_readable]
  49229. ['Inherited from posix::descriptor_base.]
  49230. [indexterm2 boost_asio.indexterm.posix__basic_descriptor.bytes_readable..bytes_readable..posix::basic_descriptor]
  49231. IO control command to get the amount of data that can be read without blocking.
  49232. typedef implementation_defined bytes_readable;
  49233. Implements the FIONREAD IO control command.
  49234. [heading Example]
  49235. boost::asio::posix::stream_descriptor descriptor(my_context);
  49236. ...
  49237. boost::asio::descriptor_base::bytes_readable command(true);
  49238. descriptor.io_control(command);
  49239. std::size_t bytes_readable = command.get();
  49240. [heading Requirements]
  49241. ['Header: ][^boost/asio/posix/basic_descriptor.hpp]
  49242. ['Convenience header: ][^boost/asio.hpp]
  49243. [endsect]
  49244. [section:cancel posix::basic_descriptor::cancel]
  49245. [indexterm2 boost_asio.indexterm.posix__basic_descriptor.cancel..cancel..posix::basic_descriptor]
  49246. Cancel all asynchronous operations associated with the descriptor.
  49247. void ``[link boost_asio.reference.posix__basic_descriptor.cancel.overload1 cancel]``();
  49248. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.cancel.overload1 more...]]``
  49249. void ``[link boost_asio.reference.posix__basic_descriptor.cancel.overload2 cancel]``(
  49250. boost::system::error_code & ec);
  49251. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.cancel.overload2 more...]]``
  49252. [section:overload1 posix::basic_descriptor::cancel (1 of 2 overloads)]
  49253. Cancel all asynchronous operations associated with the descriptor.
  49254. void cancel();
  49255. This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
  49256. [heading Exceptions]
  49257. [variablelist
  49258. [[boost::system::system_error][Thrown on failure. ]]
  49259. ]
  49260. [endsect]
  49261. [section:overload2 posix::basic_descriptor::cancel (2 of 2 overloads)]
  49262. Cancel all asynchronous operations associated with the descriptor.
  49263. void cancel(
  49264. boost::system::error_code & ec);
  49265. This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
  49266. [heading Parameters]
  49267. [variablelist
  49268. [[ec][Set to indicate what error occurred, if any. ]]
  49269. ]
  49270. [endsect]
  49271. [endsect]
  49272. [section:close posix::basic_descriptor::close]
  49273. [indexterm2 boost_asio.indexterm.posix__basic_descriptor.close..close..posix::basic_descriptor]
  49274. Close the descriptor.
  49275. void ``[link boost_asio.reference.posix__basic_descriptor.close.overload1 close]``();
  49276. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.close.overload1 more...]]``
  49277. void ``[link boost_asio.reference.posix__basic_descriptor.close.overload2 close]``(
  49278. boost::system::error_code & ec);
  49279. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.close.overload2 more...]]``
  49280. [section:overload1 posix::basic_descriptor::close (1 of 2 overloads)]
  49281. Close the descriptor.
  49282. void close();
  49283. This function is used to close the descriptor. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
  49284. [heading Exceptions]
  49285. [variablelist
  49286. [[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed. ]]
  49287. ]
  49288. [endsect]
  49289. [section:overload2 posix::basic_descriptor::close (2 of 2 overloads)]
  49290. Close the descriptor.
  49291. void close(
  49292. boost::system::error_code & ec);
  49293. This function is used to close the descriptor. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
  49294. [heading Parameters]
  49295. [variablelist
  49296. [[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed. ]]
  49297. ]
  49298. [endsect]
  49299. [endsect]
  49300. [section:executor_type posix::basic_descriptor::executor_type]
  49301. [indexterm2 boost_asio.indexterm.posix__basic_descriptor.executor_type..executor_type..posix::basic_descriptor]
  49302. The type of the executor associated with the object.
  49303. typedef Executor executor_type;
  49304. [heading Requirements]
  49305. ['Header: ][^boost/asio/posix/basic_descriptor.hpp]
  49306. ['Convenience header: ][^boost/asio.hpp]
  49307. [endsect]
  49308. [section:get_executor posix::basic_descriptor::get_executor]
  49309. [indexterm2 boost_asio.indexterm.posix__basic_descriptor.get_executor..get_executor..posix::basic_descriptor]
  49310. Get the executor associated with the object.
  49311. executor_type get_executor();
  49312. [endsect]
  49313. [section:impl_ posix::basic_descriptor::impl_]
  49314. [indexterm2 boost_asio.indexterm.posix__basic_descriptor.impl_..impl_..posix::basic_descriptor]
  49315. detail::io_object_impl< detail::reactive_descriptor_service, Executor > impl_;
  49316. [endsect]
  49317. [section:io_control posix::basic_descriptor::io_control]
  49318. [indexterm2 boost_asio.indexterm.posix__basic_descriptor.io_control..io_control..posix::basic_descriptor]
  49319. Perform an IO control command on the descriptor.
  49320. template<
  49321. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  49322. void ``[link boost_asio.reference.posix__basic_descriptor.io_control.overload1 io_control]``(
  49323. IoControlCommand & command);
  49324. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.io_control.overload1 more...]]``
  49325. template<
  49326. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  49327. void ``[link boost_asio.reference.posix__basic_descriptor.io_control.overload2 io_control]``(
  49328. IoControlCommand & command,
  49329. boost::system::error_code & ec);
  49330. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.io_control.overload2 more...]]``
  49331. [section:overload1 posix::basic_descriptor::io_control (1 of 2 overloads)]
  49332. Perform an IO control command on the descriptor.
  49333. template<
  49334. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  49335. void io_control(
  49336. IoControlCommand & command);
  49337. This function is used to execute an IO control command on the descriptor.
  49338. [heading Parameters]
  49339. [variablelist
  49340. [[command][The IO control command to be performed on the descriptor.]]
  49341. ]
  49342. [heading Exceptions]
  49343. [variablelist
  49344. [[boost::system::system_error][Thrown on failure.]]
  49345. ]
  49346. [heading Example]
  49347. Getting the number of bytes ready to read:
  49348. boost::asio::posix::stream_descriptor descriptor(my_context);
  49349. ...
  49350. boost::asio::posix::stream_descriptor::bytes_readable command;
  49351. descriptor.io_control(command);
  49352. std::size_t bytes_readable = command.get();
  49353. [endsect]
  49354. [section:overload2 posix::basic_descriptor::io_control (2 of 2 overloads)]
  49355. Perform an IO control command on the descriptor.
  49356. template<
  49357. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  49358. void io_control(
  49359. IoControlCommand & command,
  49360. boost::system::error_code & ec);
  49361. This function is used to execute an IO control command on the descriptor.
  49362. [heading Parameters]
  49363. [variablelist
  49364. [[command][The IO control command to be performed on the descriptor.]]
  49365. [[ec][Set to indicate what error occurred, if any.]]
  49366. ]
  49367. [heading Example]
  49368. Getting the number of bytes ready to read:
  49369. boost::asio::posix::stream_descriptor descriptor(my_context);
  49370. ...
  49371. boost::asio::posix::stream_descriptor::bytes_readable command;
  49372. boost::system::error_code ec;
  49373. descriptor.io_control(command, ec);
  49374. if (ec)
  49375. {
  49376. // An error occurred.
  49377. }
  49378. std::size_t bytes_readable = command.get();
  49379. [endsect]
  49380. [endsect]
  49381. [section:is_open posix::basic_descriptor::is_open]
  49382. [indexterm2 boost_asio.indexterm.posix__basic_descriptor.is_open..is_open..posix::basic_descriptor]
  49383. Determine whether the descriptor is open.
  49384. bool is_open() const;
  49385. [endsect]
  49386. [section:lowest_layer posix::basic_descriptor::lowest_layer]
  49387. [indexterm2 boost_asio.indexterm.posix__basic_descriptor.lowest_layer..lowest_layer..posix::basic_descriptor]
  49388. Get a reference to the lowest layer.
  49389. lowest_layer_type & ``[link boost_asio.reference.posix__basic_descriptor.lowest_layer.overload1 lowest_layer]``();
  49390. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.lowest_layer.overload1 more...]]``
  49391. Get a const reference to the lowest layer.
  49392. const lowest_layer_type & ``[link boost_asio.reference.posix__basic_descriptor.lowest_layer.overload2 lowest_layer]``() const;
  49393. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.lowest_layer.overload2 more...]]``
  49394. [section:overload1 posix::basic_descriptor::lowest_layer (1 of 2 overloads)]
  49395. Get a reference to the lowest layer.
  49396. lowest_layer_type & lowest_layer();
  49397. This function returns a reference to the lowest layer in a stack of layers. Since a descriptor cannot contain any further layers, it simply returns a reference to itself.
  49398. [heading Return Value]
  49399. A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
  49400. [endsect]
  49401. [section:overload2 posix::basic_descriptor::lowest_layer (2 of 2 overloads)]
  49402. Get a const reference to the lowest layer.
  49403. const lowest_layer_type & lowest_layer() const;
  49404. This function returns a const reference to the lowest layer in a stack of layers. Since a descriptor cannot contain any further layers, it simply returns a reference to itself.
  49405. [heading Return Value]
  49406. A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
  49407. [endsect]
  49408. [endsect]
  49409. [section:lowest_layer_type posix::basic_descriptor::lowest_layer_type]
  49410. [indexterm2 boost_asio.indexterm.posix__basic_descriptor.lowest_layer_type..lowest_layer_type..posix::basic_descriptor]
  49411. A descriptor is always the lowest layer.
  49412. typedef basic_descriptor lowest_layer_type;
  49413. [heading Types]
  49414. [table
  49415. [[Name][Description]]
  49416. [
  49417. [[link boost_asio.reference.posix__basic_descriptor__rebind_executor [*rebind_executor]]]
  49418. [Rebinds the descriptor type to another executor. ]
  49419. ]
  49420. [
  49421. [[link boost_asio.reference.posix__basic_descriptor.bytes_readable [*bytes_readable]]]
  49422. [IO control command to get the amount of data that can be read without blocking. ]
  49423. ]
  49424. [
  49425. [[link boost_asio.reference.posix__basic_descriptor.executor_type [*executor_type]]]
  49426. [The type of the executor associated with the object. ]
  49427. ]
  49428. [
  49429. [[link boost_asio.reference.posix__basic_descriptor.lowest_layer_type [*lowest_layer_type]]]
  49430. [A descriptor is always the lowest layer. ]
  49431. ]
  49432. [
  49433. [[link boost_asio.reference.posix__basic_descriptor.native_handle_type [*native_handle_type]]]
  49434. [The native representation of a descriptor. ]
  49435. ]
  49436. [
  49437. [[link boost_asio.reference.posix__basic_descriptor.wait_type [*wait_type]]]
  49438. [Wait types. ]
  49439. ]
  49440. ]
  49441. [heading Member Functions]
  49442. [table
  49443. [[Name][Description]]
  49444. [
  49445. [[link boost_asio.reference.posix__basic_descriptor.assign [*assign]]]
  49446. [Assign an existing native descriptor to the descriptor. ]
  49447. ]
  49448. [
  49449. [[link boost_asio.reference.posix__basic_descriptor.async_wait [*async_wait]]]
  49450. [Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
  49451. ]
  49452. [
  49453. [[link boost_asio.reference.posix__basic_descriptor.basic_descriptor [*basic_descriptor]]]
  49454. [Construct a descriptor without opening it.
  49455. [hr]
  49456. Construct a descriptor on an existing native descriptor.
  49457. [hr]
  49458. Move-construct a descriptor from another. ]
  49459. ]
  49460. [
  49461. [[link boost_asio.reference.posix__basic_descriptor.cancel [*cancel]]]
  49462. [Cancel all asynchronous operations associated with the descriptor. ]
  49463. ]
  49464. [
  49465. [[link boost_asio.reference.posix__basic_descriptor.close [*close]]]
  49466. [Close the descriptor. ]
  49467. ]
  49468. [
  49469. [[link boost_asio.reference.posix__basic_descriptor.get_executor [*get_executor]]]
  49470. [Get the executor associated with the object. ]
  49471. ]
  49472. [
  49473. [[link boost_asio.reference.posix__basic_descriptor.io_control [*io_control]]]
  49474. [Perform an IO control command on the descriptor. ]
  49475. ]
  49476. [
  49477. [[link boost_asio.reference.posix__basic_descriptor.is_open [*is_open]]]
  49478. [Determine whether the descriptor is open. ]
  49479. ]
  49480. [
  49481. [[link boost_asio.reference.posix__basic_descriptor.lowest_layer [*lowest_layer]]]
  49482. [Get a reference to the lowest layer.
  49483. [hr]
  49484. Get a const reference to the lowest layer. ]
  49485. ]
  49486. [
  49487. [[link boost_asio.reference.posix__basic_descriptor.native_handle [*native_handle]]]
  49488. [Get the native descriptor representation. ]
  49489. ]
  49490. [
  49491. [[link boost_asio.reference.posix__basic_descriptor.native_non_blocking [*native_non_blocking]]]
  49492. [Gets the non-blocking mode of the native descriptor implementation.
  49493. [hr]
  49494. Sets the non-blocking mode of the native descriptor implementation. ]
  49495. ]
  49496. [
  49497. [[link boost_asio.reference.posix__basic_descriptor.non_blocking [*non_blocking]]]
  49498. [Gets the non-blocking mode of the descriptor.
  49499. [hr]
  49500. Sets the non-blocking mode of the descriptor. ]
  49501. ]
  49502. [
  49503. [[link boost_asio.reference.posix__basic_descriptor.operator_eq_ [*operator=]]]
  49504. [Move-assign a descriptor from another. ]
  49505. ]
  49506. [
  49507. [[link boost_asio.reference.posix__basic_descriptor.release [*release]]]
  49508. [Release ownership of the native descriptor implementation. ]
  49509. ]
  49510. [
  49511. [[link boost_asio.reference.posix__basic_descriptor.wait [*wait]]]
  49512. [Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
  49513. ]
  49514. ]
  49515. [heading Protected Member Functions]
  49516. [table
  49517. [[Name][Description]]
  49518. [
  49519. [[link boost_asio.reference.posix__basic_descriptor._basic_descriptor [*~basic_descriptor]]]
  49520. [Protected destructor to prevent deletion through this type. ]
  49521. ]
  49522. ]
  49523. [heading Protected Data Members]
  49524. [table
  49525. [[Name][Description]]
  49526. [
  49527. [[link boost_asio.reference.posix__basic_descriptor.impl_ [*impl_]]]
  49528. []
  49529. ]
  49530. ]
  49531. The [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] class template provides the ability to wrap a POSIX descriptor.
  49532. [heading Thread Safety]
  49533. ['Distinct] ['objects:] Safe.
  49534. ['Shared] ['objects:] Unsafe.
  49535. [heading Requirements]
  49536. ['Header: ][^boost/asio/posix/basic_descriptor.hpp]
  49537. ['Convenience header: ][^boost/asio.hpp]
  49538. [endsect]
  49539. [section:native_handle posix::basic_descriptor::native_handle]
  49540. [indexterm2 boost_asio.indexterm.posix__basic_descriptor.native_handle..native_handle..posix::basic_descriptor]
  49541. Get the native descriptor representation.
  49542. native_handle_type native_handle();
  49543. This function may be used to obtain the underlying representation of the descriptor. This is intended to allow access to native descriptor functionality that is not otherwise provided.
  49544. [endsect]
  49545. [section:native_handle_type posix::basic_descriptor::native_handle_type]
  49546. [indexterm2 boost_asio.indexterm.posix__basic_descriptor.native_handle_type..native_handle_type..posix::basic_descriptor]
  49547. The native representation of a descriptor.
  49548. typedef implementation_defined native_handle_type;
  49549. [heading Requirements]
  49550. ['Header: ][^boost/asio/posix/basic_descriptor.hpp]
  49551. ['Convenience header: ][^boost/asio.hpp]
  49552. [endsect]
  49553. [section:native_non_blocking posix::basic_descriptor::native_non_blocking]
  49554. [indexterm2 boost_asio.indexterm.posix__basic_descriptor.native_non_blocking..native_non_blocking..posix::basic_descriptor]
  49555. Gets the non-blocking mode of the native descriptor implementation.
  49556. bool ``[link boost_asio.reference.posix__basic_descriptor.native_non_blocking.overload1 native_non_blocking]``() const;
  49557. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.native_non_blocking.overload1 more...]]``
  49558. Sets the non-blocking mode of the native descriptor implementation.
  49559. void ``[link boost_asio.reference.posix__basic_descriptor.native_non_blocking.overload2 native_non_blocking]``(
  49560. bool mode);
  49561. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.native_non_blocking.overload2 more...]]``
  49562. void ``[link boost_asio.reference.posix__basic_descriptor.native_non_blocking.overload3 native_non_blocking]``(
  49563. bool mode,
  49564. boost::system::error_code & ec);
  49565. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.native_non_blocking.overload3 more...]]``
  49566. [section:overload1 posix::basic_descriptor::native_non_blocking (1 of 3 overloads)]
  49567. Gets the non-blocking mode of the native descriptor implementation.
  49568. bool native_non_blocking() const;
  49569. This function is used to retrieve the non-blocking mode of the underlying native descriptor. This mode has no effect on the behaviour of the descriptor object's synchronous operations.
  49570. [heading Return Value]
  49571. `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).
  49572. [heading Remarks]
  49573. The current non-blocking mode is cached by the descriptor object. Consequently, the return value may be incorrect if the non-blocking mode was set directly on the native descriptor.
  49574. [endsect]
  49575. [section:overload2 posix::basic_descriptor::native_non_blocking (2 of 3 overloads)]
  49576. Sets the non-blocking mode of the native descriptor implementation.
  49577. void native_non_blocking(
  49578. bool mode);
  49579. This function is used to modify the non-blocking mode of the underlying native descriptor. It has no effect on the behaviour of the descriptor object's synchronous operations.
  49580. [heading Parameters]
  49581. [variablelist
  49582. [[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).]]
  49583. ]
  49584. [heading Exceptions]
  49585. [variablelist
  49586. [[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. ]]
  49587. ]
  49588. [endsect]
  49589. [section:overload3 posix::basic_descriptor::native_non_blocking (3 of 3 overloads)]
  49590. Sets the non-blocking mode of the native descriptor implementation.
  49591. void native_non_blocking(
  49592. bool mode,
  49593. boost::system::error_code & ec);
  49594. This function is used to modify the non-blocking mode of the underlying native descriptor. It has no effect on the behaviour of the descriptor object's synchronous operations.
  49595. [heading Parameters]
  49596. [variablelist
  49597. [[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).]]
  49598. [[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. ]]
  49599. ]
  49600. [endsect]
  49601. [endsect]
  49602. [section:non_blocking posix::basic_descriptor::non_blocking]
  49603. [indexterm2 boost_asio.indexterm.posix__basic_descriptor.non_blocking..non_blocking..posix::basic_descriptor]
  49604. Gets the non-blocking mode of the descriptor.
  49605. bool ``[link boost_asio.reference.posix__basic_descriptor.non_blocking.overload1 non_blocking]``() const;
  49606. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.non_blocking.overload1 more...]]``
  49607. Sets the non-blocking mode of the descriptor.
  49608. void ``[link boost_asio.reference.posix__basic_descriptor.non_blocking.overload2 non_blocking]``(
  49609. bool mode);
  49610. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.non_blocking.overload2 more...]]``
  49611. void ``[link boost_asio.reference.posix__basic_descriptor.non_blocking.overload3 non_blocking]``(
  49612. bool mode,
  49613. boost::system::error_code & ec);
  49614. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.non_blocking.overload3 more...]]``
  49615. [section:overload1 posix::basic_descriptor::non_blocking (1 of 3 overloads)]
  49616. Gets the non-blocking mode of the descriptor.
  49617. bool non_blocking() const;
  49618. [heading Return Value]
  49619. `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.
  49620. [heading Remarks]
  49621. The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
  49622. [endsect]
  49623. [section:overload2 posix::basic_descriptor::non_blocking (2 of 3 overloads)]
  49624. Sets the non-blocking mode of the descriptor.
  49625. void non_blocking(
  49626. bool mode);
  49627. [heading Parameters]
  49628. [variablelist
  49629. [[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.]]
  49630. ]
  49631. [heading Exceptions]
  49632. [variablelist
  49633. [[boost::system::system_error][Thrown on failure.]]
  49634. ]
  49635. [heading Remarks]
  49636. The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
  49637. [endsect]
  49638. [section:overload3 posix::basic_descriptor::non_blocking (3 of 3 overloads)]
  49639. Sets the non-blocking mode of the descriptor.
  49640. void non_blocking(
  49641. bool mode,
  49642. boost::system::error_code & ec);
  49643. [heading Parameters]
  49644. [variablelist
  49645. [[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.]]
  49646. [[ec][Set to indicate what error occurred, if any.]]
  49647. ]
  49648. [heading Remarks]
  49649. The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
  49650. [endsect]
  49651. [endsect]
  49652. [section:operator_eq_ posix::basic_descriptor::operator=]
  49653. [indexterm2 boost_asio.indexterm.posix__basic_descriptor.operator_eq_..operator=..posix::basic_descriptor]
  49654. Move-assign a descriptor from another.
  49655. basic_descriptor & operator=(
  49656. basic_descriptor && other);
  49657. This assignment operator moves a descriptor from one object to another.
  49658. [heading Parameters]
  49659. [variablelist
  49660. [[other][The other descriptor object from which the move will occur.]]
  49661. ]
  49662. [heading Remarks]
  49663. Following the move, the moved-from object is in the same state as if constructed using the `basic_descriptor(const executor_type&)` constructor.
  49664. [endsect]
  49665. [section:release posix::basic_descriptor::release]
  49666. [indexterm2 boost_asio.indexterm.posix__basic_descriptor.release..release..posix::basic_descriptor]
  49667. Release ownership of the native descriptor implementation.
  49668. native_handle_type release();
  49669. This function may be used to obtain the underlying representation of the descriptor. After calling this function, `is_open()` returns false. The caller is responsible for closing the descriptor.
  49670. All outstanding asynchronous read or write operations will finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
  49671. [endsect]
  49672. [section:wait posix::basic_descriptor::wait]
  49673. [indexterm2 boost_asio.indexterm.posix__basic_descriptor.wait..wait..posix::basic_descriptor]
  49674. Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions.
  49675. void ``[link boost_asio.reference.posix__basic_descriptor.wait.overload1 wait]``(
  49676. wait_type w);
  49677. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.wait.overload1 more...]]``
  49678. void ``[link boost_asio.reference.posix__basic_descriptor.wait.overload2 wait]``(
  49679. wait_type w,
  49680. boost::system::error_code & ec);
  49681. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.wait.overload2 more...]]``
  49682. [section:overload1 posix::basic_descriptor::wait (1 of 2 overloads)]
  49683. Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions.
  49684. void wait(
  49685. wait_type w);
  49686. This function is used to perform a blocking wait for a descriptor to enter a ready to read, write or error condition state.
  49687. [heading Parameters]
  49688. [variablelist
  49689. [[w][Specifies the desired descriptor state.]]
  49690. ]
  49691. [heading Example]
  49692. Waiting for a descriptor to become readable.
  49693. boost::asio::posix::stream_descriptor descriptor(my_context);
  49694. ...
  49695. descriptor.wait(boost::asio::posix::stream_descriptor::wait_read);
  49696. [endsect]
  49697. [section:overload2 posix::basic_descriptor::wait (2 of 2 overloads)]
  49698. Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions.
  49699. void wait(
  49700. wait_type w,
  49701. boost::system::error_code & ec);
  49702. This function is used to perform a blocking wait for a descriptor to enter a ready to read, write or error condition state.
  49703. [heading Parameters]
  49704. [variablelist
  49705. [[w][Specifies the desired descriptor state.]]
  49706. [[ec][Set to indicate what error occurred, if any.]]
  49707. ]
  49708. [heading Example]
  49709. Waiting for a descriptor to become readable.
  49710. boost::asio::posix::stream_descriptor descriptor(my_context);
  49711. ...
  49712. boost::system::error_code ec;
  49713. descriptor.wait(boost::asio::posix::stream_descriptor::wait_read, ec);
  49714. [endsect]
  49715. [endsect]
  49716. [section:wait_type posix::basic_descriptor::wait_type]
  49717. ['Inherited from posix::descriptor_base.]
  49718. [indexterm2 boost_asio.indexterm.posix__basic_descriptor.wait_type..wait_type..posix::basic_descriptor]
  49719. Wait types.
  49720. enum wait_type
  49721. [indexterm2 boost_asio.indexterm.posix__basic_descriptor.wait_type.wait_read..wait_read..posix::basic_descriptor]
  49722. [indexterm2 boost_asio.indexterm.posix__basic_descriptor.wait_type.wait_write..wait_write..posix::basic_descriptor]
  49723. [indexterm2 boost_asio.indexterm.posix__basic_descriptor.wait_type.wait_error..wait_error..posix::basic_descriptor]
  49724. [heading Values]
  49725. [variablelist
  49726. [
  49727. [wait_read]
  49728. [Wait for a descriptor to become ready to read. ]
  49729. ]
  49730. [
  49731. [wait_write]
  49732. [Wait for a descriptor to become ready to write. ]
  49733. ]
  49734. [
  49735. [wait_error]
  49736. [Wait for a descriptor to have error conditions pending. ]
  49737. ]
  49738. ]
  49739. For use with `descriptor::wait()` and `descriptor::async_wait()`.
  49740. [endsect]
  49741. [section:_basic_descriptor posix::basic_descriptor::~basic_descriptor]
  49742. [indexterm2 boost_asio.indexterm.posix__basic_descriptor._basic_descriptor..~basic_descriptor..posix::basic_descriptor]
  49743. Protected destructor to prevent deletion through this type.
  49744. ~basic_descriptor();
  49745. This function destroys the descriptor, cancelling any outstanding asynchronous wait operations associated with the descriptor as if by calling `cancel`.
  49746. [endsect]
  49747. [endsect]
  49748. [section:posix__basic_descriptor__rebind_executor posix::basic_descriptor::rebind_executor]
  49749. Rebinds the descriptor type to another executor.
  49750. template<
  49751. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  49752. struct rebind_executor
  49753. [heading Types]
  49754. [table
  49755. [[Name][Description]]
  49756. [
  49757. [[link boost_asio.reference.posix__basic_descriptor__rebind_executor.other [*other]]]
  49758. [The descriptor type when rebound to the specified executor. ]
  49759. ]
  49760. ]
  49761. [heading Requirements]
  49762. ['Header: ][^boost/asio/posix/basic_descriptor.hpp]
  49763. ['Convenience header: ][^boost/asio.hpp]
  49764. [section:other posix::basic_descriptor::rebind_executor::other]
  49765. [indexterm2 boost_asio.indexterm.posix__basic_descriptor__rebind_executor.other..other..posix::basic_descriptor::rebind_executor]
  49766. The descriptor type when rebound to the specified executor.
  49767. typedef basic_descriptor< Executor1 > other;
  49768. [heading Types]
  49769. [table
  49770. [[Name][Description]]
  49771. [
  49772. [[link boost_asio.reference.posix__basic_descriptor__rebind_executor [*rebind_executor]]]
  49773. [Rebinds the descriptor type to another executor. ]
  49774. ]
  49775. [
  49776. [[link boost_asio.reference.posix__basic_descriptor.bytes_readable [*bytes_readable]]]
  49777. [IO control command to get the amount of data that can be read without blocking. ]
  49778. ]
  49779. [
  49780. [[link boost_asio.reference.posix__basic_descriptor.executor_type [*executor_type]]]
  49781. [The type of the executor associated with the object. ]
  49782. ]
  49783. [
  49784. [[link boost_asio.reference.posix__basic_descriptor.lowest_layer_type [*lowest_layer_type]]]
  49785. [A descriptor is always the lowest layer. ]
  49786. ]
  49787. [
  49788. [[link boost_asio.reference.posix__basic_descriptor.native_handle_type [*native_handle_type]]]
  49789. [The native representation of a descriptor. ]
  49790. ]
  49791. [
  49792. [[link boost_asio.reference.posix__basic_descriptor.wait_type [*wait_type]]]
  49793. [Wait types. ]
  49794. ]
  49795. ]
  49796. [heading Member Functions]
  49797. [table
  49798. [[Name][Description]]
  49799. [
  49800. [[link boost_asio.reference.posix__basic_descriptor.assign [*assign]]]
  49801. [Assign an existing native descriptor to the descriptor. ]
  49802. ]
  49803. [
  49804. [[link boost_asio.reference.posix__basic_descriptor.async_wait [*async_wait]]]
  49805. [Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
  49806. ]
  49807. [
  49808. [[link boost_asio.reference.posix__basic_descriptor.basic_descriptor [*basic_descriptor]]]
  49809. [Construct a descriptor without opening it.
  49810. [hr]
  49811. Construct a descriptor on an existing native descriptor.
  49812. [hr]
  49813. Move-construct a descriptor from another. ]
  49814. ]
  49815. [
  49816. [[link boost_asio.reference.posix__basic_descriptor.cancel [*cancel]]]
  49817. [Cancel all asynchronous operations associated with the descriptor. ]
  49818. ]
  49819. [
  49820. [[link boost_asio.reference.posix__basic_descriptor.close [*close]]]
  49821. [Close the descriptor. ]
  49822. ]
  49823. [
  49824. [[link boost_asio.reference.posix__basic_descriptor.get_executor [*get_executor]]]
  49825. [Get the executor associated with the object. ]
  49826. ]
  49827. [
  49828. [[link boost_asio.reference.posix__basic_descriptor.io_control [*io_control]]]
  49829. [Perform an IO control command on the descriptor. ]
  49830. ]
  49831. [
  49832. [[link boost_asio.reference.posix__basic_descriptor.is_open [*is_open]]]
  49833. [Determine whether the descriptor is open. ]
  49834. ]
  49835. [
  49836. [[link boost_asio.reference.posix__basic_descriptor.lowest_layer [*lowest_layer]]]
  49837. [Get a reference to the lowest layer.
  49838. [hr]
  49839. Get a const reference to the lowest layer. ]
  49840. ]
  49841. [
  49842. [[link boost_asio.reference.posix__basic_descriptor.native_handle [*native_handle]]]
  49843. [Get the native descriptor representation. ]
  49844. ]
  49845. [
  49846. [[link boost_asio.reference.posix__basic_descriptor.native_non_blocking [*native_non_blocking]]]
  49847. [Gets the non-blocking mode of the native descriptor implementation.
  49848. [hr]
  49849. Sets the non-blocking mode of the native descriptor implementation. ]
  49850. ]
  49851. [
  49852. [[link boost_asio.reference.posix__basic_descriptor.non_blocking [*non_blocking]]]
  49853. [Gets the non-blocking mode of the descriptor.
  49854. [hr]
  49855. Sets the non-blocking mode of the descriptor. ]
  49856. ]
  49857. [
  49858. [[link boost_asio.reference.posix__basic_descriptor.operator_eq_ [*operator=]]]
  49859. [Move-assign a descriptor from another. ]
  49860. ]
  49861. [
  49862. [[link boost_asio.reference.posix__basic_descriptor.release [*release]]]
  49863. [Release ownership of the native descriptor implementation. ]
  49864. ]
  49865. [
  49866. [[link boost_asio.reference.posix__basic_descriptor.wait [*wait]]]
  49867. [Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
  49868. ]
  49869. ]
  49870. [heading Protected Member Functions]
  49871. [table
  49872. [[Name][Description]]
  49873. [
  49874. [[link boost_asio.reference.posix__basic_descriptor._basic_descriptor [*~basic_descriptor]]]
  49875. [Protected destructor to prevent deletion through this type. ]
  49876. ]
  49877. ]
  49878. [heading Protected Data Members]
  49879. [table
  49880. [[Name][Description]]
  49881. [
  49882. [[link boost_asio.reference.posix__basic_descriptor.impl_ [*impl_]]]
  49883. []
  49884. ]
  49885. ]
  49886. The [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] class template provides the ability to wrap a POSIX descriptor.
  49887. [heading Thread Safety]
  49888. ['Distinct] ['objects:] Safe.
  49889. ['Shared] ['objects:] Unsafe.
  49890. [heading Requirements]
  49891. ['Header: ][^boost/asio/posix/basic_descriptor.hpp]
  49892. ['Convenience header: ][^boost/asio.hpp]
  49893. [endsect]
  49894. [endsect]
  49895. [section:posix__basic_stream_descriptor posix::basic_stream_descriptor]
  49896. Provides stream-oriented descriptor functionality.
  49897. template<
  49898. typename ``[link boost_asio.reference.Executor1 Executor]`` = executor>
  49899. class basic_stream_descriptor :
  49900. public posix::basic_descriptor< Executor >
  49901. [heading Types]
  49902. [table
  49903. [[Name][Description]]
  49904. [
  49905. [[link boost_asio.reference.posix__basic_stream_descriptor__rebind_executor [*rebind_executor]]]
  49906. [Rebinds the descriptor type to another executor. ]
  49907. ]
  49908. [
  49909. [[link boost_asio.reference.posix__basic_stream_descriptor.bytes_readable [*bytes_readable]]]
  49910. [IO control command to get the amount of data that can be read without blocking. ]
  49911. ]
  49912. [
  49913. [[link boost_asio.reference.posix__basic_stream_descriptor.executor_type [*executor_type]]]
  49914. [The type of the executor associated with the object. ]
  49915. ]
  49916. [
  49917. [[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer_type [*lowest_layer_type]]]
  49918. [A descriptor is always the lowest layer. ]
  49919. ]
  49920. [
  49921. [[link boost_asio.reference.posix__basic_stream_descriptor.native_handle_type [*native_handle_type]]]
  49922. [The native representation of a descriptor. ]
  49923. ]
  49924. [
  49925. [[link boost_asio.reference.posix__basic_stream_descriptor.wait_type [*wait_type]]]
  49926. [Wait types. ]
  49927. ]
  49928. ]
  49929. [heading Member Functions]
  49930. [table
  49931. [[Name][Description]]
  49932. [
  49933. [[link boost_asio.reference.posix__basic_stream_descriptor.assign [*assign]]]
  49934. [Assign an existing native descriptor to the descriptor. ]
  49935. ]
  49936. [
  49937. [[link boost_asio.reference.posix__basic_stream_descriptor.async_read_some [*async_read_some]]]
  49938. [Start an asynchronous read. ]
  49939. ]
  49940. [
  49941. [[link boost_asio.reference.posix__basic_stream_descriptor.async_wait [*async_wait]]]
  49942. [Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
  49943. ]
  49944. [
  49945. [[link boost_asio.reference.posix__basic_stream_descriptor.async_write_some [*async_write_some]]]
  49946. [Start an asynchronous write. ]
  49947. ]
  49948. [
  49949. [[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor [*basic_stream_descriptor]]]
  49950. [Construct a stream descriptor without opening it.
  49951. [hr]
  49952. Construct a stream descriptor on an existing native descriptor.
  49953. [hr]
  49954. Move-construct a stream descriptor from another. ]
  49955. ]
  49956. [
  49957. [[link boost_asio.reference.posix__basic_stream_descriptor.cancel [*cancel]]]
  49958. [Cancel all asynchronous operations associated with the descriptor. ]
  49959. ]
  49960. [
  49961. [[link boost_asio.reference.posix__basic_stream_descriptor.close [*close]]]
  49962. [Close the descriptor. ]
  49963. ]
  49964. [
  49965. [[link boost_asio.reference.posix__basic_stream_descriptor.get_executor [*get_executor]]]
  49966. [Get the executor associated with the object. ]
  49967. ]
  49968. [
  49969. [[link boost_asio.reference.posix__basic_stream_descriptor.io_control [*io_control]]]
  49970. [Perform an IO control command on the descriptor. ]
  49971. ]
  49972. [
  49973. [[link boost_asio.reference.posix__basic_stream_descriptor.is_open [*is_open]]]
  49974. [Determine whether the descriptor is open. ]
  49975. ]
  49976. [
  49977. [[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer [*lowest_layer]]]
  49978. [Get a reference to the lowest layer.
  49979. [hr]
  49980. Get a const reference to the lowest layer. ]
  49981. ]
  49982. [
  49983. [[link boost_asio.reference.posix__basic_stream_descriptor.native_handle [*native_handle]]]
  49984. [Get the native descriptor representation. ]
  49985. ]
  49986. [
  49987. [[link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking [*native_non_blocking]]]
  49988. [Gets the non-blocking mode of the native descriptor implementation.
  49989. [hr]
  49990. Sets the non-blocking mode of the native descriptor implementation. ]
  49991. ]
  49992. [
  49993. [[link boost_asio.reference.posix__basic_stream_descriptor.non_blocking [*non_blocking]]]
  49994. [Gets the non-blocking mode of the descriptor.
  49995. [hr]
  49996. Sets the non-blocking mode of the descriptor. ]
  49997. ]
  49998. [
  49999. [[link boost_asio.reference.posix__basic_stream_descriptor.operator_eq_ [*operator=]]]
  50000. [Move-assign a stream descriptor from another. ]
  50001. ]
  50002. [
  50003. [[link boost_asio.reference.posix__basic_stream_descriptor.read_some [*read_some]]]
  50004. [Read some data from the descriptor. ]
  50005. ]
  50006. [
  50007. [[link boost_asio.reference.posix__basic_stream_descriptor.release [*release]]]
  50008. [Release ownership of the native descriptor implementation. ]
  50009. ]
  50010. [
  50011. [[link boost_asio.reference.posix__basic_stream_descriptor.wait [*wait]]]
  50012. [Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
  50013. ]
  50014. [
  50015. [[link boost_asio.reference.posix__basic_stream_descriptor.write_some [*write_some]]]
  50016. [Write some data to the descriptor. ]
  50017. ]
  50018. ]
  50019. [heading Protected Data Members]
  50020. [table
  50021. [[Name][Description]]
  50022. [
  50023. [[link boost_asio.reference.posix__basic_stream_descriptor.impl_ [*impl_]]]
  50024. []
  50025. ]
  50026. ]
  50027. The [link boost_asio.reference.posix__basic_stream_descriptor `posix::basic_stream_descriptor`] class template provides asynchronous and blocking stream-oriented descriptor functionality.
  50028. [heading Thread Safety]
  50029. ['Distinct] ['objects:] Safe.
  50030. ['Shared] ['objects:] Unsafe.
  50031. [heading Requirements]
  50032. ['Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
  50033. ['Convenience header: ][^boost/asio.hpp]
  50034. [section:assign posix::basic_stream_descriptor::assign]
  50035. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.assign..assign..posix::basic_stream_descriptor]
  50036. Assign an existing native descriptor to the descriptor.
  50037. void ``[link boost_asio.reference.posix__basic_stream_descriptor.assign.overload1 assign]``(
  50038. const native_handle_type & native_descriptor);
  50039. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.assign.overload1 more...]]``
  50040. void ``[link boost_asio.reference.posix__basic_stream_descriptor.assign.overload2 assign]``(
  50041. const native_handle_type & native_descriptor,
  50042. boost::system::error_code & ec);
  50043. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.assign.overload2 more...]]``
  50044. [section:overload1 posix::basic_stream_descriptor::assign (1 of 2 overloads)]
  50045. ['Inherited from posix::basic_descriptor.]
  50046. Assign an existing native descriptor to the descriptor.
  50047. void assign(
  50048. const native_handle_type & native_descriptor);
  50049. [endsect]
  50050. [section:overload2 posix::basic_stream_descriptor::assign (2 of 2 overloads)]
  50051. ['Inherited from posix::basic_descriptor.]
  50052. Assign an existing native descriptor to the descriptor.
  50053. void assign(
  50054. const native_handle_type & native_descriptor,
  50055. boost::system::error_code & ec);
  50056. [endsect]
  50057. [endsect]
  50058. [section:async_read_some posix::basic_stream_descriptor::async_read_some]
  50059. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.async_read_some..async_read_some..posix::basic_stream_descriptor]
  50060. Start an asynchronous read.
  50061. template<
  50062. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  50063. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  50064. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_some(
  50065. const MutableBufferSequence & buffers,
  50066. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  50067. This function is used to asynchronously read data from the stream descriptor. The function call always returns immediately.
  50068. [heading Parameters]
  50069. [variablelist
  50070. [[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.]]
  50071. [[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:
  50072. ``
  50073. void handler(
  50074. const boost::system::error_code& error, // Result of operation.
  50075. std::size_t bytes_transferred // Number of bytes read.
  50076. );
  50077. ``
  50078. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  50079. ]
  50080. [heading Remarks]
  50081. The read operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.async_read `async_read`] function if you need to ensure that the requested amount of data is read before the asynchronous operation completes.
  50082. [heading Example]
  50083. To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  50084. descriptor.async_read_some(boost::asio::buffer(data, size), handler);
  50085. See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  50086. [endsect]
  50087. [section:async_wait posix::basic_stream_descriptor::async_wait]
  50088. ['Inherited from posix::basic_descriptor.]
  50089. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.async_wait..async_wait..posix::basic_stream_descriptor]
  50090. Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions.
  50091. template<
  50092. typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  50093. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait(
  50094. wait_type w,
  50095. WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  50096. This function is used to perform an asynchronous wait for a descriptor to enter a ready to read, write or error condition state.
  50097. [heading Parameters]
  50098. [variablelist
  50099. [[w][Specifies the desired descriptor state.]]
  50100. [[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:
  50101. ``
  50102. void handler(
  50103. const boost::system::error_code& error // Result of operation
  50104. );
  50105. ``
  50106. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  50107. ]
  50108. [heading Example]
  50109. void wait_handler(const boost::system::error_code& error)
  50110. {
  50111. if (!error)
  50112. {
  50113. // Wait succeeded.
  50114. }
  50115. }
  50116. ...
  50117. boost::asio::posix::stream_descriptor descriptor(my_context);
  50118. ...
  50119. descriptor.async_wait(
  50120. boost::asio::posix::stream_descriptor::wait_read,
  50121. wait_handler);
  50122. [endsect]
  50123. [section:async_write_some posix::basic_stream_descriptor::async_write_some]
  50124. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.async_write_some..async_write_some..posix::basic_stream_descriptor]
  50125. Start an asynchronous write.
  50126. template<
  50127. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  50128. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  50129. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_some(
  50130. const ConstBufferSequence & buffers,
  50131. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  50132. This function is used to asynchronously write data to the stream descriptor. The function call always returns immediately.
  50133. [heading Parameters]
  50134. [variablelist
  50135. [[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.]]
  50136. [[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:
  50137. ``
  50138. void handler(
  50139. const boost::system::error_code& error, // Result of operation.
  50140. std::size_t bytes_transferred // Number of bytes written.
  50141. );
  50142. ``
  50143. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  50144. ]
  50145. [heading Remarks]
  50146. The write operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.async_write `async_write`] function if you need to ensure that all data is written before the asynchronous operation completes.
  50147. [heading Example]
  50148. To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  50149. descriptor.async_write_some(boost::asio::buffer(data, size), handler);
  50150. See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  50151. [endsect]
  50152. [section:basic_stream_descriptor posix::basic_stream_descriptor::basic_stream_descriptor]
  50153. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.basic_stream_descriptor..basic_stream_descriptor..posix::basic_stream_descriptor]
  50154. Construct a stream descriptor without opening it.
  50155. explicit ``[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload1 basic_stream_descriptor]``(
  50156. const executor_type & ex);
  50157. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload1 more...]]``
  50158. template<
  50159. typename ExecutionContext>
  50160. explicit ``[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload2 basic_stream_descriptor]``(
  50161. ExecutionContext & context,
  50162. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  50163. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload2 more...]]``
  50164. Construct a stream descriptor on an existing native descriptor.
  50165. ``[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload3 basic_stream_descriptor]``(
  50166. const executor_type & ex,
  50167. const native_handle_type & native_descriptor);
  50168. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload3 more...]]``
  50169. template<
  50170. typename ExecutionContext>
  50171. ``[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload4 basic_stream_descriptor]``(
  50172. ExecutionContext & context,
  50173. const native_handle_type & native_descriptor,
  50174. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  50175. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload4 more...]]``
  50176. Move-construct a stream descriptor from another.
  50177. ``[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload5 basic_stream_descriptor]``(
  50178. basic_stream_descriptor && other);
  50179. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload5 more...]]``
  50180. [section:overload1 posix::basic_stream_descriptor::basic_stream_descriptor (1 of 5 overloads)]
  50181. Construct a stream descriptor without opening it.
  50182. basic_stream_descriptor(
  50183. const executor_type & ex);
  50184. This constructor creates a stream descriptor without opening it. The descriptor needs to be opened and then connected or accepted before data can be sent or received on it.
  50185. [heading Parameters]
  50186. [variablelist
  50187. [[ex][The I/O executor that the descriptor will use, by default, to dispatch handlers for any asynchronous operations performed on the descriptor. ]]
  50188. ]
  50189. [endsect]
  50190. [section:overload2 posix::basic_stream_descriptor::basic_stream_descriptor (2 of 5 overloads)]
  50191. Construct a stream descriptor without opening it.
  50192. template<
  50193. typename ExecutionContext>
  50194. basic_stream_descriptor(
  50195. ExecutionContext & context,
  50196. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  50197. This constructor creates a stream descriptor without opening it. The descriptor needs to be opened and then connected or accepted before data can be sent or received on it.
  50198. [heading Parameters]
  50199. [variablelist
  50200. [[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. ]]
  50201. ]
  50202. [endsect]
  50203. [section:overload3 posix::basic_stream_descriptor::basic_stream_descriptor (3 of 5 overloads)]
  50204. Construct a stream descriptor on an existing native descriptor.
  50205. basic_stream_descriptor(
  50206. const executor_type & ex,
  50207. const native_handle_type & native_descriptor);
  50208. This constructor creates a stream descriptor object to hold an existing native descriptor.
  50209. [heading Parameters]
  50210. [variablelist
  50211. [[ex][The I/O executor that the descriptor will use, by default, to dispatch handlers for any asynchronous operations performed on the descriptor.]]
  50212. [[native_descriptor][The new underlying descriptor implementation.]]
  50213. ]
  50214. [heading Exceptions]
  50215. [variablelist
  50216. [[boost::system::system_error][Thrown on failure. ]]
  50217. ]
  50218. [endsect]
  50219. [section:overload4 posix::basic_stream_descriptor::basic_stream_descriptor (4 of 5 overloads)]
  50220. Construct a stream descriptor on an existing native descriptor.
  50221. template<
  50222. typename ExecutionContext>
  50223. basic_stream_descriptor(
  50224. ExecutionContext & context,
  50225. const native_handle_type & native_descriptor,
  50226. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  50227. This constructor creates a stream descriptor object to hold an existing native descriptor.
  50228. [heading Parameters]
  50229. [variablelist
  50230. [[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.]]
  50231. [[native_descriptor][The new underlying descriptor implementation.]]
  50232. ]
  50233. [heading Exceptions]
  50234. [variablelist
  50235. [[boost::system::system_error][Thrown on failure. ]]
  50236. ]
  50237. [endsect]
  50238. [section:overload5 posix::basic_stream_descriptor::basic_stream_descriptor (5 of 5 overloads)]
  50239. Move-construct a stream descriptor from another.
  50240. basic_stream_descriptor(
  50241. basic_stream_descriptor && other);
  50242. This constructor moves a stream descriptor from one object to another.
  50243. [heading Parameters]
  50244. [variablelist
  50245. [[other][The other stream descriptor object from which the move will occur.]]
  50246. ]
  50247. [heading Remarks]
  50248. Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_descriptor(const executor_type&)` constructor.
  50249. [endsect]
  50250. [endsect]
  50251. [section:bytes_readable posix::basic_stream_descriptor::bytes_readable]
  50252. ['Inherited from posix::descriptor_base.]
  50253. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.bytes_readable..bytes_readable..posix::basic_stream_descriptor]
  50254. IO control command to get the amount of data that can be read without blocking.
  50255. typedef implementation_defined bytes_readable;
  50256. Implements the FIONREAD IO control command.
  50257. [heading Example]
  50258. boost::asio::posix::stream_descriptor descriptor(my_context);
  50259. ...
  50260. boost::asio::descriptor_base::bytes_readable command(true);
  50261. descriptor.io_control(command);
  50262. std::size_t bytes_readable = command.get();
  50263. [heading Requirements]
  50264. ['Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
  50265. ['Convenience header: ][^boost/asio.hpp]
  50266. [endsect]
  50267. [section:cancel posix::basic_stream_descriptor::cancel]
  50268. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.cancel..cancel..posix::basic_stream_descriptor]
  50269. Cancel all asynchronous operations associated with the descriptor.
  50270. void ``[link boost_asio.reference.posix__basic_stream_descriptor.cancel.overload1 cancel]``();
  50271. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.cancel.overload1 more...]]``
  50272. void ``[link boost_asio.reference.posix__basic_stream_descriptor.cancel.overload2 cancel]``(
  50273. boost::system::error_code & ec);
  50274. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.cancel.overload2 more...]]``
  50275. [section:overload1 posix::basic_stream_descriptor::cancel (1 of 2 overloads)]
  50276. ['Inherited from posix::basic_descriptor.]
  50277. Cancel all asynchronous operations associated with the descriptor.
  50278. void cancel();
  50279. This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
  50280. [heading Exceptions]
  50281. [variablelist
  50282. [[boost::system::system_error][Thrown on failure. ]]
  50283. ]
  50284. [endsect]
  50285. [section:overload2 posix::basic_stream_descriptor::cancel (2 of 2 overloads)]
  50286. ['Inherited from posix::basic_descriptor.]
  50287. Cancel all asynchronous operations associated with the descriptor.
  50288. void cancel(
  50289. boost::system::error_code & ec);
  50290. This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
  50291. [heading Parameters]
  50292. [variablelist
  50293. [[ec][Set to indicate what error occurred, if any. ]]
  50294. ]
  50295. [endsect]
  50296. [endsect]
  50297. [section:close posix::basic_stream_descriptor::close]
  50298. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.close..close..posix::basic_stream_descriptor]
  50299. Close the descriptor.
  50300. void ``[link boost_asio.reference.posix__basic_stream_descriptor.close.overload1 close]``();
  50301. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.close.overload1 more...]]``
  50302. void ``[link boost_asio.reference.posix__basic_stream_descriptor.close.overload2 close]``(
  50303. boost::system::error_code & ec);
  50304. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.close.overload2 more...]]``
  50305. [section:overload1 posix::basic_stream_descriptor::close (1 of 2 overloads)]
  50306. ['Inherited from posix::basic_descriptor.]
  50307. Close the descriptor.
  50308. void close();
  50309. This function is used to close the descriptor. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
  50310. [heading Exceptions]
  50311. [variablelist
  50312. [[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed. ]]
  50313. ]
  50314. [endsect]
  50315. [section:overload2 posix::basic_stream_descriptor::close (2 of 2 overloads)]
  50316. ['Inherited from posix::basic_descriptor.]
  50317. Close the descriptor.
  50318. void close(
  50319. boost::system::error_code & ec);
  50320. This function is used to close the descriptor. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
  50321. [heading Parameters]
  50322. [variablelist
  50323. [[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed. ]]
  50324. ]
  50325. [endsect]
  50326. [endsect]
  50327. [section:executor_type posix::basic_stream_descriptor::executor_type]
  50328. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.executor_type..executor_type..posix::basic_stream_descriptor]
  50329. The type of the executor associated with the object.
  50330. typedef Executor executor_type;
  50331. [heading Requirements]
  50332. ['Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
  50333. ['Convenience header: ][^boost/asio.hpp]
  50334. [endsect]
  50335. [section:get_executor posix::basic_stream_descriptor::get_executor]
  50336. ['Inherited from posix::basic_descriptor.]
  50337. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.get_executor..get_executor..posix::basic_stream_descriptor]
  50338. Get the executor associated with the object.
  50339. executor_type get_executor();
  50340. [endsect]
  50341. [section:impl_ posix::basic_stream_descriptor::impl_]
  50342. ['Inherited from posix::basic_descriptor.]
  50343. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.impl_..impl_..posix::basic_stream_descriptor]
  50344. detail::io_object_impl< detail::reactive_descriptor_service, Executor > impl_;
  50345. [endsect]
  50346. [section:io_control posix::basic_stream_descriptor::io_control]
  50347. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.io_control..io_control..posix::basic_stream_descriptor]
  50348. Perform an IO control command on the descriptor.
  50349. template<
  50350. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  50351. void ``[link boost_asio.reference.posix__basic_stream_descriptor.io_control.overload1 io_control]``(
  50352. IoControlCommand & command);
  50353. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.io_control.overload1 more...]]``
  50354. template<
  50355. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  50356. void ``[link boost_asio.reference.posix__basic_stream_descriptor.io_control.overload2 io_control]``(
  50357. IoControlCommand & command,
  50358. boost::system::error_code & ec);
  50359. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.io_control.overload2 more...]]``
  50360. [section:overload1 posix::basic_stream_descriptor::io_control (1 of 2 overloads)]
  50361. ['Inherited from posix::basic_descriptor.]
  50362. Perform an IO control command on the descriptor.
  50363. template<
  50364. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  50365. void io_control(
  50366. IoControlCommand & command);
  50367. This function is used to execute an IO control command on the descriptor.
  50368. [heading Parameters]
  50369. [variablelist
  50370. [[command][The IO control command to be performed on the descriptor.]]
  50371. ]
  50372. [heading Exceptions]
  50373. [variablelist
  50374. [[boost::system::system_error][Thrown on failure.]]
  50375. ]
  50376. [heading Example]
  50377. Getting the number of bytes ready to read:
  50378. boost::asio::posix::stream_descriptor descriptor(my_context);
  50379. ...
  50380. boost::asio::posix::stream_descriptor::bytes_readable command;
  50381. descriptor.io_control(command);
  50382. std::size_t bytes_readable = command.get();
  50383. [endsect]
  50384. [section:overload2 posix::basic_stream_descriptor::io_control (2 of 2 overloads)]
  50385. ['Inherited from posix::basic_descriptor.]
  50386. Perform an IO control command on the descriptor.
  50387. template<
  50388. typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
  50389. void io_control(
  50390. IoControlCommand & command,
  50391. boost::system::error_code & ec);
  50392. This function is used to execute an IO control command on the descriptor.
  50393. [heading Parameters]
  50394. [variablelist
  50395. [[command][The IO control command to be performed on the descriptor.]]
  50396. [[ec][Set to indicate what error occurred, if any.]]
  50397. ]
  50398. [heading Example]
  50399. Getting the number of bytes ready to read:
  50400. boost::asio::posix::stream_descriptor descriptor(my_context);
  50401. ...
  50402. boost::asio::posix::stream_descriptor::bytes_readable command;
  50403. boost::system::error_code ec;
  50404. descriptor.io_control(command, ec);
  50405. if (ec)
  50406. {
  50407. // An error occurred.
  50408. }
  50409. std::size_t bytes_readable = command.get();
  50410. [endsect]
  50411. [endsect]
  50412. [section:is_open posix::basic_stream_descriptor::is_open]
  50413. ['Inherited from posix::basic_descriptor.]
  50414. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.is_open..is_open..posix::basic_stream_descriptor]
  50415. Determine whether the descriptor is open.
  50416. bool is_open() const;
  50417. [endsect]
  50418. [section:lowest_layer posix::basic_stream_descriptor::lowest_layer]
  50419. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.lowest_layer..lowest_layer..posix::basic_stream_descriptor]
  50420. Get a reference to the lowest layer.
  50421. lowest_layer_type & ``[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer.overload1 lowest_layer]``();
  50422. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer.overload1 more...]]``
  50423. Get a const reference to the lowest layer.
  50424. const lowest_layer_type & ``[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer.overload2 lowest_layer]``() const;
  50425. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer.overload2 more...]]``
  50426. [section:overload1 posix::basic_stream_descriptor::lowest_layer (1 of 2 overloads)]
  50427. ['Inherited from posix::basic_descriptor.]
  50428. Get a reference to the lowest layer.
  50429. lowest_layer_type & lowest_layer();
  50430. This function returns a reference to the lowest layer in a stack of layers. Since a descriptor cannot contain any further layers, it simply returns a reference to itself.
  50431. [heading Return Value]
  50432. A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
  50433. [endsect]
  50434. [section:overload2 posix::basic_stream_descriptor::lowest_layer (2 of 2 overloads)]
  50435. ['Inherited from posix::basic_descriptor.]
  50436. Get a const reference to the lowest layer.
  50437. const lowest_layer_type & lowest_layer() const;
  50438. This function returns a const reference to the lowest layer in a stack of layers. Since a descriptor cannot contain any further layers, it simply returns a reference to itself.
  50439. [heading Return Value]
  50440. A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
  50441. [endsect]
  50442. [endsect]
  50443. [section:lowest_layer_type posix::basic_stream_descriptor::lowest_layer_type]
  50444. ['Inherited from posix::basic_descriptor.]
  50445. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.lowest_layer_type..lowest_layer_type..posix::basic_stream_descriptor]
  50446. A descriptor is always the lowest layer.
  50447. typedef basic_descriptor lowest_layer_type;
  50448. [heading Types]
  50449. [table
  50450. [[Name][Description]]
  50451. [
  50452. [[link boost_asio.reference.posix__basic_descriptor__rebind_executor [*rebind_executor]]]
  50453. [Rebinds the descriptor type to another executor. ]
  50454. ]
  50455. [
  50456. [[link boost_asio.reference.posix__basic_descriptor.bytes_readable [*bytes_readable]]]
  50457. [IO control command to get the amount of data that can be read without blocking. ]
  50458. ]
  50459. [
  50460. [[link boost_asio.reference.posix__basic_descriptor.executor_type [*executor_type]]]
  50461. [The type of the executor associated with the object. ]
  50462. ]
  50463. [
  50464. [[link boost_asio.reference.posix__basic_descriptor.lowest_layer_type [*lowest_layer_type]]]
  50465. [A descriptor is always the lowest layer. ]
  50466. ]
  50467. [
  50468. [[link boost_asio.reference.posix__basic_descriptor.native_handle_type [*native_handle_type]]]
  50469. [The native representation of a descriptor. ]
  50470. ]
  50471. [
  50472. [[link boost_asio.reference.posix__basic_descriptor.wait_type [*wait_type]]]
  50473. [Wait types. ]
  50474. ]
  50475. ]
  50476. [heading Member Functions]
  50477. [table
  50478. [[Name][Description]]
  50479. [
  50480. [[link boost_asio.reference.posix__basic_descriptor.assign [*assign]]]
  50481. [Assign an existing native descriptor to the descriptor. ]
  50482. ]
  50483. [
  50484. [[link boost_asio.reference.posix__basic_descriptor.async_wait [*async_wait]]]
  50485. [Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
  50486. ]
  50487. [
  50488. [[link boost_asio.reference.posix__basic_descriptor.basic_descriptor [*basic_descriptor]]]
  50489. [Construct a descriptor without opening it.
  50490. [hr]
  50491. Construct a descriptor on an existing native descriptor.
  50492. [hr]
  50493. Move-construct a descriptor from another. ]
  50494. ]
  50495. [
  50496. [[link boost_asio.reference.posix__basic_descriptor.cancel [*cancel]]]
  50497. [Cancel all asynchronous operations associated with the descriptor. ]
  50498. ]
  50499. [
  50500. [[link boost_asio.reference.posix__basic_descriptor.close [*close]]]
  50501. [Close the descriptor. ]
  50502. ]
  50503. [
  50504. [[link boost_asio.reference.posix__basic_descriptor.get_executor [*get_executor]]]
  50505. [Get the executor associated with the object. ]
  50506. ]
  50507. [
  50508. [[link boost_asio.reference.posix__basic_descriptor.io_control [*io_control]]]
  50509. [Perform an IO control command on the descriptor. ]
  50510. ]
  50511. [
  50512. [[link boost_asio.reference.posix__basic_descriptor.is_open [*is_open]]]
  50513. [Determine whether the descriptor is open. ]
  50514. ]
  50515. [
  50516. [[link boost_asio.reference.posix__basic_descriptor.lowest_layer [*lowest_layer]]]
  50517. [Get a reference to the lowest layer.
  50518. [hr]
  50519. Get a const reference to the lowest layer. ]
  50520. ]
  50521. [
  50522. [[link boost_asio.reference.posix__basic_descriptor.native_handle [*native_handle]]]
  50523. [Get the native descriptor representation. ]
  50524. ]
  50525. [
  50526. [[link boost_asio.reference.posix__basic_descriptor.native_non_blocking [*native_non_blocking]]]
  50527. [Gets the non-blocking mode of the native descriptor implementation.
  50528. [hr]
  50529. Sets the non-blocking mode of the native descriptor implementation. ]
  50530. ]
  50531. [
  50532. [[link boost_asio.reference.posix__basic_descriptor.non_blocking [*non_blocking]]]
  50533. [Gets the non-blocking mode of the descriptor.
  50534. [hr]
  50535. Sets the non-blocking mode of the descriptor. ]
  50536. ]
  50537. [
  50538. [[link boost_asio.reference.posix__basic_descriptor.operator_eq_ [*operator=]]]
  50539. [Move-assign a descriptor from another. ]
  50540. ]
  50541. [
  50542. [[link boost_asio.reference.posix__basic_descriptor.release [*release]]]
  50543. [Release ownership of the native descriptor implementation. ]
  50544. ]
  50545. [
  50546. [[link boost_asio.reference.posix__basic_descriptor.wait [*wait]]]
  50547. [Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
  50548. ]
  50549. ]
  50550. [heading Protected Member Functions]
  50551. [table
  50552. [[Name][Description]]
  50553. [
  50554. [[link boost_asio.reference.posix__basic_descriptor._basic_descriptor [*~basic_descriptor]]]
  50555. [Protected destructor to prevent deletion through this type. ]
  50556. ]
  50557. ]
  50558. [heading Protected Data Members]
  50559. [table
  50560. [[Name][Description]]
  50561. [
  50562. [[link boost_asio.reference.posix__basic_descriptor.impl_ [*impl_]]]
  50563. []
  50564. ]
  50565. ]
  50566. The [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] class template provides the ability to wrap a POSIX descriptor.
  50567. [heading Thread Safety]
  50568. ['Distinct] ['objects:] Safe.
  50569. ['Shared] ['objects:] Unsafe.
  50570. [heading Requirements]
  50571. ['Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
  50572. ['Convenience header: ][^boost/asio.hpp]
  50573. [endsect]
  50574. [section:native_handle posix::basic_stream_descriptor::native_handle]
  50575. ['Inherited from posix::basic_descriptor.]
  50576. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.native_handle..native_handle..posix::basic_stream_descriptor]
  50577. Get the native descriptor representation.
  50578. native_handle_type native_handle();
  50579. This function may be used to obtain the underlying representation of the descriptor. This is intended to allow access to native descriptor functionality that is not otherwise provided.
  50580. [endsect]
  50581. [section:native_handle_type posix::basic_stream_descriptor::native_handle_type]
  50582. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.native_handle_type..native_handle_type..posix::basic_stream_descriptor]
  50583. The native representation of a descriptor.
  50584. typedef basic_descriptor< Executor >::native_handle_type native_handle_type;
  50585. [heading Types]
  50586. [table
  50587. [[Name][Description]]
  50588. [
  50589. [[link boost_asio.reference.posix__basic_descriptor__rebind_executor [*rebind_executor]]]
  50590. [Rebinds the descriptor type to another executor. ]
  50591. ]
  50592. [
  50593. [[link boost_asio.reference.posix__basic_descriptor.bytes_readable [*bytes_readable]]]
  50594. [IO control command to get the amount of data that can be read without blocking. ]
  50595. ]
  50596. [
  50597. [[link boost_asio.reference.posix__basic_descriptor.executor_type [*executor_type]]]
  50598. [The type of the executor associated with the object. ]
  50599. ]
  50600. [
  50601. [[link boost_asio.reference.posix__basic_descriptor.lowest_layer_type [*lowest_layer_type]]]
  50602. [A descriptor is always the lowest layer. ]
  50603. ]
  50604. [
  50605. [[link boost_asio.reference.posix__basic_descriptor.native_handle_type [*native_handle_type]]]
  50606. [The native representation of a descriptor. ]
  50607. ]
  50608. [
  50609. [[link boost_asio.reference.posix__basic_descriptor.wait_type [*wait_type]]]
  50610. [Wait types. ]
  50611. ]
  50612. ]
  50613. [heading Member Functions]
  50614. [table
  50615. [[Name][Description]]
  50616. [
  50617. [[link boost_asio.reference.posix__basic_descriptor.assign [*assign]]]
  50618. [Assign an existing native descriptor to the descriptor. ]
  50619. ]
  50620. [
  50621. [[link boost_asio.reference.posix__basic_descriptor.async_wait [*async_wait]]]
  50622. [Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
  50623. ]
  50624. [
  50625. [[link boost_asio.reference.posix__basic_descriptor.basic_descriptor [*basic_descriptor]]]
  50626. [Construct a descriptor without opening it.
  50627. [hr]
  50628. Construct a descriptor on an existing native descriptor.
  50629. [hr]
  50630. Move-construct a descriptor from another. ]
  50631. ]
  50632. [
  50633. [[link boost_asio.reference.posix__basic_descriptor.cancel [*cancel]]]
  50634. [Cancel all asynchronous operations associated with the descriptor. ]
  50635. ]
  50636. [
  50637. [[link boost_asio.reference.posix__basic_descriptor.close [*close]]]
  50638. [Close the descriptor. ]
  50639. ]
  50640. [
  50641. [[link boost_asio.reference.posix__basic_descriptor.get_executor [*get_executor]]]
  50642. [Get the executor associated with the object. ]
  50643. ]
  50644. [
  50645. [[link boost_asio.reference.posix__basic_descriptor.io_control [*io_control]]]
  50646. [Perform an IO control command on the descriptor. ]
  50647. ]
  50648. [
  50649. [[link boost_asio.reference.posix__basic_descriptor.is_open [*is_open]]]
  50650. [Determine whether the descriptor is open. ]
  50651. ]
  50652. [
  50653. [[link boost_asio.reference.posix__basic_descriptor.lowest_layer [*lowest_layer]]]
  50654. [Get a reference to the lowest layer.
  50655. [hr]
  50656. Get a const reference to the lowest layer. ]
  50657. ]
  50658. [
  50659. [[link boost_asio.reference.posix__basic_descriptor.native_handle [*native_handle]]]
  50660. [Get the native descriptor representation. ]
  50661. ]
  50662. [
  50663. [[link boost_asio.reference.posix__basic_descriptor.native_non_blocking [*native_non_blocking]]]
  50664. [Gets the non-blocking mode of the native descriptor implementation.
  50665. [hr]
  50666. Sets the non-blocking mode of the native descriptor implementation. ]
  50667. ]
  50668. [
  50669. [[link boost_asio.reference.posix__basic_descriptor.non_blocking [*non_blocking]]]
  50670. [Gets the non-blocking mode of the descriptor.
  50671. [hr]
  50672. Sets the non-blocking mode of the descriptor. ]
  50673. ]
  50674. [
  50675. [[link boost_asio.reference.posix__basic_descriptor.operator_eq_ [*operator=]]]
  50676. [Move-assign a descriptor from another. ]
  50677. ]
  50678. [
  50679. [[link boost_asio.reference.posix__basic_descriptor.release [*release]]]
  50680. [Release ownership of the native descriptor implementation. ]
  50681. ]
  50682. [
  50683. [[link boost_asio.reference.posix__basic_descriptor.wait [*wait]]]
  50684. [Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
  50685. ]
  50686. ]
  50687. [heading Protected Member Functions]
  50688. [table
  50689. [[Name][Description]]
  50690. [
  50691. [[link boost_asio.reference.posix__basic_descriptor._basic_descriptor [*~basic_descriptor]]]
  50692. [Protected destructor to prevent deletion through this type. ]
  50693. ]
  50694. ]
  50695. [heading Protected Data Members]
  50696. [table
  50697. [[Name][Description]]
  50698. [
  50699. [[link boost_asio.reference.posix__basic_descriptor.impl_ [*impl_]]]
  50700. []
  50701. ]
  50702. ]
  50703. The [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] class template provides the ability to wrap a POSIX descriptor.
  50704. [heading Thread Safety]
  50705. ['Distinct] ['objects:] Safe.
  50706. ['Shared] ['objects:] Unsafe.
  50707. [heading Requirements]
  50708. ['Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
  50709. ['Convenience header: ][^boost/asio.hpp]
  50710. [endsect]
  50711. [section:native_non_blocking posix::basic_stream_descriptor::native_non_blocking]
  50712. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.native_non_blocking..native_non_blocking..posix::basic_stream_descriptor]
  50713. Gets the non-blocking mode of the native descriptor implementation.
  50714. bool ``[link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking.overload1 native_non_blocking]``() const;
  50715. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking.overload1 more...]]``
  50716. Sets the non-blocking mode of the native descriptor implementation.
  50717. void ``[link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking.overload2 native_non_blocking]``(
  50718. bool mode);
  50719. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking.overload2 more...]]``
  50720. void ``[link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking.overload3 native_non_blocking]``(
  50721. bool mode,
  50722. boost::system::error_code & ec);
  50723. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking.overload3 more...]]``
  50724. [section:overload1 posix::basic_stream_descriptor::native_non_blocking (1 of 3 overloads)]
  50725. ['Inherited from posix::basic_descriptor.]
  50726. Gets the non-blocking mode of the native descriptor implementation.
  50727. bool native_non_blocking() const;
  50728. This function is used to retrieve the non-blocking mode of the underlying native descriptor. This mode has no effect on the behaviour of the descriptor object's synchronous operations.
  50729. [heading Return Value]
  50730. `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).
  50731. [heading Remarks]
  50732. The current non-blocking mode is cached by the descriptor object. Consequently, the return value may be incorrect if the non-blocking mode was set directly on the native descriptor.
  50733. [endsect]
  50734. [section:overload2 posix::basic_stream_descriptor::native_non_blocking (2 of 3 overloads)]
  50735. ['Inherited from posix::basic_descriptor.]
  50736. Sets the non-blocking mode of the native descriptor implementation.
  50737. void native_non_blocking(
  50738. bool mode);
  50739. This function is used to modify the non-blocking mode of the underlying native descriptor. It has no effect on the behaviour of the descriptor object's synchronous operations.
  50740. [heading Parameters]
  50741. [variablelist
  50742. [[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).]]
  50743. ]
  50744. [heading Exceptions]
  50745. [variablelist
  50746. [[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. ]]
  50747. ]
  50748. [endsect]
  50749. [section:overload3 posix::basic_stream_descriptor::native_non_blocking (3 of 3 overloads)]
  50750. ['Inherited from posix::basic_descriptor.]
  50751. Sets the non-blocking mode of the native descriptor implementation.
  50752. void native_non_blocking(
  50753. bool mode,
  50754. boost::system::error_code & ec);
  50755. This function is used to modify the non-blocking mode of the underlying native descriptor. It has no effect on the behaviour of the descriptor object's synchronous operations.
  50756. [heading Parameters]
  50757. [variablelist
  50758. [[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).]]
  50759. [[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. ]]
  50760. ]
  50761. [endsect]
  50762. [endsect]
  50763. [section:non_blocking posix::basic_stream_descriptor::non_blocking]
  50764. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.non_blocking..non_blocking..posix::basic_stream_descriptor]
  50765. Gets the non-blocking mode of the descriptor.
  50766. bool ``[link boost_asio.reference.posix__basic_stream_descriptor.non_blocking.overload1 non_blocking]``() const;
  50767. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.non_blocking.overload1 more...]]``
  50768. Sets the non-blocking mode of the descriptor.
  50769. void ``[link boost_asio.reference.posix__basic_stream_descriptor.non_blocking.overload2 non_blocking]``(
  50770. bool mode);
  50771. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.non_blocking.overload2 more...]]``
  50772. void ``[link boost_asio.reference.posix__basic_stream_descriptor.non_blocking.overload3 non_blocking]``(
  50773. bool mode,
  50774. boost::system::error_code & ec);
  50775. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.non_blocking.overload3 more...]]``
  50776. [section:overload1 posix::basic_stream_descriptor::non_blocking (1 of 3 overloads)]
  50777. ['Inherited from posix::basic_descriptor.]
  50778. Gets the non-blocking mode of the descriptor.
  50779. bool non_blocking() const;
  50780. [heading Return Value]
  50781. `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.
  50782. [heading Remarks]
  50783. The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
  50784. [endsect]
  50785. [section:overload2 posix::basic_stream_descriptor::non_blocking (2 of 3 overloads)]
  50786. ['Inherited from posix::basic_descriptor.]
  50787. Sets the non-blocking mode of the descriptor.
  50788. void non_blocking(
  50789. bool mode);
  50790. [heading Parameters]
  50791. [variablelist
  50792. [[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.]]
  50793. ]
  50794. [heading Exceptions]
  50795. [variablelist
  50796. [[boost::system::system_error][Thrown on failure.]]
  50797. ]
  50798. [heading Remarks]
  50799. The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
  50800. [endsect]
  50801. [section:overload3 posix::basic_stream_descriptor::non_blocking (3 of 3 overloads)]
  50802. ['Inherited from posix::basic_descriptor.]
  50803. Sets the non-blocking mode of the descriptor.
  50804. void non_blocking(
  50805. bool mode,
  50806. boost::system::error_code & ec);
  50807. [heading Parameters]
  50808. [variablelist
  50809. [[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.]]
  50810. [[ec][Set to indicate what error occurred, if any.]]
  50811. ]
  50812. [heading Remarks]
  50813. The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
  50814. [endsect]
  50815. [endsect]
  50816. [section:operator_eq_ posix::basic_stream_descriptor::operator=]
  50817. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.operator_eq_..operator=..posix::basic_stream_descriptor]
  50818. Move-assign a stream descriptor from another.
  50819. basic_stream_descriptor & operator=(
  50820. basic_stream_descriptor && other);
  50821. This assignment operator moves a stream descriptor from one object to another.
  50822. [heading Parameters]
  50823. [variablelist
  50824. [[other][The other stream descriptor object from which the move will occur.]]
  50825. ]
  50826. [heading Remarks]
  50827. Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_descriptor(const executor_type&)` constructor.
  50828. [endsect]
  50829. [section:read_some posix::basic_stream_descriptor::read_some]
  50830. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.read_some..read_some..posix::basic_stream_descriptor]
  50831. Read some data from the descriptor.
  50832. template<
  50833. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  50834. std::size_t ``[link boost_asio.reference.posix__basic_stream_descriptor.read_some.overload1 read_some]``(
  50835. const MutableBufferSequence & buffers);
  50836. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.read_some.overload1 more...]]``
  50837. template<
  50838. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  50839. std::size_t ``[link boost_asio.reference.posix__basic_stream_descriptor.read_some.overload2 read_some]``(
  50840. const MutableBufferSequence & buffers,
  50841. boost::system::error_code & ec);
  50842. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.read_some.overload2 more...]]``
  50843. [section:overload1 posix::basic_stream_descriptor::read_some (1 of 2 overloads)]
  50844. Read some data from the descriptor.
  50845. template<
  50846. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  50847. std::size_t read_some(
  50848. const MutableBufferSequence & buffers);
  50849. This function is used to read data from the stream descriptor. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
  50850. [heading Parameters]
  50851. [variablelist
  50852. [[buffers][One or more buffers into which the data will be read.]]
  50853. ]
  50854. [heading Return Value]
  50855. The number of bytes read.
  50856. [heading Exceptions]
  50857. [variablelist
  50858. [[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
  50859. ]
  50860. [heading Remarks]
  50861. The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
  50862. [heading Example]
  50863. To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  50864. descriptor.read_some(boost::asio::buffer(data, size));
  50865. See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  50866. [endsect]
  50867. [section:overload2 posix::basic_stream_descriptor::read_some (2 of 2 overloads)]
  50868. Read some data from the descriptor.
  50869. template<
  50870. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  50871. std::size_t read_some(
  50872. const MutableBufferSequence & buffers,
  50873. boost::system::error_code & ec);
  50874. This function is used to read data from the stream descriptor. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
  50875. [heading Parameters]
  50876. [variablelist
  50877. [[buffers][One or more buffers into which the data will be read.]]
  50878. [[ec][Set to indicate what error occurred, if any.]]
  50879. ]
  50880. [heading Return Value]
  50881. The number of bytes read. Returns 0 if an error occurred.
  50882. [heading Remarks]
  50883. The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
  50884. [endsect]
  50885. [endsect]
  50886. [section:release posix::basic_stream_descriptor::release]
  50887. ['Inherited from posix::basic_descriptor.]
  50888. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.release..release..posix::basic_stream_descriptor]
  50889. Release ownership of the native descriptor implementation.
  50890. native_handle_type release();
  50891. This function may be used to obtain the underlying representation of the descriptor. After calling this function, `is_open()` returns false. The caller is responsible for closing the descriptor.
  50892. All outstanding asynchronous read or write operations will finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
  50893. [endsect]
  50894. [section:wait posix::basic_stream_descriptor::wait]
  50895. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.wait..wait..posix::basic_stream_descriptor]
  50896. Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions.
  50897. void ``[link boost_asio.reference.posix__basic_stream_descriptor.wait.overload1 wait]``(
  50898. wait_type w);
  50899. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.wait.overload1 more...]]``
  50900. void ``[link boost_asio.reference.posix__basic_stream_descriptor.wait.overload2 wait]``(
  50901. wait_type w,
  50902. boost::system::error_code & ec);
  50903. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.wait.overload2 more...]]``
  50904. [section:overload1 posix::basic_stream_descriptor::wait (1 of 2 overloads)]
  50905. ['Inherited from posix::basic_descriptor.]
  50906. Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions.
  50907. void wait(
  50908. wait_type w);
  50909. This function is used to perform a blocking wait for a descriptor to enter a ready to read, write or error condition state.
  50910. [heading Parameters]
  50911. [variablelist
  50912. [[w][Specifies the desired descriptor state.]]
  50913. ]
  50914. [heading Example]
  50915. Waiting for a descriptor to become readable.
  50916. boost::asio::posix::stream_descriptor descriptor(my_context);
  50917. ...
  50918. descriptor.wait(boost::asio::posix::stream_descriptor::wait_read);
  50919. [endsect]
  50920. [section:overload2 posix::basic_stream_descriptor::wait (2 of 2 overloads)]
  50921. ['Inherited from posix::basic_descriptor.]
  50922. Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions.
  50923. void wait(
  50924. wait_type w,
  50925. boost::system::error_code & ec);
  50926. This function is used to perform a blocking wait for a descriptor to enter a ready to read, write or error condition state.
  50927. [heading Parameters]
  50928. [variablelist
  50929. [[w][Specifies the desired descriptor state.]]
  50930. [[ec][Set to indicate what error occurred, if any.]]
  50931. ]
  50932. [heading Example]
  50933. Waiting for a descriptor to become readable.
  50934. boost::asio::posix::stream_descriptor descriptor(my_context);
  50935. ...
  50936. boost::system::error_code ec;
  50937. descriptor.wait(boost::asio::posix::stream_descriptor::wait_read, ec);
  50938. [endsect]
  50939. [endsect]
  50940. [section:wait_type posix::basic_stream_descriptor::wait_type]
  50941. ['Inherited from posix::descriptor_base.]
  50942. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.wait_type..wait_type..posix::basic_stream_descriptor]
  50943. Wait types.
  50944. enum wait_type
  50945. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.wait_type.wait_read..wait_read..posix::basic_stream_descriptor]
  50946. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.wait_type.wait_write..wait_write..posix::basic_stream_descriptor]
  50947. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.wait_type.wait_error..wait_error..posix::basic_stream_descriptor]
  50948. [heading Values]
  50949. [variablelist
  50950. [
  50951. [wait_read]
  50952. [Wait for a descriptor to become ready to read. ]
  50953. ]
  50954. [
  50955. [wait_write]
  50956. [Wait for a descriptor to become ready to write. ]
  50957. ]
  50958. [
  50959. [wait_error]
  50960. [Wait for a descriptor to have error conditions pending. ]
  50961. ]
  50962. ]
  50963. For use with `descriptor::wait()` and `descriptor::async_wait()`.
  50964. [endsect]
  50965. [section:write_some posix::basic_stream_descriptor::write_some]
  50966. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor.write_some..write_some..posix::basic_stream_descriptor]
  50967. Write some data to the descriptor.
  50968. template<
  50969. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  50970. std::size_t ``[link boost_asio.reference.posix__basic_stream_descriptor.write_some.overload1 write_some]``(
  50971. const ConstBufferSequence & buffers);
  50972. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.write_some.overload1 more...]]``
  50973. template<
  50974. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  50975. std::size_t ``[link boost_asio.reference.posix__basic_stream_descriptor.write_some.overload2 write_some]``(
  50976. const ConstBufferSequence & buffers,
  50977. boost::system::error_code & ec);
  50978. `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.write_some.overload2 more...]]``
  50979. [section:overload1 posix::basic_stream_descriptor::write_some (1 of 2 overloads)]
  50980. Write some data to the descriptor.
  50981. template<
  50982. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  50983. std::size_t write_some(
  50984. const ConstBufferSequence & buffers);
  50985. This function is used to write data to the stream descriptor. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
  50986. [heading Parameters]
  50987. [variablelist
  50988. [[buffers][One or more data buffers to be written to the descriptor.]]
  50989. ]
  50990. [heading Return Value]
  50991. The number of bytes written.
  50992. [heading Exceptions]
  50993. [variablelist
  50994. [[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
  50995. ]
  50996. [heading Remarks]
  50997. The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
  50998. [heading Example]
  50999. To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  51000. descriptor.write_some(boost::asio::buffer(data, size));
  51001. See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  51002. [endsect]
  51003. [section:overload2 posix::basic_stream_descriptor::write_some (2 of 2 overloads)]
  51004. Write some data to the descriptor.
  51005. template<
  51006. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  51007. std::size_t write_some(
  51008. const ConstBufferSequence & buffers,
  51009. boost::system::error_code & ec);
  51010. This function is used to write data to the stream descriptor. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
  51011. [heading Parameters]
  51012. [variablelist
  51013. [[buffers][One or more data buffers to be written to the descriptor.]]
  51014. [[ec][Set to indicate what error occurred, if any.]]
  51015. ]
  51016. [heading Return Value]
  51017. The number of bytes written. Returns 0 if an error occurred.
  51018. [heading Remarks]
  51019. The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
  51020. [endsect]
  51021. [endsect]
  51022. [endsect]
  51023. [section:posix__basic_stream_descriptor__rebind_executor posix::basic_stream_descriptor::rebind_executor]
  51024. Rebinds the descriptor type to another executor.
  51025. template<
  51026. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  51027. struct rebind_executor
  51028. [heading Types]
  51029. [table
  51030. [[Name][Description]]
  51031. [
  51032. [[link boost_asio.reference.posix__basic_stream_descriptor__rebind_executor.other [*other]]]
  51033. [The descriptor type when rebound to the specified executor. ]
  51034. ]
  51035. ]
  51036. [heading Requirements]
  51037. ['Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
  51038. ['Convenience header: ][^boost/asio.hpp]
  51039. [section:other posix::basic_stream_descriptor::rebind_executor::other]
  51040. [indexterm2 boost_asio.indexterm.posix__basic_stream_descriptor__rebind_executor.other..other..posix::basic_stream_descriptor::rebind_executor]
  51041. The descriptor type when rebound to the specified executor.
  51042. typedef basic_stream_descriptor< Executor1 > other;
  51043. [heading Types]
  51044. [table
  51045. [[Name][Description]]
  51046. [
  51047. [[link boost_asio.reference.posix__basic_stream_descriptor__rebind_executor [*rebind_executor]]]
  51048. [Rebinds the descriptor type to another executor. ]
  51049. ]
  51050. [
  51051. [[link boost_asio.reference.posix__basic_stream_descriptor.bytes_readable [*bytes_readable]]]
  51052. [IO control command to get the amount of data that can be read without blocking. ]
  51053. ]
  51054. [
  51055. [[link boost_asio.reference.posix__basic_stream_descriptor.executor_type [*executor_type]]]
  51056. [The type of the executor associated with the object. ]
  51057. ]
  51058. [
  51059. [[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer_type [*lowest_layer_type]]]
  51060. [A descriptor is always the lowest layer. ]
  51061. ]
  51062. [
  51063. [[link boost_asio.reference.posix__basic_stream_descriptor.native_handle_type [*native_handle_type]]]
  51064. [The native representation of a descriptor. ]
  51065. ]
  51066. [
  51067. [[link boost_asio.reference.posix__basic_stream_descriptor.wait_type [*wait_type]]]
  51068. [Wait types. ]
  51069. ]
  51070. ]
  51071. [heading Member Functions]
  51072. [table
  51073. [[Name][Description]]
  51074. [
  51075. [[link boost_asio.reference.posix__basic_stream_descriptor.assign [*assign]]]
  51076. [Assign an existing native descriptor to the descriptor. ]
  51077. ]
  51078. [
  51079. [[link boost_asio.reference.posix__basic_stream_descriptor.async_read_some [*async_read_some]]]
  51080. [Start an asynchronous read. ]
  51081. ]
  51082. [
  51083. [[link boost_asio.reference.posix__basic_stream_descriptor.async_wait [*async_wait]]]
  51084. [Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
  51085. ]
  51086. [
  51087. [[link boost_asio.reference.posix__basic_stream_descriptor.async_write_some [*async_write_some]]]
  51088. [Start an asynchronous write. ]
  51089. ]
  51090. [
  51091. [[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor [*basic_stream_descriptor]]]
  51092. [Construct a stream descriptor without opening it.
  51093. [hr]
  51094. Construct a stream descriptor on an existing native descriptor.
  51095. [hr]
  51096. Move-construct a stream descriptor from another. ]
  51097. ]
  51098. [
  51099. [[link boost_asio.reference.posix__basic_stream_descriptor.cancel [*cancel]]]
  51100. [Cancel all asynchronous operations associated with the descriptor. ]
  51101. ]
  51102. [
  51103. [[link boost_asio.reference.posix__basic_stream_descriptor.close [*close]]]
  51104. [Close the descriptor. ]
  51105. ]
  51106. [
  51107. [[link boost_asio.reference.posix__basic_stream_descriptor.get_executor [*get_executor]]]
  51108. [Get the executor associated with the object. ]
  51109. ]
  51110. [
  51111. [[link boost_asio.reference.posix__basic_stream_descriptor.io_control [*io_control]]]
  51112. [Perform an IO control command on the descriptor. ]
  51113. ]
  51114. [
  51115. [[link boost_asio.reference.posix__basic_stream_descriptor.is_open [*is_open]]]
  51116. [Determine whether the descriptor is open. ]
  51117. ]
  51118. [
  51119. [[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer [*lowest_layer]]]
  51120. [Get a reference to the lowest layer.
  51121. [hr]
  51122. Get a const reference to the lowest layer. ]
  51123. ]
  51124. [
  51125. [[link boost_asio.reference.posix__basic_stream_descriptor.native_handle [*native_handle]]]
  51126. [Get the native descriptor representation. ]
  51127. ]
  51128. [
  51129. [[link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking [*native_non_blocking]]]
  51130. [Gets the non-blocking mode of the native descriptor implementation.
  51131. [hr]
  51132. Sets the non-blocking mode of the native descriptor implementation. ]
  51133. ]
  51134. [
  51135. [[link boost_asio.reference.posix__basic_stream_descriptor.non_blocking [*non_blocking]]]
  51136. [Gets the non-blocking mode of the descriptor.
  51137. [hr]
  51138. Sets the non-blocking mode of the descriptor. ]
  51139. ]
  51140. [
  51141. [[link boost_asio.reference.posix__basic_stream_descriptor.operator_eq_ [*operator=]]]
  51142. [Move-assign a stream descriptor from another. ]
  51143. ]
  51144. [
  51145. [[link boost_asio.reference.posix__basic_stream_descriptor.read_some [*read_some]]]
  51146. [Read some data from the descriptor. ]
  51147. ]
  51148. [
  51149. [[link boost_asio.reference.posix__basic_stream_descriptor.release [*release]]]
  51150. [Release ownership of the native descriptor implementation. ]
  51151. ]
  51152. [
  51153. [[link boost_asio.reference.posix__basic_stream_descriptor.wait [*wait]]]
  51154. [Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
  51155. ]
  51156. [
  51157. [[link boost_asio.reference.posix__basic_stream_descriptor.write_some [*write_some]]]
  51158. [Write some data to the descriptor. ]
  51159. ]
  51160. ]
  51161. [heading Protected Data Members]
  51162. [table
  51163. [[Name][Description]]
  51164. [
  51165. [[link boost_asio.reference.posix__basic_stream_descriptor.impl_ [*impl_]]]
  51166. []
  51167. ]
  51168. ]
  51169. The [link boost_asio.reference.posix__basic_stream_descriptor `posix::basic_stream_descriptor`] class template provides asynchronous and blocking stream-oriented descriptor functionality.
  51170. [heading Thread Safety]
  51171. ['Distinct] ['objects:] Safe.
  51172. ['Shared] ['objects:] Unsafe.
  51173. [heading Requirements]
  51174. ['Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
  51175. ['Convenience header: ][^boost/asio.hpp]
  51176. [endsect]
  51177. [endsect]
  51178. [section:posix__descriptor posix::descriptor]
  51179. [indexterm1 boost_asio.indexterm.posix__descriptor..posix::descriptor]
  51180. Typedef for the typical usage of [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`].
  51181. typedef basic_descriptor descriptor;
  51182. [heading Types]
  51183. [table
  51184. [[Name][Description]]
  51185. [
  51186. [[link boost_asio.reference.posix__basic_descriptor__rebind_executor [*rebind_executor]]]
  51187. [Rebinds the descriptor type to another executor. ]
  51188. ]
  51189. [
  51190. [[link boost_asio.reference.posix__basic_descriptor.bytes_readable [*bytes_readable]]]
  51191. [IO control command to get the amount of data that can be read without blocking. ]
  51192. ]
  51193. [
  51194. [[link boost_asio.reference.posix__basic_descriptor.executor_type [*executor_type]]]
  51195. [The type of the executor associated with the object. ]
  51196. ]
  51197. [
  51198. [[link boost_asio.reference.posix__basic_descriptor.lowest_layer_type [*lowest_layer_type]]]
  51199. [A descriptor is always the lowest layer. ]
  51200. ]
  51201. [
  51202. [[link boost_asio.reference.posix__basic_descriptor.native_handle_type [*native_handle_type]]]
  51203. [The native representation of a descriptor. ]
  51204. ]
  51205. [
  51206. [[link boost_asio.reference.posix__basic_descriptor.wait_type [*wait_type]]]
  51207. [Wait types. ]
  51208. ]
  51209. ]
  51210. [heading Member Functions]
  51211. [table
  51212. [[Name][Description]]
  51213. [
  51214. [[link boost_asio.reference.posix__basic_descriptor.assign [*assign]]]
  51215. [Assign an existing native descriptor to the descriptor. ]
  51216. ]
  51217. [
  51218. [[link boost_asio.reference.posix__basic_descriptor.async_wait [*async_wait]]]
  51219. [Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
  51220. ]
  51221. [
  51222. [[link boost_asio.reference.posix__basic_descriptor.basic_descriptor [*basic_descriptor]]]
  51223. [Construct a descriptor without opening it.
  51224. [hr]
  51225. Construct a descriptor on an existing native descriptor.
  51226. [hr]
  51227. Move-construct a descriptor from another. ]
  51228. ]
  51229. [
  51230. [[link boost_asio.reference.posix__basic_descriptor.cancel [*cancel]]]
  51231. [Cancel all asynchronous operations associated with the descriptor. ]
  51232. ]
  51233. [
  51234. [[link boost_asio.reference.posix__basic_descriptor.close [*close]]]
  51235. [Close the descriptor. ]
  51236. ]
  51237. [
  51238. [[link boost_asio.reference.posix__basic_descriptor.get_executor [*get_executor]]]
  51239. [Get the executor associated with the object. ]
  51240. ]
  51241. [
  51242. [[link boost_asio.reference.posix__basic_descriptor.io_control [*io_control]]]
  51243. [Perform an IO control command on the descriptor. ]
  51244. ]
  51245. [
  51246. [[link boost_asio.reference.posix__basic_descriptor.is_open [*is_open]]]
  51247. [Determine whether the descriptor is open. ]
  51248. ]
  51249. [
  51250. [[link boost_asio.reference.posix__basic_descriptor.lowest_layer [*lowest_layer]]]
  51251. [Get a reference to the lowest layer.
  51252. [hr]
  51253. Get a const reference to the lowest layer. ]
  51254. ]
  51255. [
  51256. [[link boost_asio.reference.posix__basic_descriptor.native_handle [*native_handle]]]
  51257. [Get the native descriptor representation. ]
  51258. ]
  51259. [
  51260. [[link boost_asio.reference.posix__basic_descriptor.native_non_blocking [*native_non_blocking]]]
  51261. [Gets the non-blocking mode of the native descriptor implementation.
  51262. [hr]
  51263. Sets the non-blocking mode of the native descriptor implementation. ]
  51264. ]
  51265. [
  51266. [[link boost_asio.reference.posix__basic_descriptor.non_blocking [*non_blocking]]]
  51267. [Gets the non-blocking mode of the descriptor.
  51268. [hr]
  51269. Sets the non-blocking mode of the descriptor. ]
  51270. ]
  51271. [
  51272. [[link boost_asio.reference.posix__basic_descriptor.operator_eq_ [*operator=]]]
  51273. [Move-assign a descriptor from another. ]
  51274. ]
  51275. [
  51276. [[link boost_asio.reference.posix__basic_descriptor.release [*release]]]
  51277. [Release ownership of the native descriptor implementation. ]
  51278. ]
  51279. [
  51280. [[link boost_asio.reference.posix__basic_descriptor.wait [*wait]]]
  51281. [Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
  51282. ]
  51283. ]
  51284. [heading Protected Member Functions]
  51285. [table
  51286. [[Name][Description]]
  51287. [
  51288. [[link boost_asio.reference.posix__basic_descriptor._basic_descriptor [*~basic_descriptor]]]
  51289. [Protected destructor to prevent deletion through this type. ]
  51290. ]
  51291. ]
  51292. [heading Protected Data Members]
  51293. [table
  51294. [[Name][Description]]
  51295. [
  51296. [[link boost_asio.reference.posix__basic_descriptor.impl_ [*impl_]]]
  51297. []
  51298. ]
  51299. ]
  51300. The [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] class template provides the ability to wrap a POSIX descriptor.
  51301. [heading Thread Safety]
  51302. ['Distinct] ['objects:] Safe.
  51303. ['Shared] ['objects:] Unsafe.
  51304. [heading Requirements]
  51305. ['Header: ][^boost/asio/posix/descriptor.hpp]
  51306. ['Convenience header: ][^boost/asio.hpp]
  51307. [endsect]
  51308. [section:posix__descriptor_base posix::descriptor_base]
  51309. The [link boost_asio.reference.posix__descriptor_base `posix::descriptor_base`] class is used as a base for the descriptor class as a place to define the associated IO control commands.
  51310. class descriptor_base
  51311. [heading Types]
  51312. [table
  51313. [[Name][Description]]
  51314. [
  51315. [[link boost_asio.reference.posix__descriptor_base.bytes_readable [*bytes_readable]]]
  51316. [IO control command to get the amount of data that can be read without blocking. ]
  51317. ]
  51318. [
  51319. [[link boost_asio.reference.posix__descriptor_base.wait_type [*wait_type]]]
  51320. [Wait types. ]
  51321. ]
  51322. ]
  51323. [heading Protected Member Functions]
  51324. [table
  51325. [[Name][Description]]
  51326. [
  51327. [[link boost_asio.reference.posix__descriptor_base._descriptor_base [*~descriptor_base]]]
  51328. [Protected destructor to prevent deletion through this type. ]
  51329. ]
  51330. ]
  51331. [heading Requirements]
  51332. ['Header: ][^boost/asio/posix/descriptor_base.hpp]
  51333. ['Convenience header: ][^boost/asio.hpp]
  51334. [section:bytes_readable posix::descriptor_base::bytes_readable]
  51335. [indexterm2 boost_asio.indexterm.posix__descriptor_base.bytes_readable..bytes_readable..posix::descriptor_base]
  51336. IO control command to get the amount of data that can be read without blocking.
  51337. typedef implementation_defined bytes_readable;
  51338. Implements the FIONREAD IO control command.
  51339. [heading Example]
  51340. boost::asio::posix::stream_descriptor descriptor(my_context);
  51341. ...
  51342. boost::asio::descriptor_base::bytes_readable command(true);
  51343. descriptor.io_control(command);
  51344. std::size_t bytes_readable = command.get();
  51345. [heading Requirements]
  51346. ['Header: ][^boost/asio/posix/descriptor_base.hpp]
  51347. ['Convenience header: ][^boost/asio.hpp]
  51348. [endsect]
  51349. [section:wait_type posix::descriptor_base::wait_type]
  51350. [indexterm2 boost_asio.indexterm.posix__descriptor_base.wait_type..wait_type..posix::descriptor_base]
  51351. Wait types.
  51352. enum wait_type
  51353. [indexterm2 boost_asio.indexterm.posix__descriptor_base.wait_type.wait_read..wait_read..posix::descriptor_base]
  51354. [indexterm2 boost_asio.indexterm.posix__descriptor_base.wait_type.wait_write..wait_write..posix::descriptor_base]
  51355. [indexterm2 boost_asio.indexterm.posix__descriptor_base.wait_type.wait_error..wait_error..posix::descriptor_base]
  51356. [heading Values]
  51357. [variablelist
  51358. [
  51359. [wait_read]
  51360. [Wait for a descriptor to become ready to read. ]
  51361. ]
  51362. [
  51363. [wait_write]
  51364. [Wait for a descriptor to become ready to write. ]
  51365. ]
  51366. [
  51367. [wait_error]
  51368. [Wait for a descriptor to have error conditions pending. ]
  51369. ]
  51370. ]
  51371. For use with `descriptor::wait()` and `descriptor::async_wait()`.
  51372. [endsect]
  51373. [section:_descriptor_base posix::descriptor_base::~descriptor_base]
  51374. [indexterm2 boost_asio.indexterm.posix__descriptor_base._descriptor_base..~descriptor_base..posix::descriptor_base]
  51375. Protected destructor to prevent deletion through this type.
  51376. ~descriptor_base();
  51377. [endsect]
  51378. [endsect]
  51379. [section:posix__stream_descriptor posix::stream_descriptor]
  51380. [indexterm1 boost_asio.indexterm.posix__stream_descriptor..posix::stream_descriptor]
  51381. Typedef for the typical usage of a stream-oriented descriptor.
  51382. typedef basic_stream_descriptor stream_descriptor;
  51383. [heading Types]
  51384. [table
  51385. [[Name][Description]]
  51386. [
  51387. [[link boost_asio.reference.posix__basic_stream_descriptor__rebind_executor [*rebind_executor]]]
  51388. [Rebinds the descriptor type to another executor. ]
  51389. ]
  51390. [
  51391. [[link boost_asio.reference.posix__basic_stream_descriptor.bytes_readable [*bytes_readable]]]
  51392. [IO control command to get the amount of data that can be read without blocking. ]
  51393. ]
  51394. [
  51395. [[link boost_asio.reference.posix__basic_stream_descriptor.executor_type [*executor_type]]]
  51396. [The type of the executor associated with the object. ]
  51397. ]
  51398. [
  51399. [[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer_type [*lowest_layer_type]]]
  51400. [A descriptor is always the lowest layer. ]
  51401. ]
  51402. [
  51403. [[link boost_asio.reference.posix__basic_stream_descriptor.native_handle_type [*native_handle_type]]]
  51404. [The native representation of a descriptor. ]
  51405. ]
  51406. [
  51407. [[link boost_asio.reference.posix__basic_stream_descriptor.wait_type [*wait_type]]]
  51408. [Wait types. ]
  51409. ]
  51410. ]
  51411. [heading Member Functions]
  51412. [table
  51413. [[Name][Description]]
  51414. [
  51415. [[link boost_asio.reference.posix__basic_stream_descriptor.assign [*assign]]]
  51416. [Assign an existing native descriptor to the descriptor. ]
  51417. ]
  51418. [
  51419. [[link boost_asio.reference.posix__basic_stream_descriptor.async_read_some [*async_read_some]]]
  51420. [Start an asynchronous read. ]
  51421. ]
  51422. [
  51423. [[link boost_asio.reference.posix__basic_stream_descriptor.async_wait [*async_wait]]]
  51424. [Asynchronously wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
  51425. ]
  51426. [
  51427. [[link boost_asio.reference.posix__basic_stream_descriptor.async_write_some [*async_write_some]]]
  51428. [Start an asynchronous write. ]
  51429. ]
  51430. [
  51431. [[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor [*basic_stream_descriptor]]]
  51432. [Construct a stream descriptor without opening it.
  51433. [hr]
  51434. Construct a stream descriptor on an existing native descriptor.
  51435. [hr]
  51436. Move-construct a stream descriptor from another. ]
  51437. ]
  51438. [
  51439. [[link boost_asio.reference.posix__basic_stream_descriptor.cancel [*cancel]]]
  51440. [Cancel all asynchronous operations associated with the descriptor. ]
  51441. ]
  51442. [
  51443. [[link boost_asio.reference.posix__basic_stream_descriptor.close [*close]]]
  51444. [Close the descriptor. ]
  51445. ]
  51446. [
  51447. [[link boost_asio.reference.posix__basic_stream_descriptor.get_executor [*get_executor]]]
  51448. [Get the executor associated with the object. ]
  51449. ]
  51450. [
  51451. [[link boost_asio.reference.posix__basic_stream_descriptor.io_control [*io_control]]]
  51452. [Perform an IO control command on the descriptor. ]
  51453. ]
  51454. [
  51455. [[link boost_asio.reference.posix__basic_stream_descriptor.is_open [*is_open]]]
  51456. [Determine whether the descriptor is open. ]
  51457. ]
  51458. [
  51459. [[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer [*lowest_layer]]]
  51460. [Get a reference to the lowest layer.
  51461. [hr]
  51462. Get a const reference to the lowest layer. ]
  51463. ]
  51464. [
  51465. [[link boost_asio.reference.posix__basic_stream_descriptor.native_handle [*native_handle]]]
  51466. [Get the native descriptor representation. ]
  51467. ]
  51468. [
  51469. [[link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking [*native_non_blocking]]]
  51470. [Gets the non-blocking mode of the native descriptor implementation.
  51471. [hr]
  51472. Sets the non-blocking mode of the native descriptor implementation. ]
  51473. ]
  51474. [
  51475. [[link boost_asio.reference.posix__basic_stream_descriptor.non_blocking [*non_blocking]]]
  51476. [Gets the non-blocking mode of the descriptor.
  51477. [hr]
  51478. Sets the non-blocking mode of the descriptor. ]
  51479. ]
  51480. [
  51481. [[link boost_asio.reference.posix__basic_stream_descriptor.operator_eq_ [*operator=]]]
  51482. [Move-assign a stream descriptor from another. ]
  51483. ]
  51484. [
  51485. [[link boost_asio.reference.posix__basic_stream_descriptor.read_some [*read_some]]]
  51486. [Read some data from the descriptor. ]
  51487. ]
  51488. [
  51489. [[link boost_asio.reference.posix__basic_stream_descriptor.release [*release]]]
  51490. [Release ownership of the native descriptor implementation. ]
  51491. ]
  51492. [
  51493. [[link boost_asio.reference.posix__basic_stream_descriptor.wait [*wait]]]
  51494. [Wait for the descriptor to become ready to read, ready to write, or to have pending error conditions. ]
  51495. ]
  51496. [
  51497. [[link boost_asio.reference.posix__basic_stream_descriptor.write_some [*write_some]]]
  51498. [Write some data to the descriptor. ]
  51499. ]
  51500. ]
  51501. [heading Protected Data Members]
  51502. [table
  51503. [[Name][Description]]
  51504. [
  51505. [[link boost_asio.reference.posix__basic_stream_descriptor.impl_ [*impl_]]]
  51506. []
  51507. ]
  51508. ]
  51509. The [link boost_asio.reference.posix__basic_stream_descriptor `posix::basic_stream_descriptor`] class template provides asynchronous and blocking stream-oriented descriptor functionality.
  51510. [heading Thread Safety]
  51511. ['Distinct] ['objects:] Safe.
  51512. ['Shared] ['objects:] Unsafe.
  51513. [heading Requirements]
  51514. ['Header: ][^boost/asio/posix/stream_descriptor.hpp]
  51515. ['Convenience header: ][^boost/asio.hpp]
  51516. [endsect]
  51517. [section:post post]
  51518. [indexterm1 boost_asio.indexterm.post..post]
  51519. Submits a completion token or function object for execution.
  51520. template<
  51521. typename CompletionToken>
  51522. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.post.overload1 post]``(
  51523. CompletionToken && token);
  51524. `` [''''&raquo;''' [link boost_asio.reference.post.overload1 more...]]``
  51525. template<
  51526. typename ``[link boost_asio.reference.Executor1 Executor]``,
  51527. typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  51528. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.post.overload2 post]``(
  51529. const Executor & ex,
  51530. CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  51531. typename enable_if< is_executor< Executor >::value >::type * = 0);
  51532. `` [''''&raquo;''' [link boost_asio.reference.post.overload2 more...]]``
  51533. template<
  51534. typename ExecutionContext,
  51535. typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  51536. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.post.overload3 post]``(
  51537. ExecutionContext & ctx,
  51538. CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  51539. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  51540. `` [''''&raquo;''' [link boost_asio.reference.post.overload3 more...]]``
  51541. [heading Requirements]
  51542. ['Header: ][^boost/asio/post.hpp]
  51543. ['Convenience header: ][^boost/asio.hpp]
  51544. [section:overload1 post (1 of 3 overloads)]
  51545. Submits a completion token or function object for execution.
  51546. template<
  51547. typename CompletionToken>
  51548. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` post(
  51549. CompletionToken && token);
  51550. This function submits an object for execution using the object's associated executor. The function object is queued for execution, and is never called from the current thread prior to returning from `post()`.
  51551. The use of `post()`, rather than [link boost_asio.reference.defer `defer`] , indicates the caller's preference that the function object be eagerly queued for execution.
  51552. This function has the following effects:
  51553. * Constructs a function object handler of type `Handler`, initialized with `handler(forward<CompletionToken>(token))`.
  51554. * Constructs an object `result` of type `async_result<Handler>`, initializing the object as `result(handler)`.
  51555. * Obtains the handler's associated executor object `ex` by performing `get_associated_executor(handler)`.
  51556. * Obtains the handler's associated allocator object `alloc` by performing `get_associated_allocator(handler)`.
  51557. * Performs `ex.post(std::move(handler), alloc)`.
  51558. * Returns `result.get()`.
  51559. [endsect]
  51560. [section:overload2 post (2 of 3 overloads)]
  51561. Submits a completion token or function object for execution.
  51562. template<
  51563. typename ``[link boost_asio.reference.Executor1 Executor]``,
  51564. typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  51565. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` post(
  51566. const Executor & ex,
  51567. CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  51568. typename enable_if< is_executor< Executor >::value >::type * = 0);
  51569. This function submits an object for execution using the specified executor. The function object is queued for execution, and is never called from the current thread prior to returning from `post()`.
  51570. The use of `post()`, rather than [link boost_asio.reference.defer `defer`] , indicates the caller's preference that the function object be eagerly queued for execution.
  51571. This function has the following effects:
  51572. * Constructs a function object handler of type `Handler`, initialized with `handler(forward<CompletionToken>(token))`.
  51573. * Constructs an object `result` of type `async_result<Handler>`, initializing the object as `result(handler)`.
  51574. * Obtains the handler's associated executor object `ex1` by performing `get_associated_executor(handler)`.
  51575. * Creates a work object `w` by performing `make_work(ex1)`.
  51576. * Obtains the handler's associated allocator object `alloc` by performing `get_associated_allocator(handler)`.
  51577. * Constructs a function object `f` with a function call operator that performs `ex1.dispatch(std::move(handler), alloc)` followed by `w.reset()`.
  51578. * Performs `Executor(ex).post(std::move(f), alloc)`.
  51579. * Returns `result.get()`.
  51580. [endsect]
  51581. [section:overload3 post (3 of 3 overloads)]
  51582. Submits a completion token or function object for execution.
  51583. template<
  51584. typename ExecutionContext,
  51585. typename CompletionToken = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  51586. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` post(
  51587. ExecutionContext & ctx,
  51588. CompletionToken && token = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``,
  51589. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  51590. [heading Return Value]
  51591. `post(ctx.get_executor(), forward<CompletionToken>(token))`.
  51592. [endsect]
  51593. [endsect]
  51594. [section:read read]
  51595. [indexterm1 boost_asio.indexterm.read..read]
  51596. The `read` function is a composed operation that reads a certain amount of data from a stream before returning.
  51597. Attempt to read a certain amount of data from a stream before returning.
  51598. template<
  51599. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  51600. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  51601. std::size_t ``[link boost_asio.reference.read.overload1 read]``(
  51602. SyncReadStream & s,
  51603. const MutableBufferSequence & buffers,
  51604. typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type * = 0);
  51605. `` [''''&raquo;''' [link boost_asio.reference.read.overload1 more...]]``
  51606. template<
  51607. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  51608. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  51609. std::size_t ``[link boost_asio.reference.read.overload2 read]``(
  51610. SyncReadStream & s,
  51611. const MutableBufferSequence & buffers,
  51612. boost::system::error_code & ec,
  51613. typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type * = 0);
  51614. `` [''''&raquo;''' [link boost_asio.reference.read.overload2 more...]]``
  51615. template<
  51616. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  51617. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  51618. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  51619. std::size_t ``[link boost_asio.reference.read.overload3 read]``(
  51620. SyncReadStream & s,
  51621. const MutableBufferSequence & buffers,
  51622. CompletionCondition completion_condition,
  51623. typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type * = 0);
  51624. `` [''''&raquo;''' [link boost_asio.reference.read.overload3 more...]]``
  51625. template<
  51626. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  51627. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  51628. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  51629. std::size_t ``[link boost_asio.reference.read.overload4 read]``(
  51630. SyncReadStream & s,
  51631. const MutableBufferSequence & buffers,
  51632. CompletionCondition completion_condition,
  51633. boost::system::error_code & ec,
  51634. typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type * = 0);
  51635. `` [''''&raquo;''' [link boost_asio.reference.read.overload4 more...]]``
  51636. template<
  51637. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  51638. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
  51639. std::size_t ``[link boost_asio.reference.read.overload5 read]``(
  51640. SyncReadStream & s,
  51641. DynamicBuffer_v1 && buffers,
  51642. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  51643. `` [''''&raquo;''' [link boost_asio.reference.read.overload5 more...]]``
  51644. template<
  51645. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  51646. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
  51647. std::size_t ``[link boost_asio.reference.read.overload6 read]``(
  51648. SyncReadStream & s,
  51649. DynamicBuffer_v1 && buffers,
  51650. boost::system::error_code & ec,
  51651. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  51652. `` [''''&raquo;''' [link boost_asio.reference.read.overload6 more...]]``
  51653. template<
  51654. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  51655. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
  51656. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  51657. std::size_t ``[link boost_asio.reference.read.overload7 read]``(
  51658. SyncReadStream & s,
  51659. DynamicBuffer_v1 && buffers,
  51660. CompletionCondition completion_condition,
  51661. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  51662. `` [''''&raquo;''' [link boost_asio.reference.read.overload7 more...]]``
  51663. template<
  51664. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  51665. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
  51666. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  51667. std::size_t ``[link boost_asio.reference.read.overload8 read]``(
  51668. SyncReadStream & s,
  51669. DynamicBuffer_v1 && buffers,
  51670. CompletionCondition completion_condition,
  51671. boost::system::error_code & ec,
  51672. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  51673. `` [''''&raquo;''' [link boost_asio.reference.read.overload8 more...]]``
  51674. template<
  51675. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  51676. typename Allocator>
  51677. std::size_t ``[link boost_asio.reference.read.overload9 read]``(
  51678. SyncReadStream & s,
  51679. basic_streambuf< Allocator > & b);
  51680. `` [''''&raquo;''' [link boost_asio.reference.read.overload9 more...]]``
  51681. template<
  51682. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  51683. typename Allocator>
  51684. std::size_t ``[link boost_asio.reference.read.overload10 read]``(
  51685. SyncReadStream & s,
  51686. basic_streambuf< Allocator > & b,
  51687. boost::system::error_code & ec);
  51688. `` [''''&raquo;''' [link boost_asio.reference.read.overload10 more...]]``
  51689. template<
  51690. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  51691. typename Allocator,
  51692. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  51693. std::size_t ``[link boost_asio.reference.read.overload11 read]``(
  51694. SyncReadStream & s,
  51695. basic_streambuf< Allocator > & b,
  51696. CompletionCondition completion_condition);
  51697. `` [''''&raquo;''' [link boost_asio.reference.read.overload11 more...]]``
  51698. template<
  51699. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  51700. typename Allocator,
  51701. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  51702. std::size_t ``[link boost_asio.reference.read.overload12 read]``(
  51703. SyncReadStream & s,
  51704. basic_streambuf< Allocator > & b,
  51705. CompletionCondition completion_condition,
  51706. boost::system::error_code & ec);
  51707. `` [''''&raquo;''' [link boost_asio.reference.read.overload12 more...]]``
  51708. template<
  51709. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  51710. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
  51711. std::size_t ``[link boost_asio.reference.read.overload13 read]``(
  51712. SyncReadStream & s,
  51713. DynamicBuffer_v2 buffers,
  51714. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  51715. `` [''''&raquo;''' [link boost_asio.reference.read.overload13 more...]]``
  51716. template<
  51717. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  51718. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
  51719. std::size_t ``[link boost_asio.reference.read.overload14 read]``(
  51720. SyncReadStream & s,
  51721. DynamicBuffer_v2 buffers,
  51722. boost::system::error_code & ec,
  51723. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  51724. `` [''''&raquo;''' [link boost_asio.reference.read.overload14 more...]]``
  51725. template<
  51726. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  51727. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
  51728. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  51729. std::size_t ``[link boost_asio.reference.read.overload15 read]``(
  51730. SyncReadStream & s,
  51731. DynamicBuffer_v2 buffers,
  51732. CompletionCondition completion_condition,
  51733. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  51734. `` [''''&raquo;''' [link boost_asio.reference.read.overload15 more...]]``
  51735. template<
  51736. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  51737. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
  51738. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  51739. std::size_t ``[link boost_asio.reference.read.overload16 read]``(
  51740. SyncReadStream & s,
  51741. DynamicBuffer_v2 buffers,
  51742. CompletionCondition completion_condition,
  51743. boost::system::error_code & ec,
  51744. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  51745. `` [''''&raquo;''' [link boost_asio.reference.read.overload16 more...]]``
  51746. [heading Requirements]
  51747. ['Header: ][^boost/asio/read.hpp]
  51748. ['Convenience header: ][^boost/asio.hpp]
  51749. [section:overload1 read (1 of 16 overloads)]
  51750. Attempt to read a certain amount of data from a stream before returning.
  51751. template<
  51752. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  51753. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  51754. std::size_t read(
  51755. SyncReadStream & s,
  51756. const MutableBufferSequence & buffers,
  51757. typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type * = 0);
  51758. This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
  51759. * The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
  51760. * An error occurred.
  51761. This operation is implemented in terms of zero or more calls to the stream's read\_some function.
  51762. [heading Parameters]
  51763. [variablelist
  51764. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  51765. [[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.]]
  51766. ]
  51767. [heading Return Value]
  51768. The number of bytes transferred.
  51769. [heading Exceptions]
  51770. [variablelist
  51771. [[boost::system::system_error][Thrown on failure.]]
  51772. ]
  51773. [heading Example]
  51774. To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  51775. boost::asio::read(s, boost::asio::buffer(data, size));
  51776. See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  51777. [heading Remarks]
  51778. This overload is equivalent to calling:
  51779. boost::asio::read(
  51780. s, buffers,
  51781. boost::asio::transfer_all());
  51782. [endsect]
  51783. [section:overload2 read (2 of 16 overloads)]
  51784. Attempt to read a certain amount of data from a stream before returning.
  51785. template<
  51786. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  51787. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  51788. std::size_t read(
  51789. SyncReadStream & s,
  51790. const MutableBufferSequence & buffers,
  51791. boost::system::error_code & ec,
  51792. typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type * = 0);
  51793. This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
  51794. * The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
  51795. * An error occurred.
  51796. This operation is implemented in terms of zero or more calls to the stream's read\_some function.
  51797. [heading Parameters]
  51798. [variablelist
  51799. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  51800. [[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.]]
  51801. [[ec][Set to indicate what error occurred, if any.]]
  51802. ]
  51803. [heading Return Value]
  51804. The number of bytes transferred.
  51805. [heading Example]
  51806. To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  51807. boost::asio::read(s, boost::asio::buffer(data, size), ec);
  51808. See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  51809. [heading Remarks]
  51810. This overload is equivalent to calling:
  51811. boost::asio::read(
  51812. s, buffers,
  51813. boost::asio::transfer_all(), ec);
  51814. [endsect]
  51815. [section:overload3 read (3 of 16 overloads)]
  51816. Attempt to read a certain amount of data from a stream before returning.
  51817. template<
  51818. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  51819. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  51820. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  51821. std::size_t read(
  51822. SyncReadStream & s,
  51823. const MutableBufferSequence & buffers,
  51824. CompletionCondition completion_condition,
  51825. typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type * = 0);
  51826. This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
  51827. * The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
  51828. * The completion\_condition function object returns 0.
  51829. This operation is implemented in terms of zero or more calls to the stream's read\_some function.
  51830. [heading Parameters]
  51831. [variablelist
  51832. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  51833. [[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.]]
  51834. [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
  51835. ``
  51836. std::size_t completion_condition(
  51837. // Result of latest read_some operation.
  51838. const boost::system::error_code& error,
  51839. // Number of bytes transferred so far.
  51840. std::size_t bytes_transferred
  51841. );
  51842. ``
  51843. A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's read\_some function.]]
  51844. ]
  51845. [heading Return Value]
  51846. The number of bytes transferred.
  51847. [heading Exceptions]
  51848. [variablelist
  51849. [[boost::system::system_error][Thrown on failure.]]
  51850. ]
  51851. [heading Example]
  51852. To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  51853. boost::asio::read(s, boost::asio::buffer(data, size),
  51854. boost::asio::transfer_at_least(32));
  51855. See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  51856. [endsect]
  51857. [section:overload4 read (4 of 16 overloads)]
  51858. Attempt to read a certain amount of data from a stream before returning.
  51859. template<
  51860. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  51861. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  51862. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  51863. std::size_t read(
  51864. SyncReadStream & s,
  51865. const MutableBufferSequence & buffers,
  51866. CompletionCondition completion_condition,
  51867. boost::system::error_code & ec,
  51868. typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type * = 0);
  51869. This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
  51870. * The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
  51871. * The completion\_condition function object returns 0.
  51872. This operation is implemented in terms of zero or more calls to the stream's read\_some function.
  51873. [heading Parameters]
  51874. [variablelist
  51875. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  51876. [[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.]]
  51877. [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
  51878. ``
  51879. std::size_t completion_condition(
  51880. // Result of latest read_some operation.
  51881. const boost::system::error_code& error,
  51882. // Number of bytes transferred so far.
  51883. std::size_t bytes_transferred
  51884. );
  51885. ``
  51886. A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's read\_some function.]]
  51887. [[ec][Set to indicate what error occurred, if any.]]
  51888. ]
  51889. [heading Return Value]
  51890. The number of bytes read. If an error occurs, returns the total number of bytes successfully transferred prior to the error.
  51891. [endsect]
  51892. [section:overload5 read (5 of 16 overloads)]
  51893. Attempt to read a certain amount of data from a stream before returning.
  51894. template<
  51895. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  51896. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
  51897. std::size_t read(
  51898. SyncReadStream & s,
  51899. DynamicBuffer_v1 && buffers,
  51900. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  51901. This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
  51902. * The specified dynamic buffer sequence is full (that is, it has reached maximum size).
  51903. * An error occurred.
  51904. This operation is implemented in terms of zero or more calls to the stream's read\_some function.
  51905. [heading Parameters]
  51906. [variablelist
  51907. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  51908. [[buffers][The dynamic buffer sequence into which the data will be read.]]
  51909. ]
  51910. [heading Return Value]
  51911. The number of bytes transferred.
  51912. [heading Exceptions]
  51913. [variablelist
  51914. [[boost::system::system_error][Thrown on failure.]]
  51915. ]
  51916. [heading Remarks]
  51917. This overload is equivalent to calling:
  51918. boost::asio::read(
  51919. s, buffers,
  51920. boost::asio::transfer_all());
  51921. [endsect]
  51922. [section:overload6 read (6 of 16 overloads)]
  51923. Attempt to read a certain amount of data from a stream before returning.
  51924. template<
  51925. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  51926. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
  51927. std::size_t read(
  51928. SyncReadStream & s,
  51929. DynamicBuffer_v1 && buffers,
  51930. boost::system::error_code & ec,
  51931. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  51932. This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
  51933. * The supplied buffer is full (that is, it has reached maximum size).
  51934. * An error occurred.
  51935. This operation is implemented in terms of zero or more calls to the stream's read\_some function.
  51936. [heading Parameters]
  51937. [variablelist
  51938. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  51939. [[buffers][The dynamic buffer sequence into which the data will be read.]]
  51940. [[ec][Set to indicate what error occurred, if any.]]
  51941. ]
  51942. [heading Return Value]
  51943. The number of bytes transferred.
  51944. [heading Remarks]
  51945. This overload is equivalent to calling:
  51946. boost::asio::read(
  51947. s, buffers,
  51948. boost::asio::transfer_all(), ec);
  51949. [endsect]
  51950. [section:overload7 read (7 of 16 overloads)]
  51951. Attempt to read a certain amount of data from a stream before returning.
  51952. template<
  51953. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  51954. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
  51955. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  51956. std::size_t read(
  51957. SyncReadStream & s,
  51958. DynamicBuffer_v1 && buffers,
  51959. CompletionCondition completion_condition,
  51960. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  51961. This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
  51962. * The specified dynamic buffer sequence is full (that is, it has reached maximum size).
  51963. * The completion\_condition function object returns 0.
  51964. This operation is implemented in terms of zero or more calls to the stream's read\_some function.
  51965. [heading Parameters]
  51966. [variablelist
  51967. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  51968. [[buffers][The dynamic buffer sequence into which the data will be read.]]
  51969. [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
  51970. ``
  51971. std::size_t completion_condition(
  51972. // Result of latest read_some operation.
  51973. const boost::system::error_code& error,
  51974. // Number of bytes transferred so far.
  51975. std::size_t bytes_transferred
  51976. );
  51977. ``
  51978. A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's read\_some function.]]
  51979. ]
  51980. [heading Return Value]
  51981. The number of bytes transferred.
  51982. [heading Exceptions]
  51983. [variablelist
  51984. [[boost::system::system_error][Thrown on failure. ]]
  51985. ]
  51986. [endsect]
  51987. [section:overload8 read (8 of 16 overloads)]
  51988. Attempt to read a certain amount of data from a stream before returning.
  51989. template<
  51990. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  51991. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
  51992. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  51993. std::size_t read(
  51994. SyncReadStream & s,
  51995. DynamicBuffer_v1 && buffers,
  51996. CompletionCondition completion_condition,
  51997. boost::system::error_code & ec,
  51998. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  51999. This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
  52000. * The specified dynamic buffer sequence is full (that is, it has reached maximum size).
  52001. * The completion\_condition function object returns 0.
  52002. This operation is implemented in terms of zero or more calls to the stream's read\_some function.
  52003. [heading Parameters]
  52004. [variablelist
  52005. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  52006. [[buffers][The dynamic buffer sequence into which the data will be read.]]
  52007. [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
  52008. ``
  52009. std::size_t completion_condition(
  52010. // Result of latest read_some operation.
  52011. const boost::system::error_code& error,
  52012. // Number of bytes transferred so far.
  52013. std::size_t bytes_transferred
  52014. );
  52015. ``
  52016. A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's read\_some function.]]
  52017. [[ec][Set to indicate what error occurred, if any.]]
  52018. ]
  52019. [heading Return Value]
  52020. The number of bytes read. If an error occurs, returns the total number of bytes successfully transferred prior to the error.
  52021. [endsect]
  52022. [section:overload9 read (9 of 16 overloads)]
  52023. Attempt to read a certain amount of data from a stream before returning.
  52024. template<
  52025. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52026. typename Allocator>
  52027. std::size_t read(
  52028. SyncReadStream & s,
  52029. basic_streambuf< Allocator > & b);
  52030. This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
  52031. * The supplied buffer is full (that is, it has reached maximum size).
  52032. * An error occurred.
  52033. This operation is implemented in terms of zero or more calls to the stream's read\_some function.
  52034. [heading Parameters]
  52035. [variablelist
  52036. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  52037. [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
  52038. ]
  52039. [heading Return Value]
  52040. The number of bytes transferred.
  52041. [heading Exceptions]
  52042. [variablelist
  52043. [[boost::system::system_error][Thrown on failure.]]
  52044. ]
  52045. [heading Remarks]
  52046. This overload is equivalent to calling:
  52047. boost::asio::read(
  52048. s, b,
  52049. boost::asio::transfer_all());
  52050. [endsect]
  52051. [section:overload10 read (10 of 16 overloads)]
  52052. Attempt to read a certain amount of data from a stream before returning.
  52053. template<
  52054. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52055. typename Allocator>
  52056. std::size_t read(
  52057. SyncReadStream & s,
  52058. basic_streambuf< Allocator > & b,
  52059. boost::system::error_code & ec);
  52060. This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
  52061. * The supplied buffer is full (that is, it has reached maximum size).
  52062. * An error occurred.
  52063. This operation is implemented in terms of zero or more calls to the stream's read\_some function.
  52064. [heading Parameters]
  52065. [variablelist
  52066. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  52067. [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
  52068. [[ec][Set to indicate what error occurred, if any.]]
  52069. ]
  52070. [heading Return Value]
  52071. The number of bytes transferred.
  52072. [heading Remarks]
  52073. This overload is equivalent to calling:
  52074. boost::asio::read(
  52075. s, b,
  52076. boost::asio::transfer_all(), ec);
  52077. [endsect]
  52078. [section:overload11 read (11 of 16 overloads)]
  52079. Attempt to read a certain amount of data from a stream before returning.
  52080. template<
  52081. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52082. typename Allocator,
  52083. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  52084. std::size_t read(
  52085. SyncReadStream & s,
  52086. basic_streambuf< Allocator > & b,
  52087. CompletionCondition completion_condition);
  52088. This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
  52089. * The supplied buffer is full (that is, it has reached maximum size).
  52090. * The completion\_condition function object returns 0.
  52091. This operation is implemented in terms of zero or more calls to the stream's read\_some function.
  52092. [heading Parameters]
  52093. [variablelist
  52094. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  52095. [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
  52096. [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
  52097. ``
  52098. std::size_t completion_condition(
  52099. // Result of latest read_some operation.
  52100. const boost::system::error_code& error,
  52101. // Number of bytes transferred so far.
  52102. std::size_t bytes_transferred
  52103. );
  52104. ``
  52105. A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's read\_some function.]]
  52106. ]
  52107. [heading Return Value]
  52108. The number of bytes transferred.
  52109. [heading Exceptions]
  52110. [variablelist
  52111. [[boost::system::system_error][Thrown on failure. ]]
  52112. ]
  52113. [endsect]
  52114. [section:overload12 read (12 of 16 overloads)]
  52115. Attempt to read a certain amount of data from a stream before returning.
  52116. template<
  52117. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52118. typename Allocator,
  52119. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  52120. std::size_t read(
  52121. SyncReadStream & s,
  52122. basic_streambuf< Allocator > & b,
  52123. CompletionCondition completion_condition,
  52124. boost::system::error_code & ec);
  52125. This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
  52126. * The supplied buffer is full (that is, it has reached maximum size).
  52127. * The completion\_condition function object returns 0.
  52128. This operation is implemented in terms of zero or more calls to the stream's read\_some function.
  52129. [heading Parameters]
  52130. [variablelist
  52131. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  52132. [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
  52133. [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
  52134. ``
  52135. std::size_t completion_condition(
  52136. // Result of latest read_some operation.
  52137. const boost::system::error_code& error,
  52138. // Number of bytes transferred so far.
  52139. std::size_t bytes_transferred
  52140. );
  52141. ``
  52142. A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's read\_some function.]]
  52143. [[ec][Set to indicate what error occurred, if any.]]
  52144. ]
  52145. [heading Return Value]
  52146. The number of bytes read. If an error occurs, returns the total number of bytes successfully transferred prior to the error.
  52147. [endsect]
  52148. [section:overload13 read (13 of 16 overloads)]
  52149. Attempt to read a certain amount of data from a stream before returning.
  52150. template<
  52151. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52152. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
  52153. std::size_t read(
  52154. SyncReadStream & s,
  52155. DynamicBuffer_v2 buffers,
  52156. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  52157. This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
  52158. * The specified dynamic buffer sequence is full (that is, it has reached maximum size).
  52159. * An error occurred.
  52160. This operation is implemented in terms of zero or more calls to the stream's read\_some function.
  52161. [heading Parameters]
  52162. [variablelist
  52163. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  52164. [[buffers][The dynamic buffer sequence into which the data will be read.]]
  52165. ]
  52166. [heading Return Value]
  52167. The number of bytes transferred.
  52168. [heading Exceptions]
  52169. [variablelist
  52170. [[boost::system::system_error][Thrown on failure.]]
  52171. ]
  52172. [heading Remarks]
  52173. This overload is equivalent to calling:
  52174. boost::asio::read(
  52175. s, buffers,
  52176. boost::asio::transfer_all());
  52177. [endsect]
  52178. [section:overload14 read (14 of 16 overloads)]
  52179. Attempt to read a certain amount of data from a stream before returning.
  52180. template<
  52181. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52182. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
  52183. std::size_t read(
  52184. SyncReadStream & s,
  52185. DynamicBuffer_v2 buffers,
  52186. boost::system::error_code & ec,
  52187. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  52188. This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
  52189. * The supplied buffer is full (that is, it has reached maximum size).
  52190. * An error occurred.
  52191. This operation is implemented in terms of zero or more calls to the stream's read\_some function.
  52192. [heading Parameters]
  52193. [variablelist
  52194. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  52195. [[buffers][The dynamic buffer sequence into which the data will be read.]]
  52196. [[ec][Set to indicate what error occurred, if any.]]
  52197. ]
  52198. [heading Return Value]
  52199. The number of bytes transferred.
  52200. [heading Remarks]
  52201. This overload is equivalent to calling:
  52202. boost::asio::read(
  52203. s, buffers,
  52204. boost::asio::transfer_all(), ec);
  52205. [endsect]
  52206. [section:overload15 read (15 of 16 overloads)]
  52207. Attempt to read a certain amount of data from a stream before returning.
  52208. template<
  52209. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52210. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
  52211. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  52212. std::size_t read(
  52213. SyncReadStream & s,
  52214. DynamicBuffer_v2 buffers,
  52215. CompletionCondition completion_condition,
  52216. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  52217. This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
  52218. * The specified dynamic buffer sequence is full (that is, it has reached maximum size).
  52219. * The completion\_condition function object returns 0.
  52220. This operation is implemented in terms of zero or more calls to the stream's read\_some function.
  52221. [heading Parameters]
  52222. [variablelist
  52223. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  52224. [[buffers][The dynamic buffer sequence into which the data will be read.]]
  52225. [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
  52226. ``
  52227. std::size_t completion_condition(
  52228. // Result of latest read_some operation.
  52229. const boost::system::error_code& error,
  52230. // Number of bytes transferred so far.
  52231. std::size_t bytes_transferred
  52232. );
  52233. ``
  52234. A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's read\_some function.]]
  52235. ]
  52236. [heading Return Value]
  52237. The number of bytes transferred.
  52238. [heading Exceptions]
  52239. [variablelist
  52240. [[boost::system::system_error][Thrown on failure. ]]
  52241. ]
  52242. [endsect]
  52243. [section:overload16 read (16 of 16 overloads)]
  52244. Attempt to read a certain amount of data from a stream before returning.
  52245. template<
  52246. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52247. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
  52248. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  52249. std::size_t read(
  52250. SyncReadStream & s,
  52251. DynamicBuffer_v2 buffers,
  52252. CompletionCondition completion_condition,
  52253. boost::system::error_code & ec,
  52254. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  52255. This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
  52256. * The specified dynamic buffer sequence is full (that is, it has reached maximum size).
  52257. * The completion\_condition function object returns 0.
  52258. This operation is implemented in terms of zero or more calls to the stream's read\_some function.
  52259. [heading Parameters]
  52260. [variablelist
  52261. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  52262. [[buffers][The dynamic buffer sequence into which the data will be read.]]
  52263. [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
  52264. ``
  52265. std::size_t completion_condition(
  52266. // Result of latest read_some operation.
  52267. const boost::system::error_code& error,
  52268. // Number of bytes transferred so far.
  52269. std::size_t bytes_transferred
  52270. );
  52271. ``
  52272. A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's read\_some function.]]
  52273. [[ec][Set to indicate what error occurred, if any.]]
  52274. ]
  52275. [heading Return Value]
  52276. The number of bytes read. If an error occurs, returns the total number of bytes successfully transferred prior to the error.
  52277. [endsect]
  52278. [endsect]
  52279. [section:read_at read_at]
  52280. [indexterm1 boost_asio.indexterm.read_at..read_at]
  52281. The `read_at` function is a composed operation that reads a certain amount of data at the specified offset before returning.
  52282. Attempt to read a certain amount of data at the specified offset before returning.
  52283. template<
  52284. typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
  52285. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  52286. std::size_t ``[link boost_asio.reference.read_at.overload1 read_at]``(
  52287. SyncRandomAccessReadDevice & d,
  52288. uint64_t offset,
  52289. const MutableBufferSequence & buffers);
  52290. `` [''''&raquo;''' [link boost_asio.reference.read_at.overload1 more...]]``
  52291. template<
  52292. typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
  52293. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  52294. std::size_t ``[link boost_asio.reference.read_at.overload2 read_at]``(
  52295. SyncRandomAccessReadDevice & d,
  52296. uint64_t offset,
  52297. const MutableBufferSequence & buffers,
  52298. boost::system::error_code & ec);
  52299. `` [''''&raquo;''' [link boost_asio.reference.read_at.overload2 more...]]``
  52300. template<
  52301. typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
  52302. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  52303. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  52304. std::size_t ``[link boost_asio.reference.read_at.overload3 read_at]``(
  52305. SyncRandomAccessReadDevice & d,
  52306. uint64_t offset,
  52307. const MutableBufferSequence & buffers,
  52308. CompletionCondition completion_condition);
  52309. `` [''''&raquo;''' [link boost_asio.reference.read_at.overload3 more...]]``
  52310. template<
  52311. typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
  52312. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  52313. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  52314. std::size_t ``[link boost_asio.reference.read_at.overload4 read_at]``(
  52315. SyncRandomAccessReadDevice & d,
  52316. uint64_t offset,
  52317. const MutableBufferSequence & buffers,
  52318. CompletionCondition completion_condition,
  52319. boost::system::error_code & ec);
  52320. `` [''''&raquo;''' [link boost_asio.reference.read_at.overload4 more...]]``
  52321. template<
  52322. typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
  52323. typename Allocator>
  52324. std::size_t ``[link boost_asio.reference.read_at.overload5 read_at]``(
  52325. SyncRandomAccessReadDevice & d,
  52326. uint64_t offset,
  52327. basic_streambuf< Allocator > & b);
  52328. `` [''''&raquo;''' [link boost_asio.reference.read_at.overload5 more...]]``
  52329. template<
  52330. typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
  52331. typename Allocator>
  52332. std::size_t ``[link boost_asio.reference.read_at.overload6 read_at]``(
  52333. SyncRandomAccessReadDevice & d,
  52334. uint64_t offset,
  52335. basic_streambuf< Allocator > & b,
  52336. boost::system::error_code & ec);
  52337. `` [''''&raquo;''' [link boost_asio.reference.read_at.overload6 more...]]``
  52338. template<
  52339. typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
  52340. typename Allocator,
  52341. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  52342. std::size_t ``[link boost_asio.reference.read_at.overload7 read_at]``(
  52343. SyncRandomAccessReadDevice & d,
  52344. uint64_t offset,
  52345. basic_streambuf< Allocator > & b,
  52346. CompletionCondition completion_condition);
  52347. `` [''''&raquo;''' [link boost_asio.reference.read_at.overload7 more...]]``
  52348. template<
  52349. typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
  52350. typename Allocator,
  52351. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  52352. std::size_t ``[link boost_asio.reference.read_at.overload8 read_at]``(
  52353. SyncRandomAccessReadDevice & d,
  52354. uint64_t offset,
  52355. basic_streambuf< Allocator > & b,
  52356. CompletionCondition completion_condition,
  52357. boost::system::error_code & ec);
  52358. `` [''''&raquo;''' [link boost_asio.reference.read_at.overload8 more...]]``
  52359. [heading Requirements]
  52360. ['Header: ][^boost/asio/read_at.hpp]
  52361. ['Convenience header: ][^boost/asio.hpp]
  52362. [section:overload1 read_at (1 of 8 overloads)]
  52363. Attempt to read a certain amount of data at the specified offset before returning.
  52364. template<
  52365. typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
  52366. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  52367. std::size_t read_at(
  52368. SyncRandomAccessReadDevice & d,
  52369. uint64_t offset,
  52370. const MutableBufferSequence & buffers);
  52371. This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
  52372. * The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
  52373. * An error occurred.
  52374. This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
  52375. [heading Parameters]
  52376. [variablelist
  52377. [[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
  52378. [[offset][The offset at which the data will be read.]]
  52379. [[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.]]
  52380. ]
  52381. [heading Return Value]
  52382. The number of bytes transferred.
  52383. [heading Exceptions]
  52384. [variablelist
  52385. [[boost::system::system_error][Thrown on failure.]]
  52386. ]
  52387. [heading Example]
  52388. To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  52389. boost::asio::read_at(d, 42, boost::asio::buffer(data, size));
  52390. See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  52391. [heading Remarks]
  52392. This overload is equivalent to calling:
  52393. boost::asio::read_at(
  52394. d, 42, buffers,
  52395. boost::asio::transfer_all());
  52396. [endsect]
  52397. [section:overload2 read_at (2 of 8 overloads)]
  52398. Attempt to read a certain amount of data at the specified offset before returning.
  52399. template<
  52400. typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
  52401. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  52402. std::size_t read_at(
  52403. SyncRandomAccessReadDevice & d,
  52404. uint64_t offset,
  52405. const MutableBufferSequence & buffers,
  52406. boost::system::error_code & ec);
  52407. This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
  52408. * The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
  52409. * An error occurred.
  52410. This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
  52411. [heading Parameters]
  52412. [variablelist
  52413. [[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
  52414. [[offset][The offset at which the data will be read.]]
  52415. [[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.]]
  52416. [[ec][Set to indicate what error occurred, if any.]]
  52417. ]
  52418. [heading Return Value]
  52419. The number of bytes transferred.
  52420. [heading Example]
  52421. To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  52422. boost::asio::read_at(d, 42,
  52423. boost::asio::buffer(data, size), ec);
  52424. See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  52425. [heading Remarks]
  52426. This overload is equivalent to calling:
  52427. boost::asio::read_at(
  52428. d, 42, buffers,
  52429. boost::asio::transfer_all(), ec);
  52430. [endsect]
  52431. [section:overload3 read_at (3 of 8 overloads)]
  52432. Attempt to read a certain amount of data at the specified offset before returning.
  52433. template<
  52434. typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
  52435. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  52436. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  52437. std::size_t read_at(
  52438. SyncRandomAccessReadDevice & d,
  52439. uint64_t offset,
  52440. const MutableBufferSequence & buffers,
  52441. CompletionCondition completion_condition);
  52442. This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
  52443. * The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
  52444. * The completion\_condition function object returns 0.
  52445. This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
  52446. [heading Parameters]
  52447. [variablelist
  52448. [[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
  52449. [[offset][The offset at which the data will be read.]]
  52450. [[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.]]
  52451. [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
  52452. ``
  52453. std::size_t completion_condition(
  52454. // Result of latest read_some_at operation.
  52455. const boost::system::error_code& error,
  52456. // Number of bytes transferred so far.
  52457. std::size_t bytes_transferred
  52458. );
  52459. ``
  52460. A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the device's read\_some\_at function.]]
  52461. ]
  52462. [heading Return Value]
  52463. The number of bytes transferred.
  52464. [heading Exceptions]
  52465. [variablelist
  52466. [[boost::system::system_error][Thrown on failure.]]
  52467. ]
  52468. [heading Example]
  52469. To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  52470. boost::asio::read_at(d, 42, boost::asio::buffer(data, size),
  52471. boost::asio::transfer_at_least(32));
  52472. See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  52473. [endsect]
  52474. [section:overload4 read_at (4 of 8 overloads)]
  52475. Attempt to read a certain amount of data at the specified offset before returning.
  52476. template<
  52477. typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
  52478. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  52479. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  52480. std::size_t read_at(
  52481. SyncRandomAccessReadDevice & d,
  52482. uint64_t offset,
  52483. const MutableBufferSequence & buffers,
  52484. CompletionCondition completion_condition,
  52485. boost::system::error_code & ec);
  52486. This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
  52487. * The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
  52488. * The completion\_condition function object returns 0.
  52489. This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
  52490. [heading Parameters]
  52491. [variablelist
  52492. [[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
  52493. [[offset][The offset at which the data will be read.]]
  52494. [[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.]]
  52495. [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
  52496. ``
  52497. std::size_t completion_condition(
  52498. // Result of latest read_some_at operation.
  52499. const boost::system::error_code& error,
  52500. // Number of bytes transferred so far.
  52501. std::size_t bytes_transferred
  52502. );
  52503. ``
  52504. A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the device's read\_some\_at function.]]
  52505. [[ec][Set to indicate what error occurred, if any.]]
  52506. ]
  52507. [heading Return Value]
  52508. The number of bytes read. If an error occurs, returns the total number of bytes successfully transferred prior to the error.
  52509. [endsect]
  52510. [section:overload5 read_at (5 of 8 overloads)]
  52511. Attempt to read a certain amount of data at the specified offset before returning.
  52512. template<
  52513. typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
  52514. typename Allocator>
  52515. std::size_t read_at(
  52516. SyncRandomAccessReadDevice & d,
  52517. uint64_t offset,
  52518. basic_streambuf< Allocator > & b);
  52519. This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
  52520. * An error occurred.
  52521. This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
  52522. [heading Parameters]
  52523. [variablelist
  52524. [[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
  52525. [[offset][The offset at which the data will be read.]]
  52526. [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
  52527. ]
  52528. [heading Return Value]
  52529. The number of bytes transferred.
  52530. [heading Exceptions]
  52531. [variablelist
  52532. [[boost::system::system_error][Thrown on failure.]]
  52533. ]
  52534. [heading Remarks]
  52535. This overload is equivalent to calling:
  52536. boost::asio::read_at(
  52537. d, 42, b,
  52538. boost::asio::transfer_all());
  52539. [endsect]
  52540. [section:overload6 read_at (6 of 8 overloads)]
  52541. Attempt to read a certain amount of data at the specified offset before returning.
  52542. template<
  52543. typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
  52544. typename Allocator>
  52545. std::size_t read_at(
  52546. SyncRandomAccessReadDevice & d,
  52547. uint64_t offset,
  52548. basic_streambuf< Allocator > & b,
  52549. boost::system::error_code & ec);
  52550. This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
  52551. * An error occurred.
  52552. This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
  52553. [heading Parameters]
  52554. [variablelist
  52555. [[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
  52556. [[offset][The offset at which the data will be read.]]
  52557. [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
  52558. [[ec][Set to indicate what error occurred, if any.]]
  52559. ]
  52560. [heading Return Value]
  52561. The number of bytes transferred.
  52562. [heading Remarks]
  52563. This overload is equivalent to calling:
  52564. boost::asio::read_at(
  52565. d, 42, b,
  52566. boost::asio::transfer_all(), ec);
  52567. [endsect]
  52568. [section:overload7 read_at (7 of 8 overloads)]
  52569. Attempt to read a certain amount of data at the specified offset before returning.
  52570. template<
  52571. typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
  52572. typename Allocator,
  52573. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  52574. std::size_t read_at(
  52575. SyncRandomAccessReadDevice & d,
  52576. uint64_t offset,
  52577. basic_streambuf< Allocator > & b,
  52578. CompletionCondition completion_condition);
  52579. This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
  52580. * The completion\_condition function object returns 0.
  52581. This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
  52582. [heading Parameters]
  52583. [variablelist
  52584. [[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
  52585. [[offset][The offset at which the data will be read.]]
  52586. [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
  52587. [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
  52588. ``
  52589. std::size_t completion_condition(
  52590. // Result of latest read_some_at operation.
  52591. const boost::system::error_code& error,
  52592. // Number of bytes transferred so far.
  52593. std::size_t bytes_transferred
  52594. );
  52595. ``
  52596. A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the device's read\_some\_at function.]]
  52597. ]
  52598. [heading Return Value]
  52599. The number of bytes transferred.
  52600. [heading Exceptions]
  52601. [variablelist
  52602. [[boost::system::system_error][Thrown on failure. ]]
  52603. ]
  52604. [endsect]
  52605. [section:overload8 read_at (8 of 8 overloads)]
  52606. Attempt to read a certain amount of data at the specified offset before returning.
  52607. template<
  52608. typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
  52609. typename Allocator,
  52610. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  52611. std::size_t read_at(
  52612. SyncRandomAccessReadDevice & d,
  52613. uint64_t offset,
  52614. basic_streambuf< Allocator > & b,
  52615. CompletionCondition completion_condition,
  52616. boost::system::error_code & ec);
  52617. This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
  52618. * The completion\_condition function object returns 0.
  52619. This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
  52620. [heading Parameters]
  52621. [variablelist
  52622. [[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
  52623. [[offset][The offset at which the data will be read.]]
  52624. [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
  52625. [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
  52626. ``
  52627. std::size_t completion_condition(
  52628. // Result of latest read_some_at operation.
  52629. const boost::system::error_code& error,
  52630. // Number of bytes transferred so far.
  52631. std::size_t bytes_transferred
  52632. );
  52633. ``
  52634. A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the device's read\_some\_at function.]]
  52635. [[ec][Set to indicate what error occurred, if any.]]
  52636. ]
  52637. [heading Return Value]
  52638. The number of bytes read. If an error occurs, returns the total number of bytes successfully transferred prior to the error.
  52639. [endsect]
  52640. [endsect]
  52641. [section:read_until read_until]
  52642. [indexterm1 boost_asio.indexterm.read_until..read_until]
  52643. The `read_until` function is a composed operation that reads data into a dynamic buffer sequence, or into a streambuf, until it contains a delimiter, matches a regular expression, or a function object indicates a match.
  52644. Read data into a dynamic buffer sequence until it contains a specified delimiter.
  52645. template<
  52646. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52647. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
  52648. std::size_t ``[link boost_asio.reference.read_until.overload1 read_until]``(
  52649. SyncReadStream & s,
  52650. DynamicBuffer_v1 && buffers,
  52651. char delim,
  52652. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  52653. `` [''''&raquo;''' [link boost_asio.reference.read_until.overload1 more...]]``
  52654. template<
  52655. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52656. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
  52657. std::size_t ``[link boost_asio.reference.read_until.overload2 read_until]``(
  52658. SyncReadStream & s,
  52659. DynamicBuffer_v1 && buffers,
  52660. char delim,
  52661. boost::system::error_code & ec,
  52662. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  52663. `` [''''&raquo;''' [link boost_asio.reference.read_until.overload2 more...]]``
  52664. template<
  52665. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52666. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
  52667. std::size_t ``[link boost_asio.reference.read_until.overload3 read_until]``(
  52668. SyncReadStream & s,
  52669. DynamicBuffer_v1 && buffers,
  52670. string_view delim,
  52671. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  52672. `` [''''&raquo;''' [link boost_asio.reference.read_until.overload3 more...]]``
  52673. template<
  52674. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52675. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
  52676. std::size_t ``[link boost_asio.reference.read_until.overload4 read_until]``(
  52677. SyncReadStream & s,
  52678. DynamicBuffer_v1 && buffers,
  52679. string_view delim,
  52680. boost::system::error_code & ec,
  52681. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  52682. `` [''''&raquo;''' [link boost_asio.reference.read_until.overload4 more...]]``
  52683. Read data into a dynamic buffer sequence until some part of the data it contains matches a regular expression.
  52684. template<
  52685. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52686. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
  52687. std::size_t ``[link boost_asio.reference.read_until.overload5 read_until]``(
  52688. SyncReadStream & s,
  52689. DynamicBuffer_v1 && buffers,
  52690. const boost::regex & expr,
  52691. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  52692. `` [''''&raquo;''' [link boost_asio.reference.read_until.overload5 more...]]``
  52693. template<
  52694. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52695. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
  52696. std::size_t ``[link boost_asio.reference.read_until.overload6 read_until]``(
  52697. SyncReadStream & s,
  52698. DynamicBuffer_v1 && buffers,
  52699. const boost::regex & expr,
  52700. boost::system::error_code & ec,
  52701. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  52702. `` [''''&raquo;''' [link boost_asio.reference.read_until.overload6 more...]]``
  52703. Read data into a dynamic buffer sequence until a function object indicates a match.
  52704. template<
  52705. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52706. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
  52707. typename MatchCondition>
  52708. std::size_t ``[link boost_asio.reference.read_until.overload7 read_until]``(
  52709. SyncReadStream & s,
  52710. DynamicBuffer_v1 && buffers,
  52711. MatchCondition match_condition,
  52712. typename enable_if< is_match_condition< MatchCondition >::value &&is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  52713. `` [''''&raquo;''' [link boost_asio.reference.read_until.overload7 more...]]``
  52714. template<
  52715. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52716. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
  52717. typename MatchCondition>
  52718. std::size_t ``[link boost_asio.reference.read_until.overload8 read_until]``(
  52719. SyncReadStream & s,
  52720. DynamicBuffer_v1 && buffers,
  52721. MatchCondition match_condition,
  52722. boost::system::error_code & ec,
  52723. typename enable_if< is_match_condition< MatchCondition >::value &&is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  52724. `` [''''&raquo;''' [link boost_asio.reference.read_until.overload8 more...]]``
  52725. Read data into a streambuf until it contains a specified delimiter.
  52726. template<
  52727. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52728. typename Allocator>
  52729. std::size_t ``[link boost_asio.reference.read_until.overload9 read_until]``(
  52730. SyncReadStream & s,
  52731. boost::asio::basic_streambuf< Allocator > & b,
  52732. char delim);
  52733. `` [''''&raquo;''' [link boost_asio.reference.read_until.overload9 more...]]``
  52734. template<
  52735. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52736. typename Allocator>
  52737. std::size_t ``[link boost_asio.reference.read_until.overload10 read_until]``(
  52738. SyncReadStream & s,
  52739. boost::asio::basic_streambuf< Allocator > & b,
  52740. char delim,
  52741. boost::system::error_code & ec);
  52742. `` [''''&raquo;''' [link boost_asio.reference.read_until.overload10 more...]]``
  52743. template<
  52744. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52745. typename Allocator>
  52746. std::size_t ``[link boost_asio.reference.read_until.overload11 read_until]``(
  52747. SyncReadStream & s,
  52748. boost::asio::basic_streambuf< Allocator > & b,
  52749. string_view delim);
  52750. `` [''''&raquo;''' [link boost_asio.reference.read_until.overload11 more...]]``
  52751. template<
  52752. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52753. typename Allocator>
  52754. std::size_t ``[link boost_asio.reference.read_until.overload12 read_until]``(
  52755. SyncReadStream & s,
  52756. boost::asio::basic_streambuf< Allocator > & b,
  52757. string_view delim,
  52758. boost::system::error_code & ec);
  52759. `` [''''&raquo;''' [link boost_asio.reference.read_until.overload12 more...]]``
  52760. Read data into a streambuf until some part of the data it contains matches a regular expression.
  52761. template<
  52762. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52763. typename Allocator>
  52764. std::size_t ``[link boost_asio.reference.read_until.overload13 read_until]``(
  52765. SyncReadStream & s,
  52766. boost::asio::basic_streambuf< Allocator > & b,
  52767. const boost::regex & expr);
  52768. `` [''''&raquo;''' [link boost_asio.reference.read_until.overload13 more...]]``
  52769. template<
  52770. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52771. typename Allocator>
  52772. std::size_t ``[link boost_asio.reference.read_until.overload14 read_until]``(
  52773. SyncReadStream & s,
  52774. boost::asio::basic_streambuf< Allocator > & b,
  52775. const boost::regex & expr,
  52776. boost::system::error_code & ec);
  52777. `` [''''&raquo;''' [link boost_asio.reference.read_until.overload14 more...]]``
  52778. Read data into a streambuf until a function object indicates a match.
  52779. template<
  52780. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52781. typename Allocator,
  52782. typename MatchCondition>
  52783. std::size_t ``[link boost_asio.reference.read_until.overload15 read_until]``(
  52784. SyncReadStream & s,
  52785. boost::asio::basic_streambuf< Allocator > & b,
  52786. MatchCondition match_condition,
  52787. typename enable_if< is_match_condition< MatchCondition >::value >::type * = 0);
  52788. `` [''''&raquo;''' [link boost_asio.reference.read_until.overload15 more...]]``
  52789. template<
  52790. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52791. typename Allocator,
  52792. typename MatchCondition>
  52793. std::size_t ``[link boost_asio.reference.read_until.overload16 read_until]``(
  52794. SyncReadStream & s,
  52795. boost::asio::basic_streambuf< Allocator > & b,
  52796. MatchCondition match_condition,
  52797. boost::system::error_code & ec,
  52798. typename enable_if< is_match_condition< MatchCondition >::value >::type * = 0);
  52799. `` [''''&raquo;''' [link boost_asio.reference.read_until.overload16 more...]]``
  52800. Read data into a dynamic buffer sequence until it contains a specified delimiter.
  52801. template<
  52802. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52803. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
  52804. std::size_t ``[link boost_asio.reference.read_until.overload17 read_until]``(
  52805. SyncReadStream & s,
  52806. DynamicBuffer_v2 buffers,
  52807. char delim,
  52808. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  52809. `` [''''&raquo;''' [link boost_asio.reference.read_until.overload17 more...]]``
  52810. template<
  52811. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52812. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
  52813. std::size_t ``[link boost_asio.reference.read_until.overload18 read_until]``(
  52814. SyncReadStream & s,
  52815. DynamicBuffer_v2 buffers,
  52816. char delim,
  52817. boost::system::error_code & ec,
  52818. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  52819. `` [''''&raquo;''' [link boost_asio.reference.read_until.overload18 more...]]``
  52820. template<
  52821. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52822. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
  52823. std::size_t ``[link boost_asio.reference.read_until.overload19 read_until]``(
  52824. SyncReadStream & s,
  52825. DynamicBuffer_v2 buffers,
  52826. string_view delim,
  52827. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  52828. `` [''''&raquo;''' [link boost_asio.reference.read_until.overload19 more...]]``
  52829. template<
  52830. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52831. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
  52832. std::size_t ``[link boost_asio.reference.read_until.overload20 read_until]``(
  52833. SyncReadStream & s,
  52834. DynamicBuffer_v2 buffers,
  52835. string_view delim,
  52836. boost::system::error_code & ec,
  52837. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  52838. `` [''''&raquo;''' [link boost_asio.reference.read_until.overload20 more...]]``
  52839. Read data into a dynamic buffer sequence until some part of the data it contains matches a regular expression.
  52840. template<
  52841. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52842. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
  52843. std::size_t ``[link boost_asio.reference.read_until.overload21 read_until]``(
  52844. SyncReadStream & s,
  52845. DynamicBuffer_v2 buffers,
  52846. const boost::regex & expr,
  52847. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  52848. `` [''''&raquo;''' [link boost_asio.reference.read_until.overload21 more...]]``
  52849. template<
  52850. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52851. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
  52852. std::size_t ``[link boost_asio.reference.read_until.overload22 read_until]``(
  52853. SyncReadStream & s,
  52854. DynamicBuffer_v2 buffers,
  52855. const boost::regex & expr,
  52856. boost::system::error_code & ec,
  52857. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  52858. `` [''''&raquo;''' [link boost_asio.reference.read_until.overload22 more...]]``
  52859. Read data into a dynamic buffer sequence until a function object indicates a match.
  52860. template<
  52861. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52862. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
  52863. typename MatchCondition>
  52864. std::size_t ``[link boost_asio.reference.read_until.overload23 read_until]``(
  52865. SyncReadStream & s,
  52866. DynamicBuffer_v2 buffers,
  52867. MatchCondition match_condition,
  52868. typename enable_if< is_match_condition< MatchCondition >::value &&is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  52869. `` [''''&raquo;''' [link boost_asio.reference.read_until.overload23 more...]]``
  52870. template<
  52871. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52872. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
  52873. typename MatchCondition>
  52874. std::size_t ``[link boost_asio.reference.read_until.overload24 read_until]``(
  52875. SyncReadStream & s,
  52876. DynamicBuffer_v2 buffers,
  52877. MatchCondition match_condition,
  52878. boost::system::error_code & ec,
  52879. typename enable_if< is_match_condition< MatchCondition >::value &&is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  52880. `` [''''&raquo;''' [link boost_asio.reference.read_until.overload24 more...]]``
  52881. [heading Requirements]
  52882. ['Header: ][^boost/asio/read_until.hpp]
  52883. ['Convenience header: ][^boost/asio.hpp]
  52884. [section:overload1 read_until (1 of 24 overloads)]
  52885. Read data into a dynamic buffer sequence until it contains a specified delimiter.
  52886. template<
  52887. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52888. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
  52889. std::size_t read_until(
  52890. SyncReadStream & s,
  52891. DynamicBuffer_v1 && buffers,
  52892. char delim,
  52893. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  52894. This function is used to read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains the specified delimiter. The call will block until one of the following conditions is true:
  52895. * The get area of the dynamic buffer sequence contains the specified delimiter.
  52896. * An error occurred.
  52897. This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the dynamic buffer sequence's get area already contains the delimiter, the function returns immediately.
  52898. [heading Parameters]
  52899. [variablelist
  52900. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  52901. [[buffers][The dynamic buffer sequence into which the data will be read.]]
  52902. [[delim][The delimiter character.]]
  52903. ]
  52904. [heading Return Value]
  52905. The number of bytes in the dynamic buffer sequence's get area up to and including the delimiter.
  52906. [heading Exceptions]
  52907. [variablelist
  52908. [[boost::system::system_error][Thrown on failure.]]
  52909. ]
  52910. [heading Remarks]
  52911. After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond the delimiter. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine.
  52912. [heading Example]
  52913. To read data into a `std::string` until a newline is encountered:
  52914. std::string data;
  52915. std::string n = boost::asio::read_until(s,
  52916. boost::asio::dynamic_buffer(data), '\n');
  52917. std::string line = data.substr(0, n);
  52918. data.erase(0, n);
  52919. After the `read_until` operation completes successfully, the string `data` contains the delimiter:
  52920. { 'a', 'b', ..., 'c', '\n', 'd', 'e', ... }
  52921. The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains:
  52922. { 'a', 'b', ..., 'c', '\n' }
  52923. After the call to `erase`, the remaining data is left in the buffer `b` as follows:
  52924. { 'd', 'e', ... }
  52925. This data may be the start of a new line, to be extracted by a subsequent `read_until` operation.
  52926. [endsect]
  52927. [section:overload2 read_until (2 of 24 overloads)]
  52928. Read data into a dynamic buffer sequence until it contains a specified delimiter.
  52929. template<
  52930. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52931. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
  52932. std::size_t read_until(
  52933. SyncReadStream & s,
  52934. DynamicBuffer_v1 && buffers,
  52935. char delim,
  52936. boost::system::error_code & ec,
  52937. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  52938. This function is used to read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains the specified delimiter. The call will block until one of the following conditions is true:
  52939. * The get area of the dynamic buffer sequence contains the specified delimiter.
  52940. * An error occurred.
  52941. This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the dynamic buffer sequence's get area already contains the delimiter, the function returns immediately.
  52942. [heading Parameters]
  52943. [variablelist
  52944. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  52945. [[buffers][The dynamic buffer sequence into which the data will be read.]]
  52946. [[delim][The delimiter character.]]
  52947. [[ec][Set to indicate what error occurred, if any.]]
  52948. ]
  52949. [heading Return Value]
  52950. The number of bytes in the dynamic buffer sequence's get area up to and including the delimiter. Returns 0 if an error occurred.
  52951. [heading Remarks]
  52952. After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond the delimiter. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine.
  52953. [endsect]
  52954. [section:overload3 read_until (3 of 24 overloads)]
  52955. Read data into a dynamic buffer sequence until it contains a specified delimiter.
  52956. template<
  52957. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52958. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
  52959. std::size_t read_until(
  52960. SyncReadStream & s,
  52961. DynamicBuffer_v1 && buffers,
  52962. string_view delim,
  52963. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  52964. This function is used to read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains the specified delimiter. The call will block until one of the following conditions is true:
  52965. * The get area of the dynamic buffer sequence contains the specified delimiter.
  52966. * An error occurred.
  52967. This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the dynamic buffer sequence's get area already contains the delimiter, the function returns immediately.
  52968. [heading Parameters]
  52969. [variablelist
  52970. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  52971. [[buffers][The dynamic buffer sequence into which the data will be read.]]
  52972. [[delim][The delimiter string.]]
  52973. ]
  52974. [heading Return Value]
  52975. The number of bytes in the dynamic buffer sequence's get area up to and including the delimiter.
  52976. [heading Remarks]
  52977. After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond the delimiter. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine.
  52978. [heading Example]
  52979. To read data into a `std::string` until a CR-LF sequence is encountered:
  52980. std::string data;
  52981. std::string n = boost::asio::read_until(s,
  52982. boost::asio::dynamic_buffer(data), "\r\n");
  52983. std::string line = data.substr(0, n);
  52984. data.erase(0, n);
  52985. After the `read_until` operation completes successfully, the string `data` contains the delimiter:
  52986. { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... }
  52987. The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains:
  52988. { 'a', 'b', ..., 'c', '\r', '\n' }
  52989. After the call to `erase`, the remaining data is left in the buffer `b` as follows:
  52990. { 'd', 'e', ... }
  52991. This data may be the start of a new line, to be extracted by a subsequent `read_until` operation.
  52992. [endsect]
  52993. [section:overload4 read_until (4 of 24 overloads)]
  52994. Read data into a dynamic buffer sequence until it contains a specified delimiter.
  52995. template<
  52996. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  52997. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
  52998. std::size_t read_until(
  52999. SyncReadStream & s,
  53000. DynamicBuffer_v1 && buffers,
  53001. string_view delim,
  53002. boost::system::error_code & ec,
  53003. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  53004. This function is used to read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains the specified delimiter. The call will block until one of the following conditions is true:
  53005. * The get area of the dynamic buffer sequence contains the specified delimiter.
  53006. * An error occurred.
  53007. This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the dynamic buffer sequence's get area already contains the delimiter, the function returns immediately.
  53008. [heading Parameters]
  53009. [variablelist
  53010. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  53011. [[buffers][The dynamic buffer sequence into which the data will be read.]]
  53012. [[delim][The delimiter string.]]
  53013. [[ec][Set to indicate what error occurred, if any.]]
  53014. ]
  53015. [heading Return Value]
  53016. The number of bytes in the dynamic buffer sequence's get area up to and including the delimiter. Returns 0 if an error occurred.
  53017. [heading Remarks]
  53018. After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond the delimiter. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine.
  53019. [endsect]
  53020. [section:overload5 read_until (5 of 24 overloads)]
  53021. Read data into a dynamic buffer sequence until some part of the data it contains matches a regular expression.
  53022. template<
  53023. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  53024. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
  53025. std::size_t read_until(
  53026. SyncReadStream & s,
  53027. DynamicBuffer_v1 && buffers,
  53028. const boost::regex & expr,
  53029. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  53030. This function is used to read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains some data that matches a regular expression. The call will block until one of the following conditions is true:
  53031. * A substring of the dynamic buffer sequence's get area matches the regular expression.
  53032. * An error occurred.
  53033. This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the dynamic buffer sequence's get area already contains data that matches the regular expression, the function returns immediately.
  53034. [heading Parameters]
  53035. [variablelist
  53036. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  53037. [[buffers][A dynamic buffer sequence into which the data will be read.]]
  53038. [[expr][The regular expression.]]
  53039. ]
  53040. [heading Return Value]
  53041. The number of bytes in the dynamic buffer sequence's get area up to and including the substring that matches the regular expression.
  53042. [heading Exceptions]
  53043. [variablelist
  53044. [[boost::system::system_error][Thrown on failure.]]
  53045. ]
  53046. [heading Remarks]
  53047. After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond that which matched the regular expression. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine.
  53048. [heading Example]
  53049. To read data into a `std::string` until a CR-LF sequence is encountered:
  53050. std::string data;
  53051. std::string n = boost::asio::read_until(s,
  53052. boost::asio::dynamic_buffer(data), boost::regex("\r\n"));
  53053. std::string line = data.substr(0, n);
  53054. data.erase(0, n);
  53055. After the `read_until` operation completes successfully, the string `data` contains the delimiter:
  53056. { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... }
  53057. The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains:
  53058. { 'a', 'b', ..., 'c', '\r', '\n' }
  53059. After the call to `erase`, the remaining data is left in the buffer `b` as follows:
  53060. { 'd', 'e', ... }
  53061. This data may be the start of a new line, to be extracted by a subsequent `read_until` operation.
  53062. [endsect]
  53063. [section:overload6 read_until (6 of 24 overloads)]
  53064. Read data into a dynamic buffer sequence until some part of the data it contains matches a regular expression.
  53065. template<
  53066. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  53067. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
  53068. std::size_t read_until(
  53069. SyncReadStream & s,
  53070. DynamicBuffer_v1 && buffers,
  53071. const boost::regex & expr,
  53072. boost::system::error_code & ec,
  53073. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  53074. This function is used to read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains some data that matches a regular expression. The call will block until one of the following conditions is true:
  53075. * A substring of the dynamic buffer sequence's get area matches the regular expression.
  53076. * An error occurred.
  53077. This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the dynamic buffer sequence's get area already contains data that matches the regular expression, the function returns immediately.
  53078. [heading Parameters]
  53079. [variablelist
  53080. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  53081. [[buffers][A dynamic buffer sequence into which the data will be read.]]
  53082. [[expr][The regular expression.]]
  53083. [[ec][Set to indicate what error occurred, if any.]]
  53084. ]
  53085. [heading Return Value]
  53086. The number of bytes in the dynamic buffer sequence's get area up to and including the substring that matches the regular expression. Returns 0 if an error occurred.
  53087. [heading Remarks]
  53088. After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond that which matched the regular expression. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine.
  53089. [endsect]
  53090. [section:overload7 read_until (7 of 24 overloads)]
  53091. Read data into a dynamic buffer sequence until a function object indicates a match.
  53092. template<
  53093. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  53094. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
  53095. typename MatchCondition>
  53096. std::size_t read_until(
  53097. SyncReadStream & s,
  53098. DynamicBuffer_v1 && buffers,
  53099. MatchCondition match_condition,
  53100. typename enable_if< is_match_condition< MatchCondition >::value &&is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  53101. This function is used to read data into the specified dynamic buffer sequence until a user-defined match condition function object, when applied to the data contained in the dynamic buffer sequence, indicates a successful match. The call will block until one of the following conditions is true:
  53102. * The match condition function object returns a std::pair where the second element evaluates to true.
  53103. * An error occurred.
  53104. This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the match condition function object already indicates a match, the function returns immediately.
  53105. [heading Parameters]
  53106. [variablelist
  53107. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  53108. [[buffers][A dynamic buffer sequence into which the data will be read.]]
  53109. [[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be:
  53110. ``
  53111. pair<iterator, bool> match_condition(iterator begin, iterator end);
  53112. ``
  53113. where `iterator` represents the type:
  53114. ``
  53115. buffers_iterator<typename DynamicBuffer_v1::const_buffers_type>
  53116. ``
  53117. The iterator parameters `begin` and `end` define the range of bytes to be scanned to determine whether there is a match. The `first` member of the return value is an iterator marking one-past-the-end of the bytes that have been consumed by the match function. This iterator is used to calculate the `begin` parameter for any subsequent invocation of the match condition. The `second` member of the return value is true if a match has been found, false otherwise.]]
  53118. ]
  53119. [heading Return Value]
  53120. The number of bytes in the dynamic\_buffer's get area that have been fully consumed by the match function.
  53121. [heading Exceptions]
  53122. [variablelist
  53123. [[boost::system::system_error][Thrown on failure.]]
  53124. ]
  53125. [heading Remarks]
  53126. After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond that which matched the function object. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine.
  53127. The default implementation of the `is_match_condition` type trait evaluates to true for function pointers and function objects with a `result_type` typedef. It must be specialised for other user-defined function objects.
  53128. [heading Examples]
  53129. To read data into a dynamic buffer sequence until whitespace is encountered:
  53130. typedef boost::asio::buffers_iterator<
  53131. boost::asio::const_buffers_1> iterator;
  53132. std::pair<iterator, bool>
  53133. match_whitespace(iterator begin, iterator end)
  53134. {
  53135. iterator i = begin;
  53136. while (i != end)
  53137. if (std::isspace(*i++))
  53138. return std::make_pair(i, true);
  53139. return std::make_pair(i, false);
  53140. }
  53141. ...
  53142. std::string data;
  53143. boost::asio::read_until(s, data, match_whitespace);
  53144. To read data into a `std::string` until a matching character is found:
  53145. class match_char
  53146. {
  53147. public:
  53148. explicit match_char(char c) : c_(c) {}
  53149. template <typename Iterator>
  53150. std::pair<Iterator, bool> operator()(
  53151. Iterator begin, Iterator end) const
  53152. {
  53153. Iterator i = begin;
  53154. while (i != end)
  53155. if (c_ == *i++)
  53156. return std::make_pair(i, true);
  53157. return std::make_pair(i, false);
  53158. }
  53159. private:
  53160. char c_;
  53161. };
  53162. namespace asio {
  53163. template <> struct is_match_condition<match_char>
  53164. : public boost::true_type {};
  53165. } // namespace asio
  53166. ...
  53167. std::string data;
  53168. boost::asio::read_until(s, data, match_char('a'));
  53169. [endsect]
  53170. [section:overload8 read_until (8 of 24 overloads)]
  53171. Read data into a dynamic buffer sequence until a function object indicates a match.
  53172. template<
  53173. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  53174. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
  53175. typename MatchCondition>
  53176. std::size_t read_until(
  53177. SyncReadStream & s,
  53178. DynamicBuffer_v1 && buffers,
  53179. MatchCondition match_condition,
  53180. boost::system::error_code & ec,
  53181. typename enable_if< is_match_condition< MatchCondition >::value &&is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  53182. This function is used to read data into the specified dynamic buffer sequence until a user-defined match condition function object, when applied to the data contained in the dynamic buffer sequence, indicates a successful match. The call will block until one of the following conditions is true:
  53183. * The match condition function object returns a std::pair where the second element evaluates to true.
  53184. * An error occurred.
  53185. This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the match condition function object already indicates a match, the function returns immediately.
  53186. [heading Parameters]
  53187. [variablelist
  53188. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  53189. [[buffers][A dynamic buffer sequence into which the data will be read.]]
  53190. [[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be:
  53191. ``
  53192. pair<iterator, bool> match_condition(iterator begin, iterator end);
  53193. ``
  53194. where `iterator` represents the type:
  53195. ``
  53196. buffers_iterator<DynamicBuffer_v1::const_buffers_type>
  53197. ``
  53198. The iterator parameters `begin` and `end` define the range of bytes to be scanned to determine whether there is a match. The `first` member of the return value is an iterator marking one-past-the-end of the bytes that have been consumed by the match function. This iterator is used to calculate the `begin` parameter for any subsequent invocation of the match condition. The `second` member of the return value is true if a match has been found, false otherwise.]]
  53199. [[ec][Set to indicate what error occurred, if any.]]
  53200. ]
  53201. [heading Return Value]
  53202. The number of bytes in the dynamic buffer sequence's get area that have been fully consumed by the match function. Returns 0 if an error occurred.
  53203. [heading Remarks]
  53204. After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond that which matched the function object. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine.
  53205. The default implementation of the `is_match_condition` type trait evaluates to true for function pointers and function objects with a `result_type` typedef. It must be specialised for other user-defined function objects.
  53206. [endsect]
  53207. [section:overload9 read_until (9 of 24 overloads)]
  53208. Read data into a streambuf until it contains a specified delimiter.
  53209. template<
  53210. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  53211. typename Allocator>
  53212. std::size_t read_until(
  53213. SyncReadStream & s,
  53214. boost::asio::basic_streambuf< Allocator > & b,
  53215. char delim);
  53216. This function is used to read data into the specified streambuf until the streambuf's get area contains the specified delimiter. The call will block until one of the following conditions is true:
  53217. * The get area of the streambuf contains the specified delimiter.
  53218. * An error occurred.
  53219. This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the streambuf's get area already contains the delimiter, the function returns immediately.
  53220. [heading Parameters]
  53221. [variablelist
  53222. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  53223. [[b][A streambuf object into which the data will be read.]]
  53224. [[delim][The delimiter character.]]
  53225. ]
  53226. [heading Return Value]
  53227. The number of bytes in the streambuf's get area up to and including the delimiter.
  53228. [heading Exceptions]
  53229. [variablelist
  53230. [[boost::system::system_error][Thrown on failure.]]
  53231. ]
  53232. [heading Remarks]
  53233. After a successful read\_until operation, the streambuf may contain additional data beyond the delimiter. An application will typically leave that data in the streambuf for a subsequent read\_until operation to examine.
  53234. [heading Example]
  53235. To read data into a streambuf until a newline is encountered:
  53236. boost::asio::streambuf b;
  53237. boost::asio::read_until(s, b, '\n');
  53238. std::istream is(&b);
  53239. std::string line;
  53240. std::getline(is, line);
  53241. After the `read_until` operation completes successfully, the buffer `b` contains the delimiter:
  53242. { 'a', 'b', ..., 'c', '\n', 'd', 'e', ... }
  53243. The call to `std::getline` then extracts the data up to and including the newline (which is discarded), so that the string `line` contains:
  53244. { 'a', 'b', ..., 'c' }
  53245. The remaining data is left in the buffer `b` as follows:
  53246. { 'd', 'e', ... }
  53247. This data may be the start of a new line, to be extracted by a subsequent `read_until` operation.
  53248. [endsect]
  53249. [section:overload10 read_until (10 of 24 overloads)]
  53250. Read data into a streambuf until it contains a specified delimiter.
  53251. template<
  53252. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  53253. typename Allocator>
  53254. std::size_t read_until(
  53255. SyncReadStream & s,
  53256. boost::asio::basic_streambuf< Allocator > & b,
  53257. char delim,
  53258. boost::system::error_code & ec);
  53259. This function is used to read data into the specified streambuf until the streambuf's get area contains the specified delimiter. The call will block until one of the following conditions is true:
  53260. * The get area of the streambuf contains the specified delimiter.
  53261. * An error occurred.
  53262. This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the streambuf's get area already contains the delimiter, the function returns immediately.
  53263. [heading Parameters]
  53264. [variablelist
  53265. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  53266. [[b][A streambuf object into which the data will be read.]]
  53267. [[delim][The delimiter character.]]
  53268. [[ec][Set to indicate what error occurred, if any.]]
  53269. ]
  53270. [heading Return Value]
  53271. The number of bytes in the streambuf's get area up to and including the delimiter. Returns 0 if an error occurred.
  53272. [heading Remarks]
  53273. After a successful read\_until operation, the streambuf may contain additional data beyond the delimiter. An application will typically leave that data in the streambuf for a subsequent read\_until operation to examine.
  53274. [endsect]
  53275. [section:overload11 read_until (11 of 24 overloads)]
  53276. Read data into a streambuf until it contains a specified delimiter.
  53277. template<
  53278. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  53279. typename Allocator>
  53280. std::size_t read_until(
  53281. SyncReadStream & s,
  53282. boost::asio::basic_streambuf< Allocator > & b,
  53283. string_view delim);
  53284. This function is used to read data into the specified streambuf until the streambuf's get area contains the specified delimiter. The call will block until one of the following conditions is true:
  53285. * The get area of the streambuf contains the specified delimiter.
  53286. * An error occurred.
  53287. This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the streambuf's get area already contains the delimiter, the function returns immediately.
  53288. [heading Parameters]
  53289. [variablelist
  53290. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  53291. [[b][A streambuf object into which the data will be read.]]
  53292. [[delim][The delimiter string.]]
  53293. ]
  53294. [heading Return Value]
  53295. The number of bytes in the streambuf's get area up to and including the delimiter.
  53296. [heading Exceptions]
  53297. [variablelist
  53298. [[boost::system::system_error][Thrown on failure.]]
  53299. ]
  53300. [heading Remarks]
  53301. After a successful read\_until operation, the streambuf may contain additional data beyond the delimiter. An application will typically leave that data in the streambuf for a subsequent read\_until operation to examine.
  53302. [heading Example]
  53303. To read data into a streambuf until a newline is encountered:
  53304. boost::asio::streambuf b;
  53305. boost::asio::read_until(s, b, "\r\n");
  53306. std::istream is(&b);
  53307. std::string line;
  53308. std::getline(is, line);
  53309. After the `read_until` operation completes successfully, the buffer `b` contains the delimiter:
  53310. { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... }
  53311. The call to `std::getline` then extracts the data up to and including the newline (which is discarded), so that the string `line` contains:
  53312. { 'a', 'b', ..., 'c', '\r' }
  53313. The remaining data is left in the buffer `b` as follows:
  53314. { 'd', 'e', ... }
  53315. This data may be the start of a new line, to be extracted by a subsequent `read_until` operation.
  53316. [endsect]
  53317. [section:overload12 read_until (12 of 24 overloads)]
  53318. Read data into a streambuf until it contains a specified delimiter.
  53319. template<
  53320. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  53321. typename Allocator>
  53322. std::size_t read_until(
  53323. SyncReadStream & s,
  53324. boost::asio::basic_streambuf< Allocator > & b,
  53325. string_view delim,
  53326. boost::system::error_code & ec);
  53327. This function is used to read data into the specified streambuf until the streambuf's get area contains the specified delimiter. The call will block until one of the following conditions is true:
  53328. * The get area of the streambuf contains the specified delimiter.
  53329. * An error occurred.
  53330. This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the streambuf's get area already contains the delimiter, the function returns immediately.
  53331. [heading Parameters]
  53332. [variablelist
  53333. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  53334. [[b][A streambuf object into which the data will be read.]]
  53335. [[delim][The delimiter string.]]
  53336. [[ec][Set to indicate what error occurred, if any.]]
  53337. ]
  53338. [heading Return Value]
  53339. The number of bytes in the streambuf's get area up to and including the delimiter. Returns 0 if an error occurred.
  53340. [heading Remarks]
  53341. After a successful read\_until operation, the streambuf may contain additional data beyond the delimiter. An application will typically leave that data in the streambuf for a subsequent read\_until operation to examine.
  53342. [endsect]
  53343. [section:overload13 read_until (13 of 24 overloads)]
  53344. Read data into a streambuf until some part of the data it contains matches a regular expression.
  53345. template<
  53346. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  53347. typename Allocator>
  53348. std::size_t read_until(
  53349. SyncReadStream & s,
  53350. boost::asio::basic_streambuf< Allocator > & b,
  53351. const boost::regex & expr);
  53352. This function is used to read data into the specified streambuf until the streambuf's get area contains some data that matches a regular expression. The call will block until one of the following conditions is true:
  53353. * A substring of the streambuf's get area matches the regular expression.
  53354. * An error occurred.
  53355. This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the streambuf's get area already contains data that matches the regular expression, the function returns immediately.
  53356. [heading Parameters]
  53357. [variablelist
  53358. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  53359. [[b][A streambuf object into which the data will be read.]]
  53360. [[expr][The regular expression.]]
  53361. ]
  53362. [heading Return Value]
  53363. The number of bytes in the streambuf's get area up to and including the substring that matches the regular expression.
  53364. [heading Exceptions]
  53365. [variablelist
  53366. [[boost::system::system_error][Thrown on failure.]]
  53367. ]
  53368. [heading Remarks]
  53369. After a successful read\_until operation, the streambuf may contain additional data beyond that which matched the regular expression. An application will typically leave that data in the streambuf for a subsequent read\_until operation to examine.
  53370. [heading Example]
  53371. To read data into a streambuf until a CR-LF sequence is encountered:
  53372. boost::asio::streambuf b;
  53373. boost::asio::read_until(s, b, boost::regex("\r\n"));
  53374. std::istream is(&b);
  53375. std::string line;
  53376. std::getline(is, line);
  53377. After the `read_until` operation completes successfully, the buffer `b` contains the data which matched the regular expression:
  53378. { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... }
  53379. The call to `std::getline` then extracts the data up to and including the newline (which is discarded), so that the string `line` contains:
  53380. { 'a', 'b', ..., 'c', '\r' }
  53381. The remaining data is left in the buffer `b` as follows:
  53382. { 'd', 'e', ... }
  53383. This data may be the start of a new line, to be extracted by a subsequent `read_until` operation.
  53384. [endsect]
  53385. [section:overload14 read_until (14 of 24 overloads)]
  53386. Read data into a streambuf until some part of the data it contains matches a regular expression.
  53387. template<
  53388. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  53389. typename Allocator>
  53390. std::size_t read_until(
  53391. SyncReadStream & s,
  53392. boost::asio::basic_streambuf< Allocator > & b,
  53393. const boost::regex & expr,
  53394. boost::system::error_code & ec);
  53395. This function is used to read data into the specified streambuf until the streambuf's get area contains some data that matches a regular expression. The call will block until one of the following conditions is true:
  53396. * A substring of the streambuf's get area matches the regular expression.
  53397. * An error occurred.
  53398. This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the streambuf's get area already contains data that matches the regular expression, the function returns immediately.
  53399. [heading Parameters]
  53400. [variablelist
  53401. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  53402. [[b][A streambuf object into which the data will be read.]]
  53403. [[expr][The regular expression.]]
  53404. [[ec][Set to indicate what error occurred, if any.]]
  53405. ]
  53406. [heading Return Value]
  53407. The number of bytes in the streambuf's get area up to and including the substring that matches the regular expression. Returns 0 if an error occurred.
  53408. [heading Remarks]
  53409. After a successful read\_until operation, the streambuf may contain additional data beyond that which matched the regular expression. An application will typically leave that data in the streambuf for a subsequent read\_until operation to examine.
  53410. [endsect]
  53411. [section:overload15 read_until (15 of 24 overloads)]
  53412. Read data into a streambuf until a function object indicates a match.
  53413. template<
  53414. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  53415. typename Allocator,
  53416. typename MatchCondition>
  53417. std::size_t read_until(
  53418. SyncReadStream & s,
  53419. boost::asio::basic_streambuf< Allocator > & b,
  53420. MatchCondition match_condition,
  53421. typename enable_if< is_match_condition< MatchCondition >::value >::type * = 0);
  53422. This function is used to read data into the specified streambuf until a user-defined match condition function object, when applied to the data contained in the streambuf, indicates a successful match. The call will block until one of the following conditions is true:
  53423. * The match condition function object returns a std::pair where the second element evaluates to true.
  53424. * An error occurred.
  53425. This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the match condition function object already indicates a match, the function returns immediately.
  53426. [heading Parameters]
  53427. [variablelist
  53428. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  53429. [[b][A streambuf object into which the data will be read.]]
  53430. [[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be:
  53431. ``
  53432. pair<iterator, bool> match_condition(iterator begin, iterator end);
  53433. ``
  53434. where `iterator` represents the type:
  53435. ``
  53436. buffers_iterator<basic_streambuf<Allocator>::const_buffers_type>
  53437. ``
  53438. The iterator parameters `begin` and `end` define the range of bytes to be scanned to determine whether there is a match. The `first` member of the return value is an iterator marking one-past-the-end of the bytes that have been consumed by the match function. This iterator is used to calculate the `begin` parameter for any subsequent invocation of the match condition. The `second` member of the return value is true if a match has been found, false otherwise.]]
  53439. ]
  53440. [heading Return Value]
  53441. The number of bytes in the streambuf's get area that have been fully consumed by the match function.
  53442. [heading Exceptions]
  53443. [variablelist
  53444. [[boost::system::system_error][Thrown on failure.]]
  53445. ]
  53446. [heading Remarks]
  53447. After a successful read\_until operation, the streambuf may contain additional data beyond that which matched the function object. An application will typically leave that data in the streambuf for a subsequent read\_until operation to examine.
  53448. The default implementation of the `is_match_condition` type trait evaluates to true for function pointers and function objects with a `result_type` typedef. It must be specialised for other user-defined function objects.
  53449. [heading Examples]
  53450. To read data into a streambuf until whitespace is encountered:
  53451. typedef boost::asio::buffers_iterator<
  53452. boost::asio::streambuf::const_buffers_type> iterator;
  53453. std::pair<iterator, bool>
  53454. match_whitespace(iterator begin, iterator end)
  53455. {
  53456. iterator i = begin;
  53457. while (i != end)
  53458. if (std::isspace(*i++))
  53459. return std::make_pair(i, true);
  53460. return std::make_pair(i, false);
  53461. }
  53462. ...
  53463. boost::asio::streambuf b;
  53464. boost::asio::read_until(s, b, match_whitespace);
  53465. To read data into a streambuf until a matching character is found:
  53466. class match_char
  53467. {
  53468. public:
  53469. explicit match_char(char c) : c_(c) {}
  53470. template <typename Iterator>
  53471. std::pair<Iterator, bool> operator()(
  53472. Iterator begin, Iterator end) const
  53473. {
  53474. Iterator i = begin;
  53475. while (i != end)
  53476. if (c_ == *i++)
  53477. return std::make_pair(i, true);
  53478. return std::make_pair(i, false);
  53479. }
  53480. private:
  53481. char c_;
  53482. };
  53483. namespace asio {
  53484. template <> struct is_match_condition<match_char>
  53485. : public boost::true_type {};
  53486. } // namespace asio
  53487. ...
  53488. boost::asio::streambuf b;
  53489. boost::asio::read_until(s, b, match_char('a'));
  53490. [endsect]
  53491. [section:overload16 read_until (16 of 24 overloads)]
  53492. Read data into a streambuf until a function object indicates a match.
  53493. template<
  53494. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  53495. typename Allocator,
  53496. typename MatchCondition>
  53497. std::size_t read_until(
  53498. SyncReadStream & s,
  53499. boost::asio::basic_streambuf< Allocator > & b,
  53500. MatchCondition match_condition,
  53501. boost::system::error_code & ec,
  53502. typename enable_if< is_match_condition< MatchCondition >::value >::type * = 0);
  53503. This function is used to read data into the specified streambuf until a user-defined match condition function object, when applied to the data contained in the streambuf, indicates a successful match. The call will block until one of the following conditions is true:
  53504. * The match condition function object returns a std::pair where the second element evaluates to true.
  53505. * An error occurred.
  53506. This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the match condition function object already indicates a match, the function returns immediately.
  53507. [heading Parameters]
  53508. [variablelist
  53509. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  53510. [[b][A streambuf object into which the data will be read.]]
  53511. [[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be:
  53512. ``
  53513. pair<iterator, bool> match_condition(iterator begin, iterator end);
  53514. ``
  53515. where `iterator` represents the type:
  53516. ``
  53517. buffers_iterator<basic_streambuf<Allocator>::const_buffers_type>
  53518. ``
  53519. The iterator parameters `begin` and `end` define the range of bytes to be scanned to determine whether there is a match. The `first` member of the return value is an iterator marking one-past-the-end of the bytes that have been consumed by the match function. This iterator is used to calculate the `begin` parameter for any subsequent invocation of the match condition. The `second` member of the return value is true if a match has been found, false otherwise.]]
  53520. [[ec][Set to indicate what error occurred, if any.]]
  53521. ]
  53522. [heading Return Value]
  53523. The number of bytes in the streambuf's get area that have been fully consumed by the match function. Returns 0 if an error occurred.
  53524. [heading Remarks]
  53525. After a successful read\_until operation, the streambuf may contain additional data beyond that which matched the function object. An application will typically leave that data in the streambuf for a subsequent read\_until operation to examine.
  53526. The default implementation of the `is_match_condition` type trait evaluates to true for function pointers and function objects with a `result_type` typedef. It must be specialised for other user-defined function objects.
  53527. [endsect]
  53528. [section:overload17 read_until (17 of 24 overloads)]
  53529. Read data into a dynamic buffer sequence until it contains a specified delimiter.
  53530. template<
  53531. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  53532. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
  53533. std::size_t read_until(
  53534. SyncReadStream & s,
  53535. DynamicBuffer_v2 buffers,
  53536. char delim,
  53537. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  53538. This function is used to read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains the specified delimiter. The call will block until one of the following conditions is true:
  53539. * The get area of the dynamic buffer sequence contains the specified delimiter.
  53540. * An error occurred.
  53541. This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the dynamic buffer sequence's get area already contains the delimiter, the function returns immediately.
  53542. [heading Parameters]
  53543. [variablelist
  53544. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  53545. [[buffers][The dynamic buffer sequence into which the data will be read.]]
  53546. [[delim][The delimiter character.]]
  53547. ]
  53548. [heading Return Value]
  53549. The number of bytes in the dynamic buffer sequence's get area up to and including the delimiter.
  53550. [heading Exceptions]
  53551. [variablelist
  53552. [[boost::system::system_error][Thrown on failure.]]
  53553. ]
  53554. [heading Remarks]
  53555. After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond the delimiter. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine.
  53556. [heading Example]
  53557. To read data into a `std::string` until a newline is encountered:
  53558. std::string data;
  53559. std::string n = boost::asio::read_until(s,
  53560. boost::asio::dynamic_buffer(data), '\n');
  53561. std::string line = data.substr(0, n);
  53562. data.erase(0, n);
  53563. After the `read_until` operation completes successfully, the string `data` contains the delimiter:
  53564. { 'a', 'b', ..., 'c', '\n', 'd', 'e', ... }
  53565. The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains:
  53566. { 'a', 'b', ..., 'c', '\n' }
  53567. After the call to `erase`, the remaining data is left in the buffer `b` as follows:
  53568. { 'd', 'e', ... }
  53569. This data may be the start of a new line, to be extracted by a subsequent `read_until` operation.
  53570. [endsect]
  53571. [section:overload18 read_until (18 of 24 overloads)]
  53572. Read data into a dynamic buffer sequence until it contains a specified delimiter.
  53573. template<
  53574. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  53575. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
  53576. std::size_t read_until(
  53577. SyncReadStream & s,
  53578. DynamicBuffer_v2 buffers,
  53579. char delim,
  53580. boost::system::error_code & ec,
  53581. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  53582. This function is used to read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains the specified delimiter. The call will block until one of the following conditions is true:
  53583. * The get area of the dynamic buffer sequence contains the specified delimiter.
  53584. * An error occurred.
  53585. This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the dynamic buffer sequence's get area already contains the delimiter, the function returns immediately.
  53586. [heading Parameters]
  53587. [variablelist
  53588. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  53589. [[buffers][The dynamic buffer sequence into which the data will be read.]]
  53590. [[delim][The delimiter character.]]
  53591. [[ec][Set to indicate what error occurred, if any.]]
  53592. ]
  53593. [heading Return Value]
  53594. The number of bytes in the dynamic buffer sequence's get area up to and including the delimiter. Returns 0 if an error occurred.
  53595. [heading Remarks]
  53596. After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond the delimiter. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine.
  53597. [endsect]
  53598. [section:overload19 read_until (19 of 24 overloads)]
  53599. Read data into a dynamic buffer sequence until it contains a specified delimiter.
  53600. template<
  53601. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  53602. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
  53603. std::size_t read_until(
  53604. SyncReadStream & s,
  53605. DynamicBuffer_v2 buffers,
  53606. string_view delim,
  53607. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  53608. This function is used to read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains the specified delimiter. The call will block until one of the following conditions is true:
  53609. * The get area of the dynamic buffer sequence contains the specified delimiter.
  53610. * An error occurred.
  53611. This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the dynamic buffer sequence's get area already contains the delimiter, the function returns immediately.
  53612. [heading Parameters]
  53613. [variablelist
  53614. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  53615. [[buffers][The dynamic buffer sequence into which the data will be read.]]
  53616. [[delim][The delimiter string.]]
  53617. ]
  53618. [heading Return Value]
  53619. The number of bytes in the dynamic buffer sequence's get area up to and including the delimiter.
  53620. [heading Remarks]
  53621. After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond the delimiter. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine.
  53622. [heading Example]
  53623. To read data into a `std::string` until a CR-LF sequence is encountered:
  53624. std::string data;
  53625. std::string n = boost::asio::read_until(s,
  53626. boost::asio::dynamic_buffer(data), "\r\n");
  53627. std::string line = data.substr(0, n);
  53628. data.erase(0, n);
  53629. After the `read_until` operation completes successfully, the string `data` contains the delimiter:
  53630. { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... }
  53631. The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains:
  53632. { 'a', 'b', ..., 'c', '\r', '\n' }
  53633. After the call to `erase`, the remaining data is left in the buffer `b` as follows:
  53634. { 'd', 'e', ... }
  53635. This data may be the start of a new line, to be extracted by a subsequent `read_until` operation.
  53636. [endsect]
  53637. [section:overload20 read_until (20 of 24 overloads)]
  53638. Read data into a dynamic buffer sequence until it contains a specified delimiter.
  53639. template<
  53640. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  53641. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
  53642. std::size_t read_until(
  53643. SyncReadStream & s,
  53644. DynamicBuffer_v2 buffers,
  53645. string_view delim,
  53646. boost::system::error_code & ec,
  53647. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  53648. This function is used to read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains the specified delimiter. The call will block until one of the following conditions is true:
  53649. * The get area of the dynamic buffer sequence contains the specified delimiter.
  53650. * An error occurred.
  53651. This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the dynamic buffer sequence's get area already contains the delimiter, the function returns immediately.
  53652. [heading Parameters]
  53653. [variablelist
  53654. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  53655. [[buffers][The dynamic buffer sequence into which the data will be read.]]
  53656. [[delim][The delimiter string.]]
  53657. [[ec][Set to indicate what error occurred, if any.]]
  53658. ]
  53659. [heading Return Value]
  53660. The number of bytes in the dynamic buffer sequence's get area up to and including the delimiter. Returns 0 if an error occurred.
  53661. [heading Remarks]
  53662. After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond the delimiter. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine.
  53663. [endsect]
  53664. [section:overload21 read_until (21 of 24 overloads)]
  53665. Read data into a dynamic buffer sequence until some part of the data it contains matches a regular expression.
  53666. template<
  53667. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  53668. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
  53669. std::size_t read_until(
  53670. SyncReadStream & s,
  53671. DynamicBuffer_v2 buffers,
  53672. const boost::regex & expr,
  53673. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  53674. This function is used to read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains some data that matches a regular expression. The call will block until one of the following conditions is true:
  53675. * A substring of the dynamic buffer sequence's get area matches the regular expression.
  53676. * An error occurred.
  53677. This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the dynamic buffer sequence's get area already contains data that matches the regular expression, the function returns immediately.
  53678. [heading Parameters]
  53679. [variablelist
  53680. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  53681. [[buffers][A dynamic buffer sequence into which the data will be read.]]
  53682. [[expr][The regular expression.]]
  53683. ]
  53684. [heading Return Value]
  53685. The number of bytes in the dynamic buffer sequence's get area up to and including the substring that matches the regular expression.
  53686. [heading Exceptions]
  53687. [variablelist
  53688. [[boost::system::system_error][Thrown on failure.]]
  53689. ]
  53690. [heading Remarks]
  53691. After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond that which matched the regular expression. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine.
  53692. [heading Example]
  53693. To read data into a `std::string` until a CR-LF sequence is encountered:
  53694. std::string data;
  53695. std::string n = boost::asio::read_until(s,
  53696. boost::asio::dynamic_buffer(data), boost::regex("\r\n"));
  53697. std::string line = data.substr(0, n);
  53698. data.erase(0, n);
  53699. After the `read_until` operation completes successfully, the string `data` contains the delimiter:
  53700. { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... }
  53701. The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains:
  53702. { 'a', 'b', ..., 'c', '\r', '\n' }
  53703. After the call to `erase`, the remaining data is left in the buffer `b` as follows:
  53704. { 'd', 'e', ... }
  53705. This data may be the start of a new line, to be extracted by a subsequent `read_until` operation.
  53706. [endsect]
  53707. [section:overload22 read_until (22 of 24 overloads)]
  53708. Read data into a dynamic buffer sequence until some part of the data it contains matches a regular expression.
  53709. template<
  53710. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  53711. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
  53712. std::size_t read_until(
  53713. SyncReadStream & s,
  53714. DynamicBuffer_v2 buffers,
  53715. const boost::regex & expr,
  53716. boost::system::error_code & ec,
  53717. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  53718. This function is used to read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains some data that matches a regular expression. The call will block until one of the following conditions is true:
  53719. * A substring of the dynamic buffer sequence's get area matches the regular expression.
  53720. * An error occurred.
  53721. This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the dynamic buffer sequence's get area already contains data that matches the regular expression, the function returns immediately.
  53722. [heading Parameters]
  53723. [variablelist
  53724. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  53725. [[buffers][A dynamic buffer sequence into which the data will be read.]]
  53726. [[expr][The regular expression.]]
  53727. [[ec][Set to indicate what error occurred, if any.]]
  53728. ]
  53729. [heading Return Value]
  53730. The number of bytes in the dynamic buffer sequence's get area up to and including the substring that matches the regular expression. Returns 0 if an error occurred.
  53731. [heading Remarks]
  53732. After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond that which matched the regular expression. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine.
  53733. [endsect]
  53734. [section:overload23 read_until (23 of 24 overloads)]
  53735. Read data into a dynamic buffer sequence until a function object indicates a match.
  53736. template<
  53737. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  53738. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
  53739. typename MatchCondition>
  53740. std::size_t read_until(
  53741. SyncReadStream & s,
  53742. DynamicBuffer_v2 buffers,
  53743. MatchCondition match_condition,
  53744. typename enable_if< is_match_condition< MatchCondition >::value &&is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  53745. This function is used to read data into the specified dynamic buffer sequence until a user-defined match condition function object, when applied to the data contained in the dynamic buffer sequence, indicates a successful match. The call will block until one of the following conditions is true:
  53746. * The match condition function object returns a std::pair where the second element evaluates to true.
  53747. * An error occurred.
  53748. This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the match condition function object already indicates a match, the function returns immediately.
  53749. [heading Parameters]
  53750. [variablelist
  53751. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  53752. [[buffers][A dynamic buffer sequence into which the data will be read.]]
  53753. [[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be:
  53754. ``
  53755. pair<iterator, bool> match_condition(iterator begin, iterator end);
  53756. ``
  53757. where `iterator` represents the type:
  53758. ``
  53759. buffers_iterator<typename DynamicBuffer_v2::const_buffers_type>
  53760. ``
  53761. The iterator parameters `begin` and `end` define the range of bytes to be scanned to determine whether there is a match. The `first` member of the return value is an iterator marking one-past-the-end of the bytes that have been consumed by the match function. This iterator is used to calculate the `begin` parameter for any subsequent invocation of the match condition. The `second` member of the return value is true if a match has been found, false otherwise.]]
  53762. ]
  53763. [heading Return Value]
  53764. The number of bytes in the dynamic\_buffer's get area that have been fully consumed by the match function.
  53765. [heading Exceptions]
  53766. [variablelist
  53767. [[boost::system::system_error][Thrown on failure.]]
  53768. ]
  53769. [heading Remarks]
  53770. After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond that which matched the function object. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine.
  53771. The default implementation of the `is_match_condition` type trait evaluates to true for function pointers and function objects with a `result_type` typedef. It must be specialised for other user-defined function objects.
  53772. [heading Examples]
  53773. To read data into a dynamic buffer sequence until whitespace is encountered:
  53774. typedef boost::asio::buffers_iterator<
  53775. boost::asio::const_buffers_1> iterator;
  53776. std::pair<iterator, bool>
  53777. match_whitespace(iterator begin, iterator end)
  53778. {
  53779. iterator i = begin;
  53780. while (i != end)
  53781. if (std::isspace(*i++))
  53782. return std::make_pair(i, true);
  53783. return std::make_pair(i, false);
  53784. }
  53785. ...
  53786. std::string data;
  53787. boost::asio::read_until(s, data, match_whitespace);
  53788. To read data into a `std::string` until a matching character is found:
  53789. class match_char
  53790. {
  53791. public:
  53792. explicit match_char(char c) : c_(c) {}
  53793. template <typename Iterator>
  53794. std::pair<Iterator, bool> operator()(
  53795. Iterator begin, Iterator end) const
  53796. {
  53797. Iterator i = begin;
  53798. while (i != end)
  53799. if (c_ == *i++)
  53800. return std::make_pair(i, true);
  53801. return std::make_pair(i, false);
  53802. }
  53803. private:
  53804. char c_;
  53805. };
  53806. namespace asio {
  53807. template <> struct is_match_condition<match_char>
  53808. : public boost::true_type {};
  53809. } // namespace asio
  53810. ...
  53811. std::string data;
  53812. boost::asio::read_until(s, data, match_char('a'));
  53813. [endsect]
  53814. [section:overload24 read_until (24 of 24 overloads)]
  53815. Read data into a dynamic buffer sequence until a function object indicates a match.
  53816. template<
  53817. typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
  53818. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
  53819. typename MatchCondition>
  53820. std::size_t read_until(
  53821. SyncReadStream & s,
  53822. DynamicBuffer_v2 buffers,
  53823. MatchCondition match_condition,
  53824. boost::system::error_code & ec,
  53825. typename enable_if< is_match_condition< MatchCondition >::value &&is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  53826. This function is used to read data into the specified dynamic buffer sequence until a user-defined match condition function object, when applied to the data contained in the dynamic buffer sequence, indicates a successful match. The call will block until one of the following conditions is true:
  53827. * The match condition function object returns a std::pair where the second element evaluates to true.
  53828. * An error occurred.
  53829. This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the match condition function object already indicates a match, the function returns immediately.
  53830. [heading Parameters]
  53831. [variablelist
  53832. [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
  53833. [[buffers][A dynamic buffer sequence into which the data will be read.]]
  53834. [[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be:
  53835. ``
  53836. pair<iterator, bool> match_condition(iterator begin, iterator end);
  53837. ``
  53838. where `iterator` represents the type:
  53839. ``
  53840. buffers_iterator<DynamicBuffer_v2::const_buffers_type>
  53841. ``
  53842. The iterator parameters `begin` and `end` define the range of bytes to be scanned to determine whether there is a match. The `first` member of the return value is an iterator marking one-past-the-end of the bytes that have been consumed by the match function. This iterator is used to calculate the `begin` parameter for any subsequent invocation of the match condition. The `second` member of the return value is true if a match has been found, false otherwise.]]
  53843. [[ec][Set to indicate what error occurred, if any.]]
  53844. ]
  53845. [heading Return Value]
  53846. The number of bytes in the dynamic buffer sequence's get area that have been fully consumed by the match function. Returns 0 if an error occurred.
  53847. [heading Remarks]
  53848. After a successful read\_until operation, the dynamic buffer sequence may contain additional data beyond that which matched the function object. An application will typically leave that data in the dynamic buffer sequence for a subsequent read\_until operation to examine.
  53849. The default implementation of the `is_match_condition` type trait evaluates to true for function pointers and function objects with a `result_type` typedef. It must be specialised for other user-defined function objects.
  53850. [endsect]
  53851. [endsect]
  53852. [section:redirect_error redirect_error]
  53853. [indexterm1 boost_asio.indexterm.redirect_error..redirect_error]
  53854. Create a completion token to capture error\_code values to a variable.
  53855. template<
  53856. typename CompletionToken>
  53857. redirect_error_t< typename decay< CompletionToken >::type > redirect_error(
  53858. CompletionToken && completion_token,
  53859. boost::system::error_code & ec);
  53860. [heading Requirements]
  53861. ['Header: ][^boost/asio/redirect_error.hpp]
  53862. ['Convenience header: ][^boost/asio.hpp]
  53863. [endsect]
  53864. [section:redirect_error_t redirect_error_t]
  53865. Completion token type used to specify that an error produced by an asynchronous operation is captured to an error\_code variable.
  53866. template<
  53867. typename CompletionToken>
  53868. class redirect_error_t
  53869. [heading Member Functions]
  53870. [table
  53871. [[Name][Description]]
  53872. [
  53873. [[link boost_asio.reference.redirect_error_t.redirect_error_t [*redirect_error_t]]]
  53874. [Constructor. ]
  53875. ]
  53876. ]
  53877. [heading Data Members]
  53878. [table
  53879. [[Name][Description]]
  53880. [
  53881. [[link boost_asio.reference.redirect_error_t.ec_ [*ec_]]]
  53882. []
  53883. ]
  53884. [
  53885. [[link boost_asio.reference.redirect_error_t.token_ [*token_]]]
  53886. []
  53887. ]
  53888. ]
  53889. The [link boost_asio.reference.redirect_error_t `redirect_error_t`] class is used to indicate that any error\_code produced by an asynchronous operation is captured to a specified variable.
  53890. [heading Requirements]
  53891. ['Header: ][^boost/asio/redirect_error.hpp]
  53892. ['Convenience header: ][^boost/asio.hpp]
  53893. [section:ec_ redirect_error_t::ec_]
  53894. [indexterm2 boost_asio.indexterm.redirect_error_t.ec_..ec_..redirect_error_t]
  53895. boost::system::error_code & ec_;
  53896. [endsect]
  53897. [section:redirect_error_t redirect_error_t::redirect_error_t]
  53898. [indexterm2 boost_asio.indexterm.redirect_error_t.redirect_error_t..redirect_error_t..redirect_error_t]
  53899. Constructor.
  53900. template<
  53901. typename T>
  53902. redirect_error_t(
  53903. T && completion_token,
  53904. boost::system::error_code & ec);
  53905. [endsect]
  53906. [section:token_ redirect_error_t::token_]
  53907. [indexterm2 boost_asio.indexterm.redirect_error_t.token_..token_..redirect_error_t]
  53908. CompletionToken token_;
  53909. [endsect]
  53910. [endsect]
  53911. [section:resolver_errc__try_again resolver_errc::try_again]
  53912. [indexterm1 boost_asio.indexterm.resolver_errc__try_again..resolver_errc::try_again]
  53913. const error::netdb_errors try_again = error::host_not_found_try_again;
  53914. [heading Requirements]
  53915. ['Header: ][^boost/asio/error.hpp]
  53916. ['Convenience header: ][^boost/asio.hpp]
  53917. [endsect]
  53918. [section:serial_port serial_port]
  53919. [indexterm1 boost_asio.indexterm.serial_port..serial_port]
  53920. Typedef for the typical usage of a serial port.
  53921. typedef basic_serial_port serial_port;
  53922. [heading Types]
  53923. [table
  53924. [[Name][Description]]
  53925. [
  53926. [[link boost_asio.reference.basic_serial_port__rebind_executor [*rebind_executor]]]
  53927. [Rebinds the serial port type to another executor. ]
  53928. ]
  53929. [
  53930. [[link boost_asio.reference.basic_serial_port.executor_type [*executor_type]]]
  53931. [The type of the executor associated with the object. ]
  53932. ]
  53933. [
  53934. [[link boost_asio.reference.basic_serial_port.lowest_layer_type [*lowest_layer_type]]]
  53935. [A basic_basic_serial_port is always the lowest layer. ]
  53936. ]
  53937. [
  53938. [[link boost_asio.reference.basic_serial_port.native_handle_type [*native_handle_type]]]
  53939. [The native representation of a serial port. ]
  53940. ]
  53941. ]
  53942. [heading Member Functions]
  53943. [table
  53944. [[Name][Description]]
  53945. [
  53946. [[link boost_asio.reference.basic_serial_port.assign [*assign]]]
  53947. [Assign an existing native serial port to the serial port. ]
  53948. ]
  53949. [
  53950. [[link boost_asio.reference.basic_serial_port.async_read_some [*async_read_some]]]
  53951. [Start an asynchronous read. ]
  53952. ]
  53953. [
  53954. [[link boost_asio.reference.basic_serial_port.async_write_some [*async_write_some]]]
  53955. [Start an asynchronous write. ]
  53956. ]
  53957. [
  53958. [[link boost_asio.reference.basic_serial_port.basic_serial_port [*basic_serial_port]]]
  53959. [Construct a basic_serial_port without opening it.
  53960. [hr]
  53961. Construct and open a basic_serial_port.
  53962. [hr]
  53963. Construct a basic_serial_port on an existing native serial port.
  53964. [hr]
  53965. Move-construct a basic_serial_port from another. ]
  53966. ]
  53967. [
  53968. [[link boost_asio.reference.basic_serial_port.cancel [*cancel]]]
  53969. [Cancel all asynchronous operations associated with the serial port. ]
  53970. ]
  53971. [
  53972. [[link boost_asio.reference.basic_serial_port.close [*close]]]
  53973. [Close the serial port. ]
  53974. ]
  53975. [
  53976. [[link boost_asio.reference.basic_serial_port.get_executor [*get_executor]]]
  53977. [Get the executor associated with the object. ]
  53978. ]
  53979. [
  53980. [[link boost_asio.reference.basic_serial_port.get_option [*get_option]]]
  53981. [Get an option from the serial port. ]
  53982. ]
  53983. [
  53984. [[link boost_asio.reference.basic_serial_port.is_open [*is_open]]]
  53985. [Determine whether the serial port is open. ]
  53986. ]
  53987. [
  53988. [[link boost_asio.reference.basic_serial_port.lowest_layer [*lowest_layer]]]
  53989. [Get a reference to the lowest layer.
  53990. [hr]
  53991. Get a const reference to the lowest layer. ]
  53992. ]
  53993. [
  53994. [[link boost_asio.reference.basic_serial_port.native_handle [*native_handle]]]
  53995. [Get the native serial port representation. ]
  53996. ]
  53997. [
  53998. [[link boost_asio.reference.basic_serial_port.open [*open]]]
  53999. [Open the serial port using the specified device name. ]
  54000. ]
  54001. [
  54002. [[link boost_asio.reference.basic_serial_port.operator_eq_ [*operator=]]]
  54003. [Move-assign a basic_serial_port from another. ]
  54004. ]
  54005. [
  54006. [[link boost_asio.reference.basic_serial_port.read_some [*read_some]]]
  54007. [Read some data from the serial port. ]
  54008. ]
  54009. [
  54010. [[link boost_asio.reference.basic_serial_port.send_break [*send_break]]]
  54011. [Send a break sequence to the serial port. ]
  54012. ]
  54013. [
  54014. [[link boost_asio.reference.basic_serial_port.set_option [*set_option]]]
  54015. [Set an option on the serial port. ]
  54016. ]
  54017. [
  54018. [[link boost_asio.reference.basic_serial_port.write_some [*write_some]]]
  54019. [Write some data to the serial port. ]
  54020. ]
  54021. [
  54022. [[link boost_asio.reference.basic_serial_port._basic_serial_port [*~basic_serial_port]]]
  54023. [Destroys the serial port. ]
  54024. ]
  54025. ]
  54026. The [link boost_asio.reference.basic_serial_port `basic_serial_port`] class provides a wrapper over serial port functionality.
  54027. [heading Thread Safety]
  54028. ['Distinct] ['objects:] Safe.
  54029. ['Shared] ['objects:] Unsafe.
  54030. [heading Requirements]
  54031. ['Header: ][^boost/asio/serial_port.hpp]
  54032. ['Convenience header: ][^boost/asio.hpp]
  54033. [endsect]
  54034. [section:serial_port_base serial_port_base]
  54035. The [link boost_asio.reference.serial_port_base `serial_port_base`] class is used as a base for the [link boost_asio.reference.basic_serial_port `basic_serial_port`] class template so that we have a common place to define the serial port options.
  54036. class serial_port_base
  54037. [heading Types]
  54038. [table
  54039. [[Name][Description]]
  54040. [
  54041. [[link boost_asio.reference.serial_port_base__baud_rate [*baud_rate]]]
  54042. [Serial port option to permit changing the baud rate. ]
  54043. ]
  54044. [
  54045. [[link boost_asio.reference.serial_port_base__character_size [*character_size]]]
  54046. [Serial port option to permit changing the character size. ]
  54047. ]
  54048. [
  54049. [[link boost_asio.reference.serial_port_base__flow_control [*flow_control]]]
  54050. [Serial port option to permit changing the flow control. ]
  54051. ]
  54052. [
  54053. [[link boost_asio.reference.serial_port_base__parity [*parity]]]
  54054. [Serial port option to permit changing the parity. ]
  54055. ]
  54056. [
  54057. [[link boost_asio.reference.serial_port_base__stop_bits [*stop_bits]]]
  54058. [Serial port option to permit changing the number of stop bits. ]
  54059. ]
  54060. ]
  54061. [heading Protected Member Functions]
  54062. [table
  54063. [[Name][Description]]
  54064. [
  54065. [[link boost_asio.reference.serial_port_base._serial_port_base [*~serial_port_base]]]
  54066. [Protected destructor to prevent deletion through this type. ]
  54067. ]
  54068. ]
  54069. [heading Requirements]
  54070. ['Header: ][^boost/asio/serial_port_base.hpp]
  54071. ['Convenience header: ][^boost/asio.hpp]
  54072. [section:_serial_port_base serial_port_base::~serial_port_base]
  54073. [indexterm2 boost_asio.indexterm.serial_port_base._serial_port_base..~serial_port_base..serial_port_base]
  54074. Protected destructor to prevent deletion through this type.
  54075. ~serial_port_base();
  54076. [endsect]
  54077. [endsect]
  54078. [section:serial_port_base__baud_rate serial_port_base::baud_rate]
  54079. Serial port option to permit changing the baud rate.
  54080. class baud_rate
  54081. [heading Member Functions]
  54082. [table
  54083. [[Name][Description]]
  54084. [
  54085. [[link boost_asio.reference.serial_port_base__baud_rate.baud_rate [*baud_rate]]]
  54086. []
  54087. ]
  54088. [
  54089. [[link boost_asio.reference.serial_port_base__baud_rate.load [*load]]]
  54090. []
  54091. ]
  54092. [
  54093. [[link boost_asio.reference.serial_port_base__baud_rate.store [*store]]]
  54094. []
  54095. ]
  54096. [
  54097. [[link boost_asio.reference.serial_port_base__baud_rate.value [*value]]]
  54098. []
  54099. ]
  54100. ]
  54101. Implements changing the baud rate for a given serial port.
  54102. [heading Requirements]
  54103. ['Header: ][^boost/asio/serial_port_base.hpp]
  54104. ['Convenience header: ][^boost/asio.hpp]
  54105. [section:baud_rate serial_port_base::baud_rate::baud_rate]
  54106. [indexterm2 boost_asio.indexterm.serial_port_base__baud_rate.baud_rate..baud_rate..serial_port_base::baud_rate]
  54107. baud_rate(
  54108. unsigned int rate = 0);
  54109. [endsect]
  54110. [section:load serial_port_base::baud_rate::load]
  54111. [indexterm2 boost_asio.indexterm.serial_port_base__baud_rate.load..load..serial_port_base::baud_rate]
  54112. void load(
  54113. const BOOST_ASIO_OPTION_STORAGE & storage,
  54114. boost::system::error_code & ec);
  54115. [endsect]
  54116. [section:store serial_port_base::baud_rate::store]
  54117. [indexterm2 boost_asio.indexterm.serial_port_base__baud_rate.store..store..serial_port_base::baud_rate]
  54118. void store(
  54119. BOOST_ASIO_OPTION_STORAGE & storage,
  54120. boost::system::error_code & ec) const;
  54121. [endsect]
  54122. [section:value serial_port_base::baud_rate::value]
  54123. [indexterm2 boost_asio.indexterm.serial_port_base__baud_rate.value..value..serial_port_base::baud_rate]
  54124. unsigned int value() const;
  54125. [endsect]
  54126. [endsect]
  54127. [section:serial_port_base__character_size serial_port_base::character_size]
  54128. Serial port option to permit changing the character size.
  54129. class character_size
  54130. [heading Member Functions]
  54131. [table
  54132. [[Name][Description]]
  54133. [
  54134. [[link boost_asio.reference.serial_port_base__character_size.character_size [*character_size]]]
  54135. []
  54136. ]
  54137. [
  54138. [[link boost_asio.reference.serial_port_base__character_size.load [*load]]]
  54139. []
  54140. ]
  54141. [
  54142. [[link boost_asio.reference.serial_port_base__character_size.store [*store]]]
  54143. []
  54144. ]
  54145. [
  54146. [[link boost_asio.reference.serial_port_base__character_size.value [*value]]]
  54147. []
  54148. ]
  54149. ]
  54150. Implements changing the character size for a given serial port.
  54151. [heading Requirements]
  54152. ['Header: ][^boost/asio/serial_port_base.hpp]
  54153. ['Convenience header: ][^boost/asio.hpp]
  54154. [section:character_size serial_port_base::character_size::character_size]
  54155. [indexterm2 boost_asio.indexterm.serial_port_base__character_size.character_size..character_size..serial_port_base::character_size]
  54156. character_size(
  54157. unsigned int t = 8);
  54158. [endsect]
  54159. [section:load serial_port_base::character_size::load]
  54160. [indexterm2 boost_asio.indexterm.serial_port_base__character_size.load..load..serial_port_base::character_size]
  54161. void load(
  54162. const BOOST_ASIO_OPTION_STORAGE & storage,
  54163. boost::system::error_code & ec);
  54164. [endsect]
  54165. [section:store serial_port_base::character_size::store]
  54166. [indexterm2 boost_asio.indexterm.serial_port_base__character_size.store..store..serial_port_base::character_size]
  54167. void store(
  54168. BOOST_ASIO_OPTION_STORAGE & storage,
  54169. boost::system::error_code & ec) const;
  54170. [endsect]
  54171. [section:value serial_port_base::character_size::value]
  54172. [indexterm2 boost_asio.indexterm.serial_port_base__character_size.value..value..serial_port_base::character_size]
  54173. unsigned int value() const;
  54174. [endsect]
  54175. [endsect]
  54176. [section:serial_port_base__flow_control serial_port_base::flow_control]
  54177. Serial port option to permit changing the flow control.
  54178. class flow_control
  54179. [heading Types]
  54180. [table
  54181. [[Name][Description]]
  54182. [
  54183. [[link boost_asio.reference.serial_port_base__flow_control.type [*type]]]
  54184. []
  54185. ]
  54186. ]
  54187. [heading Member Functions]
  54188. [table
  54189. [[Name][Description]]
  54190. [
  54191. [[link boost_asio.reference.serial_port_base__flow_control.flow_control [*flow_control]]]
  54192. []
  54193. ]
  54194. [
  54195. [[link boost_asio.reference.serial_port_base__flow_control.load [*load]]]
  54196. []
  54197. ]
  54198. [
  54199. [[link boost_asio.reference.serial_port_base__flow_control.store [*store]]]
  54200. []
  54201. ]
  54202. [
  54203. [[link boost_asio.reference.serial_port_base__flow_control.value [*value]]]
  54204. []
  54205. ]
  54206. ]
  54207. Implements changing the flow control for a given serial port.
  54208. [heading Requirements]
  54209. ['Header: ][^boost/asio/serial_port_base.hpp]
  54210. ['Convenience header: ][^boost/asio.hpp]
  54211. [section:flow_control serial_port_base::flow_control::flow_control]
  54212. [indexterm2 boost_asio.indexterm.serial_port_base__flow_control.flow_control..flow_control..serial_port_base::flow_control]
  54213. flow_control(
  54214. type t = none);
  54215. [endsect]
  54216. [section:load serial_port_base::flow_control::load]
  54217. [indexterm2 boost_asio.indexterm.serial_port_base__flow_control.load..load..serial_port_base::flow_control]
  54218. void load(
  54219. const BOOST_ASIO_OPTION_STORAGE & storage,
  54220. boost::system::error_code & ec);
  54221. [endsect]
  54222. [section:store serial_port_base::flow_control::store]
  54223. [indexterm2 boost_asio.indexterm.serial_port_base__flow_control.store..store..serial_port_base::flow_control]
  54224. void store(
  54225. BOOST_ASIO_OPTION_STORAGE & storage,
  54226. boost::system::error_code & ec) const;
  54227. [endsect]
  54228. [section:type serial_port_base::flow_control::type]
  54229. [indexterm2 boost_asio.indexterm.serial_port_base__flow_control.type..type..serial_port_base::flow_control]
  54230. enum type
  54231. [indexterm2 boost_asio.indexterm.serial_port_base__flow_control.type.none..none..serial_port_base::flow_control]
  54232. [indexterm2 boost_asio.indexterm.serial_port_base__flow_control.type.software..software..serial_port_base::flow_control]
  54233. [indexterm2 boost_asio.indexterm.serial_port_base__flow_control.type.hardware..hardware..serial_port_base::flow_control]
  54234. [heading Values]
  54235. [variablelist
  54236. [
  54237. [none]
  54238. []
  54239. ]
  54240. [
  54241. [software]
  54242. []
  54243. ]
  54244. [
  54245. [hardware]
  54246. []
  54247. ]
  54248. ]
  54249. [endsect]
  54250. [section:value serial_port_base::flow_control::value]
  54251. [indexterm2 boost_asio.indexterm.serial_port_base__flow_control.value..value..serial_port_base::flow_control]
  54252. type value() const;
  54253. [endsect]
  54254. [endsect]
  54255. [section:serial_port_base__parity serial_port_base::parity]
  54256. Serial port option to permit changing the parity.
  54257. class parity
  54258. [heading Types]
  54259. [table
  54260. [[Name][Description]]
  54261. [
  54262. [[link boost_asio.reference.serial_port_base__parity.type [*type]]]
  54263. []
  54264. ]
  54265. ]
  54266. [heading Member Functions]
  54267. [table
  54268. [[Name][Description]]
  54269. [
  54270. [[link boost_asio.reference.serial_port_base__parity.load [*load]]]
  54271. []
  54272. ]
  54273. [
  54274. [[link boost_asio.reference.serial_port_base__parity.parity [*parity]]]
  54275. []
  54276. ]
  54277. [
  54278. [[link boost_asio.reference.serial_port_base__parity.store [*store]]]
  54279. []
  54280. ]
  54281. [
  54282. [[link boost_asio.reference.serial_port_base__parity.value [*value]]]
  54283. []
  54284. ]
  54285. ]
  54286. Implements changing the parity for a given serial port.
  54287. [heading Requirements]
  54288. ['Header: ][^boost/asio/serial_port_base.hpp]
  54289. ['Convenience header: ][^boost/asio.hpp]
  54290. [section:load serial_port_base::parity::load]
  54291. [indexterm2 boost_asio.indexterm.serial_port_base__parity.load..load..serial_port_base::parity]
  54292. void load(
  54293. const BOOST_ASIO_OPTION_STORAGE & storage,
  54294. boost::system::error_code & ec);
  54295. [endsect]
  54296. [section:parity serial_port_base::parity::parity]
  54297. [indexterm2 boost_asio.indexterm.serial_port_base__parity.parity..parity..serial_port_base::parity]
  54298. parity(
  54299. type t = none);
  54300. [endsect]
  54301. [section:store serial_port_base::parity::store]
  54302. [indexterm2 boost_asio.indexterm.serial_port_base__parity.store..store..serial_port_base::parity]
  54303. void store(
  54304. BOOST_ASIO_OPTION_STORAGE & storage,
  54305. boost::system::error_code & ec) const;
  54306. [endsect]
  54307. [section:type serial_port_base::parity::type]
  54308. [indexterm2 boost_asio.indexterm.serial_port_base__parity.type..type..serial_port_base::parity]
  54309. enum type
  54310. [indexterm2 boost_asio.indexterm.serial_port_base__parity.type.none..none..serial_port_base::parity]
  54311. [indexterm2 boost_asio.indexterm.serial_port_base__parity.type.odd..odd..serial_port_base::parity]
  54312. [indexterm2 boost_asio.indexterm.serial_port_base__parity.type.even..even..serial_port_base::parity]
  54313. [heading Values]
  54314. [variablelist
  54315. [
  54316. [none]
  54317. []
  54318. ]
  54319. [
  54320. [odd]
  54321. []
  54322. ]
  54323. [
  54324. [even]
  54325. []
  54326. ]
  54327. ]
  54328. [endsect]
  54329. [section:value serial_port_base::parity::value]
  54330. [indexterm2 boost_asio.indexterm.serial_port_base__parity.value..value..serial_port_base::parity]
  54331. type value() const;
  54332. [endsect]
  54333. [endsect]
  54334. [section:serial_port_base__stop_bits serial_port_base::stop_bits]
  54335. Serial port option to permit changing the number of stop bits.
  54336. class stop_bits
  54337. [heading Types]
  54338. [table
  54339. [[Name][Description]]
  54340. [
  54341. [[link boost_asio.reference.serial_port_base__stop_bits.type [*type]]]
  54342. []
  54343. ]
  54344. ]
  54345. [heading Member Functions]
  54346. [table
  54347. [[Name][Description]]
  54348. [
  54349. [[link boost_asio.reference.serial_port_base__stop_bits.load [*load]]]
  54350. []
  54351. ]
  54352. [
  54353. [[link boost_asio.reference.serial_port_base__stop_bits.stop_bits [*stop_bits]]]
  54354. []
  54355. ]
  54356. [
  54357. [[link boost_asio.reference.serial_port_base__stop_bits.store [*store]]]
  54358. []
  54359. ]
  54360. [
  54361. [[link boost_asio.reference.serial_port_base__stop_bits.value [*value]]]
  54362. []
  54363. ]
  54364. ]
  54365. Implements changing the number of stop bits for a given serial port.
  54366. [heading Requirements]
  54367. ['Header: ][^boost/asio/serial_port_base.hpp]
  54368. ['Convenience header: ][^boost/asio.hpp]
  54369. [section:load serial_port_base::stop_bits::load]
  54370. [indexterm2 boost_asio.indexterm.serial_port_base__stop_bits.load..load..serial_port_base::stop_bits]
  54371. void load(
  54372. const BOOST_ASIO_OPTION_STORAGE & storage,
  54373. boost::system::error_code & ec);
  54374. [endsect]
  54375. [section:stop_bits serial_port_base::stop_bits::stop_bits]
  54376. [indexterm2 boost_asio.indexterm.serial_port_base__stop_bits.stop_bits..stop_bits..serial_port_base::stop_bits]
  54377. stop_bits(
  54378. type t = one);
  54379. [endsect]
  54380. [section:store serial_port_base::stop_bits::store]
  54381. [indexterm2 boost_asio.indexterm.serial_port_base__stop_bits.store..store..serial_port_base::stop_bits]
  54382. void store(
  54383. BOOST_ASIO_OPTION_STORAGE & storage,
  54384. boost::system::error_code & ec) const;
  54385. [endsect]
  54386. [section:type serial_port_base::stop_bits::type]
  54387. [indexterm2 boost_asio.indexterm.serial_port_base__stop_bits.type..type..serial_port_base::stop_bits]
  54388. enum type
  54389. [indexterm2 boost_asio.indexterm.serial_port_base__stop_bits.type.one..one..serial_port_base::stop_bits]
  54390. [indexterm2 boost_asio.indexterm.serial_port_base__stop_bits.type.onepointfive..onepointfive..serial_port_base::stop_bits]
  54391. [indexterm2 boost_asio.indexterm.serial_port_base__stop_bits.type.two..two..serial_port_base::stop_bits]
  54392. [heading Values]
  54393. [variablelist
  54394. [
  54395. [one]
  54396. []
  54397. ]
  54398. [
  54399. [onepointfive]
  54400. []
  54401. ]
  54402. [
  54403. [two]
  54404. []
  54405. ]
  54406. ]
  54407. [endsect]
  54408. [section:value serial_port_base::stop_bits::value]
  54409. [indexterm2 boost_asio.indexterm.serial_port_base__stop_bits.value..value..serial_port_base::stop_bits]
  54410. type value() const;
  54411. [endsect]
  54412. [endsect]
  54413. [section:service_already_exists service_already_exists]
  54414. Exception thrown when trying to add a duplicate service to an [link boost_asio.reference.execution_context `execution_context`].
  54415. class service_already_exists
  54416. [heading Member Functions]
  54417. [table
  54418. [[Name][Description]]
  54419. [
  54420. [[link boost_asio.reference.service_already_exists.service_already_exists [*service_already_exists]]]
  54421. []
  54422. ]
  54423. ]
  54424. [heading Requirements]
  54425. ['Header: ][^boost/asio/execution_context.hpp]
  54426. ['Convenience header: ][^boost/asio.hpp]
  54427. [section:service_already_exists service_already_exists::service_already_exists]
  54428. [indexterm2 boost_asio.indexterm.service_already_exists.service_already_exists..service_already_exists..service_already_exists]
  54429. service_already_exists();
  54430. [endsect]
  54431. [endsect]
  54432. [section:signal_set signal_set]
  54433. [indexterm1 boost_asio.indexterm.signal_set..signal_set]
  54434. Typedef for the typical usage of a signal set.
  54435. typedef basic_signal_set signal_set;
  54436. [heading Types]
  54437. [table
  54438. [[Name][Description]]
  54439. [
  54440. [[link boost_asio.reference.basic_signal_set__rebind_executor [*rebind_executor]]]
  54441. [Rebinds the signal set type to another executor. ]
  54442. ]
  54443. [
  54444. [[link boost_asio.reference.basic_signal_set.executor_type [*executor_type]]]
  54445. [The type of the executor associated with the object. ]
  54446. ]
  54447. ]
  54448. [heading Member Functions]
  54449. [table
  54450. [[Name][Description]]
  54451. [
  54452. [[link boost_asio.reference.basic_signal_set.add [*add]]]
  54453. [Add a signal to a signal_set. ]
  54454. ]
  54455. [
  54456. [[link boost_asio.reference.basic_signal_set.async_wait [*async_wait]]]
  54457. [Start an asynchronous operation to wait for a signal to be delivered. ]
  54458. ]
  54459. [
  54460. [[link boost_asio.reference.basic_signal_set.basic_signal_set [*basic_signal_set]]]
  54461. [Construct a signal set without adding any signals.
  54462. [hr]
  54463. Construct a signal set and add one signal.
  54464. [hr]
  54465. Construct a signal set and add two signals.
  54466. [hr]
  54467. Construct a signal set and add three signals. ]
  54468. ]
  54469. [
  54470. [[link boost_asio.reference.basic_signal_set.cancel [*cancel]]]
  54471. [Cancel all operations associated with the signal set. ]
  54472. ]
  54473. [
  54474. [[link boost_asio.reference.basic_signal_set.clear [*clear]]]
  54475. [Remove all signals from a signal_set. ]
  54476. ]
  54477. [
  54478. [[link boost_asio.reference.basic_signal_set.get_executor [*get_executor]]]
  54479. [Get the executor associated with the object. ]
  54480. ]
  54481. [
  54482. [[link boost_asio.reference.basic_signal_set.remove [*remove]]]
  54483. [Remove a signal from a signal_set. ]
  54484. ]
  54485. [
  54486. [[link boost_asio.reference.basic_signal_set._basic_signal_set [*~basic_signal_set]]]
  54487. [Destroys the signal set. ]
  54488. ]
  54489. ]
  54490. The [link boost_asio.reference.basic_signal_set `basic_signal_set`] class provides the ability to perform an asynchronous wait for one or more signals to occur.
  54491. [heading Thread Safety]
  54492. ['Distinct] ['objects:] Safe.
  54493. ['Shared] ['objects:] Unsafe.
  54494. [heading Example]
  54495. Performing an asynchronous wait:
  54496. void handler(
  54497. const boost::system::error_code& error,
  54498. int signal_number)
  54499. {
  54500. if (!error)
  54501. {
  54502. // A signal occurred.
  54503. }
  54504. }
  54505. ...
  54506. // Construct a signal set registered for process termination.
  54507. boost::asio::signal_set signals(my_context, SIGINT, SIGTERM);
  54508. // Start an asynchronous wait for one of the signals to occur.
  54509. signals.async_wait(handler);
  54510. [heading Queueing of signal notifications]
  54511. If a signal is registered with a signal\_set, and the signal occurs when there are no waiting handlers, then the signal notification is queued. The next async\_wait operation on that signal\_set will dequeue the notification. If multiple notifications are queued, subsequent async\_wait operations dequeue them one at a time. Signal notifications are dequeued in order of ascending signal number.
  54512. If a signal number is removed from a signal\_set (using the `remove` or `erase` member functions) then any queued notifications for that signal are discarded.
  54513. [heading Multiple registration of signals]
  54514. The same signal number may be registered with different signal\_set objects. When the signal occurs, one handler is called for each signal\_set object.
  54515. Note that multiple registration only works for signals that are registered using Asio. The application must not also register a signal handler using functions such as `signal()` or `sigaction()`.
  54516. [heading Signal masking on POSIX platforms]
  54517. POSIX allows signals to be blocked using functions such as `sigprocmask()` and `pthread_sigmask()`. For signals to be delivered, programs must ensure that any signals registered using signal\_set objects are unblocked in at least one thread.
  54518. [heading Requirements]
  54519. ['Header: ][^boost/asio/signal_set.hpp]
  54520. ['Convenience header: ][^boost/asio.hpp]
  54521. [endsect]
  54522. [section:socket_base socket_base]
  54523. The [link boost_asio.reference.socket_base `socket_base`] class is used as a base for the [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] and [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] class templates so that we have a common place to define the shutdown\_type and enum.
  54524. class socket_base
  54525. [heading Types]
  54526. [table
  54527. [[Name][Description]]
  54528. [
  54529. [[link boost_asio.reference.socket_base.broadcast [*broadcast]]]
  54530. [Socket option to permit sending of broadcast messages. ]
  54531. ]
  54532. [
  54533. [[link boost_asio.reference.socket_base.bytes_readable [*bytes_readable]]]
  54534. [IO control command to get the amount of data that can be read without blocking. ]
  54535. ]
  54536. [
  54537. [[link boost_asio.reference.socket_base.debug [*debug]]]
  54538. [Socket option to enable socket-level debugging. ]
  54539. ]
  54540. [
  54541. [[link boost_asio.reference.socket_base.do_not_route [*do_not_route]]]
  54542. [Socket option to prevent routing, use local interfaces only. ]
  54543. ]
  54544. [
  54545. [[link boost_asio.reference.socket_base.enable_connection_aborted [*enable_connection_aborted]]]
  54546. [Socket option to report aborted connections on accept. ]
  54547. ]
  54548. [
  54549. [[link boost_asio.reference.socket_base.keep_alive [*keep_alive]]]
  54550. [Socket option to send keep-alives. ]
  54551. ]
  54552. [
  54553. [[link boost_asio.reference.socket_base.linger [*linger]]]
  54554. [Socket option to specify whether the socket lingers on close if unsent data is present. ]
  54555. ]
  54556. [
  54557. [[link boost_asio.reference.socket_base.message_flags [*message_flags]]]
  54558. [Bitmask type for flags that can be passed to send and receive operations. ]
  54559. ]
  54560. [
  54561. [[link boost_asio.reference.socket_base.out_of_band_inline [*out_of_band_inline]]]
  54562. [Socket option for putting received out-of-band data inline. ]
  54563. ]
  54564. [
  54565. [[link boost_asio.reference.socket_base.receive_buffer_size [*receive_buffer_size]]]
  54566. [Socket option for the receive buffer size of a socket. ]
  54567. ]
  54568. [
  54569. [[link boost_asio.reference.socket_base.receive_low_watermark [*receive_low_watermark]]]
  54570. [Socket option for the receive low watermark. ]
  54571. ]
  54572. [
  54573. [[link boost_asio.reference.socket_base.reuse_address [*reuse_address]]]
  54574. [Socket option to allow the socket to be bound to an address that is already in use. ]
  54575. ]
  54576. [
  54577. [[link boost_asio.reference.socket_base.send_buffer_size [*send_buffer_size]]]
  54578. [Socket option for the send buffer size of a socket. ]
  54579. ]
  54580. [
  54581. [[link boost_asio.reference.socket_base.send_low_watermark [*send_low_watermark]]]
  54582. [Socket option for the send low watermark. ]
  54583. ]
  54584. [
  54585. [[link boost_asio.reference.socket_base.shutdown_type [*shutdown_type]]]
  54586. [Different ways a socket may be shutdown. ]
  54587. ]
  54588. [
  54589. [[link boost_asio.reference.socket_base.wait_type [*wait_type]]]
  54590. [Wait types. ]
  54591. ]
  54592. ]
  54593. [heading Protected Member Functions]
  54594. [table
  54595. [[Name][Description]]
  54596. [
  54597. [[link boost_asio.reference.socket_base._socket_base [*~socket_base]]]
  54598. [Protected destructor to prevent deletion through this type. ]
  54599. ]
  54600. ]
  54601. [heading Data Members]
  54602. [table
  54603. [[Name][Description]]
  54604. [
  54605. [[link boost_asio.reference.socket_base.max_connections [*max_connections]]]
  54606. [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ]
  54607. ]
  54608. [
  54609. [[link boost_asio.reference.socket_base.max_listen_connections [*max_listen_connections]]]
  54610. [The maximum length of the queue of pending incoming connections. ]
  54611. ]
  54612. [
  54613. [[link boost_asio.reference.socket_base.message_do_not_route [*message_do_not_route]]]
  54614. [Specify that the data should not be subject to routing. ]
  54615. ]
  54616. [
  54617. [[link boost_asio.reference.socket_base.message_end_of_record [*message_end_of_record]]]
  54618. [Specifies that the data marks the end of a record. ]
  54619. ]
  54620. [
  54621. [[link boost_asio.reference.socket_base.message_out_of_band [*message_out_of_band]]]
  54622. [Process out-of-band data. ]
  54623. ]
  54624. [
  54625. [[link boost_asio.reference.socket_base.message_peek [*message_peek]]]
  54626. [Peek at incoming data without removing it from the input queue. ]
  54627. ]
  54628. ]
  54629. [heading Requirements]
  54630. ['Header: ][^boost/asio/socket_base.hpp]
  54631. ['Convenience header: ][^boost/asio.hpp]
  54632. [section:broadcast socket_base::broadcast]
  54633. [indexterm2 boost_asio.indexterm.socket_base.broadcast..broadcast..socket_base]
  54634. Socket option to permit sending of broadcast messages.
  54635. typedef implementation_defined broadcast;
  54636. Implements the SOL\_SOCKET/SO\_BROADCAST socket option.
  54637. [heading Examples]
  54638. Setting the option:
  54639. boost::asio::ip::udp::socket socket(my_context);
  54640. ...
  54641. boost::asio::socket_base::broadcast option(true);
  54642. socket.set_option(option);
  54643. Getting the current option value:
  54644. boost::asio::ip::udp::socket socket(my_context);
  54645. ...
  54646. boost::asio::socket_base::broadcast option;
  54647. socket.get_option(option);
  54648. bool is_set = option.value();
  54649. [heading Requirements]
  54650. ['Header: ][^boost/asio/socket_base.hpp]
  54651. ['Convenience header: ][^boost/asio.hpp]
  54652. [endsect]
  54653. [section:bytes_readable socket_base::bytes_readable]
  54654. [indexterm2 boost_asio.indexterm.socket_base.bytes_readable..bytes_readable..socket_base]
  54655. IO control command to get the amount of data that can be read without blocking.
  54656. typedef implementation_defined bytes_readable;
  54657. Implements the FIONREAD IO control command.
  54658. [heading Example]
  54659. boost::asio::ip::tcp::socket socket(my_context);
  54660. ...
  54661. boost::asio::socket_base::bytes_readable command(true);
  54662. socket.io_control(command);
  54663. std::size_t bytes_readable = command.get();
  54664. [heading Requirements]
  54665. ['Header: ][^boost/asio/socket_base.hpp]
  54666. ['Convenience header: ][^boost/asio.hpp]
  54667. [endsect]
  54668. [section:debug socket_base::debug]
  54669. [indexterm2 boost_asio.indexterm.socket_base.debug..debug..socket_base]
  54670. Socket option to enable socket-level debugging.
  54671. typedef implementation_defined debug;
  54672. Implements the SOL\_SOCKET/SO\_DEBUG socket option.
  54673. [heading Examples]
  54674. Setting the option:
  54675. boost::asio::ip::tcp::socket socket(my_context);
  54676. ...
  54677. boost::asio::socket_base::debug option(true);
  54678. socket.set_option(option);
  54679. Getting the current option value:
  54680. boost::asio::ip::tcp::socket socket(my_context);
  54681. ...
  54682. boost::asio::socket_base::debug option;
  54683. socket.get_option(option);
  54684. bool is_set = option.value();
  54685. [heading Requirements]
  54686. ['Header: ][^boost/asio/socket_base.hpp]
  54687. ['Convenience header: ][^boost/asio.hpp]
  54688. [endsect]
  54689. [section:do_not_route socket_base::do_not_route]
  54690. [indexterm2 boost_asio.indexterm.socket_base.do_not_route..do_not_route..socket_base]
  54691. Socket option to prevent routing, use local interfaces only.
  54692. typedef implementation_defined do_not_route;
  54693. Implements the SOL\_SOCKET/SO\_DONTROUTE socket option.
  54694. [heading Examples]
  54695. Setting the option:
  54696. boost::asio::ip::udp::socket socket(my_context);
  54697. ...
  54698. boost::asio::socket_base::do_not_route option(true);
  54699. socket.set_option(option);
  54700. Getting the current option value:
  54701. boost::asio::ip::udp::socket socket(my_context);
  54702. ...
  54703. boost::asio::socket_base::do_not_route option;
  54704. socket.get_option(option);
  54705. bool is_set = option.value();
  54706. [heading Requirements]
  54707. ['Header: ][^boost/asio/socket_base.hpp]
  54708. ['Convenience header: ][^boost/asio.hpp]
  54709. [endsect]
  54710. [section:enable_connection_aborted socket_base::enable_connection_aborted]
  54711. [indexterm2 boost_asio.indexterm.socket_base.enable_connection_aborted..enable_connection_aborted..socket_base]
  54712. Socket option to report aborted connections on accept.
  54713. typedef implementation_defined enable_connection_aborted;
  54714. Implements a custom socket option that determines whether or not an accept operation is permitted to fail with `boost::asio::error::connection_aborted`. By default the option is false.
  54715. [heading Examples]
  54716. Setting the option:
  54717. boost::asio::ip::tcp::acceptor acceptor(my_context);
  54718. ...
  54719. boost::asio::socket_base::enable_connection_aborted option(true);
  54720. acceptor.set_option(option);
  54721. Getting the current option value:
  54722. boost::asio::ip::tcp::acceptor acceptor(my_context);
  54723. ...
  54724. boost::asio::socket_base::enable_connection_aborted option;
  54725. acceptor.get_option(option);
  54726. bool is_set = option.value();
  54727. [heading Requirements]
  54728. ['Header: ][^boost/asio/socket_base.hpp]
  54729. ['Convenience header: ][^boost/asio.hpp]
  54730. [endsect]
  54731. [section:keep_alive socket_base::keep_alive]
  54732. [indexterm2 boost_asio.indexterm.socket_base.keep_alive..keep_alive..socket_base]
  54733. Socket option to send keep-alives.
  54734. typedef implementation_defined keep_alive;
  54735. Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option.
  54736. [heading Examples]
  54737. Setting the option:
  54738. boost::asio::ip::tcp::socket socket(my_context);
  54739. ...
  54740. boost::asio::socket_base::keep_alive option(true);
  54741. socket.set_option(option);
  54742. Getting the current option value:
  54743. boost::asio::ip::tcp::socket socket(my_context);
  54744. ...
  54745. boost::asio::socket_base::keep_alive option;
  54746. socket.get_option(option);
  54747. bool is_set = option.value();
  54748. [heading Requirements]
  54749. ['Header: ][^boost/asio/socket_base.hpp]
  54750. ['Convenience header: ][^boost/asio.hpp]
  54751. [endsect]
  54752. [section:linger socket_base::linger]
  54753. [indexterm2 boost_asio.indexterm.socket_base.linger..linger..socket_base]
  54754. Socket option to specify whether the socket lingers on close if unsent data is present.
  54755. typedef implementation_defined linger;
  54756. Implements the SOL\_SOCKET/SO\_LINGER socket option.
  54757. [heading Examples]
  54758. Setting the option:
  54759. boost::asio::ip::tcp::socket socket(my_context);
  54760. ...
  54761. boost::asio::socket_base::linger option(true, 30);
  54762. socket.set_option(option);
  54763. Getting the current option value:
  54764. boost::asio::ip::tcp::socket socket(my_context);
  54765. ...
  54766. boost::asio::socket_base::linger option;
  54767. socket.get_option(option);
  54768. bool is_set = option.enabled();
  54769. unsigned short timeout = option.timeout();
  54770. [heading Requirements]
  54771. ['Header: ][^boost/asio/socket_base.hpp]
  54772. ['Convenience header: ][^boost/asio.hpp]
  54773. [endsect]
  54774. [section:max_connections socket_base::max_connections]
  54775. [indexterm2 boost_asio.indexterm.socket_base.max_connections..max_connections..socket_base]
  54776. (Deprecated: Use max\_listen\_connections.) The maximum length of the queue of pending incoming connections.
  54777. static const int max_connections = implementation_defined;
  54778. [endsect]
  54779. [section:max_listen_connections socket_base::max_listen_connections]
  54780. [indexterm2 boost_asio.indexterm.socket_base.max_listen_connections..max_listen_connections..socket_base]
  54781. The maximum length of the queue of pending incoming connections.
  54782. static const int max_listen_connections = implementation_defined;
  54783. [endsect]
  54784. [section:message_do_not_route socket_base::message_do_not_route]
  54785. [indexterm2 boost_asio.indexterm.socket_base.message_do_not_route..message_do_not_route..socket_base]
  54786. Specify that the data should not be subject to routing.
  54787. static const int message_do_not_route = implementation_defined;
  54788. [endsect]
  54789. [section:message_end_of_record socket_base::message_end_of_record]
  54790. [indexterm2 boost_asio.indexterm.socket_base.message_end_of_record..message_end_of_record..socket_base]
  54791. Specifies that the data marks the end of a record.
  54792. static const int message_end_of_record = implementation_defined;
  54793. [endsect]
  54794. [section:message_flags socket_base::message_flags]
  54795. [indexterm2 boost_asio.indexterm.socket_base.message_flags..message_flags..socket_base]
  54796. Bitmask type for flags that can be passed to send and receive operations.
  54797. typedef int message_flags;
  54798. [heading Requirements]
  54799. ['Header: ][^boost/asio/socket_base.hpp]
  54800. ['Convenience header: ][^boost/asio.hpp]
  54801. [endsect]
  54802. [section:message_out_of_band socket_base::message_out_of_band]
  54803. [indexterm2 boost_asio.indexterm.socket_base.message_out_of_band..message_out_of_band..socket_base]
  54804. Process out-of-band data.
  54805. static const int message_out_of_band = implementation_defined;
  54806. [endsect]
  54807. [section:message_peek socket_base::message_peek]
  54808. [indexterm2 boost_asio.indexterm.socket_base.message_peek..message_peek..socket_base]
  54809. Peek at incoming data without removing it from the input queue.
  54810. static const int message_peek = implementation_defined;
  54811. [endsect]
  54812. [section:out_of_band_inline socket_base::out_of_band_inline]
  54813. [indexterm2 boost_asio.indexterm.socket_base.out_of_band_inline..out_of_band_inline..socket_base]
  54814. Socket option for putting received out-of-band data inline.
  54815. typedef implementation_defined out_of_band_inline;
  54816. Implements the SOL\_SOCKET/SO\_OOBINLINE socket option.
  54817. [heading Examples]
  54818. Setting the option:
  54819. boost::asio::ip::tcp::socket socket(my_context);
  54820. ...
  54821. boost::asio::socket_base::out_of_band_inline option(true);
  54822. socket.set_option(option);
  54823. Getting the current option value:
  54824. boost::asio::ip::tcp::socket socket(my_context);
  54825. ...
  54826. boost::asio::socket_base::out_of_band_inline option;
  54827. socket.get_option(option);
  54828. bool value = option.value();
  54829. [heading Requirements]
  54830. ['Header: ][^boost/asio/socket_base.hpp]
  54831. ['Convenience header: ][^boost/asio.hpp]
  54832. [endsect]
  54833. [section:receive_buffer_size socket_base::receive_buffer_size]
  54834. [indexterm2 boost_asio.indexterm.socket_base.receive_buffer_size..receive_buffer_size..socket_base]
  54835. Socket option for the receive buffer size of a socket.
  54836. typedef implementation_defined receive_buffer_size;
  54837. Implements the SOL\_SOCKET/SO\_RCVBUF socket option.
  54838. [heading Examples]
  54839. Setting the option:
  54840. boost::asio::ip::tcp::socket socket(my_context);
  54841. ...
  54842. boost::asio::socket_base::receive_buffer_size option(8192);
  54843. socket.set_option(option);
  54844. Getting the current option value:
  54845. boost::asio::ip::tcp::socket socket(my_context);
  54846. ...
  54847. boost::asio::socket_base::receive_buffer_size option;
  54848. socket.get_option(option);
  54849. int size = option.value();
  54850. [heading Requirements]
  54851. ['Header: ][^boost/asio/socket_base.hpp]
  54852. ['Convenience header: ][^boost/asio.hpp]
  54853. [endsect]
  54854. [section:receive_low_watermark socket_base::receive_low_watermark]
  54855. [indexterm2 boost_asio.indexterm.socket_base.receive_low_watermark..receive_low_watermark..socket_base]
  54856. Socket option for the receive low watermark.
  54857. typedef implementation_defined receive_low_watermark;
  54858. Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option.
  54859. [heading Examples]
  54860. Setting the option:
  54861. boost::asio::ip::tcp::socket socket(my_context);
  54862. ...
  54863. boost::asio::socket_base::receive_low_watermark option(1024);
  54864. socket.set_option(option);
  54865. Getting the current option value:
  54866. boost::asio::ip::tcp::socket socket(my_context);
  54867. ...
  54868. boost::asio::socket_base::receive_low_watermark option;
  54869. socket.get_option(option);
  54870. int size = option.value();
  54871. [heading Requirements]
  54872. ['Header: ][^boost/asio/socket_base.hpp]
  54873. ['Convenience header: ][^boost/asio.hpp]
  54874. [endsect]
  54875. [section:reuse_address socket_base::reuse_address]
  54876. [indexterm2 boost_asio.indexterm.socket_base.reuse_address..reuse_address..socket_base]
  54877. Socket option to allow the socket to be bound to an address that is already in use.
  54878. typedef implementation_defined reuse_address;
  54879. Implements the SOL\_SOCKET/SO\_REUSEADDR socket option.
  54880. [heading Examples]
  54881. Setting the option:
  54882. boost::asio::ip::tcp::acceptor acceptor(my_context);
  54883. ...
  54884. boost::asio::socket_base::reuse_address option(true);
  54885. acceptor.set_option(option);
  54886. Getting the current option value:
  54887. boost::asio::ip::tcp::acceptor acceptor(my_context);
  54888. ...
  54889. boost::asio::socket_base::reuse_address option;
  54890. acceptor.get_option(option);
  54891. bool is_set = option.value();
  54892. [heading Requirements]
  54893. ['Header: ][^boost/asio/socket_base.hpp]
  54894. ['Convenience header: ][^boost/asio.hpp]
  54895. [endsect]
  54896. [section:send_buffer_size socket_base::send_buffer_size]
  54897. [indexterm2 boost_asio.indexterm.socket_base.send_buffer_size..send_buffer_size..socket_base]
  54898. Socket option for the send buffer size of a socket.
  54899. typedef implementation_defined send_buffer_size;
  54900. Implements the SOL\_SOCKET/SO\_SNDBUF socket option.
  54901. [heading Examples]
  54902. Setting the option:
  54903. boost::asio::ip::tcp::socket socket(my_context);
  54904. ...
  54905. boost::asio::socket_base::send_buffer_size option(8192);
  54906. socket.set_option(option);
  54907. Getting the current option value:
  54908. boost::asio::ip::tcp::socket socket(my_context);
  54909. ...
  54910. boost::asio::socket_base::send_buffer_size option;
  54911. socket.get_option(option);
  54912. int size = option.value();
  54913. [heading Requirements]
  54914. ['Header: ][^boost/asio/socket_base.hpp]
  54915. ['Convenience header: ][^boost/asio.hpp]
  54916. [endsect]
  54917. [section:send_low_watermark socket_base::send_low_watermark]
  54918. [indexterm2 boost_asio.indexterm.socket_base.send_low_watermark..send_low_watermark..socket_base]
  54919. Socket option for the send low watermark.
  54920. typedef implementation_defined send_low_watermark;
  54921. Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option.
  54922. [heading Examples]
  54923. Setting the option:
  54924. boost::asio::ip::tcp::socket socket(my_context);
  54925. ...
  54926. boost::asio::socket_base::send_low_watermark option(1024);
  54927. socket.set_option(option);
  54928. Getting the current option value:
  54929. boost::asio::ip::tcp::socket socket(my_context);
  54930. ...
  54931. boost::asio::socket_base::send_low_watermark option;
  54932. socket.get_option(option);
  54933. int size = option.value();
  54934. [heading Requirements]
  54935. ['Header: ][^boost/asio/socket_base.hpp]
  54936. ['Convenience header: ][^boost/asio.hpp]
  54937. [endsect]
  54938. [section:shutdown_type socket_base::shutdown_type]
  54939. [indexterm2 boost_asio.indexterm.socket_base.shutdown_type..shutdown_type..socket_base]
  54940. Different ways a socket may be shutdown.
  54941. enum shutdown_type
  54942. [indexterm2 boost_asio.indexterm.socket_base.shutdown_type.shutdown_receive..shutdown_receive..socket_base]
  54943. [indexterm2 boost_asio.indexterm.socket_base.shutdown_type.shutdown_send..shutdown_send..socket_base]
  54944. [indexterm2 boost_asio.indexterm.socket_base.shutdown_type.shutdown_both..shutdown_both..socket_base]
  54945. [heading Values]
  54946. [variablelist
  54947. [
  54948. [shutdown_receive]
  54949. [Shutdown the receive side of the socket. ]
  54950. ]
  54951. [
  54952. [shutdown_send]
  54953. [Shutdown the send side of the socket. ]
  54954. ]
  54955. [
  54956. [shutdown_both]
  54957. [Shutdown both send and receive on the socket. ]
  54958. ]
  54959. ]
  54960. [endsect]
  54961. [section:wait_type socket_base::wait_type]
  54962. [indexterm2 boost_asio.indexterm.socket_base.wait_type..wait_type..socket_base]
  54963. Wait types.
  54964. enum wait_type
  54965. [indexterm2 boost_asio.indexterm.socket_base.wait_type.wait_read..wait_read..socket_base]
  54966. [indexterm2 boost_asio.indexterm.socket_base.wait_type.wait_write..wait_write..socket_base]
  54967. [indexterm2 boost_asio.indexterm.socket_base.wait_type.wait_error..wait_error..socket_base]
  54968. [heading Values]
  54969. [variablelist
  54970. [
  54971. [wait_read]
  54972. [Wait for a socket to become ready to read. ]
  54973. ]
  54974. [
  54975. [wait_write]
  54976. [Wait for a socket to become ready to write. ]
  54977. ]
  54978. [
  54979. [wait_error]
  54980. [Wait for a socket to have error conditions pending. ]
  54981. ]
  54982. ]
  54983. For use with `basic_socket::wait()` and `basic_socket::async_wait()`.
  54984. [endsect]
  54985. [section:_socket_base socket_base::~socket_base]
  54986. [indexterm2 boost_asio.indexterm.socket_base._socket_base..~socket_base..socket_base]
  54987. Protected destructor to prevent deletion through this type.
  54988. ~socket_base();
  54989. [endsect]
  54990. [endsect]
  54991. [section:spawn spawn]
  54992. [indexterm1 boost_asio.indexterm.spawn..spawn]
  54993. Start a new stackful coroutine.
  54994. Start a new stackful coroutine, calling the specified handler when it completes.
  54995. template<
  54996. typename Function>
  54997. void ``[link boost_asio.reference.spawn.overload1 spawn]``(
  54998. Function && function,
  54999. const boost::coroutines::attributes & attributes = boost::coroutines::attributes());
  55000. `` [''''&raquo;''' [link boost_asio.reference.spawn.overload1 more...]]``
  55001. template<
  55002. typename ``[link boost_asio.reference.Handler Handler]``,
  55003. typename Function>
  55004. void ``[link boost_asio.reference.spawn.overload2 spawn]``(
  55005. Handler && handler,
  55006. Function && function,
  55007. const boost::coroutines::attributes & attributes = boost::coroutines::attributes(),
  55008. typename enable_if<!is_executor< typename decay< Handler >::type >::value &&!is_convertible< Handler &, execution_context & >::value >::type * = 0);
  55009. `` [''''&raquo;''' [link boost_asio.reference.spawn.overload2 more...]]``
  55010. Start a new stackful coroutine, inheriting the execution context of another.
  55011. template<
  55012. typename ``[link boost_asio.reference.Handler Handler]``,
  55013. typename Function>
  55014. void ``[link boost_asio.reference.spawn.overload3 spawn]``(
  55015. basic_yield_context< Handler > ctx,
  55016. Function && function,
  55017. const boost::coroutines::attributes & attributes = boost::coroutines::attributes());
  55018. `` [''''&raquo;''' [link boost_asio.reference.spawn.overload3 more...]]``
  55019. Start a new stackful coroutine that executes on a given executor.
  55020. template<
  55021. typename Function,
  55022. typename ``[link boost_asio.reference.Executor1 Executor]``>
  55023. void ``[link boost_asio.reference.spawn.overload4 spawn]``(
  55024. const Executor & ex,
  55025. Function && function,
  55026. const boost::coroutines::attributes & attributes = boost::coroutines::attributes(),
  55027. typename enable_if< is_executor< Executor >::value >::type * = 0);
  55028. `` [''''&raquo;''' [link boost_asio.reference.spawn.overload4 more...]]``
  55029. Start a new stackful coroutine that executes on a given strand.
  55030. template<
  55031. typename Function,
  55032. typename ``[link boost_asio.reference.Executor1 Executor]``>
  55033. void ``[link boost_asio.reference.spawn.overload5 spawn]``(
  55034. const strand< Executor > & ex,
  55035. Function && function,
  55036. const boost::coroutines::attributes & attributes = boost::coroutines::attributes());
  55037. `` [''''&raquo;''' [link boost_asio.reference.spawn.overload5 more...]]``
  55038. Start a new stackful coroutine that executes in the context of a strand.
  55039. template<
  55040. typename Function>
  55041. void ``[link boost_asio.reference.spawn.overload6 spawn]``(
  55042. const boost::asio::io_context::strand & s,
  55043. Function && function,
  55044. const boost::coroutines::attributes & attributes = boost::coroutines::attributes());
  55045. `` [''''&raquo;''' [link boost_asio.reference.spawn.overload6 more...]]``
  55046. Start a new stackful coroutine that executes on a given execution context.
  55047. template<
  55048. typename Function,
  55049. typename ExecutionContext>
  55050. void ``[link boost_asio.reference.spawn.overload7 spawn]``(
  55051. ExecutionContext & ctx,
  55052. Function && function,
  55053. const boost::coroutines::attributes & attributes = boost::coroutines::attributes(),
  55054. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  55055. `` [''''&raquo;''' [link boost_asio.reference.spawn.overload7 more...]]``
  55056. The `spawn()` function is a high-level wrapper over the Boost.Coroutine library. This function enables programs to implement asynchronous logic in a synchronous manner, as illustrated by the following example:
  55057. boost::asio::spawn(my_strand, do_echo);
  55058. // ...
  55059. void do_echo(boost::asio::yield_context yield)
  55060. {
  55061. try
  55062. {
  55063. char data[128];
  55064. for (;;)
  55065. {
  55066. std::size_t length =
  55067. my_socket.async_read_some(
  55068. boost::asio::buffer(data), yield);
  55069. boost::asio::async_write(my_socket,
  55070. boost::asio::buffer(data, length), yield);
  55071. }
  55072. }
  55073. catch (std::exception& e)
  55074. {
  55075. // ...
  55076. }
  55077. }
  55078. [heading Requirements]
  55079. ['Header: ][^boost/asio/spawn.hpp]
  55080. ['Convenience header: ]None
  55081. [section:overload1 spawn (1 of 7 overloads)]
  55082. Start a new stackful coroutine, calling the specified handler when it completes.
  55083. template<
  55084. typename Function>
  55085. void spawn(
  55086. Function && function,
  55087. const boost::coroutines::attributes & attributes = boost::coroutines::attributes());
  55088. This function is used to launch a new coroutine.
  55089. [heading Parameters]
  55090. [variablelist
  55091. [[function][The coroutine function. The function must have the signature:
  55092. ``
  55093. void function(basic_yield_context<Handler> yield);
  55094. ``
  55095. ]]
  55096. [[attributes][Boost.Coroutine attributes used to customise the coroutine. ]]
  55097. ]
  55098. [endsect]
  55099. [section:overload2 spawn (2 of 7 overloads)]
  55100. Start a new stackful coroutine, calling the specified handler when it completes.
  55101. template<
  55102. typename ``[link boost_asio.reference.Handler Handler]``,
  55103. typename Function>
  55104. void spawn(
  55105. Handler && handler,
  55106. Function && function,
  55107. const boost::coroutines::attributes & attributes = boost::coroutines::attributes(),
  55108. typename enable_if<!is_executor< typename decay< Handler >::type >::value &&!is_convertible< Handler &, execution_context & >::value >::type * = 0);
  55109. This function is used to launch a new coroutine.
  55110. [heading Parameters]
  55111. [variablelist
  55112. [[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:
  55113. ``
  55114. void handler();
  55115. ``
  55116. ]]
  55117. [[function][The coroutine function. The function must have the signature:
  55118. ``
  55119. void function(basic_yield_context<Handler> yield);
  55120. ``
  55121. ]]
  55122. [[attributes][Boost.Coroutine attributes used to customise the coroutine. ]]
  55123. ]
  55124. [endsect]
  55125. [section:overload3 spawn (3 of 7 overloads)]
  55126. Start a new stackful coroutine, inheriting the execution context of another.
  55127. template<
  55128. typename ``[link boost_asio.reference.Handler Handler]``,
  55129. typename Function>
  55130. void spawn(
  55131. basic_yield_context< Handler > ctx,
  55132. Function && function,
  55133. const boost::coroutines::attributes & attributes = boost::coroutines::attributes());
  55134. This function is used to launch a new coroutine.
  55135. [heading Parameters]
  55136. [variablelist
  55137. [[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.]]
  55138. [[function][The coroutine function. The function must have the signature:
  55139. ``
  55140. void function(basic_yield_context<Handler> yield);
  55141. ``
  55142. ]]
  55143. [[attributes][Boost.Coroutine attributes used to customise the coroutine. ]]
  55144. ]
  55145. [endsect]
  55146. [section:overload4 spawn (4 of 7 overloads)]
  55147. Start a new stackful coroutine that executes on a given executor.
  55148. template<
  55149. typename Function,
  55150. typename ``[link boost_asio.reference.Executor1 Executor]``>
  55151. void spawn(
  55152. const Executor & ex,
  55153. Function && function,
  55154. const boost::coroutines::attributes & attributes = boost::coroutines::attributes(),
  55155. typename enable_if< is_executor< Executor >::value >::type * = 0);
  55156. This function is used to launch a new coroutine.
  55157. [heading Parameters]
  55158. [variablelist
  55159. [[ex][Identifies the executor that will run the coroutine. The new coroutine is implicitly given its own strand within this executor.]]
  55160. [[function][The coroutine function. The function must have the signature:
  55161. ``
  55162. void function(yield_context yield);
  55163. ``
  55164. ]]
  55165. [[attributes][Boost.Coroutine attributes used to customise the coroutine. ]]
  55166. ]
  55167. [endsect]
  55168. [section:overload5 spawn (5 of 7 overloads)]
  55169. Start a new stackful coroutine that executes on a given strand.
  55170. template<
  55171. typename Function,
  55172. typename ``[link boost_asio.reference.Executor1 Executor]``>
  55173. void spawn(
  55174. const strand< Executor > & ex,
  55175. Function && function,
  55176. const boost::coroutines::attributes & attributes = boost::coroutines::attributes());
  55177. This function is used to launch a new coroutine.
  55178. [heading Parameters]
  55179. [variablelist
  55180. [[ex][Identifies the strand that will run the coroutine.]]
  55181. [[function][The coroutine function. The function must have the signature:
  55182. ``
  55183. void function(yield_context yield);
  55184. ``
  55185. ]]
  55186. [[attributes][Boost.Coroutine attributes used to customise the coroutine. ]]
  55187. ]
  55188. [endsect]
  55189. [section:overload6 spawn (6 of 7 overloads)]
  55190. Start a new stackful coroutine that executes in the context of a strand.
  55191. template<
  55192. typename Function>
  55193. void spawn(
  55194. const boost::asio::io_context::strand & s,
  55195. Function && function,
  55196. const boost::coroutines::attributes & attributes = boost::coroutines::attributes());
  55197. This function is used to launch a new coroutine.
  55198. [heading Parameters]
  55199. [variablelist
  55200. [[s][Identifies a strand. By starting multiple coroutines on the same strand, the implementation ensures that none of those coroutines can execute simultaneously.]]
  55201. [[function][The coroutine function. The function must have the signature:
  55202. ``
  55203. void function(yield_context yield);
  55204. ``
  55205. ]]
  55206. [[attributes][Boost.Coroutine attributes used to customise the coroutine. ]]
  55207. ]
  55208. [endsect]
  55209. [section:overload7 spawn (7 of 7 overloads)]
  55210. Start a new stackful coroutine that executes on a given execution context.
  55211. template<
  55212. typename Function,
  55213. typename ExecutionContext>
  55214. void spawn(
  55215. ExecutionContext & ctx,
  55216. Function && function,
  55217. const boost::coroutines::attributes & attributes = boost::coroutines::attributes(),
  55218. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  55219. This function is used to launch a new coroutine.
  55220. [heading Parameters]
  55221. [variablelist
  55222. [[ctx][Identifies the execution context that will run the coroutine. The new coroutine is implicitly given its own strand within this execution context.]]
  55223. [[function][The coroutine function. The function must have the signature:
  55224. ``
  55225. void function(yield_context yield);
  55226. ``
  55227. ]]
  55228. [[attributes][Boost.Coroutine attributes used to customise the coroutine. ]]
  55229. ]
  55230. [endsect]
  55231. [endsect]
  55232. [section:ssl__context ssl::context]
  55233. class context :
  55234. public ssl::context_base,
  55235. noncopyable
  55236. [heading Types]
  55237. [table
  55238. [[Name][Description]]
  55239. [
  55240. [[link boost_asio.reference.ssl__context.file_format [*file_format]]]
  55241. [File format types. ]
  55242. ]
  55243. [
  55244. [[link boost_asio.reference.ssl__context.method [*method]]]
  55245. [Different methods supported by a context. ]
  55246. ]
  55247. [
  55248. [[link boost_asio.reference.ssl__context.native_handle_type [*native_handle_type]]]
  55249. [The native handle type of the SSL context. ]
  55250. ]
  55251. [
  55252. [[link boost_asio.reference.ssl__context.options [*options]]]
  55253. [Bitmask type for SSL options. ]
  55254. ]
  55255. [
  55256. [[link boost_asio.reference.ssl__context.password_purpose [*password_purpose]]]
  55257. [Purpose of PEM password. ]
  55258. ]
  55259. ]
  55260. [heading Member Functions]
  55261. [table
  55262. [[Name][Description]]
  55263. [
  55264. [[link boost_asio.reference.ssl__context.add_certificate_authority [*add_certificate_authority]]]
  55265. [Add certification authority for performing verification. ]
  55266. ]
  55267. [
  55268. [[link boost_asio.reference.ssl__context.add_verify_path [*add_verify_path]]]
  55269. [Add a directory containing certificate authority files to be used for performing verification. ]
  55270. ]
  55271. [
  55272. [[link boost_asio.reference.ssl__context.clear_options [*clear_options]]]
  55273. [Clear options on the context. ]
  55274. ]
  55275. [
  55276. [[link boost_asio.reference.ssl__context.context [*context]]]
  55277. [Constructor.
  55278. [hr]
  55279. Move-construct a context from another. ]
  55280. ]
  55281. [
  55282. [[link boost_asio.reference.ssl__context.load_verify_file [*load_verify_file]]]
  55283. [Load a certification authority file for performing verification. ]
  55284. ]
  55285. [
  55286. [[link boost_asio.reference.ssl__context.native_handle [*native_handle]]]
  55287. [Get the underlying implementation in the native type. ]
  55288. ]
  55289. [
  55290. [[link boost_asio.reference.ssl__context.operator_eq_ [*operator=]]]
  55291. [Move-assign a context from another. ]
  55292. ]
  55293. [
  55294. [[link boost_asio.reference.ssl__context.set_default_verify_paths [*set_default_verify_paths]]]
  55295. [Configures the context to use the default directories for finding certification authority certificates. ]
  55296. ]
  55297. [
  55298. [[link boost_asio.reference.ssl__context.set_options [*set_options]]]
  55299. [Set options on the context. ]
  55300. ]
  55301. [
  55302. [[link boost_asio.reference.ssl__context.set_password_callback [*set_password_callback]]]
  55303. [Set the password callback. ]
  55304. ]
  55305. [
  55306. [[link boost_asio.reference.ssl__context.set_verify_callback [*set_verify_callback]]]
  55307. [Set the callback used to verify peer certificates. ]
  55308. ]
  55309. [
  55310. [[link boost_asio.reference.ssl__context.set_verify_depth [*set_verify_depth]]]
  55311. [Set the peer verification depth. ]
  55312. ]
  55313. [
  55314. [[link boost_asio.reference.ssl__context.set_verify_mode [*set_verify_mode]]]
  55315. [Set the peer verification mode. ]
  55316. ]
  55317. [
  55318. [[link boost_asio.reference.ssl__context.use_certificate [*use_certificate]]]
  55319. [Use a certificate from a memory buffer. ]
  55320. ]
  55321. [
  55322. [[link boost_asio.reference.ssl__context.use_certificate_chain [*use_certificate_chain]]]
  55323. [Use a certificate chain from a memory buffer. ]
  55324. ]
  55325. [
  55326. [[link boost_asio.reference.ssl__context.use_certificate_chain_file [*use_certificate_chain_file]]]
  55327. [Use a certificate chain from a file. ]
  55328. ]
  55329. [
  55330. [[link boost_asio.reference.ssl__context.use_certificate_file [*use_certificate_file]]]
  55331. [Use a certificate from a file. ]
  55332. ]
  55333. [
  55334. [[link boost_asio.reference.ssl__context.use_private_key [*use_private_key]]]
  55335. [Use a private key from a memory buffer. ]
  55336. ]
  55337. [
  55338. [[link boost_asio.reference.ssl__context.use_private_key_file [*use_private_key_file]]]
  55339. [Use a private key from a file. ]
  55340. ]
  55341. [
  55342. [[link boost_asio.reference.ssl__context.use_rsa_private_key [*use_rsa_private_key]]]
  55343. [Use an RSA private key from a memory buffer. ]
  55344. ]
  55345. [
  55346. [[link boost_asio.reference.ssl__context.use_rsa_private_key_file [*use_rsa_private_key_file]]]
  55347. [Use an RSA private key from a file. ]
  55348. ]
  55349. [
  55350. [[link boost_asio.reference.ssl__context.use_tmp_dh [*use_tmp_dh]]]
  55351. [Use the specified memory buffer to obtain the temporary Diffie-Hellman parameters. ]
  55352. ]
  55353. [
  55354. [[link boost_asio.reference.ssl__context.use_tmp_dh_file [*use_tmp_dh_file]]]
  55355. [Use the specified file to obtain the temporary Diffie-Hellman parameters. ]
  55356. ]
  55357. [
  55358. [[link boost_asio.reference.ssl__context._context [*~context]]]
  55359. [Destructor. ]
  55360. ]
  55361. ]
  55362. [heading Data Members]
  55363. [table
  55364. [[Name][Description]]
  55365. [
  55366. [[link boost_asio.reference.ssl__context.default_workarounds [*default_workarounds]]]
  55367. [Implement various bug workarounds. ]
  55368. ]
  55369. [
  55370. [[link boost_asio.reference.ssl__context.no_compression [*no_compression]]]
  55371. [Disable compression. Compression is disabled by default. ]
  55372. ]
  55373. [
  55374. [[link boost_asio.reference.ssl__context.no_sslv2 [*no_sslv2]]]
  55375. [Disable SSL v2. ]
  55376. ]
  55377. [
  55378. [[link boost_asio.reference.ssl__context.no_sslv3 [*no_sslv3]]]
  55379. [Disable SSL v3. ]
  55380. ]
  55381. [
  55382. [[link boost_asio.reference.ssl__context.no_tlsv1 [*no_tlsv1]]]
  55383. [Disable TLS v1. ]
  55384. ]
  55385. [
  55386. [[link boost_asio.reference.ssl__context.no_tlsv1_1 [*no_tlsv1_1]]]
  55387. [Disable TLS v1.1. ]
  55388. ]
  55389. [
  55390. [[link boost_asio.reference.ssl__context.no_tlsv1_2 [*no_tlsv1_2]]]
  55391. [Disable TLS v1.2. ]
  55392. ]
  55393. [
  55394. [[link boost_asio.reference.ssl__context.no_tlsv1_3 [*no_tlsv1_3]]]
  55395. [Disable TLS v1.3. ]
  55396. ]
  55397. [
  55398. [[link boost_asio.reference.ssl__context.single_dh_use [*single_dh_use]]]
  55399. [Always create a new key when using tmp_dh parameters. ]
  55400. ]
  55401. ]
  55402. [heading Requirements]
  55403. ['Header: ][^boost/asio/ssl/context.hpp]
  55404. ['Convenience header: ][^boost/asio/ssl.hpp]
  55405. [section:add_certificate_authority ssl::context::add_certificate_authority]
  55406. [indexterm2 boost_asio.indexterm.ssl__context.add_certificate_authority..add_certificate_authority..ssl::context]
  55407. Add certification authority for performing verification.
  55408. void ``[link boost_asio.reference.ssl__context.add_certificate_authority.overload1 add_certificate_authority]``(
  55409. const const_buffer & ca);
  55410. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.add_certificate_authority.overload1 more...]]``
  55411. void ``[link boost_asio.reference.ssl__context.add_certificate_authority.overload2 add_certificate_authority]``(
  55412. const const_buffer & ca,
  55413. boost::system::error_code & ec);
  55414. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.add_certificate_authority.overload2 more...]]``
  55415. [section:overload1 ssl::context::add_certificate_authority (1 of 2 overloads)]
  55416. Add certification authority for performing verification.
  55417. void add_certificate_authority(
  55418. const const_buffer & ca);
  55419. This function is used to add one trusted certification authority from a memory buffer.
  55420. [heading Parameters]
  55421. [variablelist
  55422. [[ca][The buffer containing the certification authority certificate. The certificate must use the PEM format.]]
  55423. ]
  55424. [heading Exceptions]
  55425. [variablelist
  55426. [[boost::system::system_error][Thrown on failure.]]
  55427. ]
  55428. [heading Remarks]
  55429. Calls `SSL_CTX_get_cert_store` and `X509_STORE_add_cert`.
  55430. [endsect]
  55431. [section:overload2 ssl::context::add_certificate_authority (2 of 2 overloads)]
  55432. Add certification authority for performing verification.
  55433. void add_certificate_authority(
  55434. const const_buffer & ca,
  55435. boost::system::error_code & ec);
  55436. This function is used to add one trusted certification authority from a memory buffer.
  55437. [heading Parameters]
  55438. [variablelist
  55439. [[ca][The buffer containing the certification authority certificate. The certificate must use the PEM format.]]
  55440. [[ec][Set to indicate what error occurred, if any.]]
  55441. ]
  55442. [heading Remarks]
  55443. Calls `SSL_CTX_get_cert_store` and `X509_STORE_add_cert`.
  55444. [endsect]
  55445. [endsect]
  55446. [section:add_verify_path ssl::context::add_verify_path]
  55447. [indexterm2 boost_asio.indexterm.ssl__context.add_verify_path..add_verify_path..ssl::context]
  55448. Add a directory containing certificate authority files to be used for performing verification.
  55449. void ``[link boost_asio.reference.ssl__context.add_verify_path.overload1 add_verify_path]``(
  55450. const std::string & path);
  55451. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.add_verify_path.overload1 more...]]``
  55452. void ``[link boost_asio.reference.ssl__context.add_verify_path.overload2 add_verify_path]``(
  55453. const std::string & path,
  55454. boost::system::error_code & ec);
  55455. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.add_verify_path.overload2 more...]]``
  55456. [section:overload1 ssl::context::add_verify_path (1 of 2 overloads)]
  55457. Add a directory containing certificate authority files to be used for performing verification.
  55458. void add_verify_path(
  55459. const std::string & path);
  55460. This function is used to specify the name of a directory containing certification authority certificates. Each file in the directory must contain a single certificate. The files must be named using the subject name's hash and an extension of ".0".
  55461. [heading Parameters]
  55462. [variablelist
  55463. [[path][The name of a directory containing the certificates.]]
  55464. ]
  55465. [heading Exceptions]
  55466. [variablelist
  55467. [[boost::system::system_error][Thrown on failure.]]
  55468. ]
  55469. [heading Remarks]
  55470. Calls `SSL_CTX_load_verify_locations`.
  55471. [endsect]
  55472. [section:overload2 ssl::context::add_verify_path (2 of 2 overloads)]
  55473. Add a directory containing certificate authority files to be used for performing verification.
  55474. void add_verify_path(
  55475. const std::string & path,
  55476. boost::system::error_code & ec);
  55477. This function is used to specify the name of a directory containing certification authority certificates. Each file in the directory must contain a single certificate. The files must be named using the subject name's hash and an extension of ".0".
  55478. [heading Parameters]
  55479. [variablelist
  55480. [[path][The name of a directory containing the certificates.]]
  55481. [[ec][Set to indicate what error occurred, if any.]]
  55482. ]
  55483. [heading Remarks]
  55484. Calls `SSL_CTX_load_verify_locations`.
  55485. [endsect]
  55486. [endsect]
  55487. [section:clear_options ssl::context::clear_options]
  55488. [indexterm2 boost_asio.indexterm.ssl__context.clear_options..clear_options..ssl::context]
  55489. Clear options on the context.
  55490. void ``[link boost_asio.reference.ssl__context.clear_options.overload1 clear_options]``(
  55491. options o);
  55492. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.clear_options.overload1 more...]]``
  55493. void ``[link boost_asio.reference.ssl__context.clear_options.overload2 clear_options]``(
  55494. options o,
  55495. boost::system::error_code & ec);
  55496. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.clear_options.overload2 more...]]``
  55497. [section:overload1 ssl::context::clear_options (1 of 2 overloads)]
  55498. Clear options on the context.
  55499. void clear_options(
  55500. options o);
  55501. This function may be used to configure the SSL options used by the context.
  55502. [heading Parameters]
  55503. [variablelist
  55504. [[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.]]
  55505. ]
  55506. [heading Exceptions]
  55507. [variablelist
  55508. [[boost::system::system_error][Thrown on failure.]]
  55509. ]
  55510. [heading Remarks]
  55511. Calls `SSL_CTX_clear_options`.
  55512. [endsect]
  55513. [section:overload2 ssl::context::clear_options (2 of 2 overloads)]
  55514. Clear options on the context.
  55515. void clear_options(
  55516. options o,
  55517. boost::system::error_code & ec);
  55518. This function may be used to configure the SSL options used by the context.
  55519. [heading Parameters]
  55520. [variablelist
  55521. [[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.]]
  55522. [[ec][Set to indicate what error occurred, if any.]]
  55523. ]
  55524. [heading Remarks]
  55525. Calls `SSL_CTX_clear_options`.
  55526. [endsect]
  55527. [endsect]
  55528. [section:context ssl::context::context]
  55529. [indexterm2 boost_asio.indexterm.ssl__context.context..context..ssl::context]
  55530. Constructor.
  55531. explicit ``[link boost_asio.reference.ssl__context.context.overload1 context]``(
  55532. method m);
  55533. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.context.overload1 more...]]``
  55534. Move-construct a context from another.
  55535. ``[link boost_asio.reference.ssl__context.context.overload2 context]``(
  55536. context && other);
  55537. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.context.overload2 more...]]``
  55538. [section:overload1 ssl::context::context (1 of 2 overloads)]
  55539. Constructor.
  55540. context(
  55541. method m);
  55542. [endsect]
  55543. [section:overload2 ssl::context::context (2 of 2 overloads)]
  55544. Move-construct a context from another.
  55545. context(
  55546. context && other);
  55547. This constructor moves an SSL context from one object to another.
  55548. [heading Parameters]
  55549. [variablelist
  55550. [[other][The other context object from which the move will occur.]]
  55551. ]
  55552. [heading Remarks]
  55553. Following the move, the following operations only are valid for the moved-from object:
  55554. * Destruction.
  55555. * As a target for move-assignment.
  55556. [endsect]
  55557. [endsect]
  55558. [section:default_workarounds ssl::context::default_workarounds]
  55559. [indexterm2 boost_asio.indexterm.ssl__context.default_workarounds..default_workarounds..ssl::context]
  55560. Implement various bug workarounds.
  55561. static const long default_workarounds = implementation_defined;
  55562. [endsect]
  55563. [section:file_format ssl::context::file_format]
  55564. [indexterm2 boost_asio.indexterm.ssl__context.file_format..file_format..ssl::context]
  55565. File format types.
  55566. enum file_format
  55567. [indexterm2 boost_asio.indexterm.ssl__context.file_format.asn1..asn1..ssl::context]
  55568. [indexterm2 boost_asio.indexterm.ssl__context.file_format.pem..pem..ssl::context]
  55569. [heading Values]
  55570. [variablelist
  55571. [
  55572. [asn1]
  55573. [ASN.1 file. ]
  55574. ]
  55575. [
  55576. [pem]
  55577. [PEM file. ]
  55578. ]
  55579. ]
  55580. [endsect]
  55581. [section:load_verify_file ssl::context::load_verify_file]
  55582. [indexterm2 boost_asio.indexterm.ssl__context.load_verify_file..load_verify_file..ssl::context]
  55583. Load a certification authority file for performing verification.
  55584. void ``[link boost_asio.reference.ssl__context.load_verify_file.overload1 load_verify_file]``(
  55585. const std::string & filename);
  55586. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.load_verify_file.overload1 more...]]``
  55587. void ``[link boost_asio.reference.ssl__context.load_verify_file.overload2 load_verify_file]``(
  55588. const std::string & filename,
  55589. boost::system::error_code & ec);
  55590. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.load_verify_file.overload2 more...]]``
  55591. [section:overload1 ssl::context::load_verify_file (1 of 2 overloads)]
  55592. Load a certification authority file for performing verification.
  55593. void load_verify_file(
  55594. const std::string & filename);
  55595. This function is used to load one or more trusted certification authorities from a file.
  55596. [heading Parameters]
  55597. [variablelist
  55598. [[filename][The name of a file containing certification authority certificates in PEM format.]]
  55599. ]
  55600. [heading Exceptions]
  55601. [variablelist
  55602. [[boost::system::system_error][Thrown on failure.]]
  55603. ]
  55604. [heading Remarks]
  55605. Calls `SSL_CTX_load_verify_locations`.
  55606. [endsect]
  55607. [section:overload2 ssl::context::load_verify_file (2 of 2 overloads)]
  55608. Load a certification authority file for performing verification.
  55609. void load_verify_file(
  55610. const std::string & filename,
  55611. boost::system::error_code & ec);
  55612. This function is used to load the certificates for one or more trusted certification authorities from a file.
  55613. [heading Parameters]
  55614. [variablelist
  55615. [[filename][The name of a file containing certification authority certificates in PEM format.]]
  55616. [[ec][Set to indicate what error occurred, if any.]]
  55617. ]
  55618. [heading Remarks]
  55619. Calls `SSL_CTX_load_verify_locations`.
  55620. [endsect]
  55621. [endsect]
  55622. [section:method ssl::context::method]
  55623. [indexterm2 boost_asio.indexterm.ssl__context.method..method..ssl::context]
  55624. Different methods supported by a context.
  55625. enum method
  55626. [indexterm2 boost_asio.indexterm.ssl__context.method.sslv2..sslv2..ssl::context]
  55627. [indexterm2 boost_asio.indexterm.ssl__context.method.sslv2_client..sslv2_client..ssl::context]
  55628. [indexterm2 boost_asio.indexterm.ssl__context.method.sslv2_server..sslv2_server..ssl::context]
  55629. [indexterm2 boost_asio.indexterm.ssl__context.method.sslv3..sslv3..ssl::context]
  55630. [indexterm2 boost_asio.indexterm.ssl__context.method.sslv3_client..sslv3_client..ssl::context]
  55631. [indexterm2 boost_asio.indexterm.ssl__context.method.sslv3_server..sslv3_server..ssl::context]
  55632. [indexterm2 boost_asio.indexterm.ssl__context.method.tlsv1..tlsv1..ssl::context]
  55633. [indexterm2 boost_asio.indexterm.ssl__context.method.tlsv1_client..tlsv1_client..ssl::context]
  55634. [indexterm2 boost_asio.indexterm.ssl__context.method.tlsv1_server..tlsv1_server..ssl::context]
  55635. [indexterm2 boost_asio.indexterm.ssl__context.method.sslv23..sslv23..ssl::context]
  55636. [indexterm2 boost_asio.indexterm.ssl__context.method.sslv23_client..sslv23_client..ssl::context]
  55637. [indexterm2 boost_asio.indexterm.ssl__context.method.sslv23_server..sslv23_server..ssl::context]
  55638. [indexterm2 boost_asio.indexterm.ssl__context.method.tlsv11..tlsv11..ssl::context]
  55639. [indexterm2 boost_asio.indexterm.ssl__context.method.tlsv11_client..tlsv11_client..ssl::context]
  55640. [indexterm2 boost_asio.indexterm.ssl__context.method.tlsv11_server..tlsv11_server..ssl::context]
  55641. [indexterm2 boost_asio.indexterm.ssl__context.method.tlsv12..tlsv12..ssl::context]
  55642. [indexterm2 boost_asio.indexterm.ssl__context.method.tlsv12_client..tlsv12_client..ssl::context]
  55643. [indexterm2 boost_asio.indexterm.ssl__context.method.tlsv12_server..tlsv12_server..ssl::context]
  55644. [indexterm2 boost_asio.indexterm.ssl__context.method.tlsv13..tlsv13..ssl::context]
  55645. [indexterm2 boost_asio.indexterm.ssl__context.method.tlsv13_client..tlsv13_client..ssl::context]
  55646. [indexterm2 boost_asio.indexterm.ssl__context.method.tlsv13_server..tlsv13_server..ssl::context]
  55647. [indexterm2 boost_asio.indexterm.ssl__context.method.tls..tls..ssl::context]
  55648. [indexterm2 boost_asio.indexterm.ssl__context.method.tls_client..tls_client..ssl::context]
  55649. [indexterm2 boost_asio.indexterm.ssl__context.method.tls_server..tls_server..ssl::context]
  55650. [heading Values]
  55651. [variablelist
  55652. [
  55653. [sslv2]
  55654. [Generic SSL version 2. ]
  55655. ]
  55656. [
  55657. [sslv2_client]
  55658. [SSL version 2 client. ]
  55659. ]
  55660. [
  55661. [sslv2_server]
  55662. [SSL version 2 server. ]
  55663. ]
  55664. [
  55665. [sslv3]
  55666. [Generic SSL version 3. ]
  55667. ]
  55668. [
  55669. [sslv3_client]
  55670. [SSL version 3 client. ]
  55671. ]
  55672. [
  55673. [sslv3_server]
  55674. [SSL version 3 server. ]
  55675. ]
  55676. [
  55677. [tlsv1]
  55678. [Generic TLS version 1. ]
  55679. ]
  55680. [
  55681. [tlsv1_client]
  55682. [TLS version 1 client. ]
  55683. ]
  55684. [
  55685. [tlsv1_server]
  55686. [TLS version 1 server. ]
  55687. ]
  55688. [
  55689. [sslv23]
  55690. [Generic SSL/TLS. ]
  55691. ]
  55692. [
  55693. [sslv23_client]
  55694. [SSL/TLS client. ]
  55695. ]
  55696. [
  55697. [sslv23_server]
  55698. [SSL/TLS server. ]
  55699. ]
  55700. [
  55701. [tlsv11]
  55702. [Generic TLS version 1.1. ]
  55703. ]
  55704. [
  55705. [tlsv11_client]
  55706. [TLS version 1.1 client. ]
  55707. ]
  55708. [
  55709. [tlsv11_server]
  55710. [TLS version 1.1 server. ]
  55711. ]
  55712. [
  55713. [tlsv12]
  55714. [Generic TLS version 1.2. ]
  55715. ]
  55716. [
  55717. [tlsv12_client]
  55718. [TLS version 1.2 client. ]
  55719. ]
  55720. [
  55721. [tlsv12_server]
  55722. [TLS version 1.2 server. ]
  55723. ]
  55724. [
  55725. [tlsv13]
  55726. [Generic TLS version 1.3. ]
  55727. ]
  55728. [
  55729. [tlsv13_client]
  55730. [TLS version 1.3 client. ]
  55731. ]
  55732. [
  55733. [tlsv13_server]
  55734. [TLS version 1.3 server. ]
  55735. ]
  55736. [
  55737. [tls]
  55738. [Generic TLS. ]
  55739. ]
  55740. [
  55741. [tls_client]
  55742. [TLS client. ]
  55743. ]
  55744. [
  55745. [tls_server]
  55746. [TLS server. ]
  55747. ]
  55748. ]
  55749. [endsect]
  55750. [section:native_handle ssl::context::native_handle]
  55751. [indexterm2 boost_asio.indexterm.ssl__context.native_handle..native_handle..ssl::context]
  55752. Get the underlying implementation in the native type.
  55753. native_handle_type native_handle();
  55754. This function may be used to obtain the underlying implementation of the context. This is intended to allow access to context functionality that is not otherwise provided.
  55755. [endsect]
  55756. [section:native_handle_type ssl::context::native_handle_type]
  55757. [indexterm2 boost_asio.indexterm.ssl__context.native_handle_type..native_handle_type..ssl::context]
  55758. The native handle type of the SSL context.
  55759. typedef SSL_CTX * native_handle_type;
  55760. [heading Requirements]
  55761. ['Header: ][^boost/asio/ssl/context.hpp]
  55762. ['Convenience header: ][^boost/asio/ssl.hpp]
  55763. [endsect]
  55764. [section:no_compression ssl::context::no_compression]
  55765. [indexterm2 boost_asio.indexterm.ssl__context.no_compression..no_compression..ssl::context]
  55766. Disable compression. Compression is disabled by default.
  55767. static const long no_compression = implementation_defined;
  55768. [endsect]
  55769. [section:no_sslv2 ssl::context::no_sslv2]
  55770. [indexterm2 boost_asio.indexterm.ssl__context.no_sslv2..no_sslv2..ssl::context]
  55771. Disable SSL v2.
  55772. static const long no_sslv2 = implementation_defined;
  55773. [endsect]
  55774. [section:no_sslv3 ssl::context::no_sslv3]
  55775. [indexterm2 boost_asio.indexterm.ssl__context.no_sslv3..no_sslv3..ssl::context]
  55776. Disable SSL v3.
  55777. static const long no_sslv3 = implementation_defined;
  55778. [endsect]
  55779. [section:no_tlsv1 ssl::context::no_tlsv1]
  55780. [indexterm2 boost_asio.indexterm.ssl__context.no_tlsv1..no_tlsv1..ssl::context]
  55781. Disable TLS v1.
  55782. static const long no_tlsv1 = implementation_defined;
  55783. [endsect]
  55784. [section:no_tlsv1_1 ssl::context::no_tlsv1_1]
  55785. [indexterm2 boost_asio.indexterm.ssl__context.no_tlsv1_1..no_tlsv1_1..ssl::context]
  55786. Disable TLS v1.1.
  55787. static const long no_tlsv1_1 = implementation_defined;
  55788. [endsect]
  55789. [section:no_tlsv1_2 ssl::context::no_tlsv1_2]
  55790. [indexterm2 boost_asio.indexterm.ssl__context.no_tlsv1_2..no_tlsv1_2..ssl::context]
  55791. Disable TLS v1.2.
  55792. static const long no_tlsv1_2 = implementation_defined;
  55793. [endsect]
  55794. [section:no_tlsv1_3 ssl::context::no_tlsv1_3]
  55795. [indexterm2 boost_asio.indexterm.ssl__context.no_tlsv1_3..no_tlsv1_3..ssl::context]
  55796. Disable TLS v1.3.
  55797. static const long no_tlsv1_3 = implementation_defined;
  55798. [endsect]
  55799. [section:operator_eq_ ssl::context::operator=]
  55800. [indexterm2 boost_asio.indexterm.ssl__context.operator_eq_..operator=..ssl::context]
  55801. Move-assign a context from another.
  55802. context & operator=(
  55803. context && other);
  55804. This assignment operator moves an SSL context from one object to another.
  55805. [heading Parameters]
  55806. [variablelist
  55807. [[other][The other context object from which the move will occur.]]
  55808. ]
  55809. [heading Remarks]
  55810. Following the move, the following operations only are valid for the moved-from object:
  55811. * Destruction.
  55812. * As a target for move-assignment.
  55813. [endsect]
  55814. [section:options ssl::context::options]
  55815. [indexterm2 boost_asio.indexterm.ssl__context.options..options..ssl::context]
  55816. Bitmask type for SSL options.
  55817. typedef long options;
  55818. [heading Requirements]
  55819. ['Header: ][^boost/asio/ssl/context.hpp]
  55820. ['Convenience header: ][^boost/asio/ssl.hpp]
  55821. [endsect]
  55822. [section:password_purpose ssl::context::password_purpose]
  55823. [indexterm2 boost_asio.indexterm.ssl__context.password_purpose..password_purpose..ssl::context]
  55824. Purpose of PEM password.
  55825. enum password_purpose
  55826. [indexterm2 boost_asio.indexterm.ssl__context.password_purpose.for_reading..for_reading..ssl::context]
  55827. [indexterm2 boost_asio.indexterm.ssl__context.password_purpose.for_writing..for_writing..ssl::context]
  55828. [heading Values]
  55829. [variablelist
  55830. [
  55831. [for_reading]
  55832. [The password is needed for reading/decryption. ]
  55833. ]
  55834. [
  55835. [for_writing]
  55836. [The password is needed for writing/encryption. ]
  55837. ]
  55838. ]
  55839. [endsect]
  55840. [section:set_default_verify_paths ssl::context::set_default_verify_paths]
  55841. [indexterm2 boost_asio.indexterm.ssl__context.set_default_verify_paths..set_default_verify_paths..ssl::context]
  55842. Configures the context to use the default directories for finding certification authority certificates.
  55843. void ``[link boost_asio.reference.ssl__context.set_default_verify_paths.overload1 set_default_verify_paths]``();
  55844. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.set_default_verify_paths.overload1 more...]]``
  55845. void ``[link boost_asio.reference.ssl__context.set_default_verify_paths.overload2 set_default_verify_paths]``(
  55846. boost::system::error_code & ec);
  55847. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.set_default_verify_paths.overload2 more...]]``
  55848. [section:overload1 ssl::context::set_default_verify_paths (1 of 2 overloads)]
  55849. Configures the context to use the default directories for finding certification authority certificates.
  55850. void set_default_verify_paths();
  55851. This function specifies that the context should use the default, system-dependent directories for locating certification authority certificates.
  55852. [heading Exceptions]
  55853. [variablelist
  55854. [[boost::system::system_error][Thrown on failure.]]
  55855. ]
  55856. [heading Remarks]
  55857. Calls `SSL_CTX_set_default_verify_paths`.
  55858. [endsect]
  55859. [section:overload2 ssl::context::set_default_verify_paths (2 of 2 overloads)]
  55860. Configures the context to use the default directories for finding certification authority certificates.
  55861. void set_default_verify_paths(
  55862. boost::system::error_code & ec);
  55863. This function specifies that the context should use the default, system-dependent directories for locating certification authority certificates.
  55864. [heading Parameters]
  55865. [variablelist
  55866. [[ec][Set to indicate what error occurred, if any.]]
  55867. ]
  55868. [heading Remarks]
  55869. Calls `SSL_CTX_set_default_verify_paths`.
  55870. [endsect]
  55871. [endsect]
  55872. [section:set_options ssl::context::set_options]
  55873. [indexterm2 boost_asio.indexterm.ssl__context.set_options..set_options..ssl::context]
  55874. Set options on the context.
  55875. void ``[link boost_asio.reference.ssl__context.set_options.overload1 set_options]``(
  55876. options o);
  55877. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.set_options.overload1 more...]]``
  55878. void ``[link boost_asio.reference.ssl__context.set_options.overload2 set_options]``(
  55879. options o,
  55880. boost::system::error_code & ec);
  55881. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.set_options.overload2 more...]]``
  55882. [section:overload1 ssl::context::set_options (1 of 2 overloads)]
  55883. Set options on the context.
  55884. void set_options(
  55885. options o);
  55886. This function may be used to configure the SSL options used by the context.
  55887. [heading Parameters]
  55888. [variablelist
  55889. [[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.]]
  55890. ]
  55891. [heading Exceptions]
  55892. [variablelist
  55893. [[boost::system::system_error][Thrown on failure.]]
  55894. ]
  55895. [heading Remarks]
  55896. Calls `SSL_CTX_set_options`.
  55897. [endsect]
  55898. [section:overload2 ssl::context::set_options (2 of 2 overloads)]
  55899. Set options on the context.
  55900. void set_options(
  55901. options o,
  55902. boost::system::error_code & ec);
  55903. This function may be used to configure the SSL options used by the context.
  55904. [heading Parameters]
  55905. [variablelist
  55906. [[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.]]
  55907. [[ec][Set to indicate what error occurred, if any.]]
  55908. ]
  55909. [heading Remarks]
  55910. Calls `SSL_CTX_set_options`.
  55911. [endsect]
  55912. [endsect]
  55913. [section:set_password_callback ssl::context::set_password_callback]
  55914. [indexterm2 boost_asio.indexterm.ssl__context.set_password_callback..set_password_callback..ssl::context]
  55915. Set the password callback.
  55916. template<
  55917. typename PasswordCallback>
  55918. void ``[link boost_asio.reference.ssl__context.set_password_callback.overload1 set_password_callback]``(
  55919. PasswordCallback callback);
  55920. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.set_password_callback.overload1 more...]]``
  55921. template<
  55922. typename PasswordCallback>
  55923. void ``[link boost_asio.reference.ssl__context.set_password_callback.overload2 set_password_callback]``(
  55924. PasswordCallback callback,
  55925. boost::system::error_code & ec);
  55926. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.set_password_callback.overload2 more...]]``
  55927. [section:overload1 ssl::context::set_password_callback (1 of 2 overloads)]
  55928. Set the password callback.
  55929. template<
  55930. typename PasswordCallback>
  55931. void set_password_callback(
  55932. PasswordCallback callback);
  55933. This function is used to specify a callback function to obtain password information about an encrypted key in PEM format.
  55934. [heading Parameters]
  55935. [variablelist
  55936. [[callback][The function object to be used for obtaining the password. The function signature of the handler must be:
  55937. ``
  55938. std::string password_callback(
  55939. std::size_t max_length, // The maximum size for a password.
  55940. password_purpose purpose // Whether password is for reading or writing.
  55941. );
  55942. ``
  55943. The return value of the callback is a string containing the password.]]
  55944. ]
  55945. [heading Exceptions]
  55946. [variablelist
  55947. [[boost::system::system_error][Thrown on failure.]]
  55948. ]
  55949. [heading Remarks]
  55950. Calls `SSL_CTX_set_default_passwd_cb`.
  55951. [endsect]
  55952. [section:overload2 ssl::context::set_password_callback (2 of 2 overloads)]
  55953. Set the password callback.
  55954. template<
  55955. typename PasswordCallback>
  55956. void set_password_callback(
  55957. PasswordCallback callback,
  55958. boost::system::error_code & ec);
  55959. This function is used to specify a callback function to obtain password information about an encrypted key in PEM format.
  55960. [heading Parameters]
  55961. [variablelist
  55962. [[callback][The function object to be used for obtaining the password. The function signature of the handler must be:
  55963. ``
  55964. std::string password_callback(
  55965. std::size_t max_length, // The maximum size for a password.
  55966. password_purpose purpose // Whether password is for reading or writing.
  55967. );
  55968. ``
  55969. The return value of the callback is a string containing the password.]]
  55970. [[ec][Set to indicate what error occurred, if any.]]
  55971. ]
  55972. [heading Remarks]
  55973. Calls `SSL_CTX_set_default_passwd_cb`.
  55974. [endsect]
  55975. [endsect]
  55976. [section:set_verify_callback ssl::context::set_verify_callback]
  55977. [indexterm2 boost_asio.indexterm.ssl__context.set_verify_callback..set_verify_callback..ssl::context]
  55978. Set the callback used to verify peer certificates.
  55979. template<
  55980. typename VerifyCallback>
  55981. void ``[link boost_asio.reference.ssl__context.set_verify_callback.overload1 set_verify_callback]``(
  55982. VerifyCallback callback);
  55983. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.set_verify_callback.overload1 more...]]``
  55984. template<
  55985. typename VerifyCallback>
  55986. void ``[link boost_asio.reference.ssl__context.set_verify_callback.overload2 set_verify_callback]``(
  55987. VerifyCallback callback,
  55988. boost::system::error_code & ec);
  55989. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.set_verify_callback.overload2 more...]]``
  55990. [section:overload1 ssl::context::set_verify_callback (1 of 2 overloads)]
  55991. Set the callback used to verify peer certificates.
  55992. template<
  55993. typename VerifyCallback>
  55994. void set_verify_callback(
  55995. VerifyCallback callback);
  55996. This function is used to specify a callback function that will be called by the implementation when it needs to verify a peer certificate.
  55997. [heading Parameters]
  55998. [variablelist
  55999. [[callback][The function object to be used for verifying a certificate. The function signature of the handler must be:
  56000. ``
  56001. bool verify_callback(
  56002. bool preverified, // True if the certificate passed pre-verification.
  56003. verify_context& ctx // The peer certificate and other context.
  56004. );
  56005. ``
  56006. The return value of the callback is true if the certificate has passed verification, false otherwise.]]
  56007. ]
  56008. [heading Exceptions]
  56009. [variablelist
  56010. [[boost::system::system_error][Thrown on failure.]]
  56011. ]
  56012. [heading Remarks]
  56013. Calls `SSL_CTX_set_verify`.
  56014. [endsect]
  56015. [section:overload2 ssl::context::set_verify_callback (2 of 2 overloads)]
  56016. Set the callback used to verify peer certificates.
  56017. template<
  56018. typename VerifyCallback>
  56019. void set_verify_callback(
  56020. VerifyCallback callback,
  56021. boost::system::error_code & ec);
  56022. This function is used to specify a callback function that will be called by the implementation when it needs to verify a peer certificate.
  56023. [heading Parameters]
  56024. [variablelist
  56025. [[callback][The function object to be used for verifying a certificate. The function signature of the handler must be:
  56026. ``
  56027. bool verify_callback(
  56028. bool preverified, // True if the certificate passed pre-verification.
  56029. verify_context& ctx // The peer certificate and other context.
  56030. );
  56031. ``
  56032. The return value of the callback is true if the certificate has passed verification, false otherwise.]]
  56033. [[ec][Set to indicate what error occurred, if any.]]
  56034. ]
  56035. [heading Remarks]
  56036. Calls `SSL_CTX_set_verify`.
  56037. [endsect]
  56038. [endsect]
  56039. [section:set_verify_depth ssl::context::set_verify_depth]
  56040. [indexterm2 boost_asio.indexterm.ssl__context.set_verify_depth..set_verify_depth..ssl::context]
  56041. Set the peer verification depth.
  56042. void ``[link boost_asio.reference.ssl__context.set_verify_depth.overload1 set_verify_depth]``(
  56043. int depth);
  56044. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.set_verify_depth.overload1 more...]]``
  56045. void ``[link boost_asio.reference.ssl__context.set_verify_depth.overload2 set_verify_depth]``(
  56046. int depth,
  56047. boost::system::error_code & ec);
  56048. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.set_verify_depth.overload2 more...]]``
  56049. [section:overload1 ssl::context::set_verify_depth (1 of 2 overloads)]
  56050. Set the peer verification depth.
  56051. void set_verify_depth(
  56052. int depth);
  56053. This function may be used to configure the maximum verification depth allowed by the context.
  56054. [heading Parameters]
  56055. [variablelist
  56056. [[depth][Maximum depth for the certificate chain verification that shall be allowed.]]
  56057. ]
  56058. [heading Exceptions]
  56059. [variablelist
  56060. [[boost::system::system_error][Thrown on failure.]]
  56061. ]
  56062. [heading Remarks]
  56063. Calls `SSL_CTX_set_verify_depth`.
  56064. [endsect]
  56065. [section:overload2 ssl::context::set_verify_depth (2 of 2 overloads)]
  56066. Set the peer verification depth.
  56067. void set_verify_depth(
  56068. int depth,
  56069. boost::system::error_code & ec);
  56070. This function may be used to configure the maximum verification depth allowed by the context.
  56071. [heading Parameters]
  56072. [variablelist
  56073. [[depth][Maximum depth for the certificate chain verification that shall be allowed.]]
  56074. [[ec][Set to indicate what error occurred, if any.]]
  56075. ]
  56076. [heading Remarks]
  56077. Calls `SSL_CTX_set_verify_depth`.
  56078. [endsect]
  56079. [endsect]
  56080. [section:set_verify_mode ssl::context::set_verify_mode]
  56081. [indexterm2 boost_asio.indexterm.ssl__context.set_verify_mode..set_verify_mode..ssl::context]
  56082. Set the peer verification mode.
  56083. void ``[link boost_asio.reference.ssl__context.set_verify_mode.overload1 set_verify_mode]``(
  56084. verify_mode v);
  56085. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.set_verify_mode.overload1 more...]]``
  56086. void ``[link boost_asio.reference.ssl__context.set_verify_mode.overload2 set_verify_mode]``(
  56087. verify_mode v,
  56088. boost::system::error_code & ec);
  56089. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.set_verify_mode.overload2 more...]]``
  56090. [section:overload1 ssl::context::set_verify_mode (1 of 2 overloads)]
  56091. Set the peer verification mode.
  56092. void set_verify_mode(
  56093. verify_mode v);
  56094. This function may be used to configure the peer verification mode used by the context.
  56095. [heading Parameters]
  56096. [variablelist
  56097. [[v][A bitmask of peer verification modes. See [link boost_asio.reference.ssl__verify_mode `ssl::verify_mode`] for available values.]]
  56098. ]
  56099. [heading Exceptions]
  56100. [variablelist
  56101. [[boost::system::system_error][Thrown on failure.]]
  56102. ]
  56103. [heading Remarks]
  56104. Calls `SSL_CTX_set_verify`.
  56105. [endsect]
  56106. [section:overload2 ssl::context::set_verify_mode (2 of 2 overloads)]
  56107. Set the peer verification mode.
  56108. void set_verify_mode(
  56109. verify_mode v,
  56110. boost::system::error_code & ec);
  56111. This function may be used to configure the peer verification mode used by the context.
  56112. [heading Parameters]
  56113. [variablelist
  56114. [[v][A bitmask of peer verification modes. See [link boost_asio.reference.ssl__verify_mode `ssl::verify_mode`] for available values.]]
  56115. [[ec][Set to indicate what error occurred, if any.]]
  56116. ]
  56117. [heading Remarks]
  56118. Calls `SSL_CTX_set_verify`.
  56119. [endsect]
  56120. [endsect]
  56121. [section:single_dh_use ssl::context::single_dh_use]
  56122. [indexterm2 boost_asio.indexterm.ssl__context.single_dh_use..single_dh_use..ssl::context]
  56123. Always create a new key when using tmp\_dh parameters.
  56124. static const long single_dh_use = implementation_defined;
  56125. [endsect]
  56126. [section:use_certificate ssl::context::use_certificate]
  56127. [indexterm2 boost_asio.indexterm.ssl__context.use_certificate..use_certificate..ssl::context]
  56128. Use a certificate from a memory buffer.
  56129. void ``[link boost_asio.reference.ssl__context.use_certificate.overload1 use_certificate]``(
  56130. const const_buffer & certificate,
  56131. file_format format);
  56132. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_certificate.overload1 more...]]``
  56133. void ``[link boost_asio.reference.ssl__context.use_certificate.overload2 use_certificate]``(
  56134. const const_buffer & certificate,
  56135. file_format format,
  56136. boost::system::error_code & ec);
  56137. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_certificate.overload2 more...]]``
  56138. [section:overload1 ssl::context::use_certificate (1 of 2 overloads)]
  56139. Use a certificate from a memory buffer.
  56140. void use_certificate(
  56141. const const_buffer & certificate,
  56142. file_format format);
  56143. This function is used to load a certificate into the context from a buffer.
  56144. [heading Parameters]
  56145. [variablelist
  56146. [[certificate][The buffer containing the certificate.]]
  56147. [[format][The certificate format (ASN.1 or PEM).]]
  56148. ]
  56149. [heading Exceptions]
  56150. [variablelist
  56151. [[boost::system::system_error][Thrown on failure.]]
  56152. ]
  56153. [heading Remarks]
  56154. Calls `SSL_CTX_use_certificate` or SSL\_CTX\_use\_certificate\_ASN1.
  56155. [endsect]
  56156. [section:overload2 ssl::context::use_certificate (2 of 2 overloads)]
  56157. Use a certificate from a memory buffer.
  56158. void use_certificate(
  56159. const const_buffer & certificate,
  56160. file_format format,
  56161. boost::system::error_code & ec);
  56162. This function is used to load a certificate into the context from a buffer.
  56163. [heading Parameters]
  56164. [variablelist
  56165. [[certificate][The buffer containing the certificate.]]
  56166. [[format][The certificate format (ASN.1 or PEM).]]
  56167. [[ec][Set to indicate what error occurred, if any.]]
  56168. ]
  56169. [heading Remarks]
  56170. Calls `SSL_CTX_use_certificate` or SSL\_CTX\_use\_certificate\_ASN1.
  56171. [endsect]
  56172. [endsect]
  56173. [section:use_certificate_chain ssl::context::use_certificate_chain]
  56174. [indexterm2 boost_asio.indexterm.ssl__context.use_certificate_chain..use_certificate_chain..ssl::context]
  56175. Use a certificate chain from a memory buffer.
  56176. void ``[link boost_asio.reference.ssl__context.use_certificate_chain.overload1 use_certificate_chain]``(
  56177. const const_buffer & chain);
  56178. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_certificate_chain.overload1 more...]]``
  56179. void ``[link boost_asio.reference.ssl__context.use_certificate_chain.overload2 use_certificate_chain]``(
  56180. const const_buffer & chain,
  56181. boost::system::error_code & ec);
  56182. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_certificate_chain.overload2 more...]]``
  56183. [section:overload1 ssl::context::use_certificate_chain (1 of 2 overloads)]
  56184. Use a certificate chain from a memory buffer.
  56185. void use_certificate_chain(
  56186. const const_buffer & chain);
  56187. This function is used to load a certificate chain into the context from a buffer.
  56188. [heading Parameters]
  56189. [variablelist
  56190. [[chain][The buffer containing the certificate chain. The certificate chain must use the PEM format.]]
  56191. ]
  56192. [heading Exceptions]
  56193. [variablelist
  56194. [[boost::system::system_error][Thrown on failure.]]
  56195. ]
  56196. [heading Remarks]
  56197. Calls `SSL_CTX_use_certificate` and SSL\_CTX\_add\_extra\_chain\_cert.
  56198. [endsect]
  56199. [section:overload2 ssl::context::use_certificate_chain (2 of 2 overloads)]
  56200. Use a certificate chain from a memory buffer.
  56201. void use_certificate_chain(
  56202. const const_buffer & chain,
  56203. boost::system::error_code & ec);
  56204. This function is used to load a certificate chain into the context from a buffer.
  56205. [heading Parameters]
  56206. [variablelist
  56207. [[chain][The buffer containing the certificate chain. The certificate chain must use the PEM format.]]
  56208. [[ec][Set to indicate what error occurred, if any.]]
  56209. ]
  56210. [heading Remarks]
  56211. Calls `SSL_CTX_use_certificate` and SSL\_CTX\_add\_extra\_chain\_cert.
  56212. [endsect]
  56213. [endsect]
  56214. [section:use_certificate_chain_file ssl::context::use_certificate_chain_file]
  56215. [indexterm2 boost_asio.indexterm.ssl__context.use_certificate_chain_file..use_certificate_chain_file..ssl::context]
  56216. Use a certificate chain from a file.
  56217. void ``[link boost_asio.reference.ssl__context.use_certificate_chain_file.overload1 use_certificate_chain_file]``(
  56218. const std::string & filename);
  56219. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_certificate_chain_file.overload1 more...]]``
  56220. void ``[link boost_asio.reference.ssl__context.use_certificate_chain_file.overload2 use_certificate_chain_file]``(
  56221. const std::string & filename,
  56222. boost::system::error_code & ec);
  56223. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_certificate_chain_file.overload2 more...]]``
  56224. [section:overload1 ssl::context::use_certificate_chain_file (1 of 2 overloads)]
  56225. Use a certificate chain from a file.
  56226. void use_certificate_chain_file(
  56227. const std::string & filename);
  56228. This function is used to load a certificate chain into the context from a file.
  56229. [heading Parameters]
  56230. [variablelist
  56231. [[filename][The name of the file containing the certificate. The file must use the PEM format.]]
  56232. ]
  56233. [heading Exceptions]
  56234. [variablelist
  56235. [[boost::system::system_error][Thrown on failure.]]
  56236. ]
  56237. [heading Remarks]
  56238. Calls `SSL_CTX_use_certificate_chain_file`.
  56239. [endsect]
  56240. [section:overload2 ssl::context::use_certificate_chain_file (2 of 2 overloads)]
  56241. Use a certificate chain from a file.
  56242. void use_certificate_chain_file(
  56243. const std::string & filename,
  56244. boost::system::error_code & ec);
  56245. This function is used to load a certificate chain into the context from a file.
  56246. [heading Parameters]
  56247. [variablelist
  56248. [[filename][The name of the file containing the certificate. The file must use the PEM format.]]
  56249. [[ec][Set to indicate what error occurred, if any.]]
  56250. ]
  56251. [heading Remarks]
  56252. Calls `SSL_CTX_use_certificate_chain_file`.
  56253. [endsect]
  56254. [endsect]
  56255. [section:use_certificate_file ssl::context::use_certificate_file]
  56256. [indexterm2 boost_asio.indexterm.ssl__context.use_certificate_file..use_certificate_file..ssl::context]
  56257. Use a certificate from a file.
  56258. void ``[link boost_asio.reference.ssl__context.use_certificate_file.overload1 use_certificate_file]``(
  56259. const std::string & filename,
  56260. file_format format);
  56261. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_certificate_file.overload1 more...]]``
  56262. void ``[link boost_asio.reference.ssl__context.use_certificate_file.overload2 use_certificate_file]``(
  56263. const std::string & filename,
  56264. file_format format,
  56265. boost::system::error_code & ec);
  56266. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_certificate_file.overload2 more...]]``
  56267. [section:overload1 ssl::context::use_certificate_file (1 of 2 overloads)]
  56268. Use a certificate from a file.
  56269. void use_certificate_file(
  56270. const std::string & filename,
  56271. file_format format);
  56272. This function is used to load a certificate into the context from a file.
  56273. [heading Parameters]
  56274. [variablelist
  56275. [[filename][The name of the file containing the certificate.]]
  56276. [[format][The file format (ASN.1 or PEM).]]
  56277. ]
  56278. [heading Exceptions]
  56279. [variablelist
  56280. [[boost::system::system_error][Thrown on failure.]]
  56281. ]
  56282. [heading Remarks]
  56283. Calls `SSL_CTX_use_certificate_file`.
  56284. [endsect]
  56285. [section:overload2 ssl::context::use_certificate_file (2 of 2 overloads)]
  56286. Use a certificate from a file.
  56287. void use_certificate_file(
  56288. const std::string & filename,
  56289. file_format format,
  56290. boost::system::error_code & ec);
  56291. This function is used to load a certificate into the context from a file.
  56292. [heading Parameters]
  56293. [variablelist
  56294. [[filename][The name of the file containing the certificate.]]
  56295. [[format][The file format (ASN.1 or PEM).]]
  56296. [[ec][Set to indicate what error occurred, if any.]]
  56297. ]
  56298. [heading Remarks]
  56299. Calls `SSL_CTX_use_certificate_file`.
  56300. [endsect]
  56301. [endsect]
  56302. [section:use_private_key ssl::context::use_private_key]
  56303. [indexterm2 boost_asio.indexterm.ssl__context.use_private_key..use_private_key..ssl::context]
  56304. Use a private key from a memory buffer.
  56305. void ``[link boost_asio.reference.ssl__context.use_private_key.overload1 use_private_key]``(
  56306. const const_buffer & private_key,
  56307. file_format format);
  56308. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_private_key.overload1 more...]]``
  56309. void ``[link boost_asio.reference.ssl__context.use_private_key.overload2 use_private_key]``(
  56310. const const_buffer & private_key,
  56311. file_format format,
  56312. boost::system::error_code & ec);
  56313. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_private_key.overload2 more...]]``
  56314. [section:overload1 ssl::context::use_private_key (1 of 2 overloads)]
  56315. Use a private key from a memory buffer.
  56316. void use_private_key(
  56317. const const_buffer & private_key,
  56318. file_format format);
  56319. This function is used to load a private key into the context from a buffer.
  56320. [heading Parameters]
  56321. [variablelist
  56322. [[private_key][The buffer containing the private key.]]
  56323. [[format][The private key format (ASN.1 or PEM).]]
  56324. ]
  56325. [heading Exceptions]
  56326. [variablelist
  56327. [[boost::system::system_error][Thrown on failure.]]
  56328. ]
  56329. [heading Remarks]
  56330. Calls `SSL_CTX_use_PrivateKey` or SSL\_CTX\_use\_PrivateKey\_ASN1.
  56331. [endsect]
  56332. [section:overload2 ssl::context::use_private_key (2 of 2 overloads)]
  56333. Use a private key from a memory buffer.
  56334. void use_private_key(
  56335. const const_buffer & private_key,
  56336. file_format format,
  56337. boost::system::error_code & ec);
  56338. This function is used to load a private key into the context from a buffer.
  56339. [heading Parameters]
  56340. [variablelist
  56341. [[private_key][The buffer containing the private key.]]
  56342. [[format][The private key format (ASN.1 or PEM).]]
  56343. [[ec][Set to indicate what error occurred, if any.]]
  56344. ]
  56345. [heading Remarks]
  56346. Calls `SSL_CTX_use_PrivateKey` or SSL\_CTX\_use\_PrivateKey\_ASN1.
  56347. [endsect]
  56348. [endsect]
  56349. [section:use_private_key_file ssl::context::use_private_key_file]
  56350. [indexterm2 boost_asio.indexterm.ssl__context.use_private_key_file..use_private_key_file..ssl::context]
  56351. Use a private key from a file.
  56352. void ``[link boost_asio.reference.ssl__context.use_private_key_file.overload1 use_private_key_file]``(
  56353. const std::string & filename,
  56354. file_format format);
  56355. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_private_key_file.overload1 more...]]``
  56356. void ``[link boost_asio.reference.ssl__context.use_private_key_file.overload2 use_private_key_file]``(
  56357. const std::string & filename,
  56358. file_format format,
  56359. boost::system::error_code & ec);
  56360. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_private_key_file.overload2 more...]]``
  56361. [section:overload1 ssl::context::use_private_key_file (1 of 2 overloads)]
  56362. Use a private key from a file.
  56363. void use_private_key_file(
  56364. const std::string & filename,
  56365. file_format format);
  56366. This function is used to load a private key into the context from a file.
  56367. [heading Parameters]
  56368. [variablelist
  56369. [[filename][The name of the file containing the private key.]]
  56370. [[format][The file format (ASN.1 or PEM).]]
  56371. ]
  56372. [heading Exceptions]
  56373. [variablelist
  56374. [[boost::system::system_error][Thrown on failure.]]
  56375. ]
  56376. [heading Remarks]
  56377. Calls `SSL_CTX_use_PrivateKey_file`.
  56378. [endsect]
  56379. [section:overload2 ssl::context::use_private_key_file (2 of 2 overloads)]
  56380. Use a private key from a file.
  56381. void use_private_key_file(
  56382. const std::string & filename,
  56383. file_format format,
  56384. boost::system::error_code & ec);
  56385. This function is used to load a private key into the context from a file.
  56386. [heading Parameters]
  56387. [variablelist
  56388. [[filename][The name of the file containing the private key.]]
  56389. [[format][The file format (ASN.1 or PEM).]]
  56390. [[ec][Set to indicate what error occurred, if any.]]
  56391. ]
  56392. [heading Remarks]
  56393. Calls `SSL_CTX_use_PrivateKey_file`.
  56394. [endsect]
  56395. [endsect]
  56396. [section:use_rsa_private_key ssl::context::use_rsa_private_key]
  56397. [indexterm2 boost_asio.indexterm.ssl__context.use_rsa_private_key..use_rsa_private_key..ssl::context]
  56398. Use an RSA private key from a memory buffer.
  56399. void ``[link boost_asio.reference.ssl__context.use_rsa_private_key.overload1 use_rsa_private_key]``(
  56400. const const_buffer & private_key,
  56401. file_format format);
  56402. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_rsa_private_key.overload1 more...]]``
  56403. void ``[link boost_asio.reference.ssl__context.use_rsa_private_key.overload2 use_rsa_private_key]``(
  56404. const const_buffer & private_key,
  56405. file_format format,
  56406. boost::system::error_code & ec);
  56407. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_rsa_private_key.overload2 more...]]``
  56408. [section:overload1 ssl::context::use_rsa_private_key (1 of 2 overloads)]
  56409. Use an RSA private key from a memory buffer.
  56410. void use_rsa_private_key(
  56411. const const_buffer & private_key,
  56412. file_format format);
  56413. This function is used to load an RSA private key into the context from a buffer.
  56414. [heading Parameters]
  56415. [variablelist
  56416. [[private_key][The buffer containing the RSA private key.]]
  56417. [[format][The private key format (ASN.1 or PEM).]]
  56418. ]
  56419. [heading Exceptions]
  56420. [variablelist
  56421. [[boost::system::system_error][Thrown on failure.]]
  56422. ]
  56423. [heading Remarks]
  56424. Calls `SSL_CTX_use_RSAPrivateKey` or SSL\_CTX\_use\_RSAPrivateKey\_ASN1.
  56425. [endsect]
  56426. [section:overload2 ssl::context::use_rsa_private_key (2 of 2 overloads)]
  56427. Use an RSA private key from a memory buffer.
  56428. void use_rsa_private_key(
  56429. const const_buffer & private_key,
  56430. file_format format,
  56431. boost::system::error_code & ec);
  56432. This function is used to load an RSA private key into the context from a buffer.
  56433. [heading Parameters]
  56434. [variablelist
  56435. [[private_key][The buffer containing the RSA private key.]]
  56436. [[format][The private key format (ASN.1 or PEM).]]
  56437. [[ec][Set to indicate what error occurred, if any.]]
  56438. ]
  56439. [heading Remarks]
  56440. Calls `SSL_CTX_use_RSAPrivateKey` or SSL\_CTX\_use\_RSAPrivateKey\_ASN1.
  56441. [endsect]
  56442. [endsect]
  56443. [section:use_rsa_private_key_file ssl::context::use_rsa_private_key_file]
  56444. [indexterm2 boost_asio.indexterm.ssl__context.use_rsa_private_key_file..use_rsa_private_key_file..ssl::context]
  56445. Use an RSA private key from a file.
  56446. void ``[link boost_asio.reference.ssl__context.use_rsa_private_key_file.overload1 use_rsa_private_key_file]``(
  56447. const std::string & filename,
  56448. file_format format);
  56449. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_rsa_private_key_file.overload1 more...]]``
  56450. void ``[link boost_asio.reference.ssl__context.use_rsa_private_key_file.overload2 use_rsa_private_key_file]``(
  56451. const std::string & filename,
  56452. file_format format,
  56453. boost::system::error_code & ec);
  56454. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_rsa_private_key_file.overload2 more...]]``
  56455. [section:overload1 ssl::context::use_rsa_private_key_file (1 of 2 overloads)]
  56456. Use an RSA private key from a file.
  56457. void use_rsa_private_key_file(
  56458. const std::string & filename,
  56459. file_format format);
  56460. This function is used to load an RSA private key into the context from a file.
  56461. [heading Parameters]
  56462. [variablelist
  56463. [[filename][The name of the file containing the RSA private key.]]
  56464. [[format][The file format (ASN.1 or PEM).]]
  56465. ]
  56466. [heading Exceptions]
  56467. [variablelist
  56468. [[boost::system::system_error][Thrown on failure.]]
  56469. ]
  56470. [heading Remarks]
  56471. Calls `SSL_CTX_use_RSAPrivateKey_file`.
  56472. [endsect]
  56473. [section:overload2 ssl::context::use_rsa_private_key_file (2 of 2 overloads)]
  56474. Use an RSA private key from a file.
  56475. void use_rsa_private_key_file(
  56476. const std::string & filename,
  56477. file_format format,
  56478. boost::system::error_code & ec);
  56479. This function is used to load an RSA private key into the context from a file.
  56480. [heading Parameters]
  56481. [variablelist
  56482. [[filename][The name of the file containing the RSA private key.]]
  56483. [[format][The file format (ASN.1 or PEM).]]
  56484. [[ec][Set to indicate what error occurred, if any.]]
  56485. ]
  56486. [heading Remarks]
  56487. Calls `SSL_CTX_use_RSAPrivateKey_file`.
  56488. [endsect]
  56489. [endsect]
  56490. [section:use_tmp_dh ssl::context::use_tmp_dh]
  56491. [indexterm2 boost_asio.indexterm.ssl__context.use_tmp_dh..use_tmp_dh..ssl::context]
  56492. Use the specified memory buffer to obtain the temporary Diffie-Hellman parameters.
  56493. void ``[link boost_asio.reference.ssl__context.use_tmp_dh.overload1 use_tmp_dh]``(
  56494. const const_buffer & dh);
  56495. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_tmp_dh.overload1 more...]]``
  56496. void ``[link boost_asio.reference.ssl__context.use_tmp_dh.overload2 use_tmp_dh]``(
  56497. const const_buffer & dh,
  56498. boost::system::error_code & ec);
  56499. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_tmp_dh.overload2 more...]]``
  56500. [section:overload1 ssl::context::use_tmp_dh (1 of 2 overloads)]
  56501. Use the specified memory buffer to obtain the temporary Diffie-Hellman parameters.
  56502. void use_tmp_dh(
  56503. const const_buffer & dh);
  56504. This function is used to load Diffie-Hellman parameters into the context from a buffer.
  56505. [heading Parameters]
  56506. [variablelist
  56507. [[dh][The memory buffer containing the Diffie-Hellman parameters. The buffer must use the PEM format.]]
  56508. ]
  56509. [heading Exceptions]
  56510. [variablelist
  56511. [[boost::system::system_error][Thrown on failure.]]
  56512. ]
  56513. [heading Remarks]
  56514. Calls `SSL_CTX_set_tmp_dh`.
  56515. [endsect]
  56516. [section:overload2 ssl::context::use_tmp_dh (2 of 2 overloads)]
  56517. Use the specified memory buffer to obtain the temporary Diffie-Hellman parameters.
  56518. void use_tmp_dh(
  56519. const const_buffer & dh,
  56520. boost::system::error_code & ec);
  56521. This function is used to load Diffie-Hellman parameters into the context from a buffer.
  56522. [heading Parameters]
  56523. [variablelist
  56524. [[dh][The memory buffer containing the Diffie-Hellman parameters. The buffer must use the PEM format.]]
  56525. [[ec][Set to indicate what error occurred, if any.]]
  56526. ]
  56527. [heading Remarks]
  56528. Calls `SSL_CTX_set_tmp_dh`.
  56529. [endsect]
  56530. [endsect]
  56531. [section:use_tmp_dh_file ssl::context::use_tmp_dh_file]
  56532. [indexterm2 boost_asio.indexterm.ssl__context.use_tmp_dh_file..use_tmp_dh_file..ssl::context]
  56533. Use the specified file to obtain the temporary Diffie-Hellman parameters.
  56534. void ``[link boost_asio.reference.ssl__context.use_tmp_dh_file.overload1 use_tmp_dh_file]``(
  56535. const std::string & filename);
  56536. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_tmp_dh_file.overload1 more...]]``
  56537. void ``[link boost_asio.reference.ssl__context.use_tmp_dh_file.overload2 use_tmp_dh_file]``(
  56538. const std::string & filename,
  56539. boost::system::error_code & ec);
  56540. `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_tmp_dh_file.overload2 more...]]``
  56541. [section:overload1 ssl::context::use_tmp_dh_file (1 of 2 overloads)]
  56542. Use the specified file to obtain the temporary Diffie-Hellman parameters.
  56543. void use_tmp_dh_file(
  56544. const std::string & filename);
  56545. This function is used to load Diffie-Hellman parameters into the context from a file.
  56546. [heading Parameters]
  56547. [variablelist
  56548. [[filename][The name of the file containing the Diffie-Hellman parameters. The file must use the PEM format.]]
  56549. ]
  56550. [heading Exceptions]
  56551. [variablelist
  56552. [[boost::system::system_error][Thrown on failure.]]
  56553. ]
  56554. [heading Remarks]
  56555. Calls `SSL_CTX_set_tmp_dh`.
  56556. [endsect]
  56557. [section:overload2 ssl::context::use_tmp_dh_file (2 of 2 overloads)]
  56558. Use the specified file to obtain the temporary Diffie-Hellman parameters.
  56559. void use_tmp_dh_file(
  56560. const std::string & filename,
  56561. boost::system::error_code & ec);
  56562. This function is used to load Diffie-Hellman parameters into the context from a file.
  56563. [heading Parameters]
  56564. [variablelist
  56565. [[filename][The name of the file containing the Diffie-Hellman parameters. The file must use the PEM format.]]
  56566. [[ec][Set to indicate what error occurred, if any.]]
  56567. ]
  56568. [heading Remarks]
  56569. Calls `SSL_CTX_set_tmp_dh`.
  56570. [endsect]
  56571. [endsect]
  56572. [section:_context ssl::context::~context]
  56573. [indexterm2 boost_asio.indexterm.ssl__context._context..~context..ssl::context]
  56574. Destructor.
  56575. ~context();
  56576. [endsect]
  56577. [endsect]
  56578. [section:ssl__context_base ssl::context_base]
  56579. The [link boost_asio.reference.ssl__context_base `ssl::context_base`] class is used as a base for the basic\_context class template so that we have a common place to define various enums.
  56580. class context_base
  56581. [heading Types]
  56582. [table
  56583. [[Name][Description]]
  56584. [
  56585. [[link boost_asio.reference.ssl__context_base.file_format [*file_format]]]
  56586. [File format types. ]
  56587. ]
  56588. [
  56589. [[link boost_asio.reference.ssl__context_base.method [*method]]]
  56590. [Different methods supported by a context. ]
  56591. ]
  56592. [
  56593. [[link boost_asio.reference.ssl__context_base.options [*options]]]
  56594. [Bitmask type for SSL options. ]
  56595. ]
  56596. [
  56597. [[link boost_asio.reference.ssl__context_base.password_purpose [*password_purpose]]]
  56598. [Purpose of PEM password. ]
  56599. ]
  56600. ]
  56601. [heading Protected Member Functions]
  56602. [table
  56603. [[Name][Description]]
  56604. [
  56605. [[link boost_asio.reference.ssl__context_base._context_base [*~context_base]]]
  56606. [Protected destructor to prevent deletion through this type. ]
  56607. ]
  56608. ]
  56609. [heading Data Members]
  56610. [table
  56611. [[Name][Description]]
  56612. [
  56613. [[link boost_asio.reference.ssl__context_base.default_workarounds [*default_workarounds]]]
  56614. [Implement various bug workarounds. ]
  56615. ]
  56616. [
  56617. [[link boost_asio.reference.ssl__context_base.no_compression [*no_compression]]]
  56618. [Disable compression. Compression is disabled by default. ]
  56619. ]
  56620. [
  56621. [[link boost_asio.reference.ssl__context_base.no_sslv2 [*no_sslv2]]]
  56622. [Disable SSL v2. ]
  56623. ]
  56624. [
  56625. [[link boost_asio.reference.ssl__context_base.no_sslv3 [*no_sslv3]]]
  56626. [Disable SSL v3. ]
  56627. ]
  56628. [
  56629. [[link boost_asio.reference.ssl__context_base.no_tlsv1 [*no_tlsv1]]]
  56630. [Disable TLS v1. ]
  56631. ]
  56632. [
  56633. [[link boost_asio.reference.ssl__context_base.no_tlsv1_1 [*no_tlsv1_1]]]
  56634. [Disable TLS v1.1. ]
  56635. ]
  56636. [
  56637. [[link boost_asio.reference.ssl__context_base.no_tlsv1_2 [*no_tlsv1_2]]]
  56638. [Disable TLS v1.2. ]
  56639. ]
  56640. [
  56641. [[link boost_asio.reference.ssl__context_base.no_tlsv1_3 [*no_tlsv1_3]]]
  56642. [Disable TLS v1.3. ]
  56643. ]
  56644. [
  56645. [[link boost_asio.reference.ssl__context_base.single_dh_use [*single_dh_use]]]
  56646. [Always create a new key when using tmp_dh parameters. ]
  56647. ]
  56648. ]
  56649. [heading Requirements]
  56650. ['Header: ][^boost/asio/ssl/context_base.hpp]
  56651. ['Convenience header: ][^boost/asio/ssl.hpp]
  56652. [section:default_workarounds ssl::context_base::default_workarounds]
  56653. [indexterm2 boost_asio.indexterm.ssl__context_base.default_workarounds..default_workarounds..ssl::context_base]
  56654. Implement various bug workarounds.
  56655. static const long default_workarounds = implementation_defined;
  56656. [endsect]
  56657. [section:file_format ssl::context_base::file_format]
  56658. [indexterm2 boost_asio.indexterm.ssl__context_base.file_format..file_format..ssl::context_base]
  56659. File format types.
  56660. enum file_format
  56661. [indexterm2 boost_asio.indexterm.ssl__context_base.file_format.asn1..asn1..ssl::context_base]
  56662. [indexterm2 boost_asio.indexterm.ssl__context_base.file_format.pem..pem..ssl::context_base]
  56663. [heading Values]
  56664. [variablelist
  56665. [
  56666. [asn1]
  56667. [ASN.1 file. ]
  56668. ]
  56669. [
  56670. [pem]
  56671. [PEM file. ]
  56672. ]
  56673. ]
  56674. [endsect]
  56675. [section:method ssl::context_base::method]
  56676. [indexterm2 boost_asio.indexterm.ssl__context_base.method..method..ssl::context_base]
  56677. Different methods supported by a context.
  56678. enum method
  56679. [indexterm2 boost_asio.indexterm.ssl__context_base.method.sslv2..sslv2..ssl::context_base]
  56680. [indexterm2 boost_asio.indexterm.ssl__context_base.method.sslv2_client..sslv2_client..ssl::context_base]
  56681. [indexterm2 boost_asio.indexterm.ssl__context_base.method.sslv2_server..sslv2_server..ssl::context_base]
  56682. [indexterm2 boost_asio.indexterm.ssl__context_base.method.sslv3..sslv3..ssl::context_base]
  56683. [indexterm2 boost_asio.indexterm.ssl__context_base.method.sslv3_client..sslv3_client..ssl::context_base]
  56684. [indexterm2 boost_asio.indexterm.ssl__context_base.method.sslv3_server..sslv3_server..ssl::context_base]
  56685. [indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv1..tlsv1..ssl::context_base]
  56686. [indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv1_client..tlsv1_client..ssl::context_base]
  56687. [indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv1_server..tlsv1_server..ssl::context_base]
  56688. [indexterm2 boost_asio.indexterm.ssl__context_base.method.sslv23..sslv23..ssl::context_base]
  56689. [indexterm2 boost_asio.indexterm.ssl__context_base.method.sslv23_client..sslv23_client..ssl::context_base]
  56690. [indexterm2 boost_asio.indexterm.ssl__context_base.method.sslv23_server..sslv23_server..ssl::context_base]
  56691. [indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv11..tlsv11..ssl::context_base]
  56692. [indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv11_client..tlsv11_client..ssl::context_base]
  56693. [indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv11_server..tlsv11_server..ssl::context_base]
  56694. [indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv12..tlsv12..ssl::context_base]
  56695. [indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv12_client..tlsv12_client..ssl::context_base]
  56696. [indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv12_server..tlsv12_server..ssl::context_base]
  56697. [indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv13..tlsv13..ssl::context_base]
  56698. [indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv13_client..tlsv13_client..ssl::context_base]
  56699. [indexterm2 boost_asio.indexterm.ssl__context_base.method.tlsv13_server..tlsv13_server..ssl::context_base]
  56700. [indexterm2 boost_asio.indexterm.ssl__context_base.method.tls..tls..ssl::context_base]
  56701. [indexterm2 boost_asio.indexterm.ssl__context_base.method.tls_client..tls_client..ssl::context_base]
  56702. [indexterm2 boost_asio.indexterm.ssl__context_base.method.tls_server..tls_server..ssl::context_base]
  56703. [heading Values]
  56704. [variablelist
  56705. [
  56706. [sslv2]
  56707. [Generic SSL version 2. ]
  56708. ]
  56709. [
  56710. [sslv2_client]
  56711. [SSL version 2 client. ]
  56712. ]
  56713. [
  56714. [sslv2_server]
  56715. [SSL version 2 server. ]
  56716. ]
  56717. [
  56718. [sslv3]
  56719. [Generic SSL version 3. ]
  56720. ]
  56721. [
  56722. [sslv3_client]
  56723. [SSL version 3 client. ]
  56724. ]
  56725. [
  56726. [sslv3_server]
  56727. [SSL version 3 server. ]
  56728. ]
  56729. [
  56730. [tlsv1]
  56731. [Generic TLS version 1. ]
  56732. ]
  56733. [
  56734. [tlsv1_client]
  56735. [TLS version 1 client. ]
  56736. ]
  56737. [
  56738. [tlsv1_server]
  56739. [TLS version 1 server. ]
  56740. ]
  56741. [
  56742. [sslv23]
  56743. [Generic SSL/TLS. ]
  56744. ]
  56745. [
  56746. [sslv23_client]
  56747. [SSL/TLS client. ]
  56748. ]
  56749. [
  56750. [sslv23_server]
  56751. [SSL/TLS server. ]
  56752. ]
  56753. [
  56754. [tlsv11]
  56755. [Generic TLS version 1.1. ]
  56756. ]
  56757. [
  56758. [tlsv11_client]
  56759. [TLS version 1.1 client. ]
  56760. ]
  56761. [
  56762. [tlsv11_server]
  56763. [TLS version 1.1 server. ]
  56764. ]
  56765. [
  56766. [tlsv12]
  56767. [Generic TLS version 1.2. ]
  56768. ]
  56769. [
  56770. [tlsv12_client]
  56771. [TLS version 1.2 client. ]
  56772. ]
  56773. [
  56774. [tlsv12_server]
  56775. [TLS version 1.2 server. ]
  56776. ]
  56777. [
  56778. [tlsv13]
  56779. [Generic TLS version 1.3. ]
  56780. ]
  56781. [
  56782. [tlsv13_client]
  56783. [TLS version 1.3 client. ]
  56784. ]
  56785. [
  56786. [tlsv13_server]
  56787. [TLS version 1.3 server. ]
  56788. ]
  56789. [
  56790. [tls]
  56791. [Generic TLS. ]
  56792. ]
  56793. [
  56794. [tls_client]
  56795. [TLS client. ]
  56796. ]
  56797. [
  56798. [tls_server]
  56799. [TLS server. ]
  56800. ]
  56801. ]
  56802. [endsect]
  56803. [section:no_compression ssl::context_base::no_compression]
  56804. [indexterm2 boost_asio.indexterm.ssl__context_base.no_compression..no_compression..ssl::context_base]
  56805. Disable compression. Compression is disabled by default.
  56806. static const long no_compression = implementation_defined;
  56807. [endsect]
  56808. [section:no_sslv2 ssl::context_base::no_sslv2]
  56809. [indexterm2 boost_asio.indexterm.ssl__context_base.no_sslv2..no_sslv2..ssl::context_base]
  56810. Disable SSL v2.
  56811. static const long no_sslv2 = implementation_defined;
  56812. [endsect]
  56813. [section:no_sslv3 ssl::context_base::no_sslv3]
  56814. [indexterm2 boost_asio.indexterm.ssl__context_base.no_sslv3..no_sslv3..ssl::context_base]
  56815. Disable SSL v3.
  56816. static const long no_sslv3 = implementation_defined;
  56817. [endsect]
  56818. [section:no_tlsv1 ssl::context_base::no_tlsv1]
  56819. [indexterm2 boost_asio.indexterm.ssl__context_base.no_tlsv1..no_tlsv1..ssl::context_base]
  56820. Disable TLS v1.
  56821. static const long no_tlsv1 = implementation_defined;
  56822. [endsect]
  56823. [section:no_tlsv1_1 ssl::context_base::no_tlsv1_1]
  56824. [indexterm2 boost_asio.indexterm.ssl__context_base.no_tlsv1_1..no_tlsv1_1..ssl::context_base]
  56825. Disable TLS v1.1.
  56826. static const long no_tlsv1_1 = implementation_defined;
  56827. [endsect]
  56828. [section:no_tlsv1_2 ssl::context_base::no_tlsv1_2]
  56829. [indexterm2 boost_asio.indexterm.ssl__context_base.no_tlsv1_2..no_tlsv1_2..ssl::context_base]
  56830. Disable TLS v1.2.
  56831. static const long no_tlsv1_2 = implementation_defined;
  56832. [endsect]
  56833. [section:no_tlsv1_3 ssl::context_base::no_tlsv1_3]
  56834. [indexterm2 boost_asio.indexterm.ssl__context_base.no_tlsv1_3..no_tlsv1_3..ssl::context_base]
  56835. Disable TLS v1.3.
  56836. static const long no_tlsv1_3 = implementation_defined;
  56837. [endsect]
  56838. [section:options ssl::context_base::options]
  56839. [indexterm2 boost_asio.indexterm.ssl__context_base.options..options..ssl::context_base]
  56840. Bitmask type for SSL options.
  56841. typedef long options;
  56842. [heading Requirements]
  56843. ['Header: ][^boost/asio/ssl/context_base.hpp]
  56844. ['Convenience header: ][^boost/asio/ssl.hpp]
  56845. [endsect]
  56846. [section:password_purpose ssl::context_base::password_purpose]
  56847. [indexterm2 boost_asio.indexterm.ssl__context_base.password_purpose..password_purpose..ssl::context_base]
  56848. Purpose of PEM password.
  56849. enum password_purpose
  56850. [indexterm2 boost_asio.indexterm.ssl__context_base.password_purpose.for_reading..for_reading..ssl::context_base]
  56851. [indexterm2 boost_asio.indexterm.ssl__context_base.password_purpose.for_writing..for_writing..ssl::context_base]
  56852. [heading Values]
  56853. [variablelist
  56854. [
  56855. [for_reading]
  56856. [The password is needed for reading/decryption. ]
  56857. ]
  56858. [
  56859. [for_writing]
  56860. [The password is needed for writing/encryption. ]
  56861. ]
  56862. ]
  56863. [endsect]
  56864. [section:single_dh_use ssl::context_base::single_dh_use]
  56865. [indexterm2 boost_asio.indexterm.ssl__context_base.single_dh_use..single_dh_use..ssl::context_base]
  56866. Always create a new key when using tmp\_dh parameters.
  56867. static const long single_dh_use = implementation_defined;
  56868. [endsect]
  56869. [section:_context_base ssl::context_base::~context_base]
  56870. [indexterm2 boost_asio.indexterm.ssl__context_base._context_base..~context_base..ssl::context_base]
  56871. Protected destructor to prevent deletion through this type.
  56872. ~context_base();
  56873. [endsect]
  56874. [endsect]
  56875. [section:ssl__error__get_stream_category ssl::error::get_stream_category]
  56876. [indexterm1 boost_asio.indexterm.ssl__error__get_stream_category..ssl::error::get_stream_category]
  56877. const boost::system::error_category & get_stream_category();
  56878. [heading Requirements]
  56879. ['Header: ][^boost/asio/ssl/error.hpp]
  56880. ['Convenience header: ][^boost/asio/ssl.hpp]
  56881. [endsect]
  56882. [section:ssl__error__make_error_code ssl::error::make_error_code]
  56883. [indexterm1 boost_asio.indexterm.ssl__error__make_error_code..ssl::error::make_error_code]
  56884. boost::system::error_code make_error_code(
  56885. stream_errors e);
  56886. [heading Requirements]
  56887. ['Header: ][^boost/asio/ssl/error.hpp]
  56888. ['Convenience header: ][^boost/asio/ssl.hpp]
  56889. [endsect]
  56890. [section:ssl__error__stream_category ssl::error::stream_category]
  56891. [indexterm1 boost_asio.indexterm.ssl__error__stream_category..ssl::error::stream_category]
  56892. static const boost::system::error_category & stream_category = boost::asio::ssl::error::get_stream_category();
  56893. [heading Requirements]
  56894. ['Header: ][^boost/asio/ssl/error.hpp]
  56895. ['Convenience header: ][^boost/asio/ssl.hpp]
  56896. [endsect]
  56897. [section:ssl__error__stream_errors ssl::error::stream_errors]
  56898. [indexterm1 boost_asio.indexterm.ssl__error__stream_errors..ssl::error::stream_errors]
  56899. enum stream_errors
  56900. [indexterm2 boost_asio.indexterm.ssl__error__stream_errors.stream_truncated..stream_truncated..ssl::error::stream_errors]
  56901. [indexterm2 boost_asio.indexterm.ssl__error__stream_errors.unspecified_system_error..unspecified_system_error..ssl::error::stream_errors]
  56902. [indexterm2 boost_asio.indexterm.ssl__error__stream_errors.unexpected_result..unexpected_result..ssl::error::stream_errors]
  56903. [heading Values]
  56904. [variablelist
  56905. [
  56906. [stream_truncated]
  56907. [The underlying stream closed before the ssl stream gracefully shut down. ]
  56908. ]
  56909. [
  56910. [unspecified_system_error]
  56911. [The underlying SSL library returned a system error without providing further information. ]
  56912. ]
  56913. [
  56914. [unexpected_result]
  56915. [The underlying SSL library generated an unexpected result from a function call. ]
  56916. ]
  56917. ]
  56918. [heading Requirements]
  56919. ['Header: ][^boost/asio/ssl/error.hpp]
  56920. ['Convenience header: ][^boost/asio/ssl.hpp]
  56921. [endsect]
  56922. [section:ssl__rfc2818_verification ssl::rfc2818_verification]
  56923. Verifies a certificate against a hostname according to the rules described in RFC 2818.
  56924. class rfc2818_verification
  56925. [heading Types]
  56926. [table
  56927. [[Name][Description]]
  56928. [
  56929. [[link boost_asio.reference.ssl__rfc2818_verification.result_type [*result_type]]]
  56930. [The type of the function object's result. ]
  56931. ]
  56932. ]
  56933. [heading Member Functions]
  56934. [table
  56935. [[Name][Description]]
  56936. [
  56937. [[link boost_asio.reference.ssl__rfc2818_verification.operator_lp__rp_ [*operator()]]]
  56938. [Perform certificate verification. ]
  56939. ]
  56940. [
  56941. [[link boost_asio.reference.ssl__rfc2818_verification.rfc2818_verification [*rfc2818_verification]]]
  56942. [Constructor. ]
  56943. ]
  56944. ]
  56945. [heading Example]
  56946. The following example shows how to synchronously open a secure connection to a given host name:
  56947. using boost::asio::ip::tcp;
  56948. namespace ssl = boost::asio::ssl;
  56949. typedef ssl::stream<tcp::socket> ssl_socket;
  56950. // Create a context that uses the default paths for finding CA certificates.
  56951. ssl::context ctx(ssl::context::sslv23);
  56952. ctx.set_default_verify_paths();
  56953. // Open a socket and connect it to the remote host.
  56954. boost::asio::io_context io_context;
  56955. ssl_socket sock(io_context, ctx);
  56956. tcp::resolver resolver(io_context);
  56957. tcp::resolver::query query("host.name", "https");
  56958. boost::asio::connect(sock.lowest_layer(), resolver.resolve(query));
  56959. sock.lowest_layer().set_option(tcp::no_delay(true));
  56960. // Perform SSL handshake and verify the remote host's certificate.
  56961. sock.set_verify_mode(ssl::verify_peer);
  56962. sock.set_verify_callback(ssl::rfc2818_verification("host.name"));
  56963. sock.handshake(ssl_socket::client);
  56964. // ... read and write as normal ...
  56965. [heading Requirements]
  56966. ['Header: ][^boost/asio/ssl/rfc2818_verification.hpp]
  56967. ['Convenience header: ][^boost/asio/ssl.hpp]
  56968. [section:operator_lp__rp_ ssl::rfc2818_verification::operator()]
  56969. [indexterm2 boost_asio.indexterm.ssl__rfc2818_verification.operator_lp__rp_..operator()..ssl::rfc2818_verification]
  56970. Perform certificate verification.
  56971. bool operator()(
  56972. bool preverified,
  56973. verify_context & ctx) const;
  56974. [endsect]
  56975. [section:result_type ssl::rfc2818_verification::result_type]
  56976. [indexterm2 boost_asio.indexterm.ssl__rfc2818_verification.result_type..result_type..ssl::rfc2818_verification]
  56977. The type of the function object's result.
  56978. typedef bool result_type;
  56979. [heading Requirements]
  56980. ['Header: ][^boost/asio/ssl/rfc2818_verification.hpp]
  56981. ['Convenience header: ][^boost/asio/ssl.hpp]
  56982. [endsect]
  56983. [section:rfc2818_verification ssl::rfc2818_verification::rfc2818_verification]
  56984. [indexterm2 boost_asio.indexterm.ssl__rfc2818_verification.rfc2818_verification..rfc2818_verification..ssl::rfc2818_verification]
  56985. Constructor.
  56986. rfc2818_verification(
  56987. const std::string & host);
  56988. [endsect]
  56989. [endsect]
  56990. [section:ssl__stream ssl::stream]
  56991. Provides stream-oriented functionality using SSL.
  56992. template<
  56993. typename Stream>
  56994. class stream :
  56995. public ssl::stream_base,
  56996. noncopyable
  56997. [heading Types]
  56998. [table
  56999. [[Name][Description]]
  57000. [
  57001. [[link boost_asio.reference.ssl__stream__impl_struct [*impl_struct]]]
  57002. [Structure for use with deprecated impl_type. ]
  57003. ]
  57004. [
  57005. [[link boost_asio.reference.ssl__stream.executor_type [*executor_type]]]
  57006. [The type of the executor associated with the object. ]
  57007. ]
  57008. [
  57009. [[link boost_asio.reference.ssl__stream.handshake_type [*handshake_type]]]
  57010. [Different handshake types. ]
  57011. ]
  57012. [
  57013. [[link boost_asio.reference.ssl__stream.lowest_layer_type [*lowest_layer_type]]]
  57014. [The type of the lowest layer. ]
  57015. ]
  57016. [
  57017. [[link boost_asio.reference.ssl__stream.native_handle_type [*native_handle_type]]]
  57018. [The native handle type of the SSL stream. ]
  57019. ]
  57020. [
  57021. [[link boost_asio.reference.ssl__stream.next_layer_type [*next_layer_type]]]
  57022. [The type of the next layer. ]
  57023. ]
  57024. ]
  57025. [heading Member Functions]
  57026. [table
  57027. [[Name][Description]]
  57028. [
  57029. [[link boost_asio.reference.ssl__stream.async_handshake [*async_handshake]]]
  57030. [Start an asynchronous SSL handshake. ]
  57031. ]
  57032. [
  57033. [[link boost_asio.reference.ssl__stream.async_read_some [*async_read_some]]]
  57034. [Start an asynchronous read. ]
  57035. ]
  57036. [
  57037. [[link boost_asio.reference.ssl__stream.async_shutdown [*async_shutdown]]]
  57038. [Asynchronously shut down SSL on the stream. ]
  57039. ]
  57040. [
  57041. [[link boost_asio.reference.ssl__stream.async_write_some [*async_write_some]]]
  57042. [Start an asynchronous write. ]
  57043. ]
  57044. [
  57045. [[link boost_asio.reference.ssl__stream.get_executor [*get_executor]]]
  57046. [Get the executor associated with the object. ]
  57047. ]
  57048. [
  57049. [[link boost_asio.reference.ssl__stream.handshake [*handshake]]]
  57050. [Perform SSL handshaking. ]
  57051. ]
  57052. [
  57053. [[link boost_asio.reference.ssl__stream.lowest_layer [*lowest_layer]]]
  57054. [Get a reference to the lowest layer. ]
  57055. ]
  57056. [
  57057. [[link boost_asio.reference.ssl__stream.native_handle [*native_handle]]]
  57058. [Get the underlying implementation in the native type. ]
  57059. ]
  57060. [
  57061. [[link boost_asio.reference.ssl__stream.next_layer [*next_layer]]]
  57062. [Get a reference to the next layer. ]
  57063. ]
  57064. [
  57065. [[link boost_asio.reference.ssl__stream.read_some [*read_some]]]
  57066. [Read some data from the stream. ]
  57067. ]
  57068. [
  57069. [[link boost_asio.reference.ssl__stream.set_verify_callback [*set_verify_callback]]]
  57070. [Set the callback used to verify peer certificates. ]
  57071. ]
  57072. [
  57073. [[link boost_asio.reference.ssl__stream.set_verify_depth [*set_verify_depth]]]
  57074. [Set the peer verification depth. ]
  57075. ]
  57076. [
  57077. [[link boost_asio.reference.ssl__stream.set_verify_mode [*set_verify_mode]]]
  57078. [Set the peer verification mode. ]
  57079. ]
  57080. [
  57081. [[link boost_asio.reference.ssl__stream.shutdown [*shutdown]]]
  57082. [Shut down SSL on the stream. ]
  57083. ]
  57084. [
  57085. [[link boost_asio.reference.ssl__stream.stream [*stream]]]
  57086. [Construct a stream. ]
  57087. ]
  57088. [
  57089. [[link boost_asio.reference.ssl__stream.write_some [*write_some]]]
  57090. [Write some data to the stream. ]
  57091. ]
  57092. [
  57093. [[link boost_asio.reference.ssl__stream._stream [*~stream]]]
  57094. [Destructor. ]
  57095. ]
  57096. ]
  57097. The stream class template provides asynchronous and blocking stream-oriented functionality using SSL.
  57098. [heading Thread Safety]
  57099. ['Distinct] ['objects:] Safe.
  57100. ['Shared] ['objects:] Unsafe. The application must also ensure that all asynchronous operations are performed within the same implicit or explicit strand.
  57101. [heading Example]
  57102. To use the SSL stream template with an `ip::tcp::socket`, you would write:
  57103. boost::asio::io_context my_context;
  57104. boost::asio::ssl::context ctx(boost::asio::ssl::context::sslv23);
  57105. boost::asio::ssl::stream<asio:ip::tcp::socket> sock(my_context, ctx);
  57106. [heading Requirements]
  57107. ['Header: ][^boost/asio/ssl/stream.hpp]
  57108. ['Convenience header: ][^boost/asio/ssl.hpp]
  57109. [section:async_handshake ssl::stream::async_handshake]
  57110. [indexterm2 boost_asio.indexterm.ssl__stream.async_handshake..async_handshake..ssl::stream]
  57111. Start an asynchronous SSL handshake.
  57112. template<
  57113. typename ``[link boost_asio.reference.HandshakeHandler HandshakeHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  57114. ``[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]``(
  57115. handshake_type type,
  57116. HandshakeHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  57117. `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.async_handshake.overload1 more...]]``
  57118. template<
  57119. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  57120. typename ``[link boost_asio.reference.BufferedHandshakeHandler BufferedHandshakeHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  57121. ``[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]``(
  57122. handshake_type type,
  57123. const ConstBufferSequence & buffers,
  57124. BufferedHandshakeHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  57125. `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.async_handshake.overload2 more...]]``
  57126. [section:overload1 ssl::stream::async_handshake (1 of 2 overloads)]
  57127. Start an asynchronous SSL handshake.
  57128. template<
  57129. typename ``[link boost_asio.reference.HandshakeHandler HandshakeHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  57130. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_handshake(
  57131. handshake_type type,
  57132. HandshakeHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  57133. This function is used to asynchronously perform an SSL handshake on the stream. This function call always returns immediately.
  57134. [heading Parameters]
  57135. [variablelist
  57136. [[type][The type of handshaking to be performed, i.e. as a client or as a server.]]
  57137. [[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:
  57138. ``
  57139. void handler(
  57140. const boost::system::error_code& error // Result of operation.
  57141. );
  57142. ``
  57143. ]]
  57144. ]
  57145. [endsect]
  57146. [section:overload2 ssl::stream::async_handshake (2 of 2 overloads)]
  57147. Start an asynchronous SSL handshake.
  57148. template<
  57149. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  57150. typename ``[link boost_asio.reference.BufferedHandshakeHandler BufferedHandshakeHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  57151. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_handshake(
  57152. handshake_type type,
  57153. const ConstBufferSequence & buffers,
  57154. BufferedHandshakeHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  57155. This function is used to asynchronously perform an SSL handshake on the stream. This function call always returns immediately.
  57156. [heading Parameters]
  57157. [variablelist
  57158. [[type][The type of handshaking to be performed, i.e. as a client or as a server.]]
  57159. [[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.]]
  57160. [[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:
  57161. ``
  57162. void handler(
  57163. const boost::system::error_code& error, // Result of operation.
  57164. std::size_t bytes_transferred // Amount of buffers used in handshake.
  57165. );
  57166. ``
  57167. ]]
  57168. ]
  57169. [endsect]
  57170. [endsect]
  57171. [section:async_read_some ssl::stream::async_read_some]
  57172. [indexterm2 boost_asio.indexterm.ssl__stream.async_read_some..async_read_some..ssl::stream]
  57173. Start an asynchronous read.
  57174. template<
  57175. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  57176. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  57177. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_some(
  57178. const MutableBufferSequence & buffers,
  57179. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  57180. This function is used to asynchronously read one or more bytes of data from the stream. The function call always returns immediately.
  57181. [heading Parameters]
  57182. [variablelist
  57183. [[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.]]
  57184. [[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:
  57185. ``
  57186. void handler(
  57187. const boost::system::error_code& error, // Result of operation.
  57188. std::size_t bytes_transferred // Number of bytes read.
  57189. );
  57190. ``
  57191. ]]
  57192. ]
  57193. [heading Remarks]
  57194. The async\_read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.async_read `async_read`] function if you need to ensure that the requested amount of data is read before the asynchronous operation completes.
  57195. [endsect]
  57196. [section:async_shutdown ssl::stream::async_shutdown]
  57197. [indexterm2 boost_asio.indexterm.ssl__stream.async_shutdown..async_shutdown..ssl::stream]
  57198. Asynchronously shut down SSL on the stream.
  57199. template<
  57200. typename ``[link boost_asio.reference.ShutdownHandler ShutdownHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  57201. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_shutdown(
  57202. ShutdownHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  57203. This function is used to asynchronously shut down SSL on the stream. This function call always returns immediately.
  57204. [heading Parameters]
  57205. [variablelist
  57206. [[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:
  57207. ``
  57208. void handler(
  57209. const boost::system::error_code& error // Result of operation.
  57210. );
  57211. ``
  57212. ]]
  57213. ]
  57214. [endsect]
  57215. [section:async_write_some ssl::stream::async_write_some]
  57216. [indexterm2 boost_asio.indexterm.ssl__stream.async_write_some..async_write_some..ssl::stream]
  57217. Start an asynchronous write.
  57218. template<
  57219. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  57220. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  57221. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_some(
  57222. const ConstBufferSequence & buffers,
  57223. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  57224. This function is used to asynchronously write one or more bytes of data to the stream. The function call always returns immediately.
  57225. [heading Parameters]
  57226. [variablelist
  57227. [[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.]]
  57228. [[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:
  57229. ``
  57230. void handler(
  57231. const boost::system::error_code& error, // Result of operation.
  57232. std::size_t bytes_transferred // Number of bytes written.
  57233. );
  57234. ``
  57235. ]]
  57236. ]
  57237. [heading Remarks]
  57238. The async\_write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.async_write `async_write`] function if you need to ensure that all data is written before the asynchronous operation completes.
  57239. [endsect]
  57240. [section:executor_type ssl::stream::executor_type]
  57241. [indexterm2 boost_asio.indexterm.ssl__stream.executor_type..executor_type..ssl::stream]
  57242. The type of the executor associated with the object.
  57243. typedef lowest_layer_type::executor_type executor_type;
  57244. [heading Requirements]
  57245. ['Header: ][^boost/asio/ssl/stream.hpp]
  57246. ['Convenience header: ][^boost/asio/ssl.hpp]
  57247. [endsect]
  57248. [section:get_executor ssl::stream::get_executor]
  57249. [indexterm2 boost_asio.indexterm.ssl__stream.get_executor..get_executor..ssl::stream]
  57250. Get the executor associated with the object.
  57251. executor_type get_executor();
  57252. This function may be used to obtain the executor object that the stream uses to dispatch handlers for asynchronous operations.
  57253. [heading Return Value]
  57254. A copy of the executor that stream will use to dispatch handlers.
  57255. [endsect]
  57256. [section:handshake ssl::stream::handshake]
  57257. [indexterm2 boost_asio.indexterm.ssl__stream.handshake..handshake..ssl::stream]
  57258. Perform SSL handshaking.
  57259. void ``[link boost_asio.reference.ssl__stream.handshake.overload1 handshake]``(
  57260. handshake_type type);
  57261. `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.handshake.overload1 more...]]``
  57262. void ``[link boost_asio.reference.ssl__stream.handshake.overload2 handshake]``(
  57263. handshake_type type,
  57264. boost::system::error_code & ec);
  57265. `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.handshake.overload2 more...]]``
  57266. template<
  57267. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  57268. void ``[link boost_asio.reference.ssl__stream.handshake.overload3 handshake]``(
  57269. handshake_type type,
  57270. const ConstBufferSequence & buffers);
  57271. `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.handshake.overload3 more...]]``
  57272. template<
  57273. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  57274. void ``[link boost_asio.reference.ssl__stream.handshake.overload4 handshake]``(
  57275. handshake_type type,
  57276. const ConstBufferSequence & buffers,
  57277. boost::system::error_code & ec);
  57278. `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.handshake.overload4 more...]]``
  57279. [section:overload1 ssl::stream::handshake (1 of 4 overloads)]
  57280. Perform SSL handshaking.
  57281. void handshake(
  57282. handshake_type type);
  57283. This function is used to perform SSL handshaking on the stream. The function call will block until handshaking is complete or an error occurs.
  57284. [heading Parameters]
  57285. [variablelist
  57286. [[type][The type of handshaking to be performed, i.e. as a client or as a server.]]
  57287. ]
  57288. [heading Exceptions]
  57289. [variablelist
  57290. [[boost::system::system_error][Thrown on failure. ]]
  57291. ]
  57292. [endsect]
  57293. [section:overload2 ssl::stream::handshake (2 of 4 overloads)]
  57294. Perform SSL handshaking.
  57295. void handshake(
  57296. handshake_type type,
  57297. boost::system::error_code & ec);
  57298. This function is used to perform SSL handshaking on the stream. The function call will block until handshaking is complete or an error occurs.
  57299. [heading Parameters]
  57300. [variablelist
  57301. [[type][The type of handshaking to be performed, i.e. as a client or as a server.]]
  57302. [[ec][Set to indicate what error occurred, if any. ]]
  57303. ]
  57304. [endsect]
  57305. [section:overload3 ssl::stream::handshake (3 of 4 overloads)]
  57306. Perform SSL handshaking.
  57307. template<
  57308. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  57309. void handshake(
  57310. handshake_type type,
  57311. const ConstBufferSequence & buffers);
  57312. This function is used to perform SSL handshaking on the stream. The function call will block until handshaking is complete or an error occurs.
  57313. [heading Parameters]
  57314. [variablelist
  57315. [[type][The type of handshaking to be performed, i.e. as a client or as a server.]]
  57316. [[buffers][The buffered data to be reused for the handshake.]]
  57317. ]
  57318. [heading Exceptions]
  57319. [variablelist
  57320. [[boost::system::system_error][Thrown on failure. ]]
  57321. ]
  57322. [endsect]
  57323. [section:overload4 ssl::stream::handshake (4 of 4 overloads)]
  57324. Perform SSL handshaking.
  57325. template<
  57326. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  57327. void handshake(
  57328. handshake_type type,
  57329. const ConstBufferSequence & buffers,
  57330. boost::system::error_code & ec);
  57331. This function is used to perform SSL handshaking on the stream. The function call will block until handshaking is complete or an error occurs.
  57332. [heading Parameters]
  57333. [variablelist
  57334. [[type][The type of handshaking to be performed, i.e. as a client or as a server.]]
  57335. [[buffers][The buffered data to be reused for the handshake.]]
  57336. [[ec][Set to indicate what error occurred, if any. ]]
  57337. ]
  57338. [endsect]
  57339. [endsect]
  57340. [section:handshake_type ssl::stream::handshake_type]
  57341. [indexterm2 boost_asio.indexterm.ssl__stream.handshake_type..handshake_type..ssl::stream]
  57342. Different handshake types.
  57343. enum handshake_type
  57344. [indexterm2 boost_asio.indexterm.ssl__stream.handshake_type.client..client..ssl::stream]
  57345. [indexterm2 boost_asio.indexterm.ssl__stream.handshake_type.server..server..ssl::stream]
  57346. [heading Values]
  57347. [variablelist
  57348. [
  57349. [client]
  57350. [Perform handshaking as a client. ]
  57351. ]
  57352. [
  57353. [server]
  57354. [Perform handshaking as a server. ]
  57355. ]
  57356. ]
  57357. [endsect]
  57358. [section:lowest_layer ssl::stream::lowest_layer]
  57359. [indexterm2 boost_asio.indexterm.ssl__stream.lowest_layer..lowest_layer..ssl::stream]
  57360. Get a reference to the lowest layer.
  57361. lowest_layer_type & ``[link boost_asio.reference.ssl__stream.lowest_layer.overload1 lowest_layer]``();
  57362. `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.lowest_layer.overload1 more...]]``
  57363. const lowest_layer_type & ``[link boost_asio.reference.ssl__stream.lowest_layer.overload2 lowest_layer]``() const;
  57364. `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.lowest_layer.overload2 more...]]``
  57365. [section:overload1 ssl::stream::lowest_layer (1 of 2 overloads)]
  57366. Get a reference to the lowest layer.
  57367. lowest_layer_type & lowest_layer();
  57368. This function returns a reference to the lowest layer in a stack of stream layers.
  57369. [heading Return Value]
  57370. A reference to the lowest layer in the stack of stream layers. Ownership is not transferred to the caller.
  57371. [endsect]
  57372. [section:overload2 ssl::stream::lowest_layer (2 of 2 overloads)]
  57373. Get a reference to the lowest layer.
  57374. const lowest_layer_type & lowest_layer() const;
  57375. This function returns a reference to the lowest layer in a stack of stream layers.
  57376. [heading Return Value]
  57377. A reference to the lowest layer in the stack of stream layers. Ownership is not transferred to the caller.
  57378. [endsect]
  57379. [endsect]
  57380. [section:lowest_layer_type ssl::stream::lowest_layer_type]
  57381. [indexterm2 boost_asio.indexterm.ssl__stream.lowest_layer_type..lowest_layer_type..ssl::stream]
  57382. The type of the lowest layer.
  57383. typedef next_layer_type::lowest_layer_type lowest_layer_type;
  57384. [heading Requirements]
  57385. ['Header: ][^boost/asio/ssl/stream.hpp]
  57386. ['Convenience header: ][^boost/asio/ssl.hpp]
  57387. [endsect]
  57388. [section:native_handle ssl::stream::native_handle]
  57389. [indexterm2 boost_asio.indexterm.ssl__stream.native_handle..native_handle..ssl::stream]
  57390. Get the underlying implementation in the native type.
  57391. native_handle_type native_handle();
  57392. This function may be used to obtain the underlying implementation of the context. This is intended to allow access to context functionality that is not otherwise provided.
  57393. [heading Example]
  57394. The `native_handle()` function returns a pointer of type `SSL*` that is suitable for passing to functions such as `SSL_get_verify_result` and `SSL_get_peer_certificate:`
  57395. boost::asio::ssl::stream<asio:ip::tcp::socket> sock(my_context, ctx);
  57396. // ... establish connection and perform handshake ...
  57397. if (X509* cert = SSL_get_peer_certificate(sock.native_handle()))
  57398. {
  57399. if (SSL_get_verify_result(sock.native_handle()) == X509_V_OK)
  57400. {
  57401. // ...
  57402. }
  57403. }
  57404. [endsect]
  57405. [section:native_handle_type ssl::stream::native_handle_type]
  57406. [indexterm2 boost_asio.indexterm.ssl__stream.native_handle_type..native_handle_type..ssl::stream]
  57407. The native handle type of the SSL stream.
  57408. typedef SSL * native_handle_type;
  57409. [heading Requirements]
  57410. ['Header: ][^boost/asio/ssl/stream.hpp]
  57411. ['Convenience header: ][^boost/asio/ssl.hpp]
  57412. [endsect]
  57413. [section:next_layer ssl::stream::next_layer]
  57414. [indexterm2 boost_asio.indexterm.ssl__stream.next_layer..next_layer..ssl::stream]
  57415. Get a reference to the next layer.
  57416. const next_layer_type & ``[link boost_asio.reference.ssl__stream.next_layer.overload1 next_layer]``() const;
  57417. `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.next_layer.overload1 more...]]``
  57418. next_layer_type & ``[link boost_asio.reference.ssl__stream.next_layer.overload2 next_layer]``();
  57419. `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.next_layer.overload2 more...]]``
  57420. [section:overload1 ssl::stream::next_layer (1 of 2 overloads)]
  57421. Get a reference to the next layer.
  57422. const next_layer_type & next_layer() const;
  57423. This function returns a reference to the next layer in a stack of stream layers.
  57424. [heading Return Value]
  57425. A reference to the next layer in the stack of stream layers. Ownership is not transferred to the caller.
  57426. [endsect]
  57427. [section:overload2 ssl::stream::next_layer (2 of 2 overloads)]
  57428. Get a reference to the next layer.
  57429. next_layer_type & next_layer();
  57430. This function returns a reference to the next layer in a stack of stream layers.
  57431. [heading Return Value]
  57432. A reference to the next layer in the stack of stream layers. Ownership is not transferred to the caller.
  57433. [endsect]
  57434. [endsect]
  57435. [section:next_layer_type ssl::stream::next_layer_type]
  57436. [indexterm2 boost_asio.indexterm.ssl__stream.next_layer_type..next_layer_type..ssl::stream]
  57437. The type of the next layer.
  57438. typedef remove_reference< Stream >::type next_layer_type;
  57439. [heading Requirements]
  57440. ['Header: ][^boost/asio/ssl/stream.hpp]
  57441. ['Convenience header: ][^boost/asio/ssl.hpp]
  57442. [endsect]
  57443. [section:read_some ssl::stream::read_some]
  57444. [indexterm2 boost_asio.indexterm.ssl__stream.read_some..read_some..ssl::stream]
  57445. Read some data from the stream.
  57446. template<
  57447. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  57448. std::size_t ``[link boost_asio.reference.ssl__stream.read_some.overload1 read_some]``(
  57449. const MutableBufferSequence & buffers);
  57450. `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.read_some.overload1 more...]]``
  57451. template<
  57452. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  57453. std::size_t ``[link boost_asio.reference.ssl__stream.read_some.overload2 read_some]``(
  57454. const MutableBufferSequence & buffers,
  57455. boost::system::error_code & ec);
  57456. `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.read_some.overload2 more...]]``
  57457. [section:overload1 ssl::stream::read_some (1 of 2 overloads)]
  57458. Read some data from the stream.
  57459. template<
  57460. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  57461. std::size_t read_some(
  57462. const MutableBufferSequence & buffers);
  57463. This function is used to read data from the stream. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
  57464. [heading Parameters]
  57465. [variablelist
  57466. [[buffers][The buffers into which the data will be read.]]
  57467. ]
  57468. [heading Return Value]
  57469. The number of bytes read.
  57470. [heading Exceptions]
  57471. [variablelist
  57472. [[boost::system::system_error][Thrown on failure.]]
  57473. ]
  57474. [heading Remarks]
  57475. The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
  57476. [endsect]
  57477. [section:overload2 ssl::stream::read_some (2 of 2 overloads)]
  57478. Read some data from the stream.
  57479. template<
  57480. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  57481. std::size_t read_some(
  57482. const MutableBufferSequence & buffers,
  57483. boost::system::error_code & ec);
  57484. This function is used to read data from the stream. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
  57485. [heading Parameters]
  57486. [variablelist
  57487. [[buffers][The buffers into which the data will be read.]]
  57488. [[ec][Set to indicate what error occurred, if any.]]
  57489. ]
  57490. [heading Return Value]
  57491. The number of bytes read. Returns 0 if an error occurred.
  57492. [heading Remarks]
  57493. The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
  57494. [endsect]
  57495. [endsect]
  57496. [section:set_verify_callback ssl::stream::set_verify_callback]
  57497. [indexterm2 boost_asio.indexterm.ssl__stream.set_verify_callback..set_verify_callback..ssl::stream]
  57498. Set the callback used to verify peer certificates.
  57499. template<
  57500. typename VerifyCallback>
  57501. void ``[link boost_asio.reference.ssl__stream.set_verify_callback.overload1 set_verify_callback]``(
  57502. VerifyCallback callback);
  57503. `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.set_verify_callback.overload1 more...]]``
  57504. template<
  57505. typename VerifyCallback>
  57506. void ``[link boost_asio.reference.ssl__stream.set_verify_callback.overload2 set_verify_callback]``(
  57507. VerifyCallback callback,
  57508. boost::system::error_code & ec);
  57509. `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.set_verify_callback.overload2 more...]]``
  57510. [section:overload1 ssl::stream::set_verify_callback (1 of 2 overloads)]
  57511. Set the callback used to verify peer certificates.
  57512. template<
  57513. typename VerifyCallback>
  57514. void set_verify_callback(
  57515. VerifyCallback callback);
  57516. This function is used to specify a callback function that will be called by the implementation when it needs to verify a peer certificate.
  57517. [heading Parameters]
  57518. [variablelist
  57519. [[callback][The function object to be used for verifying a certificate. The function signature of the handler must be:
  57520. ``
  57521. bool verify_callback(
  57522. bool preverified, // True if the certificate passed pre-verification.
  57523. verify_context& ctx // The peer certificate and other context.
  57524. );
  57525. ``
  57526. The return value of the callback is true if the certificate has passed verification, false otherwise.]]
  57527. ]
  57528. [heading Exceptions]
  57529. [variablelist
  57530. [[boost::system::system_error][Thrown on failure.]]
  57531. ]
  57532. [heading Remarks]
  57533. Calls `SSL_set_verify`.
  57534. [endsect]
  57535. [section:overload2 ssl::stream::set_verify_callback (2 of 2 overloads)]
  57536. Set the callback used to verify peer certificates.
  57537. template<
  57538. typename VerifyCallback>
  57539. void set_verify_callback(
  57540. VerifyCallback callback,
  57541. boost::system::error_code & ec);
  57542. This function is used to specify a callback function that will be called by the implementation when it needs to verify a peer certificate.
  57543. [heading Parameters]
  57544. [variablelist
  57545. [[callback][The function object to be used for verifying a certificate. The function signature of the handler must be:
  57546. ``
  57547. bool verify_callback(
  57548. bool preverified, // True if the certificate passed pre-verification.
  57549. verify_context& ctx // The peer certificate and other context.
  57550. );
  57551. ``
  57552. The return value of the callback is true if the certificate has passed verification, false otherwise.]]
  57553. [[ec][Set to indicate what error occurred, if any.]]
  57554. ]
  57555. [heading Remarks]
  57556. Calls `SSL_set_verify`.
  57557. [endsect]
  57558. [endsect]
  57559. [section:set_verify_depth ssl::stream::set_verify_depth]
  57560. [indexterm2 boost_asio.indexterm.ssl__stream.set_verify_depth..set_verify_depth..ssl::stream]
  57561. Set the peer verification depth.
  57562. void ``[link boost_asio.reference.ssl__stream.set_verify_depth.overload1 set_verify_depth]``(
  57563. int depth);
  57564. `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.set_verify_depth.overload1 more...]]``
  57565. void ``[link boost_asio.reference.ssl__stream.set_verify_depth.overload2 set_verify_depth]``(
  57566. int depth,
  57567. boost::system::error_code & ec);
  57568. `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.set_verify_depth.overload2 more...]]``
  57569. [section:overload1 ssl::stream::set_verify_depth (1 of 2 overloads)]
  57570. Set the peer verification depth.
  57571. void set_verify_depth(
  57572. int depth);
  57573. This function may be used to configure the maximum verification depth allowed by the stream.
  57574. [heading Parameters]
  57575. [variablelist
  57576. [[depth][Maximum depth for the certificate chain verification that shall be allowed.]]
  57577. ]
  57578. [heading Exceptions]
  57579. [variablelist
  57580. [[boost::system::system_error][Thrown on failure.]]
  57581. ]
  57582. [heading Remarks]
  57583. Calls `SSL_set_verify_depth`.
  57584. [endsect]
  57585. [section:overload2 ssl::stream::set_verify_depth (2 of 2 overloads)]
  57586. Set the peer verification depth.
  57587. void set_verify_depth(
  57588. int depth,
  57589. boost::system::error_code & ec);
  57590. This function may be used to configure the maximum verification depth allowed by the stream.
  57591. [heading Parameters]
  57592. [variablelist
  57593. [[depth][Maximum depth for the certificate chain verification that shall be allowed.]]
  57594. [[ec][Set to indicate what error occurred, if any.]]
  57595. ]
  57596. [heading Remarks]
  57597. Calls `SSL_set_verify_depth`.
  57598. [endsect]
  57599. [endsect]
  57600. [section:set_verify_mode ssl::stream::set_verify_mode]
  57601. [indexterm2 boost_asio.indexterm.ssl__stream.set_verify_mode..set_verify_mode..ssl::stream]
  57602. Set the peer verification mode.
  57603. void ``[link boost_asio.reference.ssl__stream.set_verify_mode.overload1 set_verify_mode]``(
  57604. verify_mode v);
  57605. `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.set_verify_mode.overload1 more...]]``
  57606. void ``[link boost_asio.reference.ssl__stream.set_verify_mode.overload2 set_verify_mode]``(
  57607. verify_mode v,
  57608. boost::system::error_code & ec);
  57609. `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.set_verify_mode.overload2 more...]]``
  57610. [section:overload1 ssl::stream::set_verify_mode (1 of 2 overloads)]
  57611. Set the peer verification mode.
  57612. void set_verify_mode(
  57613. verify_mode v);
  57614. This function may be used to configure the peer verification mode used by the stream. The new mode will override the mode inherited from the context.
  57615. [heading Parameters]
  57616. [variablelist
  57617. [[v][A bitmask of peer verification modes. See [link boost_asio.reference.ssl__verify_mode `ssl::verify_mode`] for available values.]]
  57618. ]
  57619. [heading Exceptions]
  57620. [variablelist
  57621. [[boost::system::system_error][Thrown on failure.]]
  57622. ]
  57623. [heading Remarks]
  57624. Calls `SSL_set_verify`.
  57625. [endsect]
  57626. [section:overload2 ssl::stream::set_verify_mode (2 of 2 overloads)]
  57627. Set the peer verification mode.
  57628. void set_verify_mode(
  57629. verify_mode v,
  57630. boost::system::error_code & ec);
  57631. This function may be used to configure the peer verification mode used by the stream. The new mode will override the mode inherited from the context.
  57632. [heading Parameters]
  57633. [variablelist
  57634. [[v][A bitmask of peer verification modes. See [link boost_asio.reference.ssl__verify_mode `ssl::verify_mode`] for available values.]]
  57635. [[ec][Set to indicate what error occurred, if any.]]
  57636. ]
  57637. [heading Remarks]
  57638. Calls `SSL_set_verify`.
  57639. [endsect]
  57640. [endsect]
  57641. [section:shutdown ssl::stream::shutdown]
  57642. [indexterm2 boost_asio.indexterm.ssl__stream.shutdown..shutdown..ssl::stream]
  57643. Shut down SSL on the stream.
  57644. void ``[link boost_asio.reference.ssl__stream.shutdown.overload1 shutdown]``();
  57645. `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.shutdown.overload1 more...]]``
  57646. void ``[link boost_asio.reference.ssl__stream.shutdown.overload2 shutdown]``(
  57647. boost::system::error_code & ec);
  57648. `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.shutdown.overload2 more...]]``
  57649. [section:overload1 ssl::stream::shutdown (1 of 2 overloads)]
  57650. Shut down SSL on the stream.
  57651. void shutdown();
  57652. This function is used to shut down SSL on the stream. The function call will block until SSL has been shut down or an error occurs.
  57653. [heading Exceptions]
  57654. [variablelist
  57655. [[boost::system::system_error][Thrown on failure. ]]
  57656. ]
  57657. [endsect]
  57658. [section:overload2 ssl::stream::shutdown (2 of 2 overloads)]
  57659. Shut down SSL on the stream.
  57660. void shutdown(
  57661. boost::system::error_code & ec);
  57662. This function is used to shut down SSL on the stream. The function call will block until SSL has been shut down or an error occurs.
  57663. [heading Parameters]
  57664. [variablelist
  57665. [[ec][Set to indicate what error occurred, if any. ]]
  57666. ]
  57667. [endsect]
  57668. [endsect]
  57669. [section:stream ssl::stream::stream]
  57670. [indexterm2 boost_asio.indexterm.ssl__stream.stream..stream..ssl::stream]
  57671. Construct a stream.
  57672. template<
  57673. typename Arg>
  57674. stream(
  57675. Arg && arg,
  57676. context & ctx);
  57677. This constructor creates a stream and initialises the underlying stream object.
  57678. [heading Parameters]
  57679. [variablelist
  57680. [[arg][The argument to be passed to initialise the underlying stream.]]
  57681. [[ctx][The SSL context to be used for the stream. ]]
  57682. ]
  57683. [endsect]
  57684. [section:write_some ssl::stream::write_some]
  57685. [indexterm2 boost_asio.indexterm.ssl__stream.write_some..write_some..ssl::stream]
  57686. Write some data to the stream.
  57687. template<
  57688. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  57689. std::size_t ``[link boost_asio.reference.ssl__stream.write_some.overload1 write_some]``(
  57690. const ConstBufferSequence & buffers);
  57691. `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.write_some.overload1 more...]]``
  57692. template<
  57693. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  57694. std::size_t ``[link boost_asio.reference.ssl__stream.write_some.overload2 write_some]``(
  57695. const ConstBufferSequence & buffers,
  57696. boost::system::error_code & ec);
  57697. `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.write_some.overload2 more...]]``
  57698. [section:overload1 ssl::stream::write_some (1 of 2 overloads)]
  57699. Write some data to the stream.
  57700. template<
  57701. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  57702. std::size_t write_some(
  57703. const ConstBufferSequence & buffers);
  57704. This function is used to write data on the stream. The function call will block until one or more bytes of data has been written successfully, or until an error occurs.
  57705. [heading Parameters]
  57706. [variablelist
  57707. [[buffers][The data to be written.]]
  57708. ]
  57709. [heading Return Value]
  57710. The number of bytes written.
  57711. [heading Exceptions]
  57712. [variablelist
  57713. [[boost::system::system_error][Thrown on failure.]]
  57714. ]
  57715. [heading Remarks]
  57716. The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
  57717. [endsect]
  57718. [section:overload2 ssl::stream::write_some (2 of 2 overloads)]
  57719. Write some data to the stream.
  57720. template<
  57721. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  57722. std::size_t write_some(
  57723. const ConstBufferSequence & buffers,
  57724. boost::system::error_code & ec);
  57725. This function is used to write data on the stream. The function call will block until one or more bytes of data has been written successfully, or until an error occurs.
  57726. [heading Parameters]
  57727. [variablelist
  57728. [[buffers][The data to be written to the stream.]]
  57729. [[ec][Set to indicate what error occurred, if any.]]
  57730. ]
  57731. [heading Return Value]
  57732. The number of bytes written. Returns 0 if an error occurred.
  57733. [heading Remarks]
  57734. The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
  57735. [endsect]
  57736. [endsect]
  57737. [section:_stream ssl::stream::~stream]
  57738. [indexterm2 boost_asio.indexterm.ssl__stream._stream..~stream..ssl::stream]
  57739. Destructor.
  57740. ~stream();
  57741. [heading Remarks]
  57742. A `stream` object must not be destroyed while there are pending asynchronous operations associated with it.
  57743. [endsect]
  57744. [endsect]
  57745. [section:ssl__stream__impl_struct ssl::stream::impl_struct]
  57746. Structure for use with deprecated impl\_type.
  57747. struct impl_struct
  57748. [heading Data Members]
  57749. [table
  57750. [[Name][Description]]
  57751. [
  57752. [[link boost_asio.reference.ssl__stream__impl_struct.ssl [*ssl]]]
  57753. []
  57754. ]
  57755. ]
  57756. [heading Requirements]
  57757. ['Header: ][^boost/asio/ssl/stream.hpp]
  57758. ['Convenience header: ][^boost/asio/ssl.hpp]
  57759. [section:ssl ssl::stream::impl_struct::ssl]
  57760. [indexterm2 boost_asio.indexterm.ssl__stream__impl_struct.ssl..ssl..ssl::stream::impl_struct]
  57761. SSL * ssl;
  57762. [endsect]
  57763. [endsect]
  57764. [section:ssl__stream_base ssl::stream_base]
  57765. The [link boost_asio.reference.ssl__stream_base `ssl::stream_base`] class is used as a base for the [link boost_asio.reference.ssl__stream `ssl::stream`] class template so that we have a common place to define various enums.
  57766. class stream_base
  57767. [heading Types]
  57768. [table
  57769. [[Name][Description]]
  57770. [
  57771. [[link boost_asio.reference.ssl__stream_base.handshake_type [*handshake_type]]]
  57772. [Different handshake types. ]
  57773. ]
  57774. ]
  57775. [heading Protected Member Functions]
  57776. [table
  57777. [[Name][Description]]
  57778. [
  57779. [[link boost_asio.reference.ssl__stream_base._stream_base [*~stream_base]]]
  57780. [Protected destructor to prevent deletion through this type. ]
  57781. ]
  57782. ]
  57783. [heading Requirements]
  57784. ['Header: ][^boost/asio/ssl/stream_base.hpp]
  57785. ['Convenience header: ][^boost/asio/ssl.hpp]
  57786. [section:handshake_type ssl::stream_base::handshake_type]
  57787. [indexterm2 boost_asio.indexterm.ssl__stream_base.handshake_type..handshake_type..ssl::stream_base]
  57788. Different handshake types.
  57789. enum handshake_type
  57790. [indexterm2 boost_asio.indexterm.ssl__stream_base.handshake_type.client..client..ssl::stream_base]
  57791. [indexterm2 boost_asio.indexterm.ssl__stream_base.handshake_type.server..server..ssl::stream_base]
  57792. [heading Values]
  57793. [variablelist
  57794. [
  57795. [client]
  57796. [Perform handshaking as a client. ]
  57797. ]
  57798. [
  57799. [server]
  57800. [Perform handshaking as a server. ]
  57801. ]
  57802. ]
  57803. [endsect]
  57804. [section:_stream_base ssl::stream_base::~stream_base]
  57805. [indexterm2 boost_asio.indexterm.ssl__stream_base._stream_base..~stream_base..ssl::stream_base]
  57806. Protected destructor to prevent deletion through this type.
  57807. ~stream_base();
  57808. [endsect]
  57809. [endsect]
  57810. [section:ssl__verify_client_once ssl::verify_client_once]
  57811. [indexterm1 boost_asio.indexterm.ssl__verify_client_once..ssl::verify_client_once]
  57812. Do not request client certificate on renegotiation. Ignored unless [link boost_asio.reference.ssl__verify_peer `ssl::verify_peer`] is set.
  57813. const int verify_client_once = implementation_defined;
  57814. [heading Requirements]
  57815. ['Header: ][^boost/asio/ssl/verify_mode.hpp]
  57816. ['Convenience header: ][^boost/asio/ssl.hpp]
  57817. [endsect]
  57818. [section:ssl__verify_context ssl::verify_context]
  57819. A simple wrapper around the X509\_STORE\_CTX type, used during verification of a peer certificate.
  57820. class verify_context :
  57821. noncopyable
  57822. [heading Types]
  57823. [table
  57824. [[Name][Description]]
  57825. [
  57826. [[link boost_asio.reference.ssl__verify_context.native_handle_type [*native_handle_type]]]
  57827. [The native handle type of the verification context. ]
  57828. ]
  57829. ]
  57830. [heading Member Functions]
  57831. [table
  57832. [[Name][Description]]
  57833. [
  57834. [[link boost_asio.reference.ssl__verify_context.native_handle [*native_handle]]]
  57835. [Get the underlying implementation in the native type. ]
  57836. ]
  57837. [
  57838. [[link boost_asio.reference.ssl__verify_context.verify_context [*verify_context]]]
  57839. [Constructor. ]
  57840. ]
  57841. ]
  57842. [heading Remarks]
  57843. The [link boost_asio.reference.ssl__verify_context `ssl::verify_context`] does not own the underlying X509\_STORE\_CTX object.
  57844. [heading Requirements]
  57845. ['Header: ][^boost/asio/ssl/verify_context.hpp]
  57846. ['Convenience header: ][^boost/asio/ssl.hpp]
  57847. [section:native_handle ssl::verify_context::native_handle]
  57848. [indexterm2 boost_asio.indexterm.ssl__verify_context.native_handle..native_handle..ssl::verify_context]
  57849. Get the underlying implementation in the native type.
  57850. native_handle_type native_handle();
  57851. This function may be used to obtain the underlying implementation of the context. This is intended to allow access to context functionality that is not otherwise provided.
  57852. [endsect]
  57853. [section:native_handle_type ssl::verify_context::native_handle_type]
  57854. [indexterm2 boost_asio.indexterm.ssl__verify_context.native_handle_type..native_handle_type..ssl::verify_context]
  57855. The native handle type of the verification context.
  57856. typedef X509_STORE_CTX * native_handle_type;
  57857. [heading Requirements]
  57858. ['Header: ][^boost/asio/ssl/verify_context.hpp]
  57859. ['Convenience header: ][^boost/asio/ssl.hpp]
  57860. [endsect]
  57861. [section:verify_context ssl::verify_context::verify_context]
  57862. [indexterm2 boost_asio.indexterm.ssl__verify_context.verify_context..verify_context..ssl::verify_context]
  57863. Constructor.
  57864. verify_context(
  57865. native_handle_type handle);
  57866. [endsect]
  57867. [endsect]
  57868. [section:ssl__verify_fail_if_no_peer_cert ssl::verify_fail_if_no_peer_cert]
  57869. [indexterm1 boost_asio.indexterm.ssl__verify_fail_if_no_peer_cert..ssl::verify_fail_if_no_peer_cert]
  57870. Fail verification if the peer has no certificate. Ignored unless [link boost_asio.reference.ssl__verify_peer `ssl::verify_peer`] is set.
  57871. const int verify_fail_if_no_peer_cert = implementation_defined;
  57872. [heading Requirements]
  57873. ['Header: ][^boost/asio/ssl/verify_mode.hpp]
  57874. ['Convenience header: ][^boost/asio/ssl.hpp]
  57875. [endsect]
  57876. [section:ssl__verify_mode ssl::verify_mode]
  57877. [indexterm1 boost_asio.indexterm.ssl__verify_mode..ssl::verify_mode]
  57878. Bitmask type for peer verification.
  57879. typedef int verify_mode;
  57880. Possible values are:
  57881. * [link boost_asio.reference.ssl__verify_none `ssl::verify_none`]
  57882. * [link boost_asio.reference.ssl__verify_peer `ssl::verify_peer`]
  57883. * [link boost_asio.reference.ssl__verify_fail_if_no_peer_cert `ssl::verify_fail_if_no_peer_cert`]
  57884. * [link boost_asio.reference.ssl__verify_client_once `ssl::verify_client_once`]
  57885. [heading Requirements]
  57886. ['Header: ][^boost/asio/ssl/verify_mode.hpp]
  57887. ['Convenience header: ][^boost/asio/ssl.hpp]
  57888. [endsect]
  57889. [section:ssl__verify_none ssl::verify_none]
  57890. [indexterm1 boost_asio.indexterm.ssl__verify_none..ssl::verify_none]
  57891. No verification.
  57892. const int verify_none = implementation_defined;
  57893. [heading Requirements]
  57894. ['Header: ][^boost/asio/ssl/verify_mode.hpp]
  57895. ['Convenience header: ][^boost/asio/ssl.hpp]
  57896. [endsect]
  57897. [section:ssl__verify_peer ssl::verify_peer]
  57898. [indexterm1 boost_asio.indexterm.ssl__verify_peer..ssl::verify_peer]
  57899. Verify the peer.
  57900. const int verify_peer = implementation_defined;
  57901. [heading Requirements]
  57902. ['Header: ][^boost/asio/ssl/verify_mode.hpp]
  57903. ['Convenience header: ][^boost/asio/ssl.hpp]
  57904. [endsect]
  57905. [section:steady_timer steady_timer]
  57906. [indexterm1 boost_asio.indexterm.steady_timer..steady_timer]
  57907. Typedef for a timer based on the steady clock.
  57908. typedef basic_waitable_timer< chrono::steady_clock > steady_timer;
  57909. [heading Types]
  57910. [table
  57911. [[Name][Description]]
  57912. [
  57913. [[link boost_asio.reference.basic_waitable_timer__rebind_executor [*rebind_executor]]]
  57914. [Rebinds the timer type to another executor. ]
  57915. ]
  57916. [
  57917. [[link boost_asio.reference.basic_waitable_timer.clock_type [*clock_type]]]
  57918. [The clock type. ]
  57919. ]
  57920. [
  57921. [[link boost_asio.reference.basic_waitable_timer.duration [*duration]]]
  57922. [The duration type of the clock. ]
  57923. ]
  57924. [
  57925. [[link boost_asio.reference.basic_waitable_timer.executor_type [*executor_type]]]
  57926. [The type of the executor associated with the object. ]
  57927. ]
  57928. [
  57929. [[link boost_asio.reference.basic_waitable_timer.time_point [*time_point]]]
  57930. [The time point type of the clock. ]
  57931. ]
  57932. [
  57933. [[link boost_asio.reference.basic_waitable_timer.traits_type [*traits_type]]]
  57934. [The wait traits type. ]
  57935. ]
  57936. ]
  57937. [heading Member Functions]
  57938. [table
  57939. [[Name][Description]]
  57940. [
  57941. [[link boost_asio.reference.basic_waitable_timer.async_wait [*async_wait]]]
  57942. [Start an asynchronous wait on the timer. ]
  57943. ]
  57944. [
  57945. [[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer [*basic_waitable_timer]]]
  57946. [Constructor.
  57947. [hr]
  57948. Constructor to set a particular expiry time as an absolute time.
  57949. [hr]
  57950. Constructor to set a particular expiry time relative to now.
  57951. [hr]
  57952. Move-construct a basic_waitable_timer from another. ]
  57953. ]
  57954. [
  57955. [[link boost_asio.reference.basic_waitable_timer.cancel [*cancel]]]
  57956. [Cancel any asynchronous operations that are waiting on the timer.
  57957. [hr]
  57958. (Deprecated: Use non-error_code overload.) Cancel any asynchronous operations that are waiting on the timer. ]
  57959. ]
  57960. [
  57961. [[link boost_asio.reference.basic_waitable_timer.cancel_one [*cancel_one]]]
  57962. [Cancels one asynchronous operation that is waiting on the timer.
  57963. [hr]
  57964. (Deprecated: Use non-error_code overload.) Cancels one asynchronous operation that is waiting on the timer. ]
  57965. ]
  57966. [
  57967. [[link boost_asio.reference.basic_waitable_timer.expires_after [*expires_after]]]
  57968. [Set the timer's expiry time relative to now. ]
  57969. ]
  57970. [
  57971. [[link boost_asio.reference.basic_waitable_timer.expires_at [*expires_at]]]
  57972. [(Deprecated: Use expiry().) Get the timer's expiry time as an absolute time.
  57973. [hr]
  57974. Set the timer's expiry time as an absolute time.
  57975. [hr]
  57976. (Deprecated: Use non-error_code overload.) Set the timer's expiry time as an absolute time. ]
  57977. ]
  57978. [
  57979. [[link boost_asio.reference.basic_waitable_timer.expires_from_now [*expires_from_now]]]
  57980. [(Deprecated: Use expiry().) Get the timer's expiry time relative to now.
  57981. [hr]
  57982. (Deprecated: Use expires_after().) Set the timer's expiry time relative to now. ]
  57983. ]
  57984. [
  57985. [[link boost_asio.reference.basic_waitable_timer.expiry [*expiry]]]
  57986. [Get the timer's expiry time as an absolute time. ]
  57987. ]
  57988. [
  57989. [[link boost_asio.reference.basic_waitable_timer.get_executor [*get_executor]]]
  57990. [Get the executor associated with the object. ]
  57991. ]
  57992. [
  57993. [[link boost_asio.reference.basic_waitable_timer.operator_eq_ [*operator=]]]
  57994. [Move-assign a basic_waitable_timer from another. ]
  57995. ]
  57996. [
  57997. [[link boost_asio.reference.basic_waitable_timer.wait [*wait]]]
  57998. [Perform a blocking wait on the timer. ]
  57999. ]
  58000. [
  58001. [[link boost_asio.reference.basic_waitable_timer._basic_waitable_timer [*~basic_waitable_timer]]]
  58002. [Destroys the timer. ]
  58003. ]
  58004. ]
  58005. The [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] class template provides the ability to perform a blocking or asynchronous wait for a timer to expire.
  58006. A waitable timer is always in one of two states: "expired" or "not expired". If the `wait()` or `async_wait()` function is called on an expired timer, the wait operation will complete immediately.
  58007. Most applications will use one of the [link boost_asio.reference.steady_timer `steady_timer`], [link boost_asio.reference.system_timer `system_timer`] or [link boost_asio.reference.high_resolution_timer `high_resolution_timer`] typedefs.
  58008. [heading Remarks]
  58009. This waitable timer functionality is for use with the C++11 standard library's `<chrono>` facility, or with the Boost.Chrono library.
  58010. [heading Thread Safety]
  58011. ['Distinct] ['objects:] Safe.
  58012. ['Shared] ['objects:] Unsafe.
  58013. [heading Examples]
  58014. Performing a blocking wait (C++11):
  58015. // Construct a timer without setting an expiry time.
  58016. boost::asio::steady_timer timer(my_context);
  58017. // Set an expiry time relative to now.
  58018. timer.expires_after(std::chrono::seconds(5));
  58019. // Wait for the timer to expire.
  58020. timer.wait();
  58021. Performing an asynchronous wait (C++11):
  58022. void handler(const boost::system::error_code& error)
  58023. {
  58024. if (!error)
  58025. {
  58026. // Timer expired.
  58027. }
  58028. }
  58029. ...
  58030. // Construct a timer with an absolute expiry time.
  58031. boost::asio::steady_timer timer(my_context,
  58032. std::chrono::steady_clock::now() + std::chrono::seconds(60));
  58033. // Start an asynchronous wait.
  58034. timer.async_wait(handler);
  58035. [heading Changing an active waitable timer's expiry time]
  58036. Changing the expiry time of a timer while there are pending asynchronous waits causes those wait operations to be cancelled. To ensure that the action associated with the timer is performed only once, use something like this: used:
  58037. void on_some_event()
  58038. {
  58039. if (my_timer.expires_after(seconds(5)) > 0)
  58040. {
  58041. // We managed to cancel the timer. Start new asynchronous wait.
  58042. my_timer.async_wait(on_timeout);
  58043. }
  58044. else
  58045. {
  58046. // Too late, timer has already expired!
  58047. }
  58048. }
  58049. void on_timeout(const boost::system::error_code& e)
  58050. {
  58051. if (e != boost::asio::error::operation_aborted)
  58052. {
  58053. // Timer was not cancelled, take necessary action.
  58054. }
  58055. }
  58056. * 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.
  58057. * If a wait handler is cancelled, the boost::system::error\_code passed to it contains the value `boost::asio::error::operation_aborted`.
  58058. This typedef uses the C++11 `<chrono>` standard library facility, if available. Otherwise, it may use the Boost.Chrono library. To explicitly utilise Boost.Chrono, use the [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] template directly:
  58059. typedef basic_waitable_timer<boost::chrono::steady_clock> timer;
  58060. [heading Requirements]
  58061. ['Header: ][^boost/asio/steady_timer.hpp]
  58062. ['Convenience header: ][^boost/asio.hpp]
  58063. [endsect]
  58064. [section:strand strand]
  58065. Provides serialised function invocation for any executor type.
  58066. template<
  58067. typename ``[link boost_asio.reference.Executor1 Executor]``>
  58068. class strand
  58069. [heading Types]
  58070. [table
  58071. [[Name][Description]]
  58072. [
  58073. [[link boost_asio.reference.strand.inner_executor_type [*inner_executor_type]]]
  58074. [The type of the underlying executor. ]
  58075. ]
  58076. ]
  58077. [heading Member Functions]
  58078. [table
  58079. [[Name][Description]]
  58080. [
  58081. [[link boost_asio.reference.strand.context [*context]]]
  58082. [Obtain the underlying execution context. ]
  58083. ]
  58084. [
  58085. [[link boost_asio.reference.strand.defer [*defer]]]
  58086. [Request the strand to invoke the given function object. ]
  58087. ]
  58088. [
  58089. [[link boost_asio.reference.strand.dispatch [*dispatch]]]
  58090. [Request the strand to invoke the given function object. ]
  58091. ]
  58092. [
  58093. [[link boost_asio.reference.strand.get_inner_executor [*get_inner_executor]]]
  58094. [Obtain the underlying executor. ]
  58095. ]
  58096. [
  58097. [[link boost_asio.reference.strand.on_work_finished [*on_work_finished]]]
  58098. [Inform the strand that some work is no longer outstanding. ]
  58099. ]
  58100. [
  58101. [[link boost_asio.reference.strand.on_work_started [*on_work_started]]]
  58102. [Inform the strand that it has some outstanding work to do. ]
  58103. ]
  58104. [
  58105. [[link boost_asio.reference.strand.operator_eq_ [*operator=]]]
  58106. [Assignment operator.
  58107. [hr]
  58108. Converting assignment operator.
  58109. [hr]
  58110. Move assignment operator.
  58111. [hr]
  58112. Converting move assignment operator. ]
  58113. ]
  58114. [
  58115. [[link boost_asio.reference.strand.post [*post]]]
  58116. [Request the strand to invoke the given function object. ]
  58117. ]
  58118. [
  58119. [[link boost_asio.reference.strand.running_in_this_thread [*running_in_this_thread]]]
  58120. [Determine whether the strand is running in the current thread. ]
  58121. ]
  58122. [
  58123. [[link boost_asio.reference.strand.strand [*strand]]]
  58124. [Default constructor.
  58125. [hr]
  58126. Construct a strand for the specified executor.
  58127. [hr]
  58128. Copy constructor.
  58129. [hr]
  58130. Converting constructor.
  58131. [hr]
  58132. Move constructor.
  58133. [hr]
  58134. Converting move constructor. ]
  58135. ]
  58136. [
  58137. [[link boost_asio.reference.strand._strand [*~strand]]]
  58138. [Destructor. ]
  58139. ]
  58140. ]
  58141. [heading Friends]
  58142. [table
  58143. [[Name][Description]]
  58144. [
  58145. [[link boost_asio.reference.strand.operator_not__eq_ [*operator!=]]]
  58146. [Compare two strands for inequality. ]
  58147. ]
  58148. [
  58149. [[link boost_asio.reference.strand.operator_eq__eq_ [*operator==]]]
  58150. [Compare two strands for equality. ]
  58151. ]
  58152. ]
  58153. [heading Requirements]
  58154. ['Header: ][^boost/asio/strand.hpp]
  58155. ['Convenience header: ][^boost/asio.hpp]
  58156. [section:context strand::context]
  58157. [indexterm2 boost_asio.indexterm.strand.context..context..strand]
  58158. Obtain the underlying execution context.
  58159. execution_context & context() const;
  58160. [endsect]
  58161. [section:defer strand::defer]
  58162. [indexterm2 boost_asio.indexterm.strand.defer..defer..strand]
  58163. Request the strand to invoke the given function object.
  58164. template<
  58165. typename Function,
  58166. typename Allocator>
  58167. void defer(
  58168. Function && f,
  58169. const Allocator & a) const;
  58170. This function is used to ask the executor to execute the given function object. The function object will never be executed inside this function. Instead, it will be scheduled by the underlying executor's defer function.
  58171. [heading Parameters]
  58172. [variablelist
  58173. [[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:
  58174. ``
  58175. void function();
  58176. ``
  58177. ]]
  58178. [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
  58179. ]
  58180. [endsect]
  58181. [section:dispatch strand::dispatch]
  58182. [indexterm2 boost_asio.indexterm.strand.dispatch..dispatch..strand]
  58183. Request the strand to invoke the given function object.
  58184. template<
  58185. typename Function,
  58186. typename Allocator>
  58187. void dispatch(
  58188. Function && f,
  58189. const Allocator & a) const;
  58190. This function is used to ask the strand to execute the given function object on its underlying executor. The function object will be executed inside this function if the strand is not otherwise busy and if the underlying executor's `dispatch()` function is also able to execute the function before returning.
  58191. [heading Parameters]
  58192. [variablelist
  58193. [[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:
  58194. ``
  58195. void function();
  58196. ``
  58197. ]]
  58198. [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
  58199. ]
  58200. [endsect]
  58201. [section:get_inner_executor strand::get_inner_executor]
  58202. [indexterm2 boost_asio.indexterm.strand.get_inner_executor..get_inner_executor..strand]
  58203. Obtain the underlying executor.
  58204. inner_executor_type get_inner_executor() const;
  58205. [endsect]
  58206. [section:inner_executor_type strand::inner_executor_type]
  58207. [indexterm2 boost_asio.indexterm.strand.inner_executor_type..inner_executor_type..strand]
  58208. The type of the underlying executor.
  58209. typedef Executor inner_executor_type;
  58210. [heading Requirements]
  58211. ['Header: ][^boost/asio/strand.hpp]
  58212. ['Convenience header: ][^boost/asio.hpp]
  58213. [endsect]
  58214. [section:on_work_finished strand::on_work_finished]
  58215. [indexterm2 boost_asio.indexterm.strand.on_work_finished..on_work_finished..strand]
  58216. Inform the strand that some work is no longer outstanding.
  58217. void on_work_finished() const;
  58218. The strand delegates this call to its underlying executor.
  58219. [endsect]
  58220. [section:on_work_started strand::on_work_started]
  58221. [indexterm2 boost_asio.indexterm.strand.on_work_started..on_work_started..strand]
  58222. Inform the strand that it has some outstanding work to do.
  58223. void on_work_started() const;
  58224. The strand delegates this call to its underlying executor.
  58225. [endsect]
  58226. [section:operator_not__eq_ strand::operator!=]
  58227. [indexterm2 boost_asio.indexterm.strand.operator_not__eq_..operator!=..strand]
  58228. Compare two strands for inequality.
  58229. friend bool operator!=(
  58230. const strand & a,
  58231. const strand & b);
  58232. Two strands are equal if they refer to the same ordered, non-concurrent state.
  58233. [heading Requirements]
  58234. ['Header: ][^boost/asio/strand.hpp]
  58235. ['Convenience header: ][^boost/asio.hpp]
  58236. [endsect]
  58237. [section:operator_eq_ strand::operator=]
  58238. [indexterm2 boost_asio.indexterm.strand.operator_eq_..operator=..strand]
  58239. Assignment operator.
  58240. strand & ``[link boost_asio.reference.strand.operator_eq_.overload1 operator=]``(
  58241. const strand & other);
  58242. `` [''''&raquo;''' [link boost_asio.reference.strand.operator_eq_.overload1 more...]]``
  58243. Converting assignment operator.
  58244. template<
  58245. class ``[link boost_asio.reference.Executor1 OtherExecutor]``>
  58246. strand & ``[link boost_asio.reference.strand.operator_eq_.overload2 operator=]``(
  58247. const strand< OtherExecutor > & other);
  58248. `` [''''&raquo;''' [link boost_asio.reference.strand.operator_eq_.overload2 more...]]``
  58249. Move assignment operator.
  58250. strand & ``[link boost_asio.reference.strand.operator_eq_.overload3 operator=]``(
  58251. strand && other);
  58252. `` [''''&raquo;''' [link boost_asio.reference.strand.operator_eq_.overload3 more...]]``
  58253. Converting move assignment operator.
  58254. template<
  58255. class ``[link boost_asio.reference.Executor1 OtherExecutor]``>
  58256. strand & ``[link boost_asio.reference.strand.operator_eq_.overload4 operator=]``(
  58257. const strand< OtherExecutor > && other);
  58258. `` [''''&raquo;''' [link boost_asio.reference.strand.operator_eq_.overload4 more...]]``
  58259. [section:overload1 strand::operator= (1 of 4 overloads)]
  58260. Assignment operator.
  58261. strand & operator=(
  58262. const strand & other);
  58263. [endsect]
  58264. [section:overload2 strand::operator= (2 of 4 overloads)]
  58265. Converting assignment operator.
  58266. template<
  58267. class ``[link boost_asio.reference.Executor1 OtherExecutor]``>
  58268. strand & operator=(
  58269. const strand< OtherExecutor > & other);
  58270. This assignment operator is only valid if the `OtherExecutor` type is convertible to `Executor`.
  58271. [endsect]
  58272. [section:overload3 strand::operator= (3 of 4 overloads)]
  58273. Move assignment operator.
  58274. strand & operator=(
  58275. strand && other);
  58276. [endsect]
  58277. [section:overload4 strand::operator= (4 of 4 overloads)]
  58278. Converting move assignment operator.
  58279. template<
  58280. class ``[link boost_asio.reference.Executor1 OtherExecutor]``>
  58281. strand & operator=(
  58282. const strand< OtherExecutor > && other);
  58283. This assignment operator is only valid if the `OtherExecutor` type is convertible to `Executor`.
  58284. [endsect]
  58285. [endsect]
  58286. [section:operator_eq__eq_ strand::operator==]
  58287. [indexterm2 boost_asio.indexterm.strand.operator_eq__eq_..operator==..strand]
  58288. Compare two strands for equality.
  58289. friend bool operator==(
  58290. const strand & a,
  58291. const strand & b);
  58292. Two strands are equal if they refer to the same ordered, non-concurrent state.
  58293. [heading Requirements]
  58294. ['Header: ][^boost/asio/strand.hpp]
  58295. ['Convenience header: ][^boost/asio.hpp]
  58296. [endsect]
  58297. [section:post strand::post]
  58298. [indexterm2 boost_asio.indexterm.strand.post..post..strand]
  58299. Request the strand to invoke the given function object.
  58300. template<
  58301. typename Function,
  58302. typename Allocator>
  58303. void post(
  58304. Function && f,
  58305. const Allocator & a) const;
  58306. This function is used to ask the executor to execute the given function object. The function object will never be executed inside this function. Instead, it will be scheduled by the underlying executor's defer function.
  58307. [heading Parameters]
  58308. [variablelist
  58309. [[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:
  58310. ``
  58311. void function();
  58312. ``
  58313. ]]
  58314. [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
  58315. ]
  58316. [endsect]
  58317. [section:running_in_this_thread strand::running_in_this_thread]
  58318. [indexterm2 boost_asio.indexterm.strand.running_in_this_thread..running_in_this_thread..strand]
  58319. Determine whether the strand is running in the current thread.
  58320. bool running_in_this_thread() const;
  58321. [heading Return Value]
  58322. `true` if the current thread is executing a function that was submitted to the strand using `post()`, `dispatch()` or `defer()`. Otherwise returns `false`.
  58323. [endsect]
  58324. [section:strand strand::strand]
  58325. [indexterm2 boost_asio.indexterm.strand.strand..strand..strand]
  58326. Default constructor.
  58327. ``[link boost_asio.reference.strand.strand.overload1 strand]``();
  58328. `` [''''&raquo;''' [link boost_asio.reference.strand.strand.overload1 more...]]``
  58329. Construct a strand for the specified executor.
  58330. explicit ``[link boost_asio.reference.strand.strand.overload2 strand]``(
  58331. const Executor & e);
  58332. `` [''''&raquo;''' [link boost_asio.reference.strand.strand.overload2 more...]]``
  58333. Copy constructor.
  58334. ``[link boost_asio.reference.strand.strand.overload3 strand]``(
  58335. const strand & other);
  58336. `` [''''&raquo;''' [link boost_asio.reference.strand.strand.overload3 more...]]``
  58337. Converting constructor.
  58338. template<
  58339. class ``[link boost_asio.reference.Executor1 OtherExecutor]``>
  58340. ``[link boost_asio.reference.strand.strand.overload4 strand]``(
  58341. const strand< OtherExecutor > & other);
  58342. `` [''''&raquo;''' [link boost_asio.reference.strand.strand.overload4 more...]]``
  58343. Move constructor.
  58344. ``[link boost_asio.reference.strand.strand.overload5 strand]``(
  58345. strand && other);
  58346. `` [''''&raquo;''' [link boost_asio.reference.strand.strand.overload5 more...]]``
  58347. Converting move constructor.
  58348. template<
  58349. class ``[link boost_asio.reference.Executor1 OtherExecutor]``>
  58350. ``[link boost_asio.reference.strand.strand.overload6 strand]``(
  58351. strand< OtherExecutor > && other);
  58352. `` [''''&raquo;''' [link boost_asio.reference.strand.strand.overload6 more...]]``
  58353. [section:overload1 strand::strand (1 of 6 overloads)]
  58354. Default constructor.
  58355. strand();
  58356. This constructor is only valid if the underlying executor type is default constructible.
  58357. [endsect]
  58358. [section:overload2 strand::strand (2 of 6 overloads)]
  58359. Construct a strand for the specified executor.
  58360. strand(
  58361. const Executor & e);
  58362. [endsect]
  58363. [section:overload3 strand::strand (3 of 6 overloads)]
  58364. Copy constructor.
  58365. strand(
  58366. const strand & other);
  58367. [endsect]
  58368. [section:overload4 strand::strand (4 of 6 overloads)]
  58369. Converting constructor.
  58370. template<
  58371. class ``[link boost_asio.reference.Executor1 OtherExecutor]``>
  58372. strand(
  58373. const strand< OtherExecutor > & other);
  58374. This constructor is only valid if the `OtherExecutor` type is convertible to `Executor`.
  58375. [endsect]
  58376. [section:overload5 strand::strand (5 of 6 overloads)]
  58377. Move constructor.
  58378. strand(
  58379. strand && other);
  58380. [endsect]
  58381. [section:overload6 strand::strand (6 of 6 overloads)]
  58382. Converting move constructor.
  58383. template<
  58384. class ``[link boost_asio.reference.Executor1 OtherExecutor]``>
  58385. strand(
  58386. strand< OtherExecutor > && other);
  58387. This constructor is only valid if the `OtherExecutor` type is convertible to `Executor`.
  58388. [endsect]
  58389. [endsect]
  58390. [section:_strand strand::~strand]
  58391. [indexterm2 boost_asio.indexterm.strand._strand..~strand..strand]
  58392. Destructor.
  58393. ~strand();
  58394. [endsect]
  58395. [endsect]
  58396. [section:streambuf streambuf]
  58397. [indexterm1 boost_asio.indexterm.streambuf..streambuf]
  58398. Typedef for the typical usage of [link boost_asio.reference.basic_streambuf `basic_streambuf`].
  58399. typedef basic_streambuf streambuf;
  58400. [heading Types]
  58401. [table
  58402. [[Name][Description]]
  58403. [
  58404. [[link boost_asio.reference.basic_streambuf.const_buffers_type [*const_buffers_type]]]
  58405. [The type used to represent the input sequence as a list of buffers. ]
  58406. ]
  58407. [
  58408. [[link boost_asio.reference.basic_streambuf.mutable_buffers_type [*mutable_buffers_type]]]
  58409. [The type used to represent the output sequence as a list of buffers. ]
  58410. ]
  58411. ]
  58412. [heading Member Functions]
  58413. [table
  58414. [[Name][Description]]
  58415. [
  58416. [[link boost_asio.reference.basic_streambuf.basic_streambuf [*basic_streambuf]]]
  58417. [Construct a basic_streambuf object. ]
  58418. ]
  58419. [
  58420. [[link boost_asio.reference.basic_streambuf.capacity [*capacity]]]
  58421. [Get the current capacity of the basic_streambuf. ]
  58422. ]
  58423. [
  58424. [[link boost_asio.reference.basic_streambuf.commit [*commit]]]
  58425. [Move characters from the output sequence to the input sequence. ]
  58426. ]
  58427. [
  58428. [[link boost_asio.reference.basic_streambuf.consume [*consume]]]
  58429. [Remove characters from the input sequence. ]
  58430. ]
  58431. [
  58432. [[link boost_asio.reference.basic_streambuf.data [*data]]]
  58433. [Get a list of buffers that represents the input sequence. ]
  58434. ]
  58435. [
  58436. [[link boost_asio.reference.basic_streambuf.max_size [*max_size]]]
  58437. [Get the maximum size of the basic_streambuf. ]
  58438. ]
  58439. [
  58440. [[link boost_asio.reference.basic_streambuf.prepare [*prepare]]]
  58441. [Get a list of buffers that represents the output sequence, with the given size. ]
  58442. ]
  58443. [
  58444. [[link boost_asio.reference.basic_streambuf.size [*size]]]
  58445. [Get the size of the input sequence. ]
  58446. ]
  58447. ]
  58448. [heading Protected Member Functions]
  58449. [table
  58450. [[Name][Description]]
  58451. [
  58452. [[link boost_asio.reference.basic_streambuf.overflow [*overflow]]]
  58453. [Override std::streambuf behaviour. ]
  58454. ]
  58455. [
  58456. [[link boost_asio.reference.basic_streambuf.reserve [*reserve]]]
  58457. []
  58458. ]
  58459. [
  58460. [[link boost_asio.reference.basic_streambuf.underflow [*underflow]]]
  58461. [Override std::streambuf behaviour. ]
  58462. ]
  58463. ]
  58464. The `basic_streambuf` class is derived from `std::streambuf` to associate the streambuf's input and output sequences with one or more character arrays. These character arrays are internal to the `basic_streambuf` object, but direct access to the array elements is provided to permit them to be used efficiently with I/O operations. Characters written to the output sequence of a `basic_streambuf` object are appended to the input sequence of the same object.
  58465. The `basic_streambuf` class's public interface is intended to permit the following implementation strategies:
  58466. * 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.
  58467. * 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.
  58468. * 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.
  58469. The constructor for [link boost_asio.reference.basic_streambuf `basic_streambuf`] accepts a `size_t` argument specifying the maximum of the sum of the sizes of the input sequence and output sequence. During the lifetime of the `basic_streambuf` object, the following invariant holds:
  58470. size() <= max_size()
  58471. Any member function that would, if successful, cause the invariant to be violated shall throw an exception of class `std::length_error`.
  58472. The constructor for `basic_streambuf` takes an Allocator argument. A copy of this argument is used for any memory allocation performed, by the constructor and by all member functions, during the lifetime of each `basic_streambuf` object.
  58473. [heading Examples]
  58474. Writing directly from an streambuf to a socket:
  58475. boost::asio::streambuf b;
  58476. std::ostream os(&b);
  58477. os << "Hello, World!\n";
  58478. // try sending some data in input sequence
  58479. size_t n = sock.send(b.data());
  58480. b.consume(n); // sent data is removed from input sequence
  58481. Reading from a socket directly into a streambuf:
  58482. boost::asio::streambuf b;
  58483. // reserve 512 bytes in output sequence
  58484. boost::asio::streambuf::mutable_buffers_type bufs = b.prepare(512);
  58485. size_t n = sock.receive(bufs);
  58486. // received data is "committed" from output sequence to input sequence
  58487. b.commit(n);
  58488. std::istream is(&b);
  58489. std::string s;
  58490. is >> s;
  58491. [heading Requirements]
  58492. ['Header: ][^boost/asio/streambuf.hpp]
  58493. ['Convenience header: ][^boost/asio.hpp]
  58494. [endsect]
  58495. [section:system_context system_context]
  58496. The executor context for the system executor.
  58497. class system_context :
  58498. public execution_context
  58499. [heading Types]
  58500. [table
  58501. [[Name][Description]]
  58502. [
  58503. [[link boost_asio.reference.system_context.executor_type [*executor_type]]]
  58504. [The executor type associated with the context. ]
  58505. ]
  58506. [
  58507. [[link boost_asio.reference.system_context.fork_event [*fork_event]]]
  58508. [Fork-related event notifications. ]
  58509. ]
  58510. ]
  58511. [heading Member Functions]
  58512. [table
  58513. [[Name][Description]]
  58514. [
  58515. [[link boost_asio.reference.system_context.get_executor [*get_executor]]]
  58516. [Obtain an executor for the context. ]
  58517. ]
  58518. [
  58519. [[link boost_asio.reference.system_context.join [*join]]]
  58520. [Join all threads in the system thread pool. ]
  58521. ]
  58522. [
  58523. [[link boost_asio.reference.system_context.notify_fork [*notify_fork]]]
  58524. [Notify the execution_context of a fork-related event. ]
  58525. ]
  58526. [
  58527. [[link boost_asio.reference.system_context.stop [*stop]]]
  58528. [Signal all threads in the system thread pool to stop. ]
  58529. ]
  58530. [
  58531. [[link boost_asio.reference.system_context.stopped [*stopped]]]
  58532. [Determine whether the system thread pool has been stopped. ]
  58533. ]
  58534. [
  58535. [[link boost_asio.reference.system_context._system_context [*~system_context]]]
  58536. [Destructor shuts down all threads in the system thread pool. ]
  58537. ]
  58538. ]
  58539. [heading Protected Member Functions]
  58540. [table
  58541. [[Name][Description]]
  58542. [
  58543. [[link boost_asio.reference.system_context.destroy [*destroy]]]
  58544. [Destroys all services in the context. ]
  58545. ]
  58546. [
  58547. [[link boost_asio.reference.system_context.shutdown [*shutdown]]]
  58548. [Shuts down all services in the context. ]
  58549. ]
  58550. ]
  58551. [heading Friends]
  58552. [table
  58553. [[Name][Description]]
  58554. [
  58555. [[link boost_asio.reference.system_context.add_service [*add_service]]]
  58556. [(Deprecated: Use make_service().) Add a service object to the execution_context. ]
  58557. ]
  58558. [
  58559. [[link boost_asio.reference.system_context.has_service [*has_service]]]
  58560. [Determine if an execution_context contains a specified service type. ]
  58561. ]
  58562. [
  58563. [[link boost_asio.reference.system_context.make_service [*make_service]]]
  58564. [Creates a service object and adds it to the execution_context. ]
  58565. ]
  58566. [
  58567. [[link boost_asio.reference.system_context.use_service [*use_service]]]
  58568. [Obtain the service object corresponding to the given type. ]
  58569. ]
  58570. ]
  58571. [heading Requirements]
  58572. ['Header: ][^boost/asio/system_context.hpp]
  58573. ['Convenience header: ][^boost/asio.hpp]
  58574. [section:add_service system_context::add_service]
  58575. ['Inherited from execution_context.]
  58576. [indexterm2 boost_asio.indexterm.system_context.add_service..add_service..system_context]
  58577. (Deprecated: Use `make_service()`.) Add a service object to the [link boost_asio.reference.execution_context `execution_context`].
  58578. template<
  58579. typename ``[link boost_asio.reference.Service Service]``>
  58580. friend void add_service(
  58581. execution_context & e,
  58582. Service * svc);
  58583. This function is used to add a service to the [link boost_asio.reference.execution_context `execution_context`].
  58584. [heading Parameters]
  58585. [variablelist
  58586. [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
  58587. [[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:
  58588. ``
  58589. delete static_cast<execution_context::service*>(svc)
  58590. ``
  58591. ]]
  58592. ]
  58593. [heading Exceptions]
  58594. [variablelist
  58595. [[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`].]]
  58596. [[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. ]]
  58597. ]
  58598. [heading Requirements]
  58599. ['Header: ][^boost/asio/system_context.hpp]
  58600. ['Convenience header: ][^boost/asio.hpp]
  58601. [endsect]
  58602. [section:destroy system_context::destroy]
  58603. ['Inherited from execution_context.]
  58604. [indexterm2 boost_asio.indexterm.system_context.destroy..destroy..system_context]
  58605. Destroys all services in the context.
  58606. void destroy();
  58607. This function is implemented as follows:
  58608. * 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)`.
  58609. [endsect]
  58610. [section:executor_type system_context::executor_type]
  58611. [indexterm2 boost_asio.indexterm.system_context.executor_type..executor_type..system_context]
  58612. The executor type associated with the context.
  58613. typedef system_executor executor_type;
  58614. [heading Member Functions]
  58615. [table
  58616. [[Name][Description]]
  58617. [
  58618. [[link boost_asio.reference.system_executor.context [*context]]]
  58619. [Obtain the underlying execution context. ]
  58620. ]
  58621. [
  58622. [[link boost_asio.reference.system_executor.defer [*defer]]]
  58623. [Request the system executor to invoke the given function object. ]
  58624. ]
  58625. [
  58626. [[link boost_asio.reference.system_executor.dispatch [*dispatch]]]
  58627. [Request the system executor to invoke the given function object. ]
  58628. ]
  58629. [
  58630. [[link boost_asio.reference.system_executor.on_work_finished [*on_work_finished]]]
  58631. [Inform the executor that some work is no longer outstanding. ]
  58632. ]
  58633. [
  58634. [[link boost_asio.reference.system_executor.on_work_started [*on_work_started]]]
  58635. [Inform the executor that it has some outstanding work to do. ]
  58636. ]
  58637. [
  58638. [[link boost_asio.reference.system_executor.post [*post]]]
  58639. [Request the system executor to invoke the given function object. ]
  58640. ]
  58641. ]
  58642. [heading Friends]
  58643. [table
  58644. [[Name][Description]]
  58645. [
  58646. [[link boost_asio.reference.system_executor.operator_not__eq_ [*operator!=]]]
  58647. [Compare two executors for inequality. ]
  58648. ]
  58649. [
  58650. [[link boost_asio.reference.system_executor.operator_eq__eq_ [*operator==]]]
  58651. [Compare two executors for equality. ]
  58652. ]
  58653. ]
  58654. The system executor represents an execution context where functions are permitted to run on arbitrary threads. The `post()` and `defer()` functions schedule the function to run on an unspecified system thread pool, and `dispatch()` invokes the function immediately.
  58655. [heading Requirements]
  58656. ['Header: ][^boost/asio/system_context.hpp]
  58657. ['Convenience header: ][^boost/asio.hpp]
  58658. [endsect]
  58659. [section:fork_event system_context::fork_event]
  58660. ['Inherited from execution_context.]
  58661. [indexterm2 boost_asio.indexterm.system_context.fork_event..fork_event..system_context]
  58662. Fork-related event notifications.
  58663. enum fork_event
  58664. [indexterm2 boost_asio.indexterm.system_context.fork_event.fork_prepare..fork_prepare..system_context]
  58665. [indexterm2 boost_asio.indexterm.system_context.fork_event.fork_parent..fork_parent..system_context]
  58666. [indexterm2 boost_asio.indexterm.system_context.fork_event.fork_child..fork_child..system_context]
  58667. [heading Values]
  58668. [variablelist
  58669. [
  58670. [fork_prepare]
  58671. [Notify the context that the process is about to fork. ]
  58672. ]
  58673. [
  58674. [fork_parent]
  58675. [Notify the context that the process has forked and is the parent. ]
  58676. ]
  58677. [
  58678. [fork_child]
  58679. [Notify the context that the process has forked and is the child. ]
  58680. ]
  58681. ]
  58682. [endsect]
  58683. [section:get_executor system_context::get_executor]
  58684. [indexterm2 boost_asio.indexterm.system_context.get_executor..get_executor..system_context]
  58685. Obtain an executor for the context.
  58686. executor_type get_executor();
  58687. [endsect]
  58688. [section:has_service system_context::has_service]
  58689. ['Inherited from execution_context.]
  58690. [indexterm2 boost_asio.indexterm.system_context.has_service..has_service..system_context]
  58691. Determine if an [link boost_asio.reference.execution_context `execution_context`] contains a specified service type.
  58692. template<
  58693. typename ``[link boost_asio.reference.Service Service]``>
  58694. friend bool has_service(
  58695. execution_context & e);
  58696. This function is used to determine whether the [link boost_asio.reference.execution_context `execution_context`] contains a service object corresponding to the given service type.
  58697. [heading Parameters]
  58698. [variablelist
  58699. [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
  58700. ]
  58701. [heading Return Value]
  58702. A boolean indicating whether the [link boost_asio.reference.execution_context `execution_context`] contains the service.
  58703. [heading Requirements]
  58704. ['Header: ][^boost/asio/system_context.hpp]
  58705. ['Convenience header: ][^boost/asio.hpp]
  58706. [endsect]
  58707. [section:join system_context::join]
  58708. [indexterm2 boost_asio.indexterm.system_context.join..join..system_context]
  58709. Join all threads in the system thread pool.
  58710. void join();
  58711. [endsect]
  58712. [section:make_service system_context::make_service]
  58713. ['Inherited from execution_context.]
  58714. [indexterm2 boost_asio.indexterm.system_context.make_service..make_service..system_context]
  58715. Creates a service object and adds it to the [link boost_asio.reference.execution_context `execution_context`].
  58716. template<
  58717. typename ``[link boost_asio.reference.Service Service]``,
  58718. typename... Args>
  58719. friend Service & make_service(
  58720. execution_context & e,
  58721. Args &&... args);
  58722. This function is used to add a service to the [link boost_asio.reference.execution_context `execution_context`].
  58723. [heading Parameters]
  58724. [variablelist
  58725. [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
  58726. [[args][Zero or more arguments to be passed to the service constructor.]]
  58727. ]
  58728. [heading Exceptions]
  58729. [variablelist
  58730. [[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`]. ]]
  58731. ]
  58732. [heading Requirements]
  58733. ['Header: ][^boost/asio/system_context.hpp]
  58734. ['Convenience header: ][^boost/asio.hpp]
  58735. [endsect]
  58736. [section:notify_fork system_context::notify_fork]
  58737. ['Inherited from execution_context.]
  58738. [indexterm2 boost_asio.indexterm.system_context.notify_fork..notify_fork..system_context]
  58739. Notify the [link boost_asio.reference.execution_context `execution_context`] of a fork-related event.
  58740. void notify_fork(
  58741. fork_event event);
  58742. This function is used to inform the [link boost_asio.reference.execution_context `execution_context`] that the process is about to fork, or has just forked. This allows the [link boost_asio.reference.execution_context `execution_context`], and the services it contains, to perform any necessary housekeeping to ensure correct operation following a fork.
  58743. This function must not be called while any other [link boost_asio.reference.execution_context `execution_context`] function, or any function associated with the execution\_context's derived class, is being called in another thread. It is, however, safe to call this function from within a completion handler, provided no other thread is accessing the [link boost_asio.reference.execution_context `execution_context`] or its derived class.
  58744. [heading Parameters]
  58745. [variablelist
  58746. [[event][A fork-related event.]]
  58747. ]
  58748. [heading Exceptions]
  58749. [variablelist
  58750. [[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.]]
  58751. ]
  58752. [heading Example]
  58753. The following code illustrates how to incorporate the `notify_fork()` function:
  58754. my_execution_context.notify_fork(execution_context::fork_prepare);
  58755. if (fork() == 0)
  58756. {
  58757. // This is the child process.
  58758. my_execution_context.notify_fork(execution_context::fork_child);
  58759. }
  58760. else
  58761. {
  58762. // This is the parent process.
  58763. my_execution_context.notify_fork(execution_context::fork_parent);
  58764. }
  58765. [heading Remarks]
  58766. For each service object `svc` in the [link boost_asio.reference.execution_context `execution_context`] set, performs `svc->notify_fork();`. When processing the fork\_prepare event, services are visited in reverse order of the beginning of service object lifetime. Otherwise, services are visited in order of the beginning of service object lifetime.
  58767. [endsect]
  58768. [section:shutdown system_context::shutdown]
  58769. ['Inherited from execution_context.]
  58770. [indexterm2 boost_asio.indexterm.system_context.shutdown..shutdown..system_context]
  58771. Shuts down all services in the context.
  58772. void shutdown();
  58773. This function is implemented as follows:
  58774. * 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()`.
  58775. [endsect]
  58776. [section:stop system_context::stop]
  58777. [indexterm2 boost_asio.indexterm.system_context.stop..stop..system_context]
  58778. Signal all threads in the system thread pool to stop.
  58779. void stop();
  58780. [endsect]
  58781. [section:stopped system_context::stopped]
  58782. [indexterm2 boost_asio.indexterm.system_context.stopped..stopped..system_context]
  58783. Determine whether the system thread pool has been stopped.
  58784. bool stopped() const;
  58785. [endsect]
  58786. [section:use_service system_context::use_service]
  58787. [indexterm2 boost_asio.indexterm.system_context.use_service..use_service..system_context]
  58788. Obtain the service object corresponding to the given type.
  58789. template<
  58790. typename ``[link boost_asio.reference.Service Service]``>
  58791. friend Service & ``[link boost_asio.reference.system_context.use_service.overload1 use_service]``(
  58792. execution_context & e);
  58793. `` [''''&raquo;''' [link boost_asio.reference.system_context.use_service.overload1 more...]]``
  58794. template<
  58795. typename ``[link boost_asio.reference.Service Service]``>
  58796. friend Service & ``[link boost_asio.reference.system_context.use_service.overload2 use_service]``(
  58797. io_context & ioc);
  58798. `` [''''&raquo;''' [link boost_asio.reference.system_context.use_service.overload2 more...]]``
  58799. [section:overload1 system_context::use_service (1 of 2 overloads)]
  58800. ['Inherited from execution_context.]
  58801. Obtain the service object corresponding to the given type.
  58802. template<
  58803. typename ``[link boost_asio.reference.Service Service]``>
  58804. friend Service & use_service(
  58805. execution_context & e);
  58806. This function is used to locate a service object that corresponds to the given service type. If there is no existing implementation of the service, then the [link boost_asio.reference.execution_context `execution_context`] will create a new instance of the service.
  58807. [heading Parameters]
  58808. [variablelist
  58809. [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
  58810. ]
  58811. [heading Return Value]
  58812. The service interface implementing the specified service type. Ownership of the service interface is not transferred to the caller.
  58813. [heading Requirements]
  58814. ['Header: ][^boost/asio/system_context.hpp]
  58815. ['Convenience header: ][^boost/asio.hpp]
  58816. [endsect]
  58817. [section:overload2 system_context::use_service (2 of 2 overloads)]
  58818. ['Inherited from execution_context.]
  58819. Obtain the service object corresponding to the given type.
  58820. template<
  58821. typename ``[link boost_asio.reference.Service Service]``>
  58822. friend Service & use_service(
  58823. io_context & ioc);
  58824. This function is used to locate a service object that corresponds to the given service type. If there is no existing implementation of the service, then the [link boost_asio.reference.io_context `io_context`] will create a new instance of the service.
  58825. [heading Parameters]
  58826. [variablelist
  58827. [[ioc][The [link boost_asio.reference.io_context `io_context`] object that owns the service.]]
  58828. ]
  58829. [heading Return Value]
  58830. The service interface implementing the specified service type. Ownership of the service interface is not transferred to the caller.
  58831. [heading Remarks]
  58832. This overload is preserved for backwards compatibility with services that inherit from [link boost_asio.reference.io_context__service `io_context::service`].
  58833. [heading Requirements]
  58834. ['Header: ][^boost/asio/system_context.hpp]
  58835. ['Convenience header: ][^boost/asio.hpp]
  58836. [endsect]
  58837. [endsect]
  58838. [section:_system_context system_context::~system_context]
  58839. [indexterm2 boost_asio.indexterm.system_context._system_context..~system_context..system_context]
  58840. Destructor shuts down all threads in the system thread pool.
  58841. ~system_context();
  58842. [endsect]
  58843. [endsect]
  58844. [section:system_executor system_executor]
  58845. An executor that uses arbitrary threads.
  58846. class system_executor
  58847. [heading Member Functions]
  58848. [table
  58849. [[Name][Description]]
  58850. [
  58851. [[link boost_asio.reference.system_executor.context [*context]]]
  58852. [Obtain the underlying execution context. ]
  58853. ]
  58854. [
  58855. [[link boost_asio.reference.system_executor.defer [*defer]]]
  58856. [Request the system executor to invoke the given function object. ]
  58857. ]
  58858. [
  58859. [[link boost_asio.reference.system_executor.dispatch [*dispatch]]]
  58860. [Request the system executor to invoke the given function object. ]
  58861. ]
  58862. [
  58863. [[link boost_asio.reference.system_executor.on_work_finished [*on_work_finished]]]
  58864. [Inform the executor that some work is no longer outstanding. ]
  58865. ]
  58866. [
  58867. [[link boost_asio.reference.system_executor.on_work_started [*on_work_started]]]
  58868. [Inform the executor that it has some outstanding work to do. ]
  58869. ]
  58870. [
  58871. [[link boost_asio.reference.system_executor.post [*post]]]
  58872. [Request the system executor to invoke the given function object. ]
  58873. ]
  58874. ]
  58875. [heading Friends]
  58876. [table
  58877. [[Name][Description]]
  58878. [
  58879. [[link boost_asio.reference.system_executor.operator_not__eq_ [*operator!=]]]
  58880. [Compare two executors for inequality. ]
  58881. ]
  58882. [
  58883. [[link boost_asio.reference.system_executor.operator_eq__eq_ [*operator==]]]
  58884. [Compare two executors for equality. ]
  58885. ]
  58886. ]
  58887. The system executor represents an execution context where functions are permitted to run on arbitrary threads. The `post()` and `defer()` functions schedule the function to run on an unspecified system thread pool, and `dispatch()` invokes the function immediately.
  58888. [heading Requirements]
  58889. ['Header: ][^boost/asio/system_executor.hpp]
  58890. ['Convenience header: ][^boost/asio.hpp]
  58891. [section:context system_executor::context]
  58892. [indexterm2 boost_asio.indexterm.system_executor.context..context..system_executor]
  58893. Obtain the underlying execution context.
  58894. system_context & context() const;
  58895. [endsect]
  58896. [section:defer system_executor::defer]
  58897. [indexterm2 boost_asio.indexterm.system_executor.defer..defer..system_executor]
  58898. Request the system executor to invoke the given function object.
  58899. template<
  58900. typename Function,
  58901. typename Allocator>
  58902. void defer(
  58903. Function && f,
  58904. const Allocator & a) const;
  58905. This function is used to ask the executor to execute the given function object. The function object will never be executed inside this function. Instead, it will be scheduled to run on an unspecified system thread pool.
  58906. [heading Parameters]
  58907. [variablelist
  58908. [[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:
  58909. ``
  58910. void function();
  58911. ``
  58912. ]]
  58913. [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
  58914. ]
  58915. [endsect]
  58916. [section:dispatch system_executor::dispatch]
  58917. [indexterm2 boost_asio.indexterm.system_executor.dispatch..dispatch..system_executor]
  58918. Request the system executor to invoke the given function object.
  58919. template<
  58920. typename Function,
  58921. typename Allocator>
  58922. void dispatch(
  58923. Function && f,
  58924. const Allocator & a) const;
  58925. This function is used to ask the executor to execute the given function object. The function object will always be executed inside this function.
  58926. [heading Parameters]
  58927. [variablelist
  58928. [[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:
  58929. ``
  58930. void function();
  58931. ``
  58932. ]]
  58933. [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
  58934. ]
  58935. [endsect]
  58936. [section:on_work_finished system_executor::on_work_finished]
  58937. [indexterm2 boost_asio.indexterm.system_executor.on_work_finished..on_work_finished..system_executor]
  58938. Inform the executor that some work is no longer outstanding.
  58939. void on_work_finished() const;
  58940. For the system executor, this is a no-op.
  58941. [endsect]
  58942. [section:on_work_started system_executor::on_work_started]
  58943. [indexterm2 boost_asio.indexterm.system_executor.on_work_started..on_work_started..system_executor]
  58944. Inform the executor that it has some outstanding work to do.
  58945. void on_work_started() const;
  58946. For the system executor, this is a no-op.
  58947. [endsect]
  58948. [section:operator_not__eq_ system_executor::operator!=]
  58949. [indexterm2 boost_asio.indexterm.system_executor.operator_not__eq_..operator!=..system_executor]
  58950. Compare two executors for inequality.
  58951. friend bool operator!=(
  58952. const system_executor & ,
  58953. const system_executor & );
  58954. System executors always compare equal.
  58955. [heading Requirements]
  58956. ['Header: ][^boost/asio/system_executor.hpp]
  58957. ['Convenience header: ][^boost/asio.hpp]
  58958. [endsect]
  58959. [section:operator_eq__eq_ system_executor::operator==]
  58960. [indexterm2 boost_asio.indexterm.system_executor.operator_eq__eq_..operator==..system_executor]
  58961. Compare two executors for equality.
  58962. friend bool operator==(
  58963. const system_executor & ,
  58964. const system_executor & );
  58965. System executors always compare equal.
  58966. [heading Requirements]
  58967. ['Header: ][^boost/asio/system_executor.hpp]
  58968. ['Convenience header: ][^boost/asio.hpp]
  58969. [endsect]
  58970. [section:post system_executor::post]
  58971. [indexterm2 boost_asio.indexterm.system_executor.post..post..system_executor]
  58972. Request the system executor to invoke the given function object.
  58973. template<
  58974. typename Function,
  58975. typename Allocator>
  58976. void post(
  58977. Function && f,
  58978. const Allocator & a) const;
  58979. This function is used to ask the executor to execute the given function object. The function object will never be executed inside this function. Instead, it will be scheduled to run on an unspecified system thread pool.
  58980. [heading Parameters]
  58981. [variablelist
  58982. [[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:
  58983. ``
  58984. void function();
  58985. ``
  58986. ]]
  58987. [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
  58988. ]
  58989. [endsect]
  58990. [endsect]
  58991. [section:system_timer system_timer]
  58992. [indexterm1 boost_asio.indexterm.system_timer..system_timer]
  58993. Typedef for a timer based on the system clock.
  58994. typedef basic_waitable_timer< chrono::system_clock > system_timer;
  58995. [heading Types]
  58996. [table
  58997. [[Name][Description]]
  58998. [
  58999. [[link boost_asio.reference.basic_waitable_timer__rebind_executor [*rebind_executor]]]
  59000. [Rebinds the timer type to another executor. ]
  59001. ]
  59002. [
  59003. [[link boost_asio.reference.basic_waitable_timer.clock_type [*clock_type]]]
  59004. [The clock type. ]
  59005. ]
  59006. [
  59007. [[link boost_asio.reference.basic_waitable_timer.duration [*duration]]]
  59008. [The duration type of the clock. ]
  59009. ]
  59010. [
  59011. [[link boost_asio.reference.basic_waitable_timer.executor_type [*executor_type]]]
  59012. [The type of the executor associated with the object. ]
  59013. ]
  59014. [
  59015. [[link boost_asio.reference.basic_waitable_timer.time_point [*time_point]]]
  59016. [The time point type of the clock. ]
  59017. ]
  59018. [
  59019. [[link boost_asio.reference.basic_waitable_timer.traits_type [*traits_type]]]
  59020. [The wait traits type. ]
  59021. ]
  59022. ]
  59023. [heading Member Functions]
  59024. [table
  59025. [[Name][Description]]
  59026. [
  59027. [[link boost_asio.reference.basic_waitable_timer.async_wait [*async_wait]]]
  59028. [Start an asynchronous wait on the timer. ]
  59029. ]
  59030. [
  59031. [[link boost_asio.reference.basic_waitable_timer.basic_waitable_timer [*basic_waitable_timer]]]
  59032. [Constructor.
  59033. [hr]
  59034. Constructor to set a particular expiry time as an absolute time.
  59035. [hr]
  59036. Constructor to set a particular expiry time relative to now.
  59037. [hr]
  59038. Move-construct a basic_waitable_timer from another. ]
  59039. ]
  59040. [
  59041. [[link boost_asio.reference.basic_waitable_timer.cancel [*cancel]]]
  59042. [Cancel any asynchronous operations that are waiting on the timer.
  59043. [hr]
  59044. (Deprecated: Use non-error_code overload.) Cancel any asynchronous operations that are waiting on the timer. ]
  59045. ]
  59046. [
  59047. [[link boost_asio.reference.basic_waitable_timer.cancel_one [*cancel_one]]]
  59048. [Cancels one asynchronous operation that is waiting on the timer.
  59049. [hr]
  59050. (Deprecated: Use non-error_code overload.) Cancels one asynchronous operation that is waiting on the timer. ]
  59051. ]
  59052. [
  59053. [[link boost_asio.reference.basic_waitable_timer.expires_after [*expires_after]]]
  59054. [Set the timer's expiry time relative to now. ]
  59055. ]
  59056. [
  59057. [[link boost_asio.reference.basic_waitable_timer.expires_at [*expires_at]]]
  59058. [(Deprecated: Use expiry().) Get the timer's expiry time as an absolute time.
  59059. [hr]
  59060. Set the timer's expiry time as an absolute time.
  59061. [hr]
  59062. (Deprecated: Use non-error_code overload.) Set the timer's expiry time as an absolute time. ]
  59063. ]
  59064. [
  59065. [[link boost_asio.reference.basic_waitable_timer.expires_from_now [*expires_from_now]]]
  59066. [(Deprecated: Use expiry().) Get the timer's expiry time relative to now.
  59067. [hr]
  59068. (Deprecated: Use expires_after().) Set the timer's expiry time relative to now. ]
  59069. ]
  59070. [
  59071. [[link boost_asio.reference.basic_waitable_timer.expiry [*expiry]]]
  59072. [Get the timer's expiry time as an absolute time. ]
  59073. ]
  59074. [
  59075. [[link boost_asio.reference.basic_waitable_timer.get_executor [*get_executor]]]
  59076. [Get the executor associated with the object. ]
  59077. ]
  59078. [
  59079. [[link boost_asio.reference.basic_waitable_timer.operator_eq_ [*operator=]]]
  59080. [Move-assign a basic_waitable_timer from another. ]
  59081. ]
  59082. [
  59083. [[link boost_asio.reference.basic_waitable_timer.wait [*wait]]]
  59084. [Perform a blocking wait on the timer. ]
  59085. ]
  59086. [
  59087. [[link boost_asio.reference.basic_waitable_timer._basic_waitable_timer [*~basic_waitable_timer]]]
  59088. [Destroys the timer. ]
  59089. ]
  59090. ]
  59091. The [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] class template provides the ability to perform a blocking or asynchronous wait for a timer to expire.
  59092. A waitable timer is always in one of two states: "expired" or "not expired". If the `wait()` or `async_wait()` function is called on an expired timer, the wait operation will complete immediately.
  59093. Most applications will use one of the [link boost_asio.reference.steady_timer `steady_timer`], [link boost_asio.reference.system_timer `system_timer`] or [link boost_asio.reference.high_resolution_timer `high_resolution_timer`] typedefs.
  59094. [heading Remarks]
  59095. This waitable timer functionality is for use with the C++11 standard library's `<chrono>` facility, or with the Boost.Chrono library.
  59096. [heading Thread Safety]
  59097. ['Distinct] ['objects:] Safe.
  59098. ['Shared] ['objects:] Unsafe.
  59099. [heading Examples]
  59100. Performing a blocking wait (C++11):
  59101. // Construct a timer without setting an expiry time.
  59102. boost::asio::steady_timer timer(my_context);
  59103. // Set an expiry time relative to now.
  59104. timer.expires_after(std::chrono::seconds(5));
  59105. // Wait for the timer to expire.
  59106. timer.wait();
  59107. Performing an asynchronous wait (C++11):
  59108. void handler(const boost::system::error_code& error)
  59109. {
  59110. if (!error)
  59111. {
  59112. // Timer expired.
  59113. }
  59114. }
  59115. ...
  59116. // Construct a timer with an absolute expiry time.
  59117. boost::asio::steady_timer timer(my_context,
  59118. std::chrono::steady_clock::now() + std::chrono::seconds(60));
  59119. // Start an asynchronous wait.
  59120. timer.async_wait(handler);
  59121. [heading Changing an active waitable timer's expiry time]
  59122. Changing the expiry time of a timer while there are pending asynchronous waits causes those wait operations to be cancelled. To ensure that the action associated with the timer is performed only once, use something like this: used:
  59123. void on_some_event()
  59124. {
  59125. if (my_timer.expires_after(seconds(5)) > 0)
  59126. {
  59127. // We managed to cancel the timer. Start new asynchronous wait.
  59128. my_timer.async_wait(on_timeout);
  59129. }
  59130. else
  59131. {
  59132. // Too late, timer has already expired!
  59133. }
  59134. }
  59135. void on_timeout(const boost::system::error_code& e)
  59136. {
  59137. if (e != boost::asio::error::operation_aborted)
  59138. {
  59139. // Timer was not cancelled, take necessary action.
  59140. }
  59141. }
  59142. * 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.
  59143. * If a wait handler is cancelled, the boost::system::error\_code passed to it contains the value `boost::asio::error::operation_aborted`.
  59144. This typedef uses the C++11 `<chrono>` standard library facility, if available. Otherwise, it may use the Boost.Chrono library. To explicitly utilise Boost.Chrono, use the [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] template directly:
  59145. typedef basic_waitable_timer<boost::chrono::system_clock> timer;
  59146. [heading Requirements]
  59147. ['Header: ][^boost/asio/system_timer.hpp]
  59148. ['Convenience header: ][^boost/asio.hpp]
  59149. [endsect]
  59150. [section:this_coro__executor this_coro::executor]
  59151. [indexterm1 boost_asio.indexterm.this_coro__executor..this_coro::executor]
  59152. Awaitable object that returns the executor of the current coroutine.
  59153. constexpr executor_t executor;
  59154. [heading Requirements]
  59155. ['Header: ][^boost/asio/this_coro.hpp]
  59156. ['Convenience header: ][^boost/asio.hpp]
  59157. [endsect]
  59158. [section:this_coro__executor_t this_coro::executor_t]
  59159. Awaitable type that returns the executor of the current coroutine.
  59160. struct executor_t
  59161. [heading Member Functions]
  59162. [table
  59163. [[Name][Description]]
  59164. [
  59165. [[link boost_asio.reference.this_coro__executor_t.executor_t [*executor_t]]]
  59166. []
  59167. ]
  59168. ]
  59169. [heading Requirements]
  59170. ['Header: ][^boost/asio/this_coro.hpp]
  59171. ['Convenience header: ][^boost/asio.hpp]
  59172. [section:executor_t this_coro::executor_t::executor_t]
  59173. [indexterm2 boost_asio.indexterm.this_coro__executor_t.executor_t..executor_t..this_coro::executor_t]
  59174. constexpr executor_t();
  59175. [endsect]
  59176. [endsect]
  59177. [section:thread_pool thread_pool]
  59178. A simple fixed-size thread pool.
  59179. class thread_pool :
  59180. public execution_context
  59181. [heading Types]
  59182. [table
  59183. [[Name][Description]]
  59184. [
  59185. [[link boost_asio.reference.thread_pool__executor_type [*executor_type]]]
  59186. [Executor used to submit functions to a thread pool. ]
  59187. ]
  59188. [
  59189. [[link boost_asio.reference.thread_pool.fork_event [*fork_event]]]
  59190. [Fork-related event notifications. ]
  59191. ]
  59192. ]
  59193. [heading Member Functions]
  59194. [table
  59195. [[Name][Description]]
  59196. [
  59197. [[link boost_asio.reference.thread_pool.get_executor [*get_executor]]]
  59198. [Obtains the executor associated with the pool. ]
  59199. ]
  59200. [
  59201. [[link boost_asio.reference.thread_pool.join [*join]]]
  59202. [Joins the threads. ]
  59203. ]
  59204. [
  59205. [[link boost_asio.reference.thread_pool.notify_fork [*notify_fork]]]
  59206. [Notify the execution_context of a fork-related event. ]
  59207. ]
  59208. [
  59209. [[link boost_asio.reference.thread_pool.stop [*stop]]]
  59210. [Stops the threads. ]
  59211. ]
  59212. [
  59213. [[link boost_asio.reference.thread_pool.thread_pool [*thread_pool]]]
  59214. [Constructs a pool with an automatically determined number of threads.
  59215. [hr]
  59216. Constructs a pool with a specified number of threads. ]
  59217. ]
  59218. [
  59219. [[link boost_asio.reference.thread_pool._thread_pool [*~thread_pool]]]
  59220. [Destructor. ]
  59221. ]
  59222. ]
  59223. [heading Protected Member Functions]
  59224. [table
  59225. [[Name][Description]]
  59226. [
  59227. [[link boost_asio.reference.thread_pool.destroy [*destroy]]]
  59228. [Destroys all services in the context. ]
  59229. ]
  59230. [
  59231. [[link boost_asio.reference.thread_pool.shutdown [*shutdown]]]
  59232. [Shuts down all services in the context. ]
  59233. ]
  59234. ]
  59235. [heading Friends]
  59236. [table
  59237. [[Name][Description]]
  59238. [
  59239. [[link boost_asio.reference.thread_pool.add_service [*add_service]]]
  59240. [(Deprecated: Use make_service().) Add a service object to the execution_context. ]
  59241. ]
  59242. [
  59243. [[link boost_asio.reference.thread_pool.has_service [*has_service]]]
  59244. [Determine if an execution_context contains a specified service type. ]
  59245. ]
  59246. [
  59247. [[link boost_asio.reference.thread_pool.make_service [*make_service]]]
  59248. [Creates a service object and adds it to the execution_context. ]
  59249. ]
  59250. [
  59251. [[link boost_asio.reference.thread_pool.use_service [*use_service]]]
  59252. [Obtain the service object corresponding to the given type. ]
  59253. ]
  59254. ]
  59255. The thread pool class is an execution context where functions are permitted to run on one of a fixed number of threads.
  59256. [heading Submitting tasks to the pool]
  59257. To submit functions to the [link boost_asio.reference.thread_pool `thread_pool`], use the [link boost_asio.reference.dispatch `dispatch`] , [link boost_asio.reference.post `post`] or [link boost_asio.reference.defer `defer`] free functions.
  59258. For example:
  59259. void my_task()
  59260. {
  59261. ...
  59262. }
  59263. ...
  59264. // Launch the pool with four threads.
  59265. boost::asio::thread_pool pool(4);
  59266. // Submit a function to the pool.
  59267. boost::asio::post(pool, my_task);
  59268. // Submit a lambda object to the pool.
  59269. boost::asio::post(pool,
  59270. []()
  59271. {
  59272. ...
  59273. });
  59274. // Wait for all tasks in the pool to complete.
  59275. pool.join();
  59276. [heading Requirements]
  59277. ['Header: ][^boost/asio/thread_pool.hpp]
  59278. ['Convenience header: ][^boost/asio.hpp]
  59279. [section:add_service thread_pool::add_service]
  59280. ['Inherited from execution_context.]
  59281. [indexterm2 boost_asio.indexterm.thread_pool.add_service..add_service..thread_pool]
  59282. (Deprecated: Use `make_service()`.) Add a service object to the [link boost_asio.reference.execution_context `execution_context`].
  59283. template<
  59284. typename ``[link boost_asio.reference.Service Service]``>
  59285. friend void add_service(
  59286. execution_context & e,
  59287. Service * svc);
  59288. This function is used to add a service to the [link boost_asio.reference.execution_context `execution_context`].
  59289. [heading Parameters]
  59290. [variablelist
  59291. [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
  59292. [[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:
  59293. ``
  59294. delete static_cast<execution_context::service*>(svc)
  59295. ``
  59296. ]]
  59297. ]
  59298. [heading Exceptions]
  59299. [variablelist
  59300. [[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`].]]
  59301. [[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. ]]
  59302. ]
  59303. [heading Requirements]
  59304. ['Header: ][^boost/asio/thread_pool.hpp]
  59305. ['Convenience header: ][^boost/asio.hpp]
  59306. [endsect]
  59307. [section:destroy thread_pool::destroy]
  59308. ['Inherited from execution_context.]
  59309. [indexterm2 boost_asio.indexterm.thread_pool.destroy..destroy..thread_pool]
  59310. Destroys all services in the context.
  59311. void destroy();
  59312. This function is implemented as follows:
  59313. * 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)`.
  59314. [endsect]
  59315. [section:fork_event thread_pool::fork_event]
  59316. ['Inherited from execution_context.]
  59317. [indexterm2 boost_asio.indexterm.thread_pool.fork_event..fork_event..thread_pool]
  59318. Fork-related event notifications.
  59319. enum fork_event
  59320. [indexterm2 boost_asio.indexterm.thread_pool.fork_event.fork_prepare..fork_prepare..thread_pool]
  59321. [indexterm2 boost_asio.indexterm.thread_pool.fork_event.fork_parent..fork_parent..thread_pool]
  59322. [indexterm2 boost_asio.indexterm.thread_pool.fork_event.fork_child..fork_child..thread_pool]
  59323. [heading Values]
  59324. [variablelist
  59325. [
  59326. [fork_prepare]
  59327. [Notify the context that the process is about to fork. ]
  59328. ]
  59329. [
  59330. [fork_parent]
  59331. [Notify the context that the process has forked and is the parent. ]
  59332. ]
  59333. [
  59334. [fork_child]
  59335. [Notify the context that the process has forked and is the child. ]
  59336. ]
  59337. ]
  59338. [endsect]
  59339. [section:get_executor thread_pool::get_executor]
  59340. [indexterm2 boost_asio.indexterm.thread_pool.get_executor..get_executor..thread_pool]
  59341. Obtains the executor associated with the pool.
  59342. executor_type get_executor();
  59343. [endsect]
  59344. [section:has_service thread_pool::has_service]
  59345. ['Inherited from execution_context.]
  59346. [indexterm2 boost_asio.indexterm.thread_pool.has_service..has_service..thread_pool]
  59347. Determine if an [link boost_asio.reference.execution_context `execution_context`] contains a specified service type.
  59348. template<
  59349. typename ``[link boost_asio.reference.Service Service]``>
  59350. friend bool has_service(
  59351. execution_context & e);
  59352. This function is used to determine whether the [link boost_asio.reference.execution_context `execution_context`] contains a service object corresponding to the given service type.
  59353. [heading Parameters]
  59354. [variablelist
  59355. [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
  59356. ]
  59357. [heading Return Value]
  59358. A boolean indicating whether the [link boost_asio.reference.execution_context `execution_context`] contains the service.
  59359. [heading Requirements]
  59360. ['Header: ][^boost/asio/thread_pool.hpp]
  59361. ['Convenience header: ][^boost/asio.hpp]
  59362. [endsect]
  59363. [section:join thread_pool::join]
  59364. [indexterm2 boost_asio.indexterm.thread_pool.join..join..thread_pool]
  59365. Joins the threads.
  59366. void join();
  59367. This function blocks until the threads in the pool have completed. If `stop()` is not called prior to `join()`, the `join()` call will wait until the pool has no more outstanding work.
  59368. [endsect]
  59369. [section:make_service thread_pool::make_service]
  59370. ['Inherited from execution_context.]
  59371. [indexterm2 boost_asio.indexterm.thread_pool.make_service..make_service..thread_pool]
  59372. Creates a service object and adds it to the [link boost_asio.reference.execution_context `execution_context`].
  59373. template<
  59374. typename ``[link boost_asio.reference.Service Service]``,
  59375. typename... Args>
  59376. friend Service & make_service(
  59377. execution_context & e,
  59378. Args &&... args);
  59379. This function is used to add a service to the [link boost_asio.reference.execution_context `execution_context`].
  59380. [heading Parameters]
  59381. [variablelist
  59382. [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
  59383. [[args][Zero or more arguments to be passed to the service constructor.]]
  59384. ]
  59385. [heading Exceptions]
  59386. [variablelist
  59387. [[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`]. ]]
  59388. ]
  59389. [heading Requirements]
  59390. ['Header: ][^boost/asio/thread_pool.hpp]
  59391. ['Convenience header: ][^boost/asio.hpp]
  59392. [endsect]
  59393. [section:notify_fork thread_pool::notify_fork]
  59394. ['Inherited from execution_context.]
  59395. [indexterm2 boost_asio.indexterm.thread_pool.notify_fork..notify_fork..thread_pool]
  59396. Notify the [link boost_asio.reference.execution_context `execution_context`] of a fork-related event.
  59397. void notify_fork(
  59398. fork_event event);
  59399. This function is used to inform the [link boost_asio.reference.execution_context `execution_context`] that the process is about to fork, or has just forked. This allows the [link boost_asio.reference.execution_context `execution_context`], and the services it contains, to perform any necessary housekeeping to ensure correct operation following a fork.
  59400. This function must not be called while any other [link boost_asio.reference.execution_context `execution_context`] function, or any function associated with the execution\_context's derived class, is being called in another thread. It is, however, safe to call this function from within a completion handler, provided no other thread is accessing the [link boost_asio.reference.execution_context `execution_context`] or its derived class.
  59401. [heading Parameters]
  59402. [variablelist
  59403. [[event][A fork-related event.]]
  59404. ]
  59405. [heading Exceptions]
  59406. [variablelist
  59407. [[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.]]
  59408. ]
  59409. [heading Example]
  59410. The following code illustrates how to incorporate the `notify_fork()` function:
  59411. my_execution_context.notify_fork(execution_context::fork_prepare);
  59412. if (fork() == 0)
  59413. {
  59414. // This is the child process.
  59415. my_execution_context.notify_fork(execution_context::fork_child);
  59416. }
  59417. else
  59418. {
  59419. // This is the parent process.
  59420. my_execution_context.notify_fork(execution_context::fork_parent);
  59421. }
  59422. [heading Remarks]
  59423. For each service object `svc` in the [link boost_asio.reference.execution_context `execution_context`] set, performs `svc->notify_fork();`. When processing the fork\_prepare event, services are visited in reverse order of the beginning of service object lifetime. Otherwise, services are visited in order of the beginning of service object lifetime.
  59424. [endsect]
  59425. [section:shutdown thread_pool::shutdown]
  59426. ['Inherited from execution_context.]
  59427. [indexterm2 boost_asio.indexterm.thread_pool.shutdown..shutdown..thread_pool]
  59428. Shuts down all services in the context.
  59429. void shutdown();
  59430. This function is implemented as follows:
  59431. * 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()`.
  59432. [endsect]
  59433. [section:stop thread_pool::stop]
  59434. [indexterm2 boost_asio.indexterm.thread_pool.stop..stop..thread_pool]
  59435. Stops the threads.
  59436. void stop();
  59437. This function stops the threads as soon as possible. As a result of calling `stop()`, pending function objects may be never be invoked.
  59438. [endsect]
  59439. [section:thread_pool thread_pool::thread_pool]
  59440. [indexterm2 boost_asio.indexterm.thread_pool.thread_pool..thread_pool..thread_pool]
  59441. Constructs a pool with an automatically determined number of threads.
  59442. ``[link boost_asio.reference.thread_pool.thread_pool.overload1 thread_pool]``();
  59443. `` [''''&raquo;''' [link boost_asio.reference.thread_pool.thread_pool.overload1 more...]]``
  59444. Constructs a pool with a specified number of threads.
  59445. ``[link boost_asio.reference.thread_pool.thread_pool.overload2 thread_pool]``(
  59446. std::size_t num_threads);
  59447. `` [''''&raquo;''' [link boost_asio.reference.thread_pool.thread_pool.overload2 more...]]``
  59448. [section:overload1 thread_pool::thread_pool (1 of 2 overloads)]
  59449. Constructs a pool with an automatically determined number of threads.
  59450. thread_pool();
  59451. [endsect]
  59452. [section:overload2 thread_pool::thread_pool (2 of 2 overloads)]
  59453. Constructs a pool with a specified number of threads.
  59454. thread_pool(
  59455. std::size_t num_threads);
  59456. [endsect]
  59457. [endsect]
  59458. [section:use_service thread_pool::use_service]
  59459. [indexterm2 boost_asio.indexterm.thread_pool.use_service..use_service..thread_pool]
  59460. Obtain the service object corresponding to the given type.
  59461. template<
  59462. typename ``[link boost_asio.reference.Service Service]``>
  59463. friend Service & ``[link boost_asio.reference.thread_pool.use_service.overload1 use_service]``(
  59464. execution_context & e);
  59465. `` [''''&raquo;''' [link boost_asio.reference.thread_pool.use_service.overload1 more...]]``
  59466. template<
  59467. typename ``[link boost_asio.reference.Service Service]``>
  59468. friend Service & ``[link boost_asio.reference.thread_pool.use_service.overload2 use_service]``(
  59469. io_context & ioc);
  59470. `` [''''&raquo;''' [link boost_asio.reference.thread_pool.use_service.overload2 more...]]``
  59471. [section:overload1 thread_pool::use_service (1 of 2 overloads)]
  59472. ['Inherited from execution_context.]
  59473. Obtain the service object corresponding to the given type.
  59474. template<
  59475. typename ``[link boost_asio.reference.Service Service]``>
  59476. friend Service & use_service(
  59477. execution_context & e);
  59478. This function is used to locate a service object that corresponds to the given service type. If there is no existing implementation of the service, then the [link boost_asio.reference.execution_context `execution_context`] will create a new instance of the service.
  59479. [heading Parameters]
  59480. [variablelist
  59481. [[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]]
  59482. ]
  59483. [heading Return Value]
  59484. The service interface implementing the specified service type. Ownership of the service interface is not transferred to the caller.
  59485. [heading Requirements]
  59486. ['Header: ][^boost/asio/thread_pool.hpp]
  59487. ['Convenience header: ][^boost/asio.hpp]
  59488. [endsect]
  59489. [section:overload2 thread_pool::use_service (2 of 2 overloads)]
  59490. ['Inherited from execution_context.]
  59491. Obtain the service object corresponding to the given type.
  59492. template<
  59493. typename ``[link boost_asio.reference.Service Service]``>
  59494. friend Service & use_service(
  59495. io_context & ioc);
  59496. This function is used to locate a service object that corresponds to the given service type. If there is no existing implementation of the service, then the [link boost_asio.reference.io_context `io_context`] will create a new instance of the service.
  59497. [heading Parameters]
  59498. [variablelist
  59499. [[ioc][The [link boost_asio.reference.io_context `io_context`] object that owns the service.]]
  59500. ]
  59501. [heading Return Value]
  59502. The service interface implementing the specified service type. Ownership of the service interface is not transferred to the caller.
  59503. [heading Remarks]
  59504. This overload is preserved for backwards compatibility with services that inherit from [link boost_asio.reference.io_context__service `io_context::service`].
  59505. [heading Requirements]
  59506. ['Header: ][^boost/asio/thread_pool.hpp]
  59507. ['Convenience header: ][^boost/asio.hpp]
  59508. [endsect]
  59509. [endsect]
  59510. [section:_thread_pool thread_pool::~thread_pool]
  59511. [indexterm2 boost_asio.indexterm.thread_pool._thread_pool..~thread_pool..thread_pool]
  59512. Destructor.
  59513. ~thread_pool();
  59514. Automatically stops and joins the pool, if not explicitly done beforehand.
  59515. [endsect]
  59516. [endsect]
  59517. [section:thread_pool__executor_type thread_pool::executor_type]
  59518. Executor used to submit functions to a thread pool.
  59519. class executor_type
  59520. [heading Member Functions]
  59521. [table
  59522. [[Name][Description]]
  59523. [
  59524. [[link boost_asio.reference.thread_pool__executor_type.context [*context]]]
  59525. [Obtain the underlying execution context. ]
  59526. ]
  59527. [
  59528. [[link boost_asio.reference.thread_pool__executor_type.defer [*defer]]]
  59529. [Request the thread pool to invoke the given function object. ]
  59530. ]
  59531. [
  59532. [[link boost_asio.reference.thread_pool__executor_type.dispatch [*dispatch]]]
  59533. [Request the thread pool to invoke the given function object. ]
  59534. ]
  59535. [
  59536. [[link boost_asio.reference.thread_pool__executor_type.on_work_finished [*on_work_finished]]]
  59537. [Inform the thread pool that some work is no longer outstanding. ]
  59538. ]
  59539. [
  59540. [[link boost_asio.reference.thread_pool__executor_type.on_work_started [*on_work_started]]]
  59541. [Inform the thread pool that it has some outstanding work to do. ]
  59542. ]
  59543. [
  59544. [[link boost_asio.reference.thread_pool__executor_type.post [*post]]]
  59545. [Request the thread pool to invoke the given function object. ]
  59546. ]
  59547. [
  59548. [[link boost_asio.reference.thread_pool__executor_type.running_in_this_thread [*running_in_this_thread]]]
  59549. [Determine whether the thread pool is running in the current thread. ]
  59550. ]
  59551. ]
  59552. [heading Friends]
  59553. [table
  59554. [[Name][Description]]
  59555. [
  59556. [[link boost_asio.reference.thread_pool__executor_type.operator_not__eq_ [*operator!=]]]
  59557. [Compare two executors for inequality. ]
  59558. ]
  59559. [
  59560. [[link boost_asio.reference.thread_pool__executor_type.operator_eq__eq_ [*operator==]]]
  59561. [Compare two executors for equality. ]
  59562. ]
  59563. ]
  59564. [heading Requirements]
  59565. ['Header: ][^boost/asio/thread_pool.hpp]
  59566. ['Convenience header: ][^boost/asio.hpp]
  59567. [section:context thread_pool::executor_type::context]
  59568. [indexterm2 boost_asio.indexterm.thread_pool__executor_type.context..context..thread_pool::executor_type]
  59569. Obtain the underlying execution context.
  59570. thread_pool & context() const;
  59571. [endsect]
  59572. [section:defer thread_pool::executor_type::defer]
  59573. [indexterm2 boost_asio.indexterm.thread_pool__executor_type.defer..defer..thread_pool::executor_type]
  59574. Request the thread pool to invoke the given function object.
  59575. template<
  59576. typename Function,
  59577. typename Allocator>
  59578. void defer(
  59579. Function && f,
  59580. const Allocator & a) const;
  59581. This function is used to ask the thread pool to execute the given function object. The function object will never be executed inside `defer()`. Instead, it will be scheduled to run on the thread pool.
  59582. If the current thread belongs to the thread pool, `defer()` will delay scheduling the function object until the current thread returns control to the pool.
  59583. [heading Parameters]
  59584. [variablelist
  59585. [[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:
  59586. ``
  59587. void function();
  59588. ``
  59589. ]]
  59590. [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
  59591. ]
  59592. [endsect]
  59593. [section:dispatch thread_pool::executor_type::dispatch]
  59594. [indexterm2 boost_asio.indexterm.thread_pool__executor_type.dispatch..dispatch..thread_pool::executor_type]
  59595. Request the thread pool to invoke the given function object.
  59596. template<
  59597. typename Function,
  59598. typename Allocator>
  59599. void dispatch(
  59600. Function && f,
  59601. const Allocator & a) const;
  59602. This function is used to ask the thread pool to execute the given function object. If the current thread belongs to the pool, `dispatch()` executes the function before returning. Otherwise, the function will be scheduled to run on the thread pool.
  59603. [heading Parameters]
  59604. [variablelist
  59605. [[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:
  59606. ``
  59607. void function();
  59608. ``
  59609. ]]
  59610. [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
  59611. ]
  59612. [endsect]
  59613. [section:on_work_finished thread_pool::executor_type::on_work_finished]
  59614. [indexterm2 boost_asio.indexterm.thread_pool__executor_type.on_work_finished..on_work_finished..thread_pool::executor_type]
  59615. Inform the thread pool that some work is no longer outstanding.
  59616. void on_work_finished() const;
  59617. This function is used to inform the thread pool that some work has finished. Once the count of unfinished work reaches zero, the thread pool's `join()` function is permitted to exit.
  59618. [endsect]
  59619. [section:on_work_started thread_pool::executor_type::on_work_started]
  59620. [indexterm2 boost_asio.indexterm.thread_pool__executor_type.on_work_started..on_work_started..thread_pool::executor_type]
  59621. Inform the thread pool that it has some outstanding work to do.
  59622. void on_work_started() const;
  59623. This function is used to inform the thread pool that some work has begun. This ensures that the thread pool's `join()` function will not return while the work is underway.
  59624. [endsect]
  59625. [section:operator_not__eq_ thread_pool::executor_type::operator!=]
  59626. [indexterm2 boost_asio.indexterm.thread_pool__executor_type.operator_not__eq_..operator!=..thread_pool::executor_type]
  59627. Compare two executors for inequality.
  59628. friend bool operator!=(
  59629. const executor_type & a,
  59630. const executor_type & b);
  59631. Two executors are equal if they refer to the same underlying thread pool.
  59632. [heading Requirements]
  59633. ['Header: ][^boost/asio/thread_pool.hpp]
  59634. ['Convenience header: ][^boost/asio.hpp]
  59635. [endsect]
  59636. [section:operator_eq__eq_ thread_pool::executor_type::operator==]
  59637. [indexterm2 boost_asio.indexterm.thread_pool__executor_type.operator_eq__eq_..operator==..thread_pool::executor_type]
  59638. Compare two executors for equality.
  59639. friend bool operator==(
  59640. const executor_type & a,
  59641. const executor_type & b);
  59642. Two executors are equal if they refer to the same underlying thread pool.
  59643. [heading Requirements]
  59644. ['Header: ][^boost/asio/thread_pool.hpp]
  59645. ['Convenience header: ][^boost/asio.hpp]
  59646. [endsect]
  59647. [section:post thread_pool::executor_type::post]
  59648. [indexterm2 boost_asio.indexterm.thread_pool__executor_type.post..post..thread_pool::executor_type]
  59649. Request the thread pool to invoke the given function object.
  59650. template<
  59651. typename Function,
  59652. typename Allocator>
  59653. void post(
  59654. Function && f,
  59655. const Allocator & a) const;
  59656. This function is used to ask the thread pool to execute the given function object. The function object will never be executed inside `post()`. Instead, it will be scheduled to run on the thread pool.
  59657. [heading Parameters]
  59658. [variablelist
  59659. [[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:
  59660. ``
  59661. void function();
  59662. ``
  59663. ]]
  59664. [[a][An allocator that may be used by the executor to allocate the internal storage needed for function invocation. ]]
  59665. ]
  59666. [endsect]
  59667. [section:running_in_this_thread thread_pool::executor_type::running_in_this_thread]
  59668. [indexterm2 boost_asio.indexterm.thread_pool__executor_type.running_in_this_thread..running_in_this_thread..thread_pool::executor_type]
  59669. Determine whether the thread pool is running in the current thread.
  59670. bool running_in_this_thread() const;
  59671. [heading Return Value]
  59672. `true` if the current thread belongs to the pool. Otherwise returns `false`.
  59673. [endsect]
  59674. [endsect]
  59675. [section:time_traits_lt__ptime__gt_ time_traits< boost::posix_time::ptime >]
  59676. Time traits specialised for posix\_time.
  59677. template<>
  59678. struct time_traits< boost::posix_time::ptime >
  59679. [heading Types]
  59680. [table
  59681. [[Name][Description]]
  59682. [
  59683. [[link boost_asio.reference.time_traits_lt__ptime__gt_.duration_type [*duration_type]]]
  59684. [The duration type. ]
  59685. ]
  59686. [
  59687. [[link boost_asio.reference.time_traits_lt__ptime__gt_.time_type [*time_type]]]
  59688. [The time type. ]
  59689. ]
  59690. ]
  59691. [heading Member Functions]
  59692. [table
  59693. [[Name][Description]]
  59694. [
  59695. [[link boost_asio.reference.time_traits_lt__ptime__gt_.add [*add]]]
  59696. [Add a duration to a time. ]
  59697. ]
  59698. [
  59699. [[link boost_asio.reference.time_traits_lt__ptime__gt_.less_than [*less_than]]]
  59700. [Test whether one time is less than another. ]
  59701. ]
  59702. [
  59703. [[link boost_asio.reference.time_traits_lt__ptime__gt_.now [*now]]]
  59704. [Get the current time. ]
  59705. ]
  59706. [
  59707. [[link boost_asio.reference.time_traits_lt__ptime__gt_.subtract [*subtract]]]
  59708. [Subtract one time from another. ]
  59709. ]
  59710. [
  59711. [[link boost_asio.reference.time_traits_lt__ptime__gt_.to_posix_duration [*to_posix_duration]]]
  59712. [Convert to POSIX duration type. ]
  59713. ]
  59714. ]
  59715. [heading Requirements]
  59716. ['Header: ][^boost/asio/time_traits.hpp]
  59717. ['Convenience header: ][^boost/asio.hpp]
  59718. [section:add time_traits< boost::posix_time::ptime >::add]
  59719. [indexterm2 boost_asio.indexterm.time_traits_lt__ptime__gt_.add..add..time_traits< boost::posix_time::ptime >]
  59720. Add a duration to a time.
  59721. static time_type add(
  59722. const time_type & t,
  59723. const duration_type & d);
  59724. [endsect]
  59725. [section:duration_type time_traits< boost::posix_time::ptime >::duration_type]
  59726. [indexterm2 boost_asio.indexterm.time_traits_lt__ptime__gt_.duration_type..duration_type..time_traits< boost::posix_time::ptime >]
  59727. The duration type.
  59728. typedef boost::posix_time::time_duration duration_type;
  59729. [heading Requirements]
  59730. ['Header: ][^boost/asio/time_traits.hpp]
  59731. ['Convenience header: ][^boost/asio.hpp]
  59732. [endsect]
  59733. [section:less_than time_traits< boost::posix_time::ptime >::less_than]
  59734. [indexterm2 boost_asio.indexterm.time_traits_lt__ptime__gt_.less_than..less_than..time_traits< boost::posix_time::ptime >]
  59735. Test whether one time is less than another.
  59736. static bool less_than(
  59737. const time_type & t1,
  59738. const time_type & t2);
  59739. [endsect]
  59740. [section:now time_traits< boost::posix_time::ptime >::now]
  59741. [indexterm2 boost_asio.indexterm.time_traits_lt__ptime__gt_.now..now..time_traits< boost::posix_time::ptime >]
  59742. Get the current time.
  59743. static time_type now();
  59744. [endsect]
  59745. [section:subtract time_traits< boost::posix_time::ptime >::subtract]
  59746. [indexterm2 boost_asio.indexterm.time_traits_lt__ptime__gt_.subtract..subtract..time_traits< boost::posix_time::ptime >]
  59747. Subtract one time from another.
  59748. static duration_type subtract(
  59749. const time_type & t1,
  59750. const time_type & t2);
  59751. [endsect]
  59752. [section:time_type time_traits< boost::posix_time::ptime >::time_type]
  59753. [indexterm2 boost_asio.indexterm.time_traits_lt__ptime__gt_.time_type..time_type..time_traits< boost::posix_time::ptime >]
  59754. The time type.
  59755. typedef boost::posix_time::ptime time_type;
  59756. [heading Requirements]
  59757. ['Header: ][^boost/asio/time_traits.hpp]
  59758. ['Convenience header: ][^boost/asio.hpp]
  59759. [endsect]
  59760. [section:to_posix_duration time_traits< boost::posix_time::ptime >::to_posix_duration]
  59761. [indexterm2 boost_asio.indexterm.time_traits_lt__ptime__gt_.to_posix_duration..to_posix_duration..time_traits< boost::posix_time::ptime >]
  59762. Convert to POSIX duration type.
  59763. static boost::posix_time::time_duration to_posix_duration(
  59764. const duration_type & d);
  59765. [endsect]
  59766. [endsect]
  59767. [section:transfer_all transfer_all]
  59768. [indexterm1 boost_asio.indexterm.transfer_all..transfer_all]
  59769. Return a completion condition function object that indicates that a read or write operation should continue until all of the data has been transferred, or until an error occurs.
  59770. unspecified transfer_all();
  59771. This function is used to create an object, of unspecified type, that meets CompletionCondition requirements.
  59772. [heading Example]
  59773. Reading until a buffer is full:
  59774. boost::array<char, 128> buf;
  59775. boost::system::error_code ec;
  59776. std::size_t n = boost::asio::read(
  59777. sock, boost::asio::buffer(buf),
  59778. boost::asio::transfer_all(), ec);
  59779. if (ec)
  59780. {
  59781. // An error occurred.
  59782. }
  59783. else
  59784. {
  59785. // n == 128
  59786. }
  59787. [heading Requirements]
  59788. ['Header: ][^boost/asio/completion_condition.hpp]
  59789. ['Convenience header: ][^boost/asio.hpp]
  59790. [endsect]
  59791. [section:transfer_at_least transfer_at_least]
  59792. [indexterm1 boost_asio.indexterm.transfer_at_least..transfer_at_least]
  59793. Return a completion condition function object that indicates that a read or write operation should continue until a minimum number of bytes has been transferred, or until an error occurs.
  59794. unspecified transfer_at_least(
  59795. std::size_t minimum);
  59796. This function is used to create an object, of unspecified type, that meets CompletionCondition requirements.
  59797. [heading Example]
  59798. Reading until a buffer is full or contains at least 64 bytes:
  59799. boost::array<char, 128> buf;
  59800. boost::system::error_code ec;
  59801. std::size_t n = boost::asio::read(
  59802. sock, boost::asio::buffer(buf),
  59803. boost::asio::transfer_at_least(64), ec);
  59804. if (ec)
  59805. {
  59806. // An error occurred.
  59807. }
  59808. else
  59809. {
  59810. // n >= 64 && n <= 128
  59811. }
  59812. [heading Requirements]
  59813. ['Header: ][^boost/asio/completion_condition.hpp]
  59814. ['Convenience header: ][^boost/asio.hpp]
  59815. [endsect]
  59816. [section:transfer_exactly transfer_exactly]
  59817. [indexterm1 boost_asio.indexterm.transfer_exactly..transfer_exactly]
  59818. Return a completion condition function object that indicates that a read or write operation should continue until an exact number of bytes has been transferred, or until an error occurs.
  59819. unspecified transfer_exactly(
  59820. std::size_t size);
  59821. This function is used to create an object, of unspecified type, that meets CompletionCondition requirements.
  59822. [heading Example]
  59823. Reading until a buffer is full or contains exactly 64 bytes:
  59824. boost::array<char, 128> buf;
  59825. boost::system::error_code ec;
  59826. std::size_t n = boost::asio::read(
  59827. sock, boost::asio::buffer(buf),
  59828. boost::asio::transfer_exactly(64), ec);
  59829. if (ec)
  59830. {
  59831. // An error occurred.
  59832. }
  59833. else
  59834. {
  59835. // n == 64
  59836. }
  59837. [heading Requirements]
  59838. ['Header: ][^boost/asio/completion_condition.hpp]
  59839. ['Convenience header: ][^boost/asio.hpp]
  59840. [endsect]
  59841. [section:use_awaitable use_awaitable]
  59842. [indexterm1 boost_asio.indexterm.use_awaitable..use_awaitable]
  59843. A completion token object that represents the currently executing coroutine.
  59844. constexpr use_awaitable_t use_awaitable;
  59845. See the documentation for [link boost_asio.reference.use_awaitable_t `use_awaitable_t`] for a usage example.
  59846. [heading Requirements]
  59847. ['Header: ][^boost/asio/use_awaitable.hpp]
  59848. ['Convenience header: ][^boost/asio.hpp]
  59849. [endsect]
  59850. [section:use_awaitable_t use_awaitable_t]
  59851. A completion token that represents the currently executing coroutine.
  59852. template<
  59853. typename ``[link boost_asio.reference.Executor1 Executor]`` = executor>
  59854. struct use_awaitable_t
  59855. [heading Types]
  59856. [table
  59857. [[Name][Description]]
  59858. [
  59859. [[link boost_asio.reference.use_awaitable_t__executor_with_default [*executor_with_default]]]
  59860. [Adapts an executor to add the use_awaitable_t completion token as the default. ]
  59861. ]
  59862. ]
  59863. [heading Member Functions]
  59864. [table
  59865. [[Name][Description]]
  59866. [
  59867. [[link boost_asio.reference.use_awaitable_t.as_default_on [*as_default_on]]]
  59868. [Function helper to adapt an I/O object to use use_awaitable_t as its default completion token type. ]
  59869. ]
  59870. [
  59871. [[link boost_asio.reference.use_awaitable_t.use_awaitable_t [*use_awaitable_t]]]
  59872. [Default constructor. ]
  59873. ]
  59874. ]
  59875. The `use_awaitable_t` class, with its value `use_awaitable`, is used to represent the currently executing coroutine. This completion token may be passed as a handler to an asynchronous operation. For example:
  59876. awaitable<void> my_coroutine()
  59877. {
  59878. std::size_t n = co_await my_socket.async_read_some(buffer, use_awaitable);
  59879. ...
  59880. }
  59881. When used with co\_await, the initiating function (`async_read_some` in the above example) suspends the current coroutine. The coroutine is resumed when the asynchronous operation completes, and the result of the operation is returned.
  59882. [heading Requirements]
  59883. ['Header: ][^boost/asio/use_awaitable.hpp]
  59884. ['Convenience header: ][^boost/asio.hpp]
  59885. [section:as_default_on use_awaitable_t::as_default_on]
  59886. [indexterm2 boost_asio.indexterm.use_awaitable_t.as_default_on..as_default_on..use_awaitable_t]
  59887. Function helper to adapt an I/O object to use `use_awaitable_t` as its default completion token type.
  59888. template<
  59889. typename T>
  59890. static T::template rebind_executor< executor_with_default< typename T::executor_type > >::other as_default_on(
  59891. T && object);
  59892. [endsect]
  59893. [section:use_awaitable_t use_awaitable_t::use_awaitable_t]
  59894. [indexterm2 boost_asio.indexterm.use_awaitable_t.use_awaitable_t..use_awaitable_t..use_awaitable_t]
  59895. Default constructor.
  59896. constexpr use_awaitable_t();
  59897. [endsect]
  59898. [endsect]
  59899. [section:use_awaitable_t__executor_with_default use_awaitable_t::executor_with_default]
  59900. Adapts an executor to add the `use_awaitable_t` completion token as the default.
  59901. template<
  59902. typename ``[link boost_asio.reference.Executor1 InnerExecutor]``>
  59903. struct executor_with_default
  59904. [heading Types]
  59905. [table
  59906. [[Name][Description]]
  59907. [
  59908. [[link boost_asio.reference.use_awaitable_t__executor_with_default.default_completion_token_type [*default_completion_token_type]]]
  59909. [Specify use_awaitable_t as the default completion token type. ]
  59910. ]
  59911. ]
  59912. [heading Member Functions]
  59913. [table
  59914. [[Name][Description]]
  59915. [
  59916. [[link boost_asio.reference.use_awaitable_t__executor_with_default.executor_with_default [*executor_with_default]]]
  59917. [Construct the adapted executor from the inner executor type. ]
  59918. ]
  59919. ]
  59920. [heading Requirements]
  59921. ['Header: ][^boost/asio/use_awaitable.hpp]
  59922. ['Convenience header: ][^boost/asio.hpp]
  59923. [section:default_completion_token_type use_awaitable_t::executor_with_default::default_completion_token_type]
  59924. [indexterm2 boost_asio.indexterm.use_awaitable_t__executor_with_default.default_completion_token_type..default_completion_token_type..use_awaitable_t::executor_with_default]
  59925. Specify `use_awaitable_t` as the default completion token type.
  59926. typedef use_awaitable_t default_completion_token_type;
  59927. [heading Types]
  59928. [table
  59929. [[Name][Description]]
  59930. [
  59931. [[link boost_asio.reference.use_awaitable_t__executor_with_default [*executor_with_default]]]
  59932. [Adapts an executor to add the use_awaitable_t completion token as the default. ]
  59933. ]
  59934. ]
  59935. [heading Member Functions]
  59936. [table
  59937. [[Name][Description]]
  59938. [
  59939. [[link boost_asio.reference.use_awaitable_t.as_default_on [*as_default_on]]]
  59940. [Function helper to adapt an I/O object to use use_awaitable_t as its default completion token type. ]
  59941. ]
  59942. [
  59943. [[link boost_asio.reference.use_awaitable_t.use_awaitable_t [*use_awaitable_t]]]
  59944. [Default constructor. ]
  59945. ]
  59946. ]
  59947. The `use_awaitable_t` class, with its value `use_awaitable`, is used to represent the currently executing coroutine. This completion token may be passed as a handler to an asynchronous operation. For example:
  59948. awaitable<void> my_coroutine()
  59949. {
  59950. std::size_t n = co_await my_socket.async_read_some(buffer, use_awaitable);
  59951. ...
  59952. }
  59953. When used with co\_await, the initiating function (`async_read_some` in the above example) suspends the current coroutine. The coroutine is resumed when the asynchronous operation completes, and the result of the operation is returned.
  59954. [heading Requirements]
  59955. ['Header: ][^boost/asio/use_awaitable.hpp]
  59956. ['Convenience header: ][^boost/asio.hpp]
  59957. [endsect]
  59958. [section:executor_with_default use_awaitable_t::executor_with_default::executor_with_default]
  59959. [indexterm2 boost_asio.indexterm.use_awaitable_t__executor_with_default.executor_with_default..executor_with_default..use_awaitable_t::executor_with_default]
  59960. Construct the adapted executor from the inner executor type.
  59961. executor_with_default(
  59962. const InnerExecutor & ex);
  59963. [endsect]
  59964. [endsect]
  59965. [section:use_future use_future]
  59966. [indexterm1 boost_asio.indexterm.use_future..use_future]
  59967. A special value, similar to std::nothrow.
  59968. constexpr use_future_t use_future;
  59969. See the documentation for [link boost_asio.reference.use_future_t `use_future_t`] for a usage example.
  59970. [heading Requirements]
  59971. ['Header: ][^boost/asio/use_future.hpp]
  59972. ['Convenience header: ][^boost/asio.hpp]
  59973. [endsect]
  59974. [section:use_future_t use_future_t]
  59975. Class used to specify that an asynchronous operation should return a future.
  59976. template<
  59977. typename Allocator = std::allocator<void>>
  59978. class use_future_t
  59979. [heading Types]
  59980. [table
  59981. [[Name][Description]]
  59982. [
  59983. [[link boost_asio.reference.use_future_t.allocator_type [*allocator_type]]]
  59984. [The allocator type. The allocator is used when constructing the std::promise object for a given asynchronous operation. ]
  59985. ]
  59986. ]
  59987. [heading Member Functions]
  59988. [table
  59989. [[Name][Description]]
  59990. [
  59991. [[link boost_asio.reference.use_future_t.get_allocator [*get_allocator]]]
  59992. [Obtain allocator. ]
  59993. ]
  59994. [
  59995. [[link boost_asio.reference.use_future_t.operator_lp__rp_ [*operator()]]]
  59996. [Wrap a function object in a packaged task. ]
  59997. ]
  59998. [
  59999. [[link boost_asio.reference.use_future_t.operator_lb__rb_ [*operator\[\]]]]
  60000. [(Deprecated: Use rebind().) Specify an alternate allocator. ]
  60001. ]
  60002. [
  60003. [[link boost_asio.reference.use_future_t.rebind [*rebind]]]
  60004. [Specify an alternate allocator. ]
  60005. ]
  60006. [
  60007. [[link boost_asio.reference.use_future_t.use_future_t [*use_future_t]]]
  60008. [Construct using default-constructed allocator.
  60009. [hr]
  60010. Construct using specified allocator. ]
  60011. ]
  60012. ]
  60013. The [link boost_asio.reference.use_future_t `use_future_t`] class is used to indicate that an asynchronous operation should return a std::future object. A [link boost_asio.reference.use_future_t `use_future_t`] object may be passed as a handler to an asynchronous operation, typically using the special value `boost::asio::use_future`. For example:
  60014. std::future<std::size_t> my_future
  60015. = my_socket.async_read_some(my_buffer, boost::asio::use_future);
  60016. The initiating function (async\_read\_some in the above example) returns a future that will receive the result of the operation. If the operation completes with an error\_code indicating failure, it is converted into a system\_error and passed back to the caller via the future.
  60017. [heading Requirements]
  60018. ['Header: ][^boost/asio/use_future.hpp]
  60019. ['Convenience header: ][^boost/asio.hpp]
  60020. [section:allocator_type use_future_t::allocator_type]
  60021. [indexterm2 boost_asio.indexterm.use_future_t.allocator_type..allocator_type..use_future_t]
  60022. The allocator type. The allocator is used when constructing the `std::promise` object for a given asynchronous operation.
  60023. typedef Allocator allocator_type;
  60024. [heading Requirements]
  60025. ['Header: ][^boost/asio/use_future.hpp]
  60026. ['Convenience header: ][^boost/asio.hpp]
  60027. [endsect]
  60028. [section:get_allocator use_future_t::get_allocator]
  60029. [indexterm2 boost_asio.indexterm.use_future_t.get_allocator..get_allocator..use_future_t]
  60030. Obtain allocator.
  60031. allocator_type get_allocator() const;
  60032. [endsect]
  60033. [section:operator_lp__rp_ use_future_t::operator()]
  60034. [indexterm2 boost_asio.indexterm.use_future_t.operator_lp__rp_..operator()..use_future_t]
  60035. Wrap a function object in a packaged task.
  60036. template<
  60037. typename Function>
  60038. unspecified operator()(
  60039. Function && f) const;
  60040. The `package` function is used to adapt a function object as a packaged task. When this adapter is passed as a completion token to an asynchronous operation, the result of the function object is retuned via a std::future.
  60041. [heading Example]
  60042. std::future<std::size_t> fut =
  60043. my_socket.async_read_some(buffer,
  60044. use_future([](boost::system::error_code ec, std::size_t n)
  60045. {
  60046. return ec ? 0 : n;
  60047. }));
  60048. ...
  60049. std::size_t n = fut.get();
  60050. [endsect]
  60051. [section:operator_lb__rb_ use_future_t::operator\[\]]
  60052. [indexterm2 boost_asio.indexterm.use_future_t.operator_lb__rb_..operator\[\]..use_future_t]
  60053. (Deprecated: Use `rebind()`.) Specify an alternate allocator.
  60054. template<
  60055. typename OtherAllocator>
  60056. use_future_t< OtherAllocator > operator[](
  60057. const OtherAllocator & allocator) const;
  60058. [endsect]
  60059. [section:rebind use_future_t::rebind]
  60060. [indexterm2 boost_asio.indexterm.use_future_t.rebind..rebind..use_future_t]
  60061. Specify an alternate allocator.
  60062. template<
  60063. typename OtherAllocator>
  60064. use_future_t< OtherAllocator > rebind(
  60065. const OtherAllocator & allocator) const;
  60066. [endsect]
  60067. [section:use_future_t use_future_t::use_future_t]
  60068. [indexterm2 boost_asio.indexterm.use_future_t.use_future_t..use_future_t..use_future_t]
  60069. Construct using default-constructed allocator.
  60070. constexpr ``[link boost_asio.reference.use_future_t.use_future_t.overload1 use_future_t]``();
  60071. `` [''''&raquo;''' [link boost_asio.reference.use_future_t.use_future_t.overload1 more...]]``
  60072. Construct using specified allocator.
  60073. explicit ``[link boost_asio.reference.use_future_t.use_future_t.overload2 use_future_t]``(
  60074. const Allocator & allocator);
  60075. `` [''''&raquo;''' [link boost_asio.reference.use_future_t.use_future_t.overload2 more...]]``
  60076. [section:overload1 use_future_t::use_future_t (1 of 2 overloads)]
  60077. Construct using default-constructed allocator.
  60078. constexpr use_future_t();
  60079. [endsect]
  60080. [section:overload2 use_future_t::use_future_t (2 of 2 overloads)]
  60081. Construct using specified allocator.
  60082. use_future_t(
  60083. const Allocator & allocator);
  60084. [endsect]
  60085. [endsect]
  60086. [endsect]
  60087. [section:uses_executor uses_executor]
  60088. The [link boost_asio.reference.uses_executor `uses_executor`] trait detects whether a type T has an associated executor that is convertible from type Executor.
  60089. template<
  60090. typename T,
  60091. typename ``[link boost_asio.reference.Executor1 Executor]``>
  60092. struct uses_executor
  60093. Meets the BinaryTypeTrait requirements. The Asio library provides a definition that is derived from false\_type. A program may specialize this template to derive from true\_type for a user-defined type T that can be constructed with an executor, where the first argument of a constructor has type [link boost_asio.reference.executor_arg_t `executor_arg_t`] and the second argument is convertible from type Executor.
  60094. [heading Requirements]
  60095. ['Header: ][^boost/asio/uses_executor.hpp]
  60096. ['Convenience header: ][^boost/asio.hpp]
  60097. [endsect]
  60098. [section:wait_traits wait_traits]
  60099. Wait traits suitable for use with the [link boost_asio.reference.basic_waitable_timer `basic_waitable_timer`] class template.
  60100. template<
  60101. typename Clock>
  60102. struct wait_traits
  60103. [heading Member Functions]
  60104. [table
  60105. [[Name][Description]]
  60106. [
  60107. [[link boost_asio.reference.wait_traits.to_wait_duration [*to_wait_duration]]]
  60108. [Convert a clock duration into a duration used for waiting. ]
  60109. ]
  60110. ]
  60111. [heading Requirements]
  60112. ['Header: ][^boost/asio/wait_traits.hpp]
  60113. ['Convenience header: ][^boost/asio.hpp]
  60114. [section:to_wait_duration wait_traits::to_wait_duration]
  60115. [indexterm2 boost_asio.indexterm.wait_traits.to_wait_duration..to_wait_duration..wait_traits]
  60116. Convert a clock duration into a duration used for waiting.
  60117. static Clock::duration ``[link boost_asio.reference.wait_traits.to_wait_duration.overload1 to_wait_duration]``(
  60118. const typename Clock::duration & d);
  60119. `` [''''&raquo;''' [link boost_asio.reference.wait_traits.to_wait_duration.overload1 more...]]``
  60120. static Clock::duration ``[link boost_asio.reference.wait_traits.to_wait_duration.overload2 to_wait_duration]``(
  60121. const typename Clock::time_point & t);
  60122. `` [''''&raquo;''' [link boost_asio.reference.wait_traits.to_wait_duration.overload2 more...]]``
  60123. [section:overload1 wait_traits::to_wait_duration (1 of 2 overloads)]
  60124. Convert a clock duration into a duration used for waiting.
  60125. static Clock::duration to_wait_duration(
  60126. const typename Clock::duration & d);
  60127. [heading Return Value]
  60128. `d`.
  60129. [endsect]
  60130. [section:overload2 wait_traits::to_wait_duration (2 of 2 overloads)]
  60131. Convert a clock duration into a duration used for waiting.
  60132. static Clock::duration to_wait_duration(
  60133. const typename Clock::time_point & t);
  60134. [heading Return Value]
  60135. `d`.
  60136. [endsect]
  60137. [endsect]
  60138. [endsect]
  60139. [section:windows__basic_object_handle windows::basic_object_handle]
  60140. Provides object-oriented handle functionality.
  60141. template<
  60142. typename ``[link boost_asio.reference.Executor1 Executor]`` = executor>
  60143. class basic_object_handle
  60144. [heading Types]
  60145. [table
  60146. [[Name][Description]]
  60147. [
  60148. [[link boost_asio.reference.windows__basic_object_handle__rebind_executor [*rebind_executor]]]
  60149. [Rebinds the handle type to another executor. ]
  60150. ]
  60151. [
  60152. [[link boost_asio.reference.windows__basic_object_handle.executor_type [*executor_type]]]
  60153. [The type of the executor associated with the object. ]
  60154. ]
  60155. [
  60156. [[link boost_asio.reference.windows__basic_object_handle.lowest_layer_type [*lowest_layer_type]]]
  60157. [An object handle is always the lowest layer. ]
  60158. ]
  60159. [
  60160. [[link boost_asio.reference.windows__basic_object_handle.native_handle_type [*native_handle_type]]]
  60161. [The native representation of a handle. ]
  60162. ]
  60163. ]
  60164. [heading Member Functions]
  60165. [table
  60166. [[Name][Description]]
  60167. [
  60168. [[link boost_asio.reference.windows__basic_object_handle.assign [*assign]]]
  60169. [Assign an existing native handle to the handle. ]
  60170. ]
  60171. [
  60172. [[link boost_asio.reference.windows__basic_object_handle.async_wait [*async_wait]]]
  60173. [Start an asynchronous wait on the object handle. ]
  60174. ]
  60175. [
  60176. [[link boost_asio.reference.windows__basic_object_handle.basic_object_handle [*basic_object_handle]]]
  60177. [Construct an object handle without opening it.
  60178. [hr]
  60179. Construct an object handle on an existing native handle.
  60180. [hr]
  60181. Move-construct an object handle from another. ]
  60182. ]
  60183. [
  60184. [[link boost_asio.reference.windows__basic_object_handle.cancel [*cancel]]]
  60185. [Cancel all asynchronous operations associated with the handle. ]
  60186. ]
  60187. [
  60188. [[link boost_asio.reference.windows__basic_object_handle.close [*close]]]
  60189. [Close the handle. ]
  60190. ]
  60191. [
  60192. [[link boost_asio.reference.windows__basic_object_handle.get_executor [*get_executor]]]
  60193. [Get the executor associated with the object. ]
  60194. ]
  60195. [
  60196. [[link boost_asio.reference.windows__basic_object_handle.is_open [*is_open]]]
  60197. [Determine whether the handle is open. ]
  60198. ]
  60199. [
  60200. [[link boost_asio.reference.windows__basic_object_handle.lowest_layer [*lowest_layer]]]
  60201. [Get a reference to the lowest layer.
  60202. [hr]
  60203. Get a const reference to the lowest layer. ]
  60204. ]
  60205. [
  60206. [[link boost_asio.reference.windows__basic_object_handle.native_handle [*native_handle]]]
  60207. [Get the native handle representation. ]
  60208. ]
  60209. [
  60210. [[link boost_asio.reference.windows__basic_object_handle.operator_eq_ [*operator=]]]
  60211. [Move-assign an object handle from another. ]
  60212. ]
  60213. [
  60214. [[link boost_asio.reference.windows__basic_object_handle.wait [*wait]]]
  60215. [Perform a blocking wait on the object handle. ]
  60216. ]
  60217. ]
  60218. The [link boost_asio.reference.windows__basic_object_handle `windows::basic_object_handle`] class provides asynchronous and blocking object-oriented handle functionality.
  60219. [heading Thread Safety]
  60220. ['Distinct] ['objects:] Safe.
  60221. ['Shared] ['objects:] Unsafe.
  60222. [heading Requirements]
  60223. ['Header: ][^boost/asio/windows/basic_object_handle.hpp]
  60224. ['Convenience header: ][^boost/asio.hpp]
  60225. [section:assign windows::basic_object_handle::assign]
  60226. [indexterm2 boost_asio.indexterm.windows__basic_object_handle.assign..assign..windows::basic_object_handle]
  60227. Assign an existing native handle to the handle.
  60228. void ``[link boost_asio.reference.windows__basic_object_handle.assign.overload1 assign]``(
  60229. const native_handle_type & handle);
  60230. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.assign.overload1 more...]]``
  60231. void ``[link boost_asio.reference.windows__basic_object_handle.assign.overload2 assign]``(
  60232. const native_handle_type & handle,
  60233. boost::system::error_code & ec);
  60234. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.assign.overload2 more...]]``
  60235. [section:overload1 windows::basic_object_handle::assign (1 of 2 overloads)]
  60236. Assign an existing native handle to the handle.
  60237. void assign(
  60238. const native_handle_type & handle);
  60239. [endsect]
  60240. [section:overload2 windows::basic_object_handle::assign (2 of 2 overloads)]
  60241. Assign an existing native handle to the handle.
  60242. void assign(
  60243. const native_handle_type & handle,
  60244. boost::system::error_code & ec);
  60245. [endsect]
  60246. [endsect]
  60247. [section:async_wait windows::basic_object_handle::async_wait]
  60248. [indexterm2 boost_asio.indexterm.windows__basic_object_handle.async_wait..async_wait..windows::basic_object_handle]
  60249. Start an asynchronous wait on the object handle.
  60250. template<
  60251. typename ``[link boost_asio.reference.WaitHandler WaitHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  60252. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait(
  60253. WaitHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  60254. This function is be used to initiate an asynchronous wait against the object handle. It always returns immediately.
  60255. [heading Parameters]
  60256. [variablelist
  60257. [[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:
  60258. ``
  60259. void handler(
  60260. const boost::system::error_code& error // Result of operation.
  60261. );
  60262. ``
  60263. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`]. ]]
  60264. ]
  60265. [endsect]
  60266. [section:basic_object_handle windows::basic_object_handle::basic_object_handle]
  60267. [indexterm2 boost_asio.indexterm.windows__basic_object_handle.basic_object_handle..basic_object_handle..windows::basic_object_handle]
  60268. Construct an object handle without opening it.
  60269. explicit ``[link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload1 basic_object_handle]``(
  60270. const executor_type & ex);
  60271. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload1 more...]]``
  60272. template<
  60273. typename ExecutionContext>
  60274. explicit ``[link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload2 basic_object_handle]``(
  60275. ExecutionContext & context,
  60276. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value, basic_object_handle >::type * = 0);
  60277. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload2 more...]]``
  60278. Construct an object handle on an existing native handle.
  60279. ``[link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload3 basic_object_handle]``(
  60280. const executor_type & ex,
  60281. const native_handle_type & native_handle);
  60282. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload3 more...]]``
  60283. template<
  60284. typename ExecutionContext>
  60285. ``[link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload4 basic_object_handle]``(
  60286. ExecutionContext & context,
  60287. const native_handle_type & native_handle,
  60288. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  60289. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload4 more...]]``
  60290. Move-construct an object handle from another.
  60291. ``[link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload5 basic_object_handle]``(
  60292. basic_object_handle && other);
  60293. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.basic_object_handle.overload5 more...]]``
  60294. [section:overload1 windows::basic_object_handle::basic_object_handle (1 of 5 overloads)]
  60295. Construct an object handle without opening it.
  60296. basic_object_handle(
  60297. const executor_type & ex);
  60298. This constructor creates an object handle without opening it.
  60299. [heading Parameters]
  60300. [variablelist
  60301. [[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. ]]
  60302. ]
  60303. [endsect]
  60304. [section:overload2 windows::basic_object_handle::basic_object_handle (2 of 5 overloads)]
  60305. Construct an object handle without opening it.
  60306. template<
  60307. typename ExecutionContext>
  60308. basic_object_handle(
  60309. ExecutionContext & context,
  60310. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value, basic_object_handle >::type * = 0);
  60311. This constructor creates an object handle without opening it.
  60312. [heading Parameters]
  60313. [variablelist
  60314. [[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. ]]
  60315. ]
  60316. [endsect]
  60317. [section:overload3 windows::basic_object_handle::basic_object_handle (3 of 5 overloads)]
  60318. Construct an object handle on an existing native handle.
  60319. basic_object_handle(
  60320. const executor_type & ex,
  60321. const native_handle_type & native_handle);
  60322. This constructor creates an object handle object to hold an existing native handle.
  60323. [heading Parameters]
  60324. [variablelist
  60325. [[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.]]
  60326. [[native_handle][The new underlying handle implementation.]]
  60327. ]
  60328. [heading Exceptions]
  60329. [variablelist
  60330. [[boost::system::system_error][Thrown on failure. ]]
  60331. ]
  60332. [endsect]
  60333. [section:overload4 windows::basic_object_handle::basic_object_handle (4 of 5 overloads)]
  60334. Construct an object handle on an existing native handle.
  60335. template<
  60336. typename ExecutionContext>
  60337. basic_object_handle(
  60338. ExecutionContext & context,
  60339. const native_handle_type & native_handle,
  60340. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  60341. This constructor creates an object handle object to hold an existing native handle.
  60342. [heading Parameters]
  60343. [variablelist
  60344. [[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.]]
  60345. [[native_handle][The new underlying handle implementation.]]
  60346. ]
  60347. [heading Exceptions]
  60348. [variablelist
  60349. [[boost::system::system_error][Thrown on failure. ]]
  60350. ]
  60351. [endsect]
  60352. [section:overload5 windows::basic_object_handle::basic_object_handle (5 of 5 overloads)]
  60353. Move-construct an object handle from another.
  60354. basic_object_handle(
  60355. basic_object_handle && other);
  60356. This constructor moves an object handle from one object to another.
  60357. [heading Parameters]
  60358. [variablelist
  60359. [[other][The other object handle object from which the move will occur.]]
  60360. ]
  60361. [heading Remarks]
  60362. Following the move, the moved-from object is in the same state as if constructed using the `basic_object_handle(const executor_type&)` constructor.
  60363. [endsect]
  60364. [endsect]
  60365. [section:cancel windows::basic_object_handle::cancel]
  60366. [indexterm2 boost_asio.indexterm.windows__basic_object_handle.cancel..cancel..windows::basic_object_handle]
  60367. Cancel all asynchronous operations associated with the handle.
  60368. void ``[link boost_asio.reference.windows__basic_object_handle.cancel.overload1 cancel]``();
  60369. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.cancel.overload1 more...]]``
  60370. void ``[link boost_asio.reference.windows__basic_object_handle.cancel.overload2 cancel]``(
  60371. boost::system::error_code & ec);
  60372. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.cancel.overload2 more...]]``
  60373. [section:overload1 windows::basic_object_handle::cancel (1 of 2 overloads)]
  60374. Cancel all asynchronous operations associated with the handle.
  60375. void cancel();
  60376. This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
  60377. [heading Exceptions]
  60378. [variablelist
  60379. [[boost::system::system_error][Thrown on failure. ]]
  60380. ]
  60381. [endsect]
  60382. [section:overload2 windows::basic_object_handle::cancel (2 of 2 overloads)]
  60383. Cancel all asynchronous operations associated with the handle.
  60384. void cancel(
  60385. boost::system::error_code & ec);
  60386. This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
  60387. [heading Parameters]
  60388. [variablelist
  60389. [[ec][Set to indicate what error occurred, if any. ]]
  60390. ]
  60391. [endsect]
  60392. [endsect]
  60393. [section:close windows::basic_object_handle::close]
  60394. [indexterm2 boost_asio.indexterm.windows__basic_object_handle.close..close..windows::basic_object_handle]
  60395. Close the handle.
  60396. void ``[link boost_asio.reference.windows__basic_object_handle.close.overload1 close]``();
  60397. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.close.overload1 more...]]``
  60398. void ``[link boost_asio.reference.windows__basic_object_handle.close.overload2 close]``(
  60399. boost::system::error_code & ec);
  60400. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.close.overload2 more...]]``
  60401. [section:overload1 windows::basic_object_handle::close (1 of 2 overloads)]
  60402. Close the handle.
  60403. void close();
  60404. This function is used to close the handle. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
  60405. [heading Exceptions]
  60406. [variablelist
  60407. [[boost::system::system_error][Thrown on failure. ]]
  60408. ]
  60409. [endsect]
  60410. [section:overload2 windows::basic_object_handle::close (2 of 2 overloads)]
  60411. Close the handle.
  60412. void close(
  60413. boost::system::error_code & ec);
  60414. This function is used to close the handle. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
  60415. [heading Parameters]
  60416. [variablelist
  60417. [[ec][Set to indicate what error occurred, if any. ]]
  60418. ]
  60419. [endsect]
  60420. [endsect]
  60421. [section:executor_type windows::basic_object_handle::executor_type]
  60422. [indexterm2 boost_asio.indexterm.windows__basic_object_handle.executor_type..executor_type..windows::basic_object_handle]
  60423. The type of the executor associated with the object.
  60424. typedef Executor executor_type;
  60425. [heading Requirements]
  60426. ['Header: ][^boost/asio/windows/basic_object_handle.hpp]
  60427. ['Convenience header: ][^boost/asio.hpp]
  60428. [endsect]
  60429. [section:get_executor windows::basic_object_handle::get_executor]
  60430. [indexterm2 boost_asio.indexterm.windows__basic_object_handle.get_executor..get_executor..windows::basic_object_handle]
  60431. Get the executor associated with the object.
  60432. executor_type get_executor();
  60433. [endsect]
  60434. [section:is_open windows::basic_object_handle::is_open]
  60435. [indexterm2 boost_asio.indexterm.windows__basic_object_handle.is_open..is_open..windows::basic_object_handle]
  60436. Determine whether the handle is open.
  60437. bool is_open() const;
  60438. [endsect]
  60439. [section:lowest_layer windows::basic_object_handle::lowest_layer]
  60440. [indexterm2 boost_asio.indexterm.windows__basic_object_handle.lowest_layer..lowest_layer..windows::basic_object_handle]
  60441. Get a reference to the lowest layer.
  60442. lowest_layer_type & ``[link boost_asio.reference.windows__basic_object_handle.lowest_layer.overload1 lowest_layer]``();
  60443. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.lowest_layer.overload1 more...]]``
  60444. Get a const reference to the lowest layer.
  60445. const lowest_layer_type & ``[link boost_asio.reference.windows__basic_object_handle.lowest_layer.overload2 lowest_layer]``() const;
  60446. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.lowest_layer.overload2 more...]]``
  60447. [section:overload1 windows::basic_object_handle::lowest_layer (1 of 2 overloads)]
  60448. Get a reference to the lowest layer.
  60449. lowest_layer_type & lowest_layer();
  60450. This function returns a reference to the lowest layer in a stack of layers. Since an object handle cannot contain any further layers, it simply returns a reference to itself.
  60451. [heading Return Value]
  60452. A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
  60453. [endsect]
  60454. [section:overload2 windows::basic_object_handle::lowest_layer (2 of 2 overloads)]
  60455. Get a const reference to the lowest layer.
  60456. const lowest_layer_type & lowest_layer() const;
  60457. This function returns a const reference to the lowest layer in a stack of layers. Since an object handle cannot contain any further layers, it simply returns a reference to itself.
  60458. [heading Return Value]
  60459. A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
  60460. [endsect]
  60461. [endsect]
  60462. [section:lowest_layer_type windows::basic_object_handle::lowest_layer_type]
  60463. [indexterm2 boost_asio.indexterm.windows__basic_object_handle.lowest_layer_type..lowest_layer_type..windows::basic_object_handle]
  60464. An object handle is always the lowest layer.
  60465. typedef basic_object_handle lowest_layer_type;
  60466. [heading Types]
  60467. [table
  60468. [[Name][Description]]
  60469. [
  60470. [[link boost_asio.reference.windows__basic_object_handle__rebind_executor [*rebind_executor]]]
  60471. [Rebinds the handle type to another executor. ]
  60472. ]
  60473. [
  60474. [[link boost_asio.reference.windows__basic_object_handle.executor_type [*executor_type]]]
  60475. [The type of the executor associated with the object. ]
  60476. ]
  60477. [
  60478. [[link boost_asio.reference.windows__basic_object_handle.lowest_layer_type [*lowest_layer_type]]]
  60479. [An object handle is always the lowest layer. ]
  60480. ]
  60481. [
  60482. [[link boost_asio.reference.windows__basic_object_handle.native_handle_type [*native_handle_type]]]
  60483. [The native representation of a handle. ]
  60484. ]
  60485. ]
  60486. [heading Member Functions]
  60487. [table
  60488. [[Name][Description]]
  60489. [
  60490. [[link boost_asio.reference.windows__basic_object_handle.assign [*assign]]]
  60491. [Assign an existing native handle to the handle. ]
  60492. ]
  60493. [
  60494. [[link boost_asio.reference.windows__basic_object_handle.async_wait [*async_wait]]]
  60495. [Start an asynchronous wait on the object handle. ]
  60496. ]
  60497. [
  60498. [[link boost_asio.reference.windows__basic_object_handle.basic_object_handle [*basic_object_handle]]]
  60499. [Construct an object handle without opening it.
  60500. [hr]
  60501. Construct an object handle on an existing native handle.
  60502. [hr]
  60503. Move-construct an object handle from another. ]
  60504. ]
  60505. [
  60506. [[link boost_asio.reference.windows__basic_object_handle.cancel [*cancel]]]
  60507. [Cancel all asynchronous operations associated with the handle. ]
  60508. ]
  60509. [
  60510. [[link boost_asio.reference.windows__basic_object_handle.close [*close]]]
  60511. [Close the handle. ]
  60512. ]
  60513. [
  60514. [[link boost_asio.reference.windows__basic_object_handle.get_executor [*get_executor]]]
  60515. [Get the executor associated with the object. ]
  60516. ]
  60517. [
  60518. [[link boost_asio.reference.windows__basic_object_handle.is_open [*is_open]]]
  60519. [Determine whether the handle is open. ]
  60520. ]
  60521. [
  60522. [[link boost_asio.reference.windows__basic_object_handle.lowest_layer [*lowest_layer]]]
  60523. [Get a reference to the lowest layer.
  60524. [hr]
  60525. Get a const reference to the lowest layer. ]
  60526. ]
  60527. [
  60528. [[link boost_asio.reference.windows__basic_object_handle.native_handle [*native_handle]]]
  60529. [Get the native handle representation. ]
  60530. ]
  60531. [
  60532. [[link boost_asio.reference.windows__basic_object_handle.operator_eq_ [*operator=]]]
  60533. [Move-assign an object handle from another. ]
  60534. ]
  60535. [
  60536. [[link boost_asio.reference.windows__basic_object_handle.wait [*wait]]]
  60537. [Perform a blocking wait on the object handle. ]
  60538. ]
  60539. ]
  60540. The [link boost_asio.reference.windows__basic_object_handle `windows::basic_object_handle`] class provides asynchronous and blocking object-oriented handle functionality.
  60541. [heading Thread Safety]
  60542. ['Distinct] ['objects:] Safe.
  60543. ['Shared] ['objects:] Unsafe.
  60544. [heading Requirements]
  60545. ['Header: ][^boost/asio/windows/basic_object_handle.hpp]
  60546. ['Convenience header: ][^boost/asio.hpp]
  60547. [endsect]
  60548. [section:native_handle windows::basic_object_handle::native_handle]
  60549. [indexterm2 boost_asio.indexterm.windows__basic_object_handle.native_handle..native_handle..windows::basic_object_handle]
  60550. Get the native handle representation.
  60551. native_handle_type native_handle();
  60552. This function may be used to obtain the underlying representation of the handle. This is intended to allow access to native handle functionality that is not otherwise provided.
  60553. [endsect]
  60554. [section:native_handle_type windows::basic_object_handle::native_handle_type]
  60555. [indexterm2 boost_asio.indexterm.windows__basic_object_handle.native_handle_type..native_handle_type..windows::basic_object_handle]
  60556. The native representation of a handle.
  60557. typedef implementation_defined native_handle_type;
  60558. [heading Requirements]
  60559. ['Header: ][^boost/asio/windows/basic_object_handle.hpp]
  60560. ['Convenience header: ][^boost/asio.hpp]
  60561. [endsect]
  60562. [section:operator_eq_ windows::basic_object_handle::operator=]
  60563. [indexterm2 boost_asio.indexterm.windows__basic_object_handle.operator_eq_..operator=..windows::basic_object_handle]
  60564. Move-assign an object handle from another.
  60565. basic_object_handle & operator=(
  60566. basic_object_handle && other);
  60567. This assignment operator moves an object handle from one object to another.
  60568. [heading Parameters]
  60569. [variablelist
  60570. [[other][The other object handle object from which the move will occur.]]
  60571. ]
  60572. [heading Remarks]
  60573. Following the move, the moved-from object is in the same state as if constructed using the `basic_object_handle(const executor_type&)` constructor.
  60574. [endsect]
  60575. [section:wait windows::basic_object_handle::wait]
  60576. [indexterm2 boost_asio.indexterm.windows__basic_object_handle.wait..wait..windows::basic_object_handle]
  60577. Perform a blocking wait on the object handle.
  60578. void ``[link boost_asio.reference.windows__basic_object_handle.wait.overload1 wait]``();
  60579. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.wait.overload1 more...]]``
  60580. void ``[link boost_asio.reference.windows__basic_object_handle.wait.overload2 wait]``(
  60581. boost::system::error_code & ec);
  60582. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_object_handle.wait.overload2 more...]]``
  60583. [section:overload1 windows::basic_object_handle::wait (1 of 2 overloads)]
  60584. Perform a blocking wait on the object handle.
  60585. void wait();
  60586. This function is used to wait for the object handle to be set to the signalled state. This function blocks and does not return until the object handle has been set to the signalled state.
  60587. [heading Exceptions]
  60588. [variablelist
  60589. [[boost::system::system_error][Thrown on failure. ]]
  60590. ]
  60591. [endsect]
  60592. [section:overload2 windows::basic_object_handle::wait (2 of 2 overloads)]
  60593. Perform a blocking wait on the object handle.
  60594. void wait(
  60595. boost::system::error_code & ec);
  60596. This function is used to wait for the object handle to be set to the signalled state. This function blocks and does not return until the object handle has been set to the signalled state.
  60597. [heading Parameters]
  60598. [variablelist
  60599. [[ec][Set to indicate what error occurred, if any. ]]
  60600. ]
  60601. [endsect]
  60602. [endsect]
  60603. [endsect]
  60604. [section:windows__basic_object_handle__rebind_executor windows::basic_object_handle::rebind_executor]
  60605. Rebinds the handle type to another executor.
  60606. template<
  60607. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  60608. struct rebind_executor
  60609. [heading Types]
  60610. [table
  60611. [[Name][Description]]
  60612. [
  60613. [[link boost_asio.reference.windows__basic_object_handle__rebind_executor.other [*other]]]
  60614. [The handle type when rebound to the specified executor. ]
  60615. ]
  60616. ]
  60617. [heading Requirements]
  60618. ['Header: ][^boost/asio/windows/basic_object_handle.hpp]
  60619. ['Convenience header: ][^boost/asio.hpp]
  60620. [section:other windows::basic_object_handle::rebind_executor::other]
  60621. [indexterm2 boost_asio.indexterm.windows__basic_object_handle__rebind_executor.other..other..windows::basic_object_handle::rebind_executor]
  60622. The handle type when rebound to the specified executor.
  60623. typedef basic_object_handle< Executor1 > other;
  60624. [heading Types]
  60625. [table
  60626. [[Name][Description]]
  60627. [
  60628. [[link boost_asio.reference.windows__basic_object_handle__rebind_executor [*rebind_executor]]]
  60629. [Rebinds the handle type to another executor. ]
  60630. ]
  60631. [
  60632. [[link boost_asio.reference.windows__basic_object_handle.executor_type [*executor_type]]]
  60633. [The type of the executor associated with the object. ]
  60634. ]
  60635. [
  60636. [[link boost_asio.reference.windows__basic_object_handle.lowest_layer_type [*lowest_layer_type]]]
  60637. [An object handle is always the lowest layer. ]
  60638. ]
  60639. [
  60640. [[link boost_asio.reference.windows__basic_object_handle.native_handle_type [*native_handle_type]]]
  60641. [The native representation of a handle. ]
  60642. ]
  60643. ]
  60644. [heading Member Functions]
  60645. [table
  60646. [[Name][Description]]
  60647. [
  60648. [[link boost_asio.reference.windows__basic_object_handle.assign [*assign]]]
  60649. [Assign an existing native handle to the handle. ]
  60650. ]
  60651. [
  60652. [[link boost_asio.reference.windows__basic_object_handle.async_wait [*async_wait]]]
  60653. [Start an asynchronous wait on the object handle. ]
  60654. ]
  60655. [
  60656. [[link boost_asio.reference.windows__basic_object_handle.basic_object_handle [*basic_object_handle]]]
  60657. [Construct an object handle without opening it.
  60658. [hr]
  60659. Construct an object handle on an existing native handle.
  60660. [hr]
  60661. Move-construct an object handle from another. ]
  60662. ]
  60663. [
  60664. [[link boost_asio.reference.windows__basic_object_handle.cancel [*cancel]]]
  60665. [Cancel all asynchronous operations associated with the handle. ]
  60666. ]
  60667. [
  60668. [[link boost_asio.reference.windows__basic_object_handle.close [*close]]]
  60669. [Close the handle. ]
  60670. ]
  60671. [
  60672. [[link boost_asio.reference.windows__basic_object_handle.get_executor [*get_executor]]]
  60673. [Get the executor associated with the object. ]
  60674. ]
  60675. [
  60676. [[link boost_asio.reference.windows__basic_object_handle.is_open [*is_open]]]
  60677. [Determine whether the handle is open. ]
  60678. ]
  60679. [
  60680. [[link boost_asio.reference.windows__basic_object_handle.lowest_layer [*lowest_layer]]]
  60681. [Get a reference to the lowest layer.
  60682. [hr]
  60683. Get a const reference to the lowest layer. ]
  60684. ]
  60685. [
  60686. [[link boost_asio.reference.windows__basic_object_handle.native_handle [*native_handle]]]
  60687. [Get the native handle representation. ]
  60688. ]
  60689. [
  60690. [[link boost_asio.reference.windows__basic_object_handle.operator_eq_ [*operator=]]]
  60691. [Move-assign an object handle from another. ]
  60692. ]
  60693. [
  60694. [[link boost_asio.reference.windows__basic_object_handle.wait [*wait]]]
  60695. [Perform a blocking wait on the object handle. ]
  60696. ]
  60697. ]
  60698. The [link boost_asio.reference.windows__basic_object_handle `windows::basic_object_handle`] class provides asynchronous and blocking object-oriented handle functionality.
  60699. [heading Thread Safety]
  60700. ['Distinct] ['objects:] Safe.
  60701. ['Shared] ['objects:] Unsafe.
  60702. [heading Requirements]
  60703. ['Header: ][^boost/asio/windows/basic_object_handle.hpp]
  60704. ['Convenience header: ][^boost/asio.hpp]
  60705. [endsect]
  60706. [endsect]
  60707. [section:windows__basic_overlapped_handle windows::basic_overlapped_handle]
  60708. Provides Windows handle functionality for objects that support overlapped I/O.
  60709. template<
  60710. typename ``[link boost_asio.reference.Executor1 Executor]`` = executor>
  60711. class basic_overlapped_handle
  60712. [heading Types]
  60713. [table
  60714. [[Name][Description]]
  60715. [
  60716. [[link boost_asio.reference.windows__basic_overlapped_handle__rebind_executor [*rebind_executor]]]
  60717. [Rebinds the handle type to another executor. ]
  60718. ]
  60719. [
  60720. [[link boost_asio.reference.windows__basic_overlapped_handle.executor_type [*executor_type]]]
  60721. [The type of the executor associated with the object. ]
  60722. ]
  60723. [
  60724. [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer_type [*lowest_layer_type]]]
  60725. [An overlapped_handle is always the lowest layer. ]
  60726. ]
  60727. [
  60728. [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle_type [*native_handle_type]]]
  60729. [The native representation of a handle. ]
  60730. ]
  60731. ]
  60732. [heading Member Functions]
  60733. [table
  60734. [[Name][Description]]
  60735. [
  60736. [[link boost_asio.reference.windows__basic_overlapped_handle.assign [*assign]]]
  60737. [Assign an existing native handle to the handle. ]
  60738. ]
  60739. [
  60740. [[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle [*basic_overlapped_handle]]]
  60741. [Construct an overlapped handle without opening it.
  60742. [hr]
  60743. Construct an overlapped handle on an existing native handle.
  60744. [hr]
  60745. Move-construct an overlapped handle from another. ]
  60746. ]
  60747. [
  60748. [[link boost_asio.reference.windows__basic_overlapped_handle.cancel [*cancel]]]
  60749. [Cancel all asynchronous operations associated with the handle. ]
  60750. ]
  60751. [
  60752. [[link boost_asio.reference.windows__basic_overlapped_handle.close [*close]]]
  60753. [Close the handle. ]
  60754. ]
  60755. [
  60756. [[link boost_asio.reference.windows__basic_overlapped_handle.get_executor [*get_executor]]]
  60757. [Get the executor associated with the object. ]
  60758. ]
  60759. [
  60760. [[link boost_asio.reference.windows__basic_overlapped_handle.is_open [*is_open]]]
  60761. [Determine whether the handle is open. ]
  60762. ]
  60763. [
  60764. [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer [*lowest_layer]]]
  60765. [Get a reference to the lowest layer.
  60766. [hr]
  60767. Get a const reference to the lowest layer. ]
  60768. ]
  60769. [
  60770. [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle [*native_handle]]]
  60771. [Get the native handle representation. ]
  60772. ]
  60773. [
  60774. [[link boost_asio.reference.windows__basic_overlapped_handle.operator_eq_ [*operator=]]]
  60775. [Move-assign an overlapped handle from another. ]
  60776. ]
  60777. ]
  60778. [heading Protected Member Functions]
  60779. [table
  60780. [[Name][Description]]
  60781. [
  60782. [[link boost_asio.reference.windows__basic_overlapped_handle._basic_overlapped_handle [*~basic_overlapped_handle]]]
  60783. [Protected destructor to prevent deletion through this type. ]
  60784. ]
  60785. ]
  60786. [heading Protected Data Members]
  60787. [table
  60788. [[Name][Description]]
  60789. [
  60790. [[link boost_asio.reference.windows__basic_overlapped_handle.impl_ [*impl_]]]
  60791. []
  60792. ]
  60793. ]
  60794. The [link boost_asio.reference.windows__overlapped_handle `windows::overlapped_handle`] class provides the ability to wrap a Windows handle. The underlying object referred to by the handle must support overlapped I/O.
  60795. [heading Thread Safety]
  60796. ['Distinct] ['objects:] Safe.
  60797. ['Shared] ['objects:] Unsafe.
  60798. [heading Requirements]
  60799. ['Header: ][^boost/asio/windows/basic_overlapped_handle.hpp]
  60800. ['Convenience header: ][^boost/asio.hpp]
  60801. [section:assign windows::basic_overlapped_handle::assign]
  60802. [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.assign..assign..windows::basic_overlapped_handle]
  60803. Assign an existing native handle to the handle.
  60804. void ``[link boost_asio.reference.windows__basic_overlapped_handle.assign.overload1 assign]``(
  60805. const native_handle_type & handle);
  60806. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_overlapped_handle.assign.overload1 more...]]``
  60807. void ``[link boost_asio.reference.windows__basic_overlapped_handle.assign.overload2 assign]``(
  60808. const native_handle_type & handle,
  60809. boost::system::error_code & ec);
  60810. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_overlapped_handle.assign.overload2 more...]]``
  60811. [section:overload1 windows::basic_overlapped_handle::assign (1 of 2 overloads)]
  60812. Assign an existing native handle to the handle.
  60813. void assign(
  60814. const native_handle_type & handle);
  60815. [endsect]
  60816. [section:overload2 windows::basic_overlapped_handle::assign (2 of 2 overloads)]
  60817. Assign an existing native handle to the handle.
  60818. void assign(
  60819. const native_handle_type & handle,
  60820. boost::system::error_code & ec);
  60821. [endsect]
  60822. [endsect]
  60823. [section:basic_overlapped_handle windows::basic_overlapped_handle::basic_overlapped_handle]
  60824. [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.basic_overlapped_handle..basic_overlapped_handle..windows::basic_overlapped_handle]
  60825. Construct an overlapped handle without opening it.
  60826. explicit ``[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload1 basic_overlapped_handle]``(
  60827. const executor_type & ex);
  60828. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload1 more...]]``
  60829. template<
  60830. typename ExecutionContext>
  60831. explicit ``[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload2 basic_overlapped_handle]``(
  60832. ExecutionContext & context,
  60833. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value, basic_overlapped_handle >::type * = 0);
  60834. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload2 more...]]``
  60835. Construct an overlapped handle on an existing native handle.
  60836. ``[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload3 basic_overlapped_handle]``(
  60837. const executor_type & ex,
  60838. const native_handle_type & native_handle);
  60839. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload3 more...]]``
  60840. template<
  60841. typename ExecutionContext>
  60842. ``[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload4 basic_overlapped_handle]``(
  60843. ExecutionContext & context,
  60844. const native_handle_type & native_handle,
  60845. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  60846. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload4 more...]]``
  60847. Move-construct an overlapped handle from another.
  60848. ``[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload5 basic_overlapped_handle]``(
  60849. basic_overlapped_handle && other);
  60850. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle.overload5 more...]]``
  60851. [section:overload1 windows::basic_overlapped_handle::basic_overlapped_handle (1 of 5 overloads)]
  60852. Construct an overlapped handle without opening it.
  60853. basic_overlapped_handle(
  60854. const executor_type & ex);
  60855. This constructor creates an overlapped handle without opening it.
  60856. [heading Parameters]
  60857. [variablelist
  60858. [[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. ]]
  60859. ]
  60860. [endsect]
  60861. [section:overload2 windows::basic_overlapped_handle::basic_overlapped_handle (2 of 5 overloads)]
  60862. Construct an overlapped handle without opening it.
  60863. template<
  60864. typename ExecutionContext>
  60865. basic_overlapped_handle(
  60866. ExecutionContext & context,
  60867. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value, basic_overlapped_handle >::type * = 0);
  60868. This constructor creates an overlapped handle without opening it.
  60869. [heading Parameters]
  60870. [variablelist
  60871. [[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. ]]
  60872. ]
  60873. [endsect]
  60874. [section:overload3 windows::basic_overlapped_handle::basic_overlapped_handle (3 of 5 overloads)]
  60875. Construct an overlapped handle on an existing native handle.
  60876. basic_overlapped_handle(
  60877. const executor_type & ex,
  60878. const native_handle_type & native_handle);
  60879. This constructor creates an overlapped handle object to hold an existing native handle.
  60880. [heading Parameters]
  60881. [variablelist
  60882. [[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.]]
  60883. [[native_handle][The new underlying handle implementation.]]
  60884. ]
  60885. [heading Exceptions]
  60886. [variablelist
  60887. [[boost::system::system_error][Thrown on failure. ]]
  60888. ]
  60889. [endsect]
  60890. [section:overload4 windows::basic_overlapped_handle::basic_overlapped_handle (4 of 5 overloads)]
  60891. Construct an overlapped handle on an existing native handle.
  60892. template<
  60893. typename ExecutionContext>
  60894. basic_overlapped_handle(
  60895. ExecutionContext & context,
  60896. const native_handle_type & native_handle,
  60897. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  60898. This constructor creates an overlapped handle object to hold an existing native handle.
  60899. [heading Parameters]
  60900. [variablelist
  60901. [[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.]]
  60902. [[native_handle][The new underlying handle implementation.]]
  60903. ]
  60904. [heading Exceptions]
  60905. [variablelist
  60906. [[boost::system::system_error][Thrown on failure. ]]
  60907. ]
  60908. [endsect]
  60909. [section:overload5 windows::basic_overlapped_handle::basic_overlapped_handle (5 of 5 overloads)]
  60910. Move-construct an overlapped handle from another.
  60911. basic_overlapped_handle(
  60912. basic_overlapped_handle && other);
  60913. This constructor moves a handle from one object to another.
  60914. [heading Parameters]
  60915. [variablelist
  60916. [[other][The other overlapped handle object from which the move will occur.]]
  60917. ]
  60918. [heading Remarks]
  60919. Following the move, the moved-from object is in the same state as if constructed using the `overlapped_handle(const executor_type&)` constructor.
  60920. [endsect]
  60921. [endsect]
  60922. [section:cancel windows::basic_overlapped_handle::cancel]
  60923. [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.cancel..cancel..windows::basic_overlapped_handle]
  60924. Cancel all asynchronous operations associated with the handle.
  60925. void ``[link boost_asio.reference.windows__basic_overlapped_handle.cancel.overload1 cancel]``();
  60926. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_overlapped_handle.cancel.overload1 more...]]``
  60927. void ``[link boost_asio.reference.windows__basic_overlapped_handle.cancel.overload2 cancel]``(
  60928. boost::system::error_code & ec);
  60929. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_overlapped_handle.cancel.overload2 more...]]``
  60930. [section:overload1 windows::basic_overlapped_handle::cancel (1 of 2 overloads)]
  60931. Cancel all asynchronous operations associated with the handle.
  60932. void cancel();
  60933. This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
  60934. [heading Exceptions]
  60935. [variablelist
  60936. [[boost::system::system_error][Thrown on failure. ]]
  60937. ]
  60938. [endsect]
  60939. [section:overload2 windows::basic_overlapped_handle::cancel (2 of 2 overloads)]
  60940. Cancel all asynchronous operations associated with the handle.
  60941. void cancel(
  60942. boost::system::error_code & ec);
  60943. This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
  60944. [heading Parameters]
  60945. [variablelist
  60946. [[ec][Set to indicate what error occurred, if any. ]]
  60947. ]
  60948. [endsect]
  60949. [endsect]
  60950. [section:close windows::basic_overlapped_handle::close]
  60951. [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.close..close..windows::basic_overlapped_handle]
  60952. Close the handle.
  60953. void ``[link boost_asio.reference.windows__basic_overlapped_handle.close.overload1 close]``();
  60954. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_overlapped_handle.close.overload1 more...]]``
  60955. void ``[link boost_asio.reference.windows__basic_overlapped_handle.close.overload2 close]``(
  60956. boost::system::error_code & ec);
  60957. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_overlapped_handle.close.overload2 more...]]``
  60958. [section:overload1 windows::basic_overlapped_handle::close (1 of 2 overloads)]
  60959. Close the handle.
  60960. void close();
  60961. This function is used to close the handle. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
  60962. [heading Exceptions]
  60963. [variablelist
  60964. [[boost::system::system_error][Thrown on failure. ]]
  60965. ]
  60966. [endsect]
  60967. [section:overload2 windows::basic_overlapped_handle::close (2 of 2 overloads)]
  60968. Close the handle.
  60969. void close(
  60970. boost::system::error_code & ec);
  60971. This function is used to close the handle. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
  60972. [heading Parameters]
  60973. [variablelist
  60974. [[ec][Set to indicate what error occurred, if any. ]]
  60975. ]
  60976. [endsect]
  60977. [endsect]
  60978. [section:executor_type windows::basic_overlapped_handle::executor_type]
  60979. [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.executor_type..executor_type..windows::basic_overlapped_handle]
  60980. The type of the executor associated with the object.
  60981. typedef Executor executor_type;
  60982. [heading Requirements]
  60983. ['Header: ][^boost/asio/windows/basic_overlapped_handle.hpp]
  60984. ['Convenience header: ][^boost/asio.hpp]
  60985. [endsect]
  60986. [section:get_executor windows::basic_overlapped_handle::get_executor]
  60987. [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.get_executor..get_executor..windows::basic_overlapped_handle]
  60988. Get the executor associated with the object.
  60989. executor_type get_executor();
  60990. [endsect]
  60991. [section:impl_ windows::basic_overlapped_handle::impl_]
  60992. [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.impl_..impl_..windows::basic_overlapped_handle]
  60993. boost::asio::detail::io_object_impl< boost::asio::detail::win_iocp_handle_service, Executor > impl_;
  60994. [endsect]
  60995. [section:is_open windows::basic_overlapped_handle::is_open]
  60996. [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.is_open..is_open..windows::basic_overlapped_handle]
  60997. Determine whether the handle is open.
  60998. bool is_open() const;
  60999. [endsect]
  61000. [section:lowest_layer windows::basic_overlapped_handle::lowest_layer]
  61001. [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.lowest_layer..lowest_layer..windows::basic_overlapped_handle]
  61002. Get a reference to the lowest layer.
  61003. lowest_layer_type & ``[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer.overload1 lowest_layer]``();
  61004. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer.overload1 more...]]``
  61005. Get a const reference to the lowest layer.
  61006. const lowest_layer_type & ``[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer.overload2 lowest_layer]``() const;
  61007. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer.overload2 more...]]``
  61008. [section:overload1 windows::basic_overlapped_handle::lowest_layer (1 of 2 overloads)]
  61009. Get a reference to the lowest layer.
  61010. lowest_layer_type & lowest_layer();
  61011. This function returns a reference to the lowest layer in a stack of layers. Since an overlapped\_handle cannot contain any further layers, it simply returns a reference to itself.
  61012. [heading Return Value]
  61013. A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
  61014. [endsect]
  61015. [section:overload2 windows::basic_overlapped_handle::lowest_layer (2 of 2 overloads)]
  61016. Get a const reference to the lowest layer.
  61017. const lowest_layer_type & lowest_layer() const;
  61018. This function returns a const reference to the lowest layer in a stack of layers. Since an overlapped\_handle cannot contain any further layers, it simply returns a reference to itself.
  61019. [heading Return Value]
  61020. A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
  61021. [endsect]
  61022. [endsect]
  61023. [section:lowest_layer_type windows::basic_overlapped_handle::lowest_layer_type]
  61024. [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.lowest_layer_type..lowest_layer_type..windows::basic_overlapped_handle]
  61025. An overlapped\_handle is always the lowest layer.
  61026. typedef basic_overlapped_handle lowest_layer_type;
  61027. [heading Types]
  61028. [table
  61029. [[Name][Description]]
  61030. [
  61031. [[link boost_asio.reference.windows__basic_overlapped_handle__rebind_executor [*rebind_executor]]]
  61032. [Rebinds the handle type to another executor. ]
  61033. ]
  61034. [
  61035. [[link boost_asio.reference.windows__basic_overlapped_handle.executor_type [*executor_type]]]
  61036. [The type of the executor associated with the object. ]
  61037. ]
  61038. [
  61039. [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer_type [*lowest_layer_type]]]
  61040. [An overlapped_handle is always the lowest layer. ]
  61041. ]
  61042. [
  61043. [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle_type [*native_handle_type]]]
  61044. [The native representation of a handle. ]
  61045. ]
  61046. ]
  61047. [heading Member Functions]
  61048. [table
  61049. [[Name][Description]]
  61050. [
  61051. [[link boost_asio.reference.windows__basic_overlapped_handle.assign [*assign]]]
  61052. [Assign an existing native handle to the handle. ]
  61053. ]
  61054. [
  61055. [[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle [*basic_overlapped_handle]]]
  61056. [Construct an overlapped handle without opening it.
  61057. [hr]
  61058. Construct an overlapped handle on an existing native handle.
  61059. [hr]
  61060. Move-construct an overlapped handle from another. ]
  61061. ]
  61062. [
  61063. [[link boost_asio.reference.windows__basic_overlapped_handle.cancel [*cancel]]]
  61064. [Cancel all asynchronous operations associated with the handle. ]
  61065. ]
  61066. [
  61067. [[link boost_asio.reference.windows__basic_overlapped_handle.close [*close]]]
  61068. [Close the handle. ]
  61069. ]
  61070. [
  61071. [[link boost_asio.reference.windows__basic_overlapped_handle.get_executor [*get_executor]]]
  61072. [Get the executor associated with the object. ]
  61073. ]
  61074. [
  61075. [[link boost_asio.reference.windows__basic_overlapped_handle.is_open [*is_open]]]
  61076. [Determine whether the handle is open. ]
  61077. ]
  61078. [
  61079. [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer [*lowest_layer]]]
  61080. [Get a reference to the lowest layer.
  61081. [hr]
  61082. Get a const reference to the lowest layer. ]
  61083. ]
  61084. [
  61085. [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle [*native_handle]]]
  61086. [Get the native handle representation. ]
  61087. ]
  61088. [
  61089. [[link boost_asio.reference.windows__basic_overlapped_handle.operator_eq_ [*operator=]]]
  61090. [Move-assign an overlapped handle from another. ]
  61091. ]
  61092. ]
  61093. [heading Protected Member Functions]
  61094. [table
  61095. [[Name][Description]]
  61096. [
  61097. [[link boost_asio.reference.windows__basic_overlapped_handle._basic_overlapped_handle [*~basic_overlapped_handle]]]
  61098. [Protected destructor to prevent deletion through this type. ]
  61099. ]
  61100. ]
  61101. [heading Protected Data Members]
  61102. [table
  61103. [[Name][Description]]
  61104. [
  61105. [[link boost_asio.reference.windows__basic_overlapped_handle.impl_ [*impl_]]]
  61106. []
  61107. ]
  61108. ]
  61109. The [link boost_asio.reference.windows__overlapped_handle `windows::overlapped_handle`] class provides the ability to wrap a Windows handle. The underlying object referred to by the handle must support overlapped I/O.
  61110. [heading Thread Safety]
  61111. ['Distinct] ['objects:] Safe.
  61112. ['Shared] ['objects:] Unsafe.
  61113. [heading Requirements]
  61114. ['Header: ][^boost/asio/windows/basic_overlapped_handle.hpp]
  61115. ['Convenience header: ][^boost/asio.hpp]
  61116. [endsect]
  61117. [section:native_handle windows::basic_overlapped_handle::native_handle]
  61118. [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.native_handle..native_handle..windows::basic_overlapped_handle]
  61119. Get the native handle representation.
  61120. native_handle_type native_handle();
  61121. This function may be used to obtain the underlying representation of the handle. This is intended to allow access to native handle functionality that is not otherwise provided.
  61122. [endsect]
  61123. [section:native_handle_type windows::basic_overlapped_handle::native_handle_type]
  61124. [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.native_handle_type..native_handle_type..windows::basic_overlapped_handle]
  61125. The native representation of a handle.
  61126. typedef implementation_defined native_handle_type;
  61127. [heading Requirements]
  61128. ['Header: ][^boost/asio/windows/basic_overlapped_handle.hpp]
  61129. ['Convenience header: ][^boost/asio.hpp]
  61130. [endsect]
  61131. [section:operator_eq_ windows::basic_overlapped_handle::operator=]
  61132. [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle.operator_eq_..operator=..windows::basic_overlapped_handle]
  61133. Move-assign an overlapped handle from another.
  61134. basic_overlapped_handle & operator=(
  61135. basic_overlapped_handle && other);
  61136. This assignment operator moves a handle from one object to another.
  61137. [heading Parameters]
  61138. [variablelist
  61139. [[other][The other overlapped handle object from which the move will occur.]]
  61140. ]
  61141. [heading Remarks]
  61142. Following the move, the moved-from object is in the same state as if constructed using the `overlapped_handle(const executor_type&)` constructor.
  61143. [endsect]
  61144. [section:_basic_overlapped_handle windows::basic_overlapped_handle::~basic_overlapped_handle]
  61145. [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle._basic_overlapped_handle..~basic_overlapped_handle..windows::basic_overlapped_handle]
  61146. Protected destructor to prevent deletion through this type.
  61147. ~basic_overlapped_handle();
  61148. This function destroys the handle, cancelling any outstanding asynchronous wait operations associated with the handle as if by calling `cancel`.
  61149. [endsect]
  61150. [endsect]
  61151. [section:windows__basic_overlapped_handle__rebind_executor windows::basic_overlapped_handle::rebind_executor]
  61152. Rebinds the handle type to another executor.
  61153. template<
  61154. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  61155. struct rebind_executor
  61156. [heading Types]
  61157. [table
  61158. [[Name][Description]]
  61159. [
  61160. [[link boost_asio.reference.windows__basic_overlapped_handle__rebind_executor.other [*other]]]
  61161. [The handle type when rebound to the specified executor. ]
  61162. ]
  61163. ]
  61164. [heading Requirements]
  61165. ['Header: ][^boost/asio/windows/basic_overlapped_handle.hpp]
  61166. ['Convenience header: ][^boost/asio.hpp]
  61167. [section:other windows::basic_overlapped_handle::rebind_executor::other]
  61168. [indexterm2 boost_asio.indexterm.windows__basic_overlapped_handle__rebind_executor.other..other..windows::basic_overlapped_handle::rebind_executor]
  61169. The handle type when rebound to the specified executor.
  61170. typedef basic_overlapped_handle< Executor1 > other;
  61171. [heading Types]
  61172. [table
  61173. [[Name][Description]]
  61174. [
  61175. [[link boost_asio.reference.windows__basic_overlapped_handle__rebind_executor [*rebind_executor]]]
  61176. [Rebinds the handle type to another executor. ]
  61177. ]
  61178. [
  61179. [[link boost_asio.reference.windows__basic_overlapped_handle.executor_type [*executor_type]]]
  61180. [The type of the executor associated with the object. ]
  61181. ]
  61182. [
  61183. [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer_type [*lowest_layer_type]]]
  61184. [An overlapped_handle is always the lowest layer. ]
  61185. ]
  61186. [
  61187. [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle_type [*native_handle_type]]]
  61188. [The native representation of a handle. ]
  61189. ]
  61190. ]
  61191. [heading Member Functions]
  61192. [table
  61193. [[Name][Description]]
  61194. [
  61195. [[link boost_asio.reference.windows__basic_overlapped_handle.assign [*assign]]]
  61196. [Assign an existing native handle to the handle. ]
  61197. ]
  61198. [
  61199. [[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle [*basic_overlapped_handle]]]
  61200. [Construct an overlapped handle without opening it.
  61201. [hr]
  61202. Construct an overlapped handle on an existing native handle.
  61203. [hr]
  61204. Move-construct an overlapped handle from another. ]
  61205. ]
  61206. [
  61207. [[link boost_asio.reference.windows__basic_overlapped_handle.cancel [*cancel]]]
  61208. [Cancel all asynchronous operations associated with the handle. ]
  61209. ]
  61210. [
  61211. [[link boost_asio.reference.windows__basic_overlapped_handle.close [*close]]]
  61212. [Close the handle. ]
  61213. ]
  61214. [
  61215. [[link boost_asio.reference.windows__basic_overlapped_handle.get_executor [*get_executor]]]
  61216. [Get the executor associated with the object. ]
  61217. ]
  61218. [
  61219. [[link boost_asio.reference.windows__basic_overlapped_handle.is_open [*is_open]]]
  61220. [Determine whether the handle is open. ]
  61221. ]
  61222. [
  61223. [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer [*lowest_layer]]]
  61224. [Get a reference to the lowest layer.
  61225. [hr]
  61226. Get a const reference to the lowest layer. ]
  61227. ]
  61228. [
  61229. [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle [*native_handle]]]
  61230. [Get the native handle representation. ]
  61231. ]
  61232. [
  61233. [[link boost_asio.reference.windows__basic_overlapped_handle.operator_eq_ [*operator=]]]
  61234. [Move-assign an overlapped handle from another. ]
  61235. ]
  61236. ]
  61237. [heading Protected Member Functions]
  61238. [table
  61239. [[Name][Description]]
  61240. [
  61241. [[link boost_asio.reference.windows__basic_overlapped_handle._basic_overlapped_handle [*~basic_overlapped_handle]]]
  61242. [Protected destructor to prevent deletion through this type. ]
  61243. ]
  61244. ]
  61245. [heading Protected Data Members]
  61246. [table
  61247. [[Name][Description]]
  61248. [
  61249. [[link boost_asio.reference.windows__basic_overlapped_handle.impl_ [*impl_]]]
  61250. []
  61251. ]
  61252. ]
  61253. The [link boost_asio.reference.windows__overlapped_handle `windows::overlapped_handle`] class provides the ability to wrap a Windows handle. The underlying object referred to by the handle must support overlapped I/O.
  61254. [heading Thread Safety]
  61255. ['Distinct] ['objects:] Safe.
  61256. ['Shared] ['objects:] Unsafe.
  61257. [heading Requirements]
  61258. ['Header: ][^boost/asio/windows/basic_overlapped_handle.hpp]
  61259. ['Convenience header: ][^boost/asio.hpp]
  61260. [endsect]
  61261. [endsect]
  61262. [section:windows__basic_random_access_handle windows::basic_random_access_handle]
  61263. Provides random-access handle functionality.
  61264. template<
  61265. typename ``[link boost_asio.reference.Executor1 Executor]`` = executor>
  61266. class basic_random_access_handle :
  61267. public windows::basic_overlapped_handle< Executor >
  61268. [heading Types]
  61269. [table
  61270. [[Name][Description]]
  61271. [
  61272. [[link boost_asio.reference.windows__basic_random_access_handle__rebind_executor [*rebind_executor]]]
  61273. [Rebinds the handle type to another executor. ]
  61274. ]
  61275. [
  61276. [[link boost_asio.reference.windows__basic_random_access_handle.executor_type [*executor_type]]]
  61277. [The type of the executor associated with the object. ]
  61278. ]
  61279. [
  61280. [[link boost_asio.reference.windows__basic_random_access_handle.lowest_layer_type [*lowest_layer_type]]]
  61281. [An overlapped_handle is always the lowest layer. ]
  61282. ]
  61283. [
  61284. [[link boost_asio.reference.windows__basic_random_access_handle.native_handle_type [*native_handle_type]]]
  61285. [The native representation of a handle. ]
  61286. ]
  61287. ]
  61288. [heading Member Functions]
  61289. [table
  61290. [[Name][Description]]
  61291. [
  61292. [[link boost_asio.reference.windows__basic_random_access_handle.assign [*assign]]]
  61293. [Assign an existing native handle to the handle. ]
  61294. ]
  61295. [
  61296. [[link boost_asio.reference.windows__basic_random_access_handle.async_read_some_at [*async_read_some_at]]]
  61297. [Start an asynchronous read at the specified offset. ]
  61298. ]
  61299. [
  61300. [[link boost_asio.reference.windows__basic_random_access_handle.async_write_some_at [*async_write_some_at]]]
  61301. [Start an asynchronous write at the specified offset. ]
  61302. ]
  61303. [
  61304. [[link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle [*basic_random_access_handle]]]
  61305. [Construct a random-access handle without opening it.
  61306. [hr]
  61307. Construct a random-access handle on an existing native handle.
  61308. [hr]
  61309. Move-construct a random-access handle from another. ]
  61310. ]
  61311. [
  61312. [[link boost_asio.reference.windows__basic_random_access_handle.cancel [*cancel]]]
  61313. [Cancel all asynchronous operations associated with the handle. ]
  61314. ]
  61315. [
  61316. [[link boost_asio.reference.windows__basic_random_access_handle.close [*close]]]
  61317. [Close the handle. ]
  61318. ]
  61319. [
  61320. [[link boost_asio.reference.windows__basic_random_access_handle.get_executor [*get_executor]]]
  61321. [Get the executor associated with the object. ]
  61322. ]
  61323. [
  61324. [[link boost_asio.reference.windows__basic_random_access_handle.is_open [*is_open]]]
  61325. [Determine whether the handle is open. ]
  61326. ]
  61327. [
  61328. [[link boost_asio.reference.windows__basic_random_access_handle.lowest_layer [*lowest_layer]]]
  61329. [Get a reference to the lowest layer.
  61330. [hr]
  61331. Get a const reference to the lowest layer. ]
  61332. ]
  61333. [
  61334. [[link boost_asio.reference.windows__basic_random_access_handle.native_handle [*native_handle]]]
  61335. [Get the native handle representation. ]
  61336. ]
  61337. [
  61338. [[link boost_asio.reference.windows__basic_random_access_handle.operator_eq_ [*operator=]]]
  61339. [Move-assign a random-access handle from another. ]
  61340. ]
  61341. [
  61342. [[link boost_asio.reference.windows__basic_random_access_handle.read_some_at [*read_some_at]]]
  61343. [Read some data from the handle at the specified offset. ]
  61344. ]
  61345. [
  61346. [[link boost_asio.reference.windows__basic_random_access_handle.write_some_at [*write_some_at]]]
  61347. [Write some data to the handle at the specified offset. ]
  61348. ]
  61349. ]
  61350. [heading Protected Data Members]
  61351. [table
  61352. [[Name][Description]]
  61353. [
  61354. [[link boost_asio.reference.windows__basic_random_access_handle.impl_ [*impl_]]]
  61355. []
  61356. ]
  61357. ]
  61358. The [link boost_asio.reference.windows__basic_random_access_handle `windows::basic_random_access_handle`] class provides asynchronous and blocking random-access handle functionality.
  61359. [heading Thread Safety]
  61360. ['Distinct] ['objects:] Safe.
  61361. ['Shared] ['objects:] Unsafe.
  61362. [heading Requirements]
  61363. ['Header: ][^boost/asio/windows/basic_random_access_handle.hpp]
  61364. ['Convenience header: ][^boost/asio.hpp]
  61365. [section:assign windows::basic_random_access_handle::assign]
  61366. [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.assign..assign..windows::basic_random_access_handle]
  61367. Assign an existing native handle to the handle.
  61368. void ``[link boost_asio.reference.windows__basic_random_access_handle.assign.overload1 assign]``(
  61369. const native_handle_type & handle);
  61370. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.assign.overload1 more...]]``
  61371. void ``[link boost_asio.reference.windows__basic_random_access_handle.assign.overload2 assign]``(
  61372. const native_handle_type & handle,
  61373. boost::system::error_code & ec);
  61374. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.assign.overload2 more...]]``
  61375. [section:overload1 windows::basic_random_access_handle::assign (1 of 2 overloads)]
  61376. ['Inherited from windows::basic_overlapped_handle.]
  61377. Assign an existing native handle to the handle.
  61378. void assign(
  61379. const native_handle_type & handle);
  61380. [endsect]
  61381. [section:overload2 windows::basic_random_access_handle::assign (2 of 2 overloads)]
  61382. ['Inherited from windows::basic_overlapped_handle.]
  61383. Assign an existing native handle to the handle.
  61384. void assign(
  61385. const native_handle_type & handle,
  61386. boost::system::error_code & ec);
  61387. [endsect]
  61388. [endsect]
  61389. [section:async_read_some_at windows::basic_random_access_handle::async_read_some_at]
  61390. [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.async_read_some_at..async_read_some_at..windows::basic_random_access_handle]
  61391. Start an asynchronous read at the specified offset.
  61392. template<
  61393. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  61394. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  61395. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_some_at(
  61396. uint64_t offset,
  61397. const MutableBufferSequence & buffers,
  61398. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  61399. This function is used to asynchronously read data from the random-access handle. The function call always returns immediately.
  61400. [heading Parameters]
  61401. [variablelist
  61402. [[offset][The offset at which the data will be read.]]
  61403. [[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.]]
  61404. [[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:
  61405. ``
  61406. void handler(
  61407. const boost::system::error_code& error, // Result of operation.
  61408. std::size_t bytes_transferred // Number of bytes read.
  61409. );
  61410. ``
  61411. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  61412. ]
  61413. [heading Remarks]
  61414. The read operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.async_read_at `async_read_at`] function if you need to ensure that the requested amount of data is read before the asynchronous operation completes.
  61415. [heading Example]
  61416. To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  61417. handle.async_read_some_at(42, boost::asio::buffer(data, size), handler);
  61418. See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  61419. [endsect]
  61420. [section:async_write_some_at windows::basic_random_access_handle::async_write_some_at]
  61421. [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.async_write_some_at..async_write_some_at..windows::basic_random_access_handle]
  61422. Start an asynchronous write at the specified offset.
  61423. template<
  61424. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  61425. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  61426. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_some_at(
  61427. uint64_t offset,
  61428. const ConstBufferSequence & buffers,
  61429. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  61430. This function is used to asynchronously write data to the random-access handle. The function call always returns immediately.
  61431. [heading Parameters]
  61432. [variablelist
  61433. [[offset][The offset at which the data will be written.]]
  61434. [[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.]]
  61435. [[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:
  61436. ``
  61437. void handler(
  61438. const boost::system::error_code& error, // Result of operation.
  61439. std::size_t bytes_transferred // Number of bytes written.
  61440. );
  61441. ``
  61442. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  61443. ]
  61444. [heading Remarks]
  61445. The write operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.async_write_at `async_write_at`] function if you need to ensure that all data is written before the asynchronous operation completes.
  61446. [heading Example]
  61447. To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  61448. handle.async_write_some_at(42, boost::asio::buffer(data, size), handler);
  61449. See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  61450. [endsect]
  61451. [section:basic_random_access_handle windows::basic_random_access_handle::basic_random_access_handle]
  61452. [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.basic_random_access_handle..basic_random_access_handle..windows::basic_random_access_handle]
  61453. Construct a random-access handle without opening it.
  61454. explicit ``[link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload1 basic_random_access_handle]``(
  61455. const executor_type & ex);
  61456. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload1 more...]]``
  61457. template<
  61458. typename ExecutionContext>
  61459. explicit ``[link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload2 basic_random_access_handle]``(
  61460. ExecutionContext & context,
  61461. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value, basic_random_access_handle >::type * = 0);
  61462. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload2 more...]]``
  61463. Construct a random-access handle on an existing native handle.
  61464. ``[link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload3 basic_random_access_handle]``(
  61465. const executor_type & ex,
  61466. const native_handle_type & handle);
  61467. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload3 more...]]``
  61468. template<
  61469. typename ExecutionContext>
  61470. ``[link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload4 basic_random_access_handle]``(
  61471. ExecutionContext & context,
  61472. const native_handle_type & handle,
  61473. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  61474. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload4 more...]]``
  61475. Move-construct a random-access handle from another.
  61476. ``[link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload5 basic_random_access_handle]``(
  61477. basic_random_access_handle && other);
  61478. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload5 more...]]``
  61479. [section:overload1 windows::basic_random_access_handle::basic_random_access_handle (1 of 5 overloads)]
  61480. Construct a random-access handle without opening it.
  61481. basic_random_access_handle(
  61482. const executor_type & ex);
  61483. This constructor creates a random-access handle without opening it.
  61484. [heading Parameters]
  61485. [variablelist
  61486. [[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. ]]
  61487. ]
  61488. [endsect]
  61489. [section:overload2 windows::basic_random_access_handle::basic_random_access_handle (2 of 5 overloads)]
  61490. Construct a random-access handle without opening it.
  61491. template<
  61492. typename ExecutionContext>
  61493. basic_random_access_handle(
  61494. ExecutionContext & context,
  61495. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value, basic_random_access_handle >::type * = 0);
  61496. This constructor creates a random-access handle without opening it. The handle needs to be opened or assigned before data can be sent or received on it.
  61497. [heading Parameters]
  61498. [variablelist
  61499. [[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. ]]
  61500. ]
  61501. [endsect]
  61502. [section:overload3 windows::basic_random_access_handle::basic_random_access_handle (3 of 5 overloads)]
  61503. Construct a random-access handle on an existing native handle.
  61504. basic_random_access_handle(
  61505. const executor_type & ex,
  61506. const native_handle_type & handle);
  61507. This constructor creates a random-access handle object to hold an existing native handle.
  61508. [heading Parameters]
  61509. [variablelist
  61510. [[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.]]
  61511. [[handle][The new underlying handle implementation.]]
  61512. ]
  61513. [heading Exceptions]
  61514. [variablelist
  61515. [[boost::system::system_error][Thrown on failure. ]]
  61516. ]
  61517. [endsect]
  61518. [section:overload4 windows::basic_random_access_handle::basic_random_access_handle (4 of 5 overloads)]
  61519. Construct a random-access handle on an existing native handle.
  61520. template<
  61521. typename ExecutionContext>
  61522. basic_random_access_handle(
  61523. ExecutionContext & context,
  61524. const native_handle_type & handle,
  61525. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  61526. This constructor creates a random-access handle object to hold an existing native handle.
  61527. [heading Parameters]
  61528. [variablelist
  61529. [[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.]]
  61530. [[handle][The new underlying handle implementation.]]
  61531. ]
  61532. [heading Exceptions]
  61533. [variablelist
  61534. [[boost::system::system_error][Thrown on failure. ]]
  61535. ]
  61536. [endsect]
  61537. [section:overload5 windows::basic_random_access_handle::basic_random_access_handle (5 of 5 overloads)]
  61538. Move-construct a random-access handle from another.
  61539. basic_random_access_handle(
  61540. basic_random_access_handle && other);
  61541. This constructor moves a random-access handle from one object to another.
  61542. [heading Parameters]
  61543. [variablelist
  61544. [[other][The other random-access handle object from which the move will occur.]]
  61545. ]
  61546. [heading Remarks]
  61547. Following the move, the moved-from object is in the same state as if constructed using the `basic_random_access_handle(const executor_type&)` constructor.
  61548. [endsect]
  61549. [endsect]
  61550. [section:cancel windows::basic_random_access_handle::cancel]
  61551. [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.cancel..cancel..windows::basic_random_access_handle]
  61552. Cancel all asynchronous operations associated with the handle.
  61553. void ``[link boost_asio.reference.windows__basic_random_access_handle.cancel.overload1 cancel]``();
  61554. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.cancel.overload1 more...]]``
  61555. void ``[link boost_asio.reference.windows__basic_random_access_handle.cancel.overload2 cancel]``(
  61556. boost::system::error_code & ec);
  61557. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.cancel.overload2 more...]]``
  61558. [section:overload1 windows::basic_random_access_handle::cancel (1 of 2 overloads)]
  61559. ['Inherited from windows::basic_overlapped_handle.]
  61560. Cancel all asynchronous operations associated with the handle.
  61561. void cancel();
  61562. This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
  61563. [heading Exceptions]
  61564. [variablelist
  61565. [[boost::system::system_error][Thrown on failure. ]]
  61566. ]
  61567. [endsect]
  61568. [section:overload2 windows::basic_random_access_handle::cancel (2 of 2 overloads)]
  61569. ['Inherited from windows::basic_overlapped_handle.]
  61570. Cancel all asynchronous operations associated with the handle.
  61571. void cancel(
  61572. boost::system::error_code & ec);
  61573. This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
  61574. [heading Parameters]
  61575. [variablelist
  61576. [[ec][Set to indicate what error occurred, if any. ]]
  61577. ]
  61578. [endsect]
  61579. [endsect]
  61580. [section:close windows::basic_random_access_handle::close]
  61581. [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.close..close..windows::basic_random_access_handle]
  61582. Close the handle.
  61583. void ``[link boost_asio.reference.windows__basic_random_access_handle.close.overload1 close]``();
  61584. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.close.overload1 more...]]``
  61585. void ``[link boost_asio.reference.windows__basic_random_access_handle.close.overload2 close]``(
  61586. boost::system::error_code & ec);
  61587. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.close.overload2 more...]]``
  61588. [section:overload1 windows::basic_random_access_handle::close (1 of 2 overloads)]
  61589. ['Inherited from windows::basic_overlapped_handle.]
  61590. Close the handle.
  61591. void close();
  61592. This function is used to close the handle. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
  61593. [heading Exceptions]
  61594. [variablelist
  61595. [[boost::system::system_error][Thrown on failure. ]]
  61596. ]
  61597. [endsect]
  61598. [section:overload2 windows::basic_random_access_handle::close (2 of 2 overloads)]
  61599. ['Inherited from windows::basic_overlapped_handle.]
  61600. Close the handle.
  61601. void close(
  61602. boost::system::error_code & ec);
  61603. This function is used to close the handle. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
  61604. [heading Parameters]
  61605. [variablelist
  61606. [[ec][Set to indicate what error occurred, if any. ]]
  61607. ]
  61608. [endsect]
  61609. [endsect]
  61610. [section:executor_type windows::basic_random_access_handle::executor_type]
  61611. [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.executor_type..executor_type..windows::basic_random_access_handle]
  61612. The type of the executor associated with the object.
  61613. typedef Executor executor_type;
  61614. [heading Requirements]
  61615. ['Header: ][^boost/asio/windows/basic_random_access_handle.hpp]
  61616. ['Convenience header: ][^boost/asio.hpp]
  61617. [endsect]
  61618. [section:get_executor windows::basic_random_access_handle::get_executor]
  61619. ['Inherited from windows::basic_overlapped_handle.]
  61620. [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.get_executor..get_executor..windows::basic_random_access_handle]
  61621. Get the executor associated with the object.
  61622. executor_type get_executor();
  61623. [endsect]
  61624. [section:impl_ windows::basic_random_access_handle::impl_]
  61625. ['Inherited from windows::basic_overlapped_handle.]
  61626. [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.impl_..impl_..windows::basic_random_access_handle]
  61627. boost::asio::detail::io_object_impl< boost::asio::detail::win_iocp_handle_service, Executor > impl_;
  61628. [endsect]
  61629. [section:is_open windows::basic_random_access_handle::is_open]
  61630. ['Inherited from windows::basic_overlapped_handle.]
  61631. [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.is_open..is_open..windows::basic_random_access_handle]
  61632. Determine whether the handle is open.
  61633. bool is_open() const;
  61634. [endsect]
  61635. [section:lowest_layer windows::basic_random_access_handle::lowest_layer]
  61636. [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.lowest_layer..lowest_layer..windows::basic_random_access_handle]
  61637. Get a reference to the lowest layer.
  61638. lowest_layer_type & ``[link boost_asio.reference.windows__basic_random_access_handle.lowest_layer.overload1 lowest_layer]``();
  61639. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.lowest_layer.overload1 more...]]``
  61640. Get a const reference to the lowest layer.
  61641. const lowest_layer_type & ``[link boost_asio.reference.windows__basic_random_access_handle.lowest_layer.overload2 lowest_layer]``() const;
  61642. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.lowest_layer.overload2 more...]]``
  61643. [section:overload1 windows::basic_random_access_handle::lowest_layer (1 of 2 overloads)]
  61644. ['Inherited from windows::basic_overlapped_handle.]
  61645. Get a reference to the lowest layer.
  61646. lowest_layer_type & lowest_layer();
  61647. This function returns a reference to the lowest layer in a stack of layers. Since an overlapped\_handle cannot contain any further layers, it simply returns a reference to itself.
  61648. [heading Return Value]
  61649. A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
  61650. [endsect]
  61651. [section:overload2 windows::basic_random_access_handle::lowest_layer (2 of 2 overloads)]
  61652. ['Inherited from windows::basic_overlapped_handle.]
  61653. Get a const reference to the lowest layer.
  61654. const lowest_layer_type & lowest_layer() const;
  61655. This function returns a const reference to the lowest layer in a stack of layers. Since an overlapped\_handle cannot contain any further layers, it simply returns a reference to itself.
  61656. [heading Return Value]
  61657. A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
  61658. [endsect]
  61659. [endsect]
  61660. [section:lowest_layer_type windows::basic_random_access_handle::lowest_layer_type]
  61661. ['Inherited from windows::basic_overlapped_handle.]
  61662. [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.lowest_layer_type..lowest_layer_type..windows::basic_random_access_handle]
  61663. An overlapped\_handle is always the lowest layer.
  61664. typedef basic_overlapped_handle lowest_layer_type;
  61665. [heading Types]
  61666. [table
  61667. [[Name][Description]]
  61668. [
  61669. [[link boost_asio.reference.windows__basic_overlapped_handle__rebind_executor [*rebind_executor]]]
  61670. [Rebinds the handle type to another executor. ]
  61671. ]
  61672. [
  61673. [[link boost_asio.reference.windows__basic_overlapped_handle.executor_type [*executor_type]]]
  61674. [The type of the executor associated with the object. ]
  61675. ]
  61676. [
  61677. [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer_type [*lowest_layer_type]]]
  61678. [An overlapped_handle is always the lowest layer. ]
  61679. ]
  61680. [
  61681. [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle_type [*native_handle_type]]]
  61682. [The native representation of a handle. ]
  61683. ]
  61684. ]
  61685. [heading Member Functions]
  61686. [table
  61687. [[Name][Description]]
  61688. [
  61689. [[link boost_asio.reference.windows__basic_overlapped_handle.assign [*assign]]]
  61690. [Assign an existing native handle to the handle. ]
  61691. ]
  61692. [
  61693. [[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle [*basic_overlapped_handle]]]
  61694. [Construct an overlapped handle without opening it.
  61695. [hr]
  61696. Construct an overlapped handle on an existing native handle.
  61697. [hr]
  61698. Move-construct an overlapped handle from another. ]
  61699. ]
  61700. [
  61701. [[link boost_asio.reference.windows__basic_overlapped_handle.cancel [*cancel]]]
  61702. [Cancel all asynchronous operations associated with the handle. ]
  61703. ]
  61704. [
  61705. [[link boost_asio.reference.windows__basic_overlapped_handle.close [*close]]]
  61706. [Close the handle. ]
  61707. ]
  61708. [
  61709. [[link boost_asio.reference.windows__basic_overlapped_handle.get_executor [*get_executor]]]
  61710. [Get the executor associated with the object. ]
  61711. ]
  61712. [
  61713. [[link boost_asio.reference.windows__basic_overlapped_handle.is_open [*is_open]]]
  61714. [Determine whether the handle is open. ]
  61715. ]
  61716. [
  61717. [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer [*lowest_layer]]]
  61718. [Get a reference to the lowest layer.
  61719. [hr]
  61720. Get a const reference to the lowest layer. ]
  61721. ]
  61722. [
  61723. [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle [*native_handle]]]
  61724. [Get the native handle representation. ]
  61725. ]
  61726. [
  61727. [[link boost_asio.reference.windows__basic_overlapped_handle.operator_eq_ [*operator=]]]
  61728. [Move-assign an overlapped handle from another. ]
  61729. ]
  61730. ]
  61731. [heading Protected Member Functions]
  61732. [table
  61733. [[Name][Description]]
  61734. [
  61735. [[link boost_asio.reference.windows__basic_overlapped_handle._basic_overlapped_handle [*~basic_overlapped_handle]]]
  61736. [Protected destructor to prevent deletion through this type. ]
  61737. ]
  61738. ]
  61739. [heading Protected Data Members]
  61740. [table
  61741. [[Name][Description]]
  61742. [
  61743. [[link boost_asio.reference.windows__basic_overlapped_handle.impl_ [*impl_]]]
  61744. []
  61745. ]
  61746. ]
  61747. The [link boost_asio.reference.windows__overlapped_handle `windows::overlapped_handle`] class provides the ability to wrap a Windows handle. The underlying object referred to by the handle must support overlapped I/O.
  61748. [heading Thread Safety]
  61749. ['Distinct] ['objects:] Safe.
  61750. ['Shared] ['objects:] Unsafe.
  61751. [heading Requirements]
  61752. ['Header: ][^boost/asio/windows/basic_random_access_handle.hpp]
  61753. ['Convenience header: ][^boost/asio.hpp]
  61754. [endsect]
  61755. [section:native_handle windows::basic_random_access_handle::native_handle]
  61756. ['Inherited from windows::basic_overlapped_handle.]
  61757. [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.native_handle..native_handle..windows::basic_random_access_handle]
  61758. Get the native handle representation.
  61759. native_handle_type native_handle();
  61760. This function may be used to obtain the underlying representation of the handle. This is intended to allow access to native handle functionality that is not otherwise provided.
  61761. [endsect]
  61762. [section:native_handle_type windows::basic_random_access_handle::native_handle_type]
  61763. [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.native_handle_type..native_handle_type..windows::basic_random_access_handle]
  61764. The native representation of a handle.
  61765. typedef implementation_defined native_handle_type;
  61766. [heading Requirements]
  61767. ['Header: ][^boost/asio/windows/basic_random_access_handle.hpp]
  61768. ['Convenience header: ][^boost/asio.hpp]
  61769. [endsect]
  61770. [section:operator_eq_ windows::basic_random_access_handle::operator=]
  61771. [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.operator_eq_..operator=..windows::basic_random_access_handle]
  61772. Move-assign a random-access handle from another.
  61773. basic_random_access_handle & operator=(
  61774. basic_random_access_handle && other);
  61775. This assignment operator moves a random-access handle from one object to another.
  61776. [heading Parameters]
  61777. [variablelist
  61778. [[other][The other random-access handle object from which the move will occur.]]
  61779. ]
  61780. [heading Remarks]
  61781. Following the move, the moved-from object is in the same state as if constructed using the `basic_random_access_handle(const executor_type&)` constructor.
  61782. [endsect]
  61783. [section:read_some_at windows::basic_random_access_handle::read_some_at]
  61784. [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.read_some_at..read_some_at..windows::basic_random_access_handle]
  61785. Read some data from the handle at the specified offset.
  61786. template<
  61787. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  61788. std::size_t ``[link boost_asio.reference.windows__basic_random_access_handle.read_some_at.overload1 read_some_at]``(
  61789. uint64_t offset,
  61790. const MutableBufferSequence & buffers);
  61791. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.read_some_at.overload1 more...]]``
  61792. template<
  61793. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  61794. std::size_t ``[link boost_asio.reference.windows__basic_random_access_handle.read_some_at.overload2 read_some_at]``(
  61795. uint64_t offset,
  61796. const MutableBufferSequence & buffers,
  61797. boost::system::error_code & ec);
  61798. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.read_some_at.overload2 more...]]``
  61799. [section:overload1 windows::basic_random_access_handle::read_some_at (1 of 2 overloads)]
  61800. Read some data from the handle at the specified offset.
  61801. template<
  61802. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  61803. std::size_t read_some_at(
  61804. uint64_t offset,
  61805. const MutableBufferSequence & buffers);
  61806. This function is used to read data from the random-access handle. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
  61807. [heading Parameters]
  61808. [variablelist
  61809. [[offset][The offset at which the data will be read.]]
  61810. [[buffers][One or more buffers into which the data will be read.]]
  61811. ]
  61812. [heading Return Value]
  61813. The number of bytes read.
  61814. [heading Exceptions]
  61815. [variablelist
  61816. [[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
  61817. ]
  61818. [heading Remarks]
  61819. The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read_at `read_at`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
  61820. [heading Example]
  61821. To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  61822. handle.read_some_at(42, boost::asio::buffer(data, size));
  61823. See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  61824. [endsect]
  61825. [section:overload2 windows::basic_random_access_handle::read_some_at (2 of 2 overloads)]
  61826. Read some data from the handle at the specified offset.
  61827. template<
  61828. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  61829. std::size_t read_some_at(
  61830. uint64_t offset,
  61831. const MutableBufferSequence & buffers,
  61832. boost::system::error_code & ec);
  61833. This function is used to read data from the random-access handle. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
  61834. [heading Parameters]
  61835. [variablelist
  61836. [[offset][The offset at which the data will be read.]]
  61837. [[buffers][One or more buffers into which the data will be read.]]
  61838. [[ec][Set to indicate what error occurred, if any.]]
  61839. ]
  61840. [heading Return Value]
  61841. The number of bytes read. Returns 0 if an error occurred.
  61842. [heading Remarks]
  61843. The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read_at `read_at`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
  61844. [endsect]
  61845. [endsect]
  61846. [section:write_some_at windows::basic_random_access_handle::write_some_at]
  61847. [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle.write_some_at..write_some_at..windows::basic_random_access_handle]
  61848. Write some data to the handle at the specified offset.
  61849. template<
  61850. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  61851. std::size_t ``[link boost_asio.reference.windows__basic_random_access_handle.write_some_at.overload1 write_some_at]``(
  61852. uint64_t offset,
  61853. const ConstBufferSequence & buffers);
  61854. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.write_some_at.overload1 more...]]``
  61855. template<
  61856. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  61857. std::size_t ``[link boost_asio.reference.windows__basic_random_access_handle.write_some_at.overload2 write_some_at]``(
  61858. uint64_t offset,
  61859. const ConstBufferSequence & buffers,
  61860. boost::system::error_code & ec);
  61861. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.write_some_at.overload2 more...]]``
  61862. [section:overload1 windows::basic_random_access_handle::write_some_at (1 of 2 overloads)]
  61863. Write some data to the handle at the specified offset.
  61864. template<
  61865. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  61866. std::size_t write_some_at(
  61867. uint64_t offset,
  61868. const ConstBufferSequence & buffers);
  61869. This function is used to write data to the random-access handle. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
  61870. [heading Parameters]
  61871. [variablelist
  61872. [[offset][The offset at which the data will be written.]]
  61873. [[buffers][One or more data buffers to be written to the handle.]]
  61874. ]
  61875. [heading Return Value]
  61876. The number of bytes written.
  61877. [heading Exceptions]
  61878. [variablelist
  61879. [[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
  61880. ]
  61881. [heading Remarks]
  61882. The write\_some\_at operation may not write all of the data. Consider using the [link boost_asio.reference.write_at `write_at`] function if you need to ensure that all data is written before the blocking operation completes.
  61883. [heading Example]
  61884. To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  61885. handle.write_some_at(42, boost::asio::buffer(data, size));
  61886. See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  61887. [endsect]
  61888. [section:overload2 windows::basic_random_access_handle::write_some_at (2 of 2 overloads)]
  61889. Write some data to the handle at the specified offset.
  61890. template<
  61891. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  61892. std::size_t write_some_at(
  61893. uint64_t offset,
  61894. const ConstBufferSequence & buffers,
  61895. boost::system::error_code & ec);
  61896. This function is used to write data to the random-access handle. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
  61897. [heading Parameters]
  61898. [variablelist
  61899. [[offset][The offset at which the data will be written.]]
  61900. [[buffers][One or more data buffers to be written to the handle.]]
  61901. [[ec][Set to indicate what error occurred, if any.]]
  61902. ]
  61903. [heading Return Value]
  61904. The number of bytes written. Returns 0 if an error occurred.
  61905. [heading Remarks]
  61906. The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write_at `write_at`] function if you need to ensure that all data is written before the blocking operation completes.
  61907. [endsect]
  61908. [endsect]
  61909. [endsect]
  61910. [section:windows__basic_random_access_handle__rebind_executor windows::basic_random_access_handle::rebind_executor]
  61911. Rebinds the handle type to another executor.
  61912. template<
  61913. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  61914. struct rebind_executor
  61915. [heading Types]
  61916. [table
  61917. [[Name][Description]]
  61918. [
  61919. [[link boost_asio.reference.windows__basic_random_access_handle__rebind_executor.other [*other]]]
  61920. [The handle type when rebound to the specified executor. ]
  61921. ]
  61922. ]
  61923. [heading Requirements]
  61924. ['Header: ][^boost/asio/windows/basic_random_access_handle.hpp]
  61925. ['Convenience header: ][^boost/asio.hpp]
  61926. [section:other windows::basic_random_access_handle::rebind_executor::other]
  61927. [indexterm2 boost_asio.indexterm.windows__basic_random_access_handle__rebind_executor.other..other..windows::basic_random_access_handle::rebind_executor]
  61928. The handle type when rebound to the specified executor.
  61929. typedef basic_random_access_handle< Executor1 > other;
  61930. [heading Types]
  61931. [table
  61932. [[Name][Description]]
  61933. [
  61934. [[link boost_asio.reference.windows__basic_random_access_handle__rebind_executor [*rebind_executor]]]
  61935. [Rebinds the handle type to another executor. ]
  61936. ]
  61937. [
  61938. [[link boost_asio.reference.windows__basic_random_access_handle.executor_type [*executor_type]]]
  61939. [The type of the executor associated with the object. ]
  61940. ]
  61941. [
  61942. [[link boost_asio.reference.windows__basic_random_access_handle.lowest_layer_type [*lowest_layer_type]]]
  61943. [An overlapped_handle is always the lowest layer. ]
  61944. ]
  61945. [
  61946. [[link boost_asio.reference.windows__basic_random_access_handle.native_handle_type [*native_handle_type]]]
  61947. [The native representation of a handle. ]
  61948. ]
  61949. ]
  61950. [heading Member Functions]
  61951. [table
  61952. [[Name][Description]]
  61953. [
  61954. [[link boost_asio.reference.windows__basic_random_access_handle.assign [*assign]]]
  61955. [Assign an existing native handle to the handle. ]
  61956. ]
  61957. [
  61958. [[link boost_asio.reference.windows__basic_random_access_handle.async_read_some_at [*async_read_some_at]]]
  61959. [Start an asynchronous read at the specified offset. ]
  61960. ]
  61961. [
  61962. [[link boost_asio.reference.windows__basic_random_access_handle.async_write_some_at [*async_write_some_at]]]
  61963. [Start an asynchronous write at the specified offset. ]
  61964. ]
  61965. [
  61966. [[link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle [*basic_random_access_handle]]]
  61967. [Construct a random-access handle without opening it.
  61968. [hr]
  61969. Construct a random-access handle on an existing native handle.
  61970. [hr]
  61971. Move-construct a random-access handle from another. ]
  61972. ]
  61973. [
  61974. [[link boost_asio.reference.windows__basic_random_access_handle.cancel [*cancel]]]
  61975. [Cancel all asynchronous operations associated with the handle. ]
  61976. ]
  61977. [
  61978. [[link boost_asio.reference.windows__basic_random_access_handle.close [*close]]]
  61979. [Close the handle. ]
  61980. ]
  61981. [
  61982. [[link boost_asio.reference.windows__basic_random_access_handle.get_executor [*get_executor]]]
  61983. [Get the executor associated with the object. ]
  61984. ]
  61985. [
  61986. [[link boost_asio.reference.windows__basic_random_access_handle.is_open [*is_open]]]
  61987. [Determine whether the handle is open. ]
  61988. ]
  61989. [
  61990. [[link boost_asio.reference.windows__basic_random_access_handle.lowest_layer [*lowest_layer]]]
  61991. [Get a reference to the lowest layer.
  61992. [hr]
  61993. Get a const reference to the lowest layer. ]
  61994. ]
  61995. [
  61996. [[link boost_asio.reference.windows__basic_random_access_handle.native_handle [*native_handle]]]
  61997. [Get the native handle representation. ]
  61998. ]
  61999. [
  62000. [[link boost_asio.reference.windows__basic_random_access_handle.operator_eq_ [*operator=]]]
  62001. [Move-assign a random-access handle from another. ]
  62002. ]
  62003. [
  62004. [[link boost_asio.reference.windows__basic_random_access_handle.read_some_at [*read_some_at]]]
  62005. [Read some data from the handle at the specified offset. ]
  62006. ]
  62007. [
  62008. [[link boost_asio.reference.windows__basic_random_access_handle.write_some_at [*write_some_at]]]
  62009. [Write some data to the handle at the specified offset. ]
  62010. ]
  62011. ]
  62012. [heading Protected Data Members]
  62013. [table
  62014. [[Name][Description]]
  62015. [
  62016. [[link boost_asio.reference.windows__basic_random_access_handle.impl_ [*impl_]]]
  62017. []
  62018. ]
  62019. ]
  62020. The [link boost_asio.reference.windows__basic_random_access_handle `windows::basic_random_access_handle`] class provides asynchronous and blocking random-access handle functionality.
  62021. [heading Thread Safety]
  62022. ['Distinct] ['objects:] Safe.
  62023. ['Shared] ['objects:] Unsafe.
  62024. [heading Requirements]
  62025. ['Header: ][^boost/asio/windows/basic_random_access_handle.hpp]
  62026. ['Convenience header: ][^boost/asio.hpp]
  62027. [endsect]
  62028. [endsect]
  62029. [section:windows__basic_stream_handle windows::basic_stream_handle]
  62030. Provides stream-oriented handle functionality.
  62031. template<
  62032. typename ``[link boost_asio.reference.Executor1 Executor]`` = executor>
  62033. class basic_stream_handle :
  62034. public windows::basic_overlapped_handle< Executor >
  62035. [heading Types]
  62036. [table
  62037. [[Name][Description]]
  62038. [
  62039. [[link boost_asio.reference.windows__basic_stream_handle__rebind_executor [*rebind_executor]]]
  62040. [Rebinds the handle type to another executor. ]
  62041. ]
  62042. [
  62043. [[link boost_asio.reference.windows__basic_stream_handle.executor_type [*executor_type]]]
  62044. [The type of the executor associated with the object. ]
  62045. ]
  62046. [
  62047. [[link boost_asio.reference.windows__basic_stream_handle.lowest_layer_type [*lowest_layer_type]]]
  62048. [An overlapped_handle is always the lowest layer. ]
  62049. ]
  62050. [
  62051. [[link boost_asio.reference.windows__basic_stream_handle.native_handle_type [*native_handle_type]]]
  62052. [The native representation of a handle. ]
  62053. ]
  62054. ]
  62055. [heading Member Functions]
  62056. [table
  62057. [[Name][Description]]
  62058. [
  62059. [[link boost_asio.reference.windows__basic_stream_handle.assign [*assign]]]
  62060. [Assign an existing native handle to the handle. ]
  62061. ]
  62062. [
  62063. [[link boost_asio.reference.windows__basic_stream_handle.async_read_some [*async_read_some]]]
  62064. [Start an asynchronous read. ]
  62065. ]
  62066. [
  62067. [[link boost_asio.reference.windows__basic_stream_handle.async_write_some [*async_write_some]]]
  62068. [Start an asynchronous write. ]
  62069. ]
  62070. [
  62071. [[link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle [*basic_stream_handle]]]
  62072. [Construct a stream handle without opening it.
  62073. [hr]
  62074. Construct a stream handle on an existing native handle.
  62075. [hr]
  62076. Move-construct a stream handle from another. ]
  62077. ]
  62078. [
  62079. [[link boost_asio.reference.windows__basic_stream_handle.cancel [*cancel]]]
  62080. [Cancel all asynchronous operations associated with the handle. ]
  62081. ]
  62082. [
  62083. [[link boost_asio.reference.windows__basic_stream_handle.close [*close]]]
  62084. [Close the handle. ]
  62085. ]
  62086. [
  62087. [[link boost_asio.reference.windows__basic_stream_handle.get_executor [*get_executor]]]
  62088. [Get the executor associated with the object. ]
  62089. ]
  62090. [
  62091. [[link boost_asio.reference.windows__basic_stream_handle.is_open [*is_open]]]
  62092. [Determine whether the handle is open. ]
  62093. ]
  62094. [
  62095. [[link boost_asio.reference.windows__basic_stream_handle.lowest_layer [*lowest_layer]]]
  62096. [Get a reference to the lowest layer.
  62097. [hr]
  62098. Get a const reference to the lowest layer. ]
  62099. ]
  62100. [
  62101. [[link boost_asio.reference.windows__basic_stream_handle.native_handle [*native_handle]]]
  62102. [Get the native handle representation. ]
  62103. ]
  62104. [
  62105. [[link boost_asio.reference.windows__basic_stream_handle.operator_eq_ [*operator=]]]
  62106. [Move-assign a stream handle from another. ]
  62107. ]
  62108. [
  62109. [[link boost_asio.reference.windows__basic_stream_handle.read_some [*read_some]]]
  62110. [Read some data from the handle. ]
  62111. ]
  62112. [
  62113. [[link boost_asio.reference.windows__basic_stream_handle.write_some [*write_some]]]
  62114. [Write some data to the handle. ]
  62115. ]
  62116. ]
  62117. [heading Protected Data Members]
  62118. [table
  62119. [[Name][Description]]
  62120. [
  62121. [[link boost_asio.reference.windows__basic_stream_handle.impl_ [*impl_]]]
  62122. []
  62123. ]
  62124. ]
  62125. The [link boost_asio.reference.windows__basic_stream_handle `windows::basic_stream_handle`] class provides asynchronous and blocking stream-oriented handle functionality.
  62126. [heading Thread Safety]
  62127. ['Distinct] ['objects:] Safe.
  62128. ['Shared] ['objects:] Unsafe.
  62129. [heading Requirements]
  62130. ['Header: ][^boost/asio/windows/basic_stream_handle.hpp]
  62131. ['Convenience header: ][^boost/asio.hpp]
  62132. [section:assign windows::basic_stream_handle::assign]
  62133. [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.assign..assign..windows::basic_stream_handle]
  62134. Assign an existing native handle to the handle.
  62135. void ``[link boost_asio.reference.windows__basic_stream_handle.assign.overload1 assign]``(
  62136. const native_handle_type & handle);
  62137. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.assign.overload1 more...]]``
  62138. void ``[link boost_asio.reference.windows__basic_stream_handle.assign.overload2 assign]``(
  62139. const native_handle_type & handle,
  62140. boost::system::error_code & ec);
  62141. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.assign.overload2 more...]]``
  62142. [section:overload1 windows::basic_stream_handle::assign (1 of 2 overloads)]
  62143. ['Inherited from windows::basic_overlapped_handle.]
  62144. Assign an existing native handle to the handle.
  62145. void assign(
  62146. const native_handle_type & handle);
  62147. [endsect]
  62148. [section:overload2 windows::basic_stream_handle::assign (2 of 2 overloads)]
  62149. ['Inherited from windows::basic_overlapped_handle.]
  62150. Assign an existing native handle to the handle.
  62151. void assign(
  62152. const native_handle_type & handle,
  62153. boost::system::error_code & ec);
  62154. [endsect]
  62155. [endsect]
  62156. [section:async_read_some windows::basic_stream_handle::async_read_some]
  62157. [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.async_read_some..async_read_some..windows::basic_stream_handle]
  62158. Start an asynchronous read.
  62159. template<
  62160. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
  62161. typename ``[link boost_asio.reference.ReadHandler ReadHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  62162. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_some(
  62163. const MutableBufferSequence & buffers,
  62164. ReadHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  62165. This function is used to asynchronously read data from the stream handle. The function call always returns immediately.
  62166. [heading Parameters]
  62167. [variablelist
  62168. [[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.]]
  62169. [[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:
  62170. ``
  62171. void handler(
  62172. const boost::system::error_code& error, // Result of operation.
  62173. std::size_t bytes_transferred // Number of bytes read.
  62174. );
  62175. ``
  62176. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  62177. ]
  62178. [heading Remarks]
  62179. The read operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.async_read `async_read`] function if you need to ensure that the requested amount of data is read before the asynchronous operation completes.
  62180. [heading Example]
  62181. To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  62182. handle.async_read_some(boost::asio::buffer(data, size), handler);
  62183. See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  62184. [endsect]
  62185. [section:async_write_some windows::basic_stream_handle::async_write_some]
  62186. [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.async_write_some..async_write_some..windows::basic_stream_handle]
  62187. Start an asynchronous write.
  62188. template<
  62189. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  62190. typename ``[link boost_asio.reference.WriteHandler WriteHandler]`` = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``>
  62191. ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_some(
  62192. const ConstBufferSequence & buffers,
  62193. WriteHandler && handler = ``[link boost_asio.reference.asynchronous_operations.default_completion_tokens ['DEFAULT]]``);
  62194. This function is used to asynchronously write data to the stream handle. The function call always returns immediately.
  62195. [heading Parameters]
  62196. [variablelist
  62197. [[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.]]
  62198. [[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:
  62199. ``
  62200. void handler(
  62201. const boost::system::error_code& error, // Result of operation.
  62202. std::size_t bytes_transferred // Number of bytes written.
  62203. );
  62204. ``
  62205. Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using [link boost_asio.reference.post `post`].]]
  62206. ]
  62207. [heading Remarks]
  62208. The write operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.async_write `async_write`] function if you need to ensure that all data is written before the asynchronous operation completes.
  62209. [heading Example]
  62210. To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  62211. handle.async_write_some(boost::asio::buffer(data, size), handler);
  62212. See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  62213. [endsect]
  62214. [section:basic_stream_handle windows::basic_stream_handle::basic_stream_handle]
  62215. [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.basic_stream_handle..basic_stream_handle..windows::basic_stream_handle]
  62216. Construct a stream handle without opening it.
  62217. explicit ``[link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload1 basic_stream_handle]``(
  62218. const executor_type & ex);
  62219. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload1 more...]]``
  62220. template<
  62221. typename ExecutionContext>
  62222. explicit ``[link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload2 basic_stream_handle]``(
  62223. ExecutionContext & context,
  62224. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value, basic_stream_handle >::type * = 0);
  62225. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload2 more...]]``
  62226. Construct a stream handle on an existing native handle.
  62227. ``[link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload3 basic_stream_handle]``(
  62228. const executor_type & ex,
  62229. const native_handle_type & handle);
  62230. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload3 more...]]``
  62231. template<
  62232. typename ExecutionContext>
  62233. ``[link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload4 basic_stream_handle]``(
  62234. ExecutionContext & context,
  62235. const native_handle_type & handle,
  62236. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  62237. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload4 more...]]``
  62238. Move-construct a stream handle from another.
  62239. ``[link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload5 basic_stream_handle]``(
  62240. basic_stream_handle && other);
  62241. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload5 more...]]``
  62242. [section:overload1 windows::basic_stream_handle::basic_stream_handle (1 of 5 overloads)]
  62243. Construct a stream handle without opening it.
  62244. basic_stream_handle(
  62245. const executor_type & ex);
  62246. This constructor creates a stream handle without opening it.
  62247. [heading Parameters]
  62248. [variablelist
  62249. [[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. ]]
  62250. ]
  62251. [endsect]
  62252. [section:overload2 windows::basic_stream_handle::basic_stream_handle (2 of 5 overloads)]
  62253. Construct a stream handle without opening it.
  62254. template<
  62255. typename ExecutionContext>
  62256. basic_stream_handle(
  62257. ExecutionContext & context,
  62258. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value, basic_stream_handle >::type * = 0);
  62259. This constructor creates a stream handle without opening it. The handle needs to be opened or assigned before data can be sent or received on it.
  62260. [heading Parameters]
  62261. [variablelist
  62262. [[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. ]]
  62263. ]
  62264. [endsect]
  62265. [section:overload3 windows::basic_stream_handle::basic_stream_handle (3 of 5 overloads)]
  62266. Construct a stream handle on an existing native handle.
  62267. basic_stream_handle(
  62268. const executor_type & ex,
  62269. const native_handle_type & handle);
  62270. This constructor creates a stream handle object to hold an existing native handle.
  62271. [heading Parameters]
  62272. [variablelist
  62273. [[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.]]
  62274. [[handle][The new underlying handle implementation.]]
  62275. ]
  62276. [heading Exceptions]
  62277. [variablelist
  62278. [[boost::system::system_error][Thrown on failure. ]]
  62279. ]
  62280. [endsect]
  62281. [section:overload4 windows::basic_stream_handle::basic_stream_handle (4 of 5 overloads)]
  62282. Construct a stream handle on an existing native handle.
  62283. template<
  62284. typename ExecutionContext>
  62285. basic_stream_handle(
  62286. ExecutionContext & context,
  62287. const native_handle_type & handle,
  62288. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  62289. This constructor creates a stream handle object to hold an existing native handle.
  62290. [heading Parameters]
  62291. [variablelist
  62292. [[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.]]
  62293. [[handle][The new underlying handle implementation.]]
  62294. ]
  62295. [heading Exceptions]
  62296. [variablelist
  62297. [[boost::system::system_error][Thrown on failure. ]]
  62298. ]
  62299. [endsect]
  62300. [section:overload5 windows::basic_stream_handle::basic_stream_handle (5 of 5 overloads)]
  62301. Move-construct a stream handle from another.
  62302. basic_stream_handle(
  62303. basic_stream_handle && other);
  62304. This constructor moves a stream handle from one object to another.
  62305. [heading Parameters]
  62306. [variablelist
  62307. [[other][The other stream handle object from which the move will occur.]]
  62308. ]
  62309. [heading Remarks]
  62310. Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_handle(const executor_type&)` constructor.
  62311. [endsect]
  62312. [endsect]
  62313. [section:cancel windows::basic_stream_handle::cancel]
  62314. [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.cancel..cancel..windows::basic_stream_handle]
  62315. Cancel all asynchronous operations associated with the handle.
  62316. void ``[link boost_asio.reference.windows__basic_stream_handle.cancel.overload1 cancel]``();
  62317. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.cancel.overload1 more...]]``
  62318. void ``[link boost_asio.reference.windows__basic_stream_handle.cancel.overload2 cancel]``(
  62319. boost::system::error_code & ec);
  62320. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.cancel.overload2 more...]]``
  62321. [section:overload1 windows::basic_stream_handle::cancel (1 of 2 overloads)]
  62322. ['Inherited from windows::basic_overlapped_handle.]
  62323. Cancel all asynchronous operations associated with the handle.
  62324. void cancel();
  62325. This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
  62326. [heading Exceptions]
  62327. [variablelist
  62328. [[boost::system::system_error][Thrown on failure. ]]
  62329. ]
  62330. [endsect]
  62331. [section:overload2 windows::basic_stream_handle::cancel (2 of 2 overloads)]
  62332. ['Inherited from windows::basic_overlapped_handle.]
  62333. Cancel all asynchronous operations associated with the handle.
  62334. void cancel(
  62335. boost::system::error_code & ec);
  62336. This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
  62337. [heading Parameters]
  62338. [variablelist
  62339. [[ec][Set to indicate what error occurred, if any. ]]
  62340. ]
  62341. [endsect]
  62342. [endsect]
  62343. [section:close windows::basic_stream_handle::close]
  62344. [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.close..close..windows::basic_stream_handle]
  62345. Close the handle.
  62346. void ``[link boost_asio.reference.windows__basic_stream_handle.close.overload1 close]``();
  62347. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.close.overload1 more...]]``
  62348. void ``[link boost_asio.reference.windows__basic_stream_handle.close.overload2 close]``(
  62349. boost::system::error_code & ec);
  62350. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.close.overload2 more...]]``
  62351. [section:overload1 windows::basic_stream_handle::close (1 of 2 overloads)]
  62352. ['Inherited from windows::basic_overlapped_handle.]
  62353. Close the handle.
  62354. void close();
  62355. This function is used to close the handle. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
  62356. [heading Exceptions]
  62357. [variablelist
  62358. [[boost::system::system_error][Thrown on failure. ]]
  62359. ]
  62360. [endsect]
  62361. [section:overload2 windows::basic_stream_handle::close (2 of 2 overloads)]
  62362. ['Inherited from windows::basic_overlapped_handle.]
  62363. Close the handle.
  62364. void close(
  62365. boost::system::error_code & ec);
  62366. This function is used to close the handle. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
  62367. [heading Parameters]
  62368. [variablelist
  62369. [[ec][Set to indicate what error occurred, if any. ]]
  62370. ]
  62371. [endsect]
  62372. [endsect]
  62373. [section:executor_type windows::basic_stream_handle::executor_type]
  62374. [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.executor_type..executor_type..windows::basic_stream_handle]
  62375. The type of the executor associated with the object.
  62376. typedef Executor executor_type;
  62377. [heading Requirements]
  62378. ['Header: ][^boost/asio/windows/basic_stream_handle.hpp]
  62379. ['Convenience header: ][^boost/asio.hpp]
  62380. [endsect]
  62381. [section:get_executor windows::basic_stream_handle::get_executor]
  62382. ['Inherited from windows::basic_overlapped_handle.]
  62383. [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.get_executor..get_executor..windows::basic_stream_handle]
  62384. Get the executor associated with the object.
  62385. executor_type get_executor();
  62386. [endsect]
  62387. [section:impl_ windows::basic_stream_handle::impl_]
  62388. ['Inherited from windows::basic_overlapped_handle.]
  62389. [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.impl_..impl_..windows::basic_stream_handle]
  62390. boost::asio::detail::io_object_impl< boost::asio::detail::win_iocp_handle_service, Executor > impl_;
  62391. [endsect]
  62392. [section:is_open windows::basic_stream_handle::is_open]
  62393. ['Inherited from windows::basic_overlapped_handle.]
  62394. [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.is_open..is_open..windows::basic_stream_handle]
  62395. Determine whether the handle is open.
  62396. bool is_open() const;
  62397. [endsect]
  62398. [section:lowest_layer windows::basic_stream_handle::lowest_layer]
  62399. [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.lowest_layer..lowest_layer..windows::basic_stream_handle]
  62400. Get a reference to the lowest layer.
  62401. lowest_layer_type & ``[link boost_asio.reference.windows__basic_stream_handle.lowest_layer.overload1 lowest_layer]``();
  62402. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.lowest_layer.overload1 more...]]``
  62403. Get a const reference to the lowest layer.
  62404. const lowest_layer_type & ``[link boost_asio.reference.windows__basic_stream_handle.lowest_layer.overload2 lowest_layer]``() const;
  62405. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.lowest_layer.overload2 more...]]``
  62406. [section:overload1 windows::basic_stream_handle::lowest_layer (1 of 2 overloads)]
  62407. ['Inherited from windows::basic_overlapped_handle.]
  62408. Get a reference to the lowest layer.
  62409. lowest_layer_type & lowest_layer();
  62410. This function returns a reference to the lowest layer in a stack of layers. Since an overlapped\_handle cannot contain any further layers, it simply returns a reference to itself.
  62411. [heading Return Value]
  62412. A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
  62413. [endsect]
  62414. [section:overload2 windows::basic_stream_handle::lowest_layer (2 of 2 overloads)]
  62415. ['Inherited from windows::basic_overlapped_handle.]
  62416. Get a const reference to the lowest layer.
  62417. const lowest_layer_type & lowest_layer() const;
  62418. This function returns a const reference to the lowest layer in a stack of layers. Since an overlapped\_handle cannot contain any further layers, it simply returns a reference to itself.
  62419. [heading Return Value]
  62420. A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
  62421. [endsect]
  62422. [endsect]
  62423. [section:lowest_layer_type windows::basic_stream_handle::lowest_layer_type]
  62424. ['Inherited from windows::basic_overlapped_handle.]
  62425. [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.lowest_layer_type..lowest_layer_type..windows::basic_stream_handle]
  62426. An overlapped\_handle is always the lowest layer.
  62427. typedef basic_overlapped_handle lowest_layer_type;
  62428. [heading Types]
  62429. [table
  62430. [[Name][Description]]
  62431. [
  62432. [[link boost_asio.reference.windows__basic_overlapped_handle__rebind_executor [*rebind_executor]]]
  62433. [Rebinds the handle type to another executor. ]
  62434. ]
  62435. [
  62436. [[link boost_asio.reference.windows__basic_overlapped_handle.executor_type [*executor_type]]]
  62437. [The type of the executor associated with the object. ]
  62438. ]
  62439. [
  62440. [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer_type [*lowest_layer_type]]]
  62441. [An overlapped_handle is always the lowest layer. ]
  62442. ]
  62443. [
  62444. [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle_type [*native_handle_type]]]
  62445. [The native representation of a handle. ]
  62446. ]
  62447. ]
  62448. [heading Member Functions]
  62449. [table
  62450. [[Name][Description]]
  62451. [
  62452. [[link boost_asio.reference.windows__basic_overlapped_handle.assign [*assign]]]
  62453. [Assign an existing native handle to the handle. ]
  62454. ]
  62455. [
  62456. [[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle [*basic_overlapped_handle]]]
  62457. [Construct an overlapped handle without opening it.
  62458. [hr]
  62459. Construct an overlapped handle on an existing native handle.
  62460. [hr]
  62461. Move-construct an overlapped handle from another. ]
  62462. ]
  62463. [
  62464. [[link boost_asio.reference.windows__basic_overlapped_handle.cancel [*cancel]]]
  62465. [Cancel all asynchronous operations associated with the handle. ]
  62466. ]
  62467. [
  62468. [[link boost_asio.reference.windows__basic_overlapped_handle.close [*close]]]
  62469. [Close the handle. ]
  62470. ]
  62471. [
  62472. [[link boost_asio.reference.windows__basic_overlapped_handle.get_executor [*get_executor]]]
  62473. [Get the executor associated with the object. ]
  62474. ]
  62475. [
  62476. [[link boost_asio.reference.windows__basic_overlapped_handle.is_open [*is_open]]]
  62477. [Determine whether the handle is open. ]
  62478. ]
  62479. [
  62480. [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer [*lowest_layer]]]
  62481. [Get a reference to the lowest layer.
  62482. [hr]
  62483. Get a const reference to the lowest layer. ]
  62484. ]
  62485. [
  62486. [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle [*native_handle]]]
  62487. [Get the native handle representation. ]
  62488. ]
  62489. [
  62490. [[link boost_asio.reference.windows__basic_overlapped_handle.operator_eq_ [*operator=]]]
  62491. [Move-assign an overlapped handle from another. ]
  62492. ]
  62493. ]
  62494. [heading Protected Member Functions]
  62495. [table
  62496. [[Name][Description]]
  62497. [
  62498. [[link boost_asio.reference.windows__basic_overlapped_handle._basic_overlapped_handle [*~basic_overlapped_handle]]]
  62499. [Protected destructor to prevent deletion through this type. ]
  62500. ]
  62501. ]
  62502. [heading Protected Data Members]
  62503. [table
  62504. [[Name][Description]]
  62505. [
  62506. [[link boost_asio.reference.windows__basic_overlapped_handle.impl_ [*impl_]]]
  62507. []
  62508. ]
  62509. ]
  62510. The [link boost_asio.reference.windows__overlapped_handle `windows::overlapped_handle`] class provides the ability to wrap a Windows handle. The underlying object referred to by the handle must support overlapped I/O.
  62511. [heading Thread Safety]
  62512. ['Distinct] ['objects:] Safe.
  62513. ['Shared] ['objects:] Unsafe.
  62514. [heading Requirements]
  62515. ['Header: ][^boost/asio/windows/basic_stream_handle.hpp]
  62516. ['Convenience header: ][^boost/asio.hpp]
  62517. [endsect]
  62518. [section:native_handle windows::basic_stream_handle::native_handle]
  62519. ['Inherited from windows::basic_overlapped_handle.]
  62520. [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.native_handle..native_handle..windows::basic_stream_handle]
  62521. Get the native handle representation.
  62522. native_handle_type native_handle();
  62523. This function may be used to obtain the underlying representation of the handle. This is intended to allow access to native handle functionality that is not otherwise provided.
  62524. [endsect]
  62525. [section:native_handle_type windows::basic_stream_handle::native_handle_type]
  62526. [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.native_handle_type..native_handle_type..windows::basic_stream_handle]
  62527. The native representation of a handle.
  62528. typedef implementation_defined native_handle_type;
  62529. [heading Requirements]
  62530. ['Header: ][^boost/asio/windows/basic_stream_handle.hpp]
  62531. ['Convenience header: ][^boost/asio.hpp]
  62532. [endsect]
  62533. [section:operator_eq_ windows::basic_stream_handle::operator=]
  62534. [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.operator_eq_..operator=..windows::basic_stream_handle]
  62535. Move-assign a stream handle from another.
  62536. basic_stream_handle & operator=(
  62537. basic_stream_handle && other);
  62538. This assignment operator moves a stream handle from one object to another.
  62539. [heading Parameters]
  62540. [variablelist
  62541. [[other][The other stream handle object from which the move will occur.]]
  62542. ]
  62543. [heading Remarks]
  62544. Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_handle(const executor_type&)` constructor.
  62545. [endsect]
  62546. [section:read_some windows::basic_stream_handle::read_some]
  62547. [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.read_some..read_some..windows::basic_stream_handle]
  62548. Read some data from the handle.
  62549. template<
  62550. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  62551. std::size_t ``[link boost_asio.reference.windows__basic_stream_handle.read_some.overload1 read_some]``(
  62552. const MutableBufferSequence & buffers);
  62553. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.read_some.overload1 more...]]``
  62554. template<
  62555. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  62556. std::size_t ``[link boost_asio.reference.windows__basic_stream_handle.read_some.overload2 read_some]``(
  62557. const MutableBufferSequence & buffers,
  62558. boost::system::error_code & ec);
  62559. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.read_some.overload2 more...]]``
  62560. [section:overload1 windows::basic_stream_handle::read_some (1 of 2 overloads)]
  62561. Read some data from the handle.
  62562. template<
  62563. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  62564. std::size_t read_some(
  62565. const MutableBufferSequence & buffers);
  62566. This function is used to read data from the stream handle. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
  62567. [heading Parameters]
  62568. [variablelist
  62569. [[buffers][One or more buffers into which the data will be read.]]
  62570. ]
  62571. [heading Return Value]
  62572. The number of bytes read.
  62573. [heading Exceptions]
  62574. [variablelist
  62575. [[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
  62576. ]
  62577. [heading Remarks]
  62578. The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
  62579. [heading Example]
  62580. To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  62581. handle.read_some(boost::asio::buffer(data, size));
  62582. See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  62583. [endsect]
  62584. [section:overload2 windows::basic_stream_handle::read_some (2 of 2 overloads)]
  62585. Read some data from the handle.
  62586. template<
  62587. typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
  62588. std::size_t read_some(
  62589. const MutableBufferSequence & buffers,
  62590. boost::system::error_code & ec);
  62591. This function is used to read data from the stream handle. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
  62592. [heading Parameters]
  62593. [variablelist
  62594. [[buffers][One or more buffers into which the data will be read.]]
  62595. [[ec][Set to indicate what error occurred, if any.]]
  62596. ]
  62597. [heading Return Value]
  62598. The number of bytes read. Returns 0 if an error occurred.
  62599. [heading Remarks]
  62600. The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
  62601. [endsect]
  62602. [endsect]
  62603. [section:write_some windows::basic_stream_handle::write_some]
  62604. [indexterm2 boost_asio.indexterm.windows__basic_stream_handle.write_some..write_some..windows::basic_stream_handle]
  62605. Write some data to the handle.
  62606. template<
  62607. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  62608. std::size_t ``[link boost_asio.reference.windows__basic_stream_handle.write_some.overload1 write_some]``(
  62609. const ConstBufferSequence & buffers);
  62610. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.write_some.overload1 more...]]``
  62611. template<
  62612. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  62613. std::size_t ``[link boost_asio.reference.windows__basic_stream_handle.write_some.overload2 write_some]``(
  62614. const ConstBufferSequence & buffers,
  62615. boost::system::error_code & ec);
  62616. `` [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.write_some.overload2 more...]]``
  62617. [section:overload1 windows::basic_stream_handle::write_some (1 of 2 overloads)]
  62618. Write some data to the handle.
  62619. template<
  62620. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  62621. std::size_t write_some(
  62622. const ConstBufferSequence & buffers);
  62623. This function is used to write data to the stream handle. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
  62624. [heading Parameters]
  62625. [variablelist
  62626. [[buffers][One or more data buffers to be written to the handle.]]
  62627. ]
  62628. [heading Return Value]
  62629. The number of bytes written.
  62630. [heading Exceptions]
  62631. [variablelist
  62632. [[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
  62633. ]
  62634. [heading Remarks]
  62635. The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
  62636. [heading Example]
  62637. To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  62638. handle.write_some(boost::asio::buffer(data, size));
  62639. See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  62640. [endsect]
  62641. [section:overload2 windows::basic_stream_handle::write_some (2 of 2 overloads)]
  62642. Write some data to the handle.
  62643. template<
  62644. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  62645. std::size_t write_some(
  62646. const ConstBufferSequence & buffers,
  62647. boost::system::error_code & ec);
  62648. This function is used to write data to the stream handle. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
  62649. [heading Parameters]
  62650. [variablelist
  62651. [[buffers][One or more data buffers to be written to the handle.]]
  62652. [[ec][Set to indicate what error occurred, if any.]]
  62653. ]
  62654. [heading Return Value]
  62655. The number of bytes written. Returns 0 if an error occurred.
  62656. [heading Remarks]
  62657. The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
  62658. [endsect]
  62659. [endsect]
  62660. [endsect]
  62661. [section:windows__basic_stream_handle__rebind_executor windows::basic_stream_handle::rebind_executor]
  62662. Rebinds the handle type to another executor.
  62663. template<
  62664. typename ``[link boost_asio.reference.Executor1 Executor1]``>
  62665. struct rebind_executor
  62666. [heading Types]
  62667. [table
  62668. [[Name][Description]]
  62669. [
  62670. [[link boost_asio.reference.windows__basic_stream_handle__rebind_executor.other [*other]]]
  62671. [The handle type when rebound to the specified executor. ]
  62672. ]
  62673. ]
  62674. [heading Requirements]
  62675. ['Header: ][^boost/asio/windows/basic_stream_handle.hpp]
  62676. ['Convenience header: ][^boost/asio.hpp]
  62677. [section:other windows::basic_stream_handle::rebind_executor::other]
  62678. [indexterm2 boost_asio.indexterm.windows__basic_stream_handle__rebind_executor.other..other..windows::basic_stream_handle::rebind_executor]
  62679. The handle type when rebound to the specified executor.
  62680. typedef basic_stream_handle< Executor1 > other;
  62681. [heading Types]
  62682. [table
  62683. [[Name][Description]]
  62684. [
  62685. [[link boost_asio.reference.windows__basic_stream_handle__rebind_executor [*rebind_executor]]]
  62686. [Rebinds the handle type to another executor. ]
  62687. ]
  62688. [
  62689. [[link boost_asio.reference.windows__basic_stream_handle.executor_type [*executor_type]]]
  62690. [The type of the executor associated with the object. ]
  62691. ]
  62692. [
  62693. [[link boost_asio.reference.windows__basic_stream_handle.lowest_layer_type [*lowest_layer_type]]]
  62694. [An overlapped_handle is always the lowest layer. ]
  62695. ]
  62696. [
  62697. [[link boost_asio.reference.windows__basic_stream_handle.native_handle_type [*native_handle_type]]]
  62698. [The native representation of a handle. ]
  62699. ]
  62700. ]
  62701. [heading Member Functions]
  62702. [table
  62703. [[Name][Description]]
  62704. [
  62705. [[link boost_asio.reference.windows__basic_stream_handle.assign [*assign]]]
  62706. [Assign an existing native handle to the handle. ]
  62707. ]
  62708. [
  62709. [[link boost_asio.reference.windows__basic_stream_handle.async_read_some [*async_read_some]]]
  62710. [Start an asynchronous read. ]
  62711. ]
  62712. [
  62713. [[link boost_asio.reference.windows__basic_stream_handle.async_write_some [*async_write_some]]]
  62714. [Start an asynchronous write. ]
  62715. ]
  62716. [
  62717. [[link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle [*basic_stream_handle]]]
  62718. [Construct a stream handle without opening it.
  62719. [hr]
  62720. Construct a stream handle on an existing native handle.
  62721. [hr]
  62722. Move-construct a stream handle from another. ]
  62723. ]
  62724. [
  62725. [[link boost_asio.reference.windows__basic_stream_handle.cancel [*cancel]]]
  62726. [Cancel all asynchronous operations associated with the handle. ]
  62727. ]
  62728. [
  62729. [[link boost_asio.reference.windows__basic_stream_handle.close [*close]]]
  62730. [Close the handle. ]
  62731. ]
  62732. [
  62733. [[link boost_asio.reference.windows__basic_stream_handle.get_executor [*get_executor]]]
  62734. [Get the executor associated with the object. ]
  62735. ]
  62736. [
  62737. [[link boost_asio.reference.windows__basic_stream_handle.is_open [*is_open]]]
  62738. [Determine whether the handle is open. ]
  62739. ]
  62740. [
  62741. [[link boost_asio.reference.windows__basic_stream_handle.lowest_layer [*lowest_layer]]]
  62742. [Get a reference to the lowest layer.
  62743. [hr]
  62744. Get a const reference to the lowest layer. ]
  62745. ]
  62746. [
  62747. [[link boost_asio.reference.windows__basic_stream_handle.native_handle [*native_handle]]]
  62748. [Get the native handle representation. ]
  62749. ]
  62750. [
  62751. [[link boost_asio.reference.windows__basic_stream_handle.operator_eq_ [*operator=]]]
  62752. [Move-assign a stream handle from another. ]
  62753. ]
  62754. [
  62755. [[link boost_asio.reference.windows__basic_stream_handle.read_some [*read_some]]]
  62756. [Read some data from the handle. ]
  62757. ]
  62758. [
  62759. [[link boost_asio.reference.windows__basic_stream_handle.write_some [*write_some]]]
  62760. [Write some data to the handle. ]
  62761. ]
  62762. ]
  62763. [heading Protected Data Members]
  62764. [table
  62765. [[Name][Description]]
  62766. [
  62767. [[link boost_asio.reference.windows__basic_stream_handle.impl_ [*impl_]]]
  62768. []
  62769. ]
  62770. ]
  62771. The [link boost_asio.reference.windows__basic_stream_handle `windows::basic_stream_handle`] class provides asynchronous and blocking stream-oriented handle functionality.
  62772. [heading Thread Safety]
  62773. ['Distinct] ['objects:] Safe.
  62774. ['Shared] ['objects:] Unsafe.
  62775. [heading Requirements]
  62776. ['Header: ][^boost/asio/windows/basic_stream_handle.hpp]
  62777. ['Convenience header: ][^boost/asio.hpp]
  62778. [endsect]
  62779. [endsect]
  62780. [section:windows__object_handle windows::object_handle]
  62781. [indexterm1 boost_asio.indexterm.windows__object_handle..windows::object_handle]
  62782. Typedef for the typical usage of an object handle.
  62783. typedef basic_object_handle object_handle;
  62784. [heading Types]
  62785. [table
  62786. [[Name][Description]]
  62787. [
  62788. [[link boost_asio.reference.windows__basic_object_handle__rebind_executor [*rebind_executor]]]
  62789. [Rebinds the handle type to another executor. ]
  62790. ]
  62791. [
  62792. [[link boost_asio.reference.windows__basic_object_handle.executor_type [*executor_type]]]
  62793. [The type of the executor associated with the object. ]
  62794. ]
  62795. [
  62796. [[link boost_asio.reference.windows__basic_object_handle.lowest_layer_type [*lowest_layer_type]]]
  62797. [An object handle is always the lowest layer. ]
  62798. ]
  62799. [
  62800. [[link boost_asio.reference.windows__basic_object_handle.native_handle_type [*native_handle_type]]]
  62801. [The native representation of a handle. ]
  62802. ]
  62803. ]
  62804. [heading Member Functions]
  62805. [table
  62806. [[Name][Description]]
  62807. [
  62808. [[link boost_asio.reference.windows__basic_object_handle.assign [*assign]]]
  62809. [Assign an existing native handle to the handle. ]
  62810. ]
  62811. [
  62812. [[link boost_asio.reference.windows__basic_object_handle.async_wait [*async_wait]]]
  62813. [Start an asynchronous wait on the object handle. ]
  62814. ]
  62815. [
  62816. [[link boost_asio.reference.windows__basic_object_handle.basic_object_handle [*basic_object_handle]]]
  62817. [Construct an object handle without opening it.
  62818. [hr]
  62819. Construct an object handle on an existing native handle.
  62820. [hr]
  62821. Move-construct an object handle from another. ]
  62822. ]
  62823. [
  62824. [[link boost_asio.reference.windows__basic_object_handle.cancel [*cancel]]]
  62825. [Cancel all asynchronous operations associated with the handle. ]
  62826. ]
  62827. [
  62828. [[link boost_asio.reference.windows__basic_object_handle.close [*close]]]
  62829. [Close the handle. ]
  62830. ]
  62831. [
  62832. [[link boost_asio.reference.windows__basic_object_handle.get_executor [*get_executor]]]
  62833. [Get the executor associated with the object. ]
  62834. ]
  62835. [
  62836. [[link boost_asio.reference.windows__basic_object_handle.is_open [*is_open]]]
  62837. [Determine whether the handle is open. ]
  62838. ]
  62839. [
  62840. [[link boost_asio.reference.windows__basic_object_handle.lowest_layer [*lowest_layer]]]
  62841. [Get a reference to the lowest layer.
  62842. [hr]
  62843. Get a const reference to the lowest layer. ]
  62844. ]
  62845. [
  62846. [[link boost_asio.reference.windows__basic_object_handle.native_handle [*native_handle]]]
  62847. [Get the native handle representation. ]
  62848. ]
  62849. [
  62850. [[link boost_asio.reference.windows__basic_object_handle.operator_eq_ [*operator=]]]
  62851. [Move-assign an object handle from another. ]
  62852. ]
  62853. [
  62854. [[link boost_asio.reference.windows__basic_object_handle.wait [*wait]]]
  62855. [Perform a blocking wait on the object handle. ]
  62856. ]
  62857. ]
  62858. The [link boost_asio.reference.windows__basic_object_handle `windows::basic_object_handle`] class provides asynchronous and blocking object-oriented handle functionality.
  62859. [heading Thread Safety]
  62860. ['Distinct] ['objects:] Safe.
  62861. ['Shared] ['objects:] Unsafe.
  62862. [heading Requirements]
  62863. ['Header: ][^boost/asio/windows/object_handle.hpp]
  62864. ['Convenience header: ][^boost/asio.hpp]
  62865. [endsect]
  62866. [section:windows__overlapped_handle windows::overlapped_handle]
  62867. [indexterm1 boost_asio.indexterm.windows__overlapped_handle..windows::overlapped_handle]
  62868. Typedef for the typical usage of an overlapped handle.
  62869. typedef basic_overlapped_handle overlapped_handle;
  62870. [heading Types]
  62871. [table
  62872. [[Name][Description]]
  62873. [
  62874. [[link boost_asio.reference.windows__basic_overlapped_handle__rebind_executor [*rebind_executor]]]
  62875. [Rebinds the handle type to another executor. ]
  62876. ]
  62877. [
  62878. [[link boost_asio.reference.windows__basic_overlapped_handle.executor_type [*executor_type]]]
  62879. [The type of the executor associated with the object. ]
  62880. ]
  62881. [
  62882. [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer_type [*lowest_layer_type]]]
  62883. [An overlapped_handle is always the lowest layer. ]
  62884. ]
  62885. [
  62886. [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle_type [*native_handle_type]]]
  62887. [The native representation of a handle. ]
  62888. ]
  62889. ]
  62890. [heading Member Functions]
  62891. [table
  62892. [[Name][Description]]
  62893. [
  62894. [[link boost_asio.reference.windows__basic_overlapped_handle.assign [*assign]]]
  62895. [Assign an existing native handle to the handle. ]
  62896. ]
  62897. [
  62898. [[link boost_asio.reference.windows__basic_overlapped_handle.basic_overlapped_handle [*basic_overlapped_handle]]]
  62899. [Construct an overlapped handle without opening it.
  62900. [hr]
  62901. Construct an overlapped handle on an existing native handle.
  62902. [hr]
  62903. Move-construct an overlapped handle from another. ]
  62904. ]
  62905. [
  62906. [[link boost_asio.reference.windows__basic_overlapped_handle.cancel [*cancel]]]
  62907. [Cancel all asynchronous operations associated with the handle. ]
  62908. ]
  62909. [
  62910. [[link boost_asio.reference.windows__basic_overlapped_handle.close [*close]]]
  62911. [Close the handle. ]
  62912. ]
  62913. [
  62914. [[link boost_asio.reference.windows__basic_overlapped_handle.get_executor [*get_executor]]]
  62915. [Get the executor associated with the object. ]
  62916. ]
  62917. [
  62918. [[link boost_asio.reference.windows__basic_overlapped_handle.is_open [*is_open]]]
  62919. [Determine whether the handle is open. ]
  62920. ]
  62921. [
  62922. [[link boost_asio.reference.windows__basic_overlapped_handle.lowest_layer [*lowest_layer]]]
  62923. [Get a reference to the lowest layer.
  62924. [hr]
  62925. Get a const reference to the lowest layer. ]
  62926. ]
  62927. [
  62928. [[link boost_asio.reference.windows__basic_overlapped_handle.native_handle [*native_handle]]]
  62929. [Get the native handle representation. ]
  62930. ]
  62931. [
  62932. [[link boost_asio.reference.windows__basic_overlapped_handle.operator_eq_ [*operator=]]]
  62933. [Move-assign an overlapped handle from another. ]
  62934. ]
  62935. ]
  62936. [heading Protected Member Functions]
  62937. [table
  62938. [[Name][Description]]
  62939. [
  62940. [[link boost_asio.reference.windows__basic_overlapped_handle._basic_overlapped_handle [*~basic_overlapped_handle]]]
  62941. [Protected destructor to prevent deletion through this type. ]
  62942. ]
  62943. ]
  62944. [heading Protected Data Members]
  62945. [table
  62946. [[Name][Description]]
  62947. [
  62948. [[link boost_asio.reference.windows__basic_overlapped_handle.impl_ [*impl_]]]
  62949. []
  62950. ]
  62951. ]
  62952. The [link boost_asio.reference.windows__overlapped_handle `windows::overlapped_handle`] class provides the ability to wrap a Windows handle. The underlying object referred to by the handle must support overlapped I/O.
  62953. [heading Thread Safety]
  62954. ['Distinct] ['objects:] Safe.
  62955. ['Shared] ['objects:] Unsafe.
  62956. [heading Requirements]
  62957. ['Header: ][^boost/asio/windows/overlapped_handle.hpp]
  62958. ['Convenience header: ][^boost/asio.hpp]
  62959. [endsect]
  62960. [section:windows__overlapped_ptr windows::overlapped_ptr]
  62961. Wraps a handler to create an OVERLAPPED object for use with overlapped I/O.
  62962. class overlapped_ptr :
  62963. noncopyable
  62964. [heading Member Functions]
  62965. [table
  62966. [[Name][Description]]
  62967. [
  62968. [[link boost_asio.reference.windows__overlapped_ptr.complete [*complete]]]
  62969. [Post completion notification for overlapped operation. Releases ownership. ]
  62970. ]
  62971. [
  62972. [[link boost_asio.reference.windows__overlapped_ptr.get [*get]]]
  62973. [Get the contained OVERLAPPED object. ]
  62974. ]
  62975. [
  62976. [[link boost_asio.reference.windows__overlapped_ptr.overlapped_ptr [*overlapped_ptr]]]
  62977. [Construct an empty overlapped_ptr.
  62978. [hr]
  62979. Construct an overlapped_ptr to contain the specified handler. ]
  62980. ]
  62981. [
  62982. [[link boost_asio.reference.windows__overlapped_ptr.release [*release]]]
  62983. [Release ownership of the OVERLAPPED object. ]
  62984. ]
  62985. [
  62986. [[link boost_asio.reference.windows__overlapped_ptr.reset [*reset]]]
  62987. [Reset to empty.
  62988. [hr]
  62989. Reset to contain the specified handler, freeing any current OVERLAPPED object. ]
  62990. ]
  62991. [
  62992. [[link boost_asio.reference.windows__overlapped_ptr._overlapped_ptr [*~overlapped_ptr]]]
  62993. [Destructor automatically frees the OVERLAPPED object unless released. ]
  62994. ]
  62995. ]
  62996. A special-purpose smart pointer used to wrap an application handler so that it can be passed as the LPOVERLAPPED argument to overlapped I/O functions.
  62997. [heading Thread Safety]
  62998. ['Distinct] ['objects:] Safe.
  62999. ['Shared] ['objects:] Unsafe.
  63000. [heading Requirements]
  63001. ['Header: ][^boost/asio/windows/overlapped_ptr.hpp]
  63002. ['Convenience header: ][^boost/asio.hpp]
  63003. [section:complete windows::overlapped_ptr::complete]
  63004. [indexterm2 boost_asio.indexterm.windows__overlapped_ptr.complete..complete..windows::overlapped_ptr]
  63005. Post completion notification for overlapped operation. Releases ownership.
  63006. void complete(
  63007. const boost::system::error_code & ec,
  63008. std::size_t bytes_transferred);
  63009. [endsect]
  63010. [section:get windows::overlapped_ptr::get]
  63011. [indexterm2 boost_asio.indexterm.windows__overlapped_ptr.get..get..windows::overlapped_ptr]
  63012. Get the contained OVERLAPPED object.
  63013. OVERLAPPED * ``[link boost_asio.reference.windows__overlapped_ptr.get.overload1 get]``();
  63014. `` [''''&raquo;''' [link boost_asio.reference.windows__overlapped_ptr.get.overload1 more...]]``
  63015. const OVERLAPPED * ``[link boost_asio.reference.windows__overlapped_ptr.get.overload2 get]``() const;
  63016. `` [''''&raquo;''' [link boost_asio.reference.windows__overlapped_ptr.get.overload2 more...]]``
  63017. [section:overload1 windows::overlapped_ptr::get (1 of 2 overloads)]
  63018. Get the contained OVERLAPPED object.
  63019. OVERLAPPED * get();
  63020. [endsect]
  63021. [section:overload2 windows::overlapped_ptr::get (2 of 2 overloads)]
  63022. Get the contained OVERLAPPED object.
  63023. const OVERLAPPED * get() const;
  63024. [endsect]
  63025. [endsect]
  63026. [section:overlapped_ptr windows::overlapped_ptr::overlapped_ptr]
  63027. [indexterm2 boost_asio.indexterm.windows__overlapped_ptr.overlapped_ptr..overlapped_ptr..windows::overlapped_ptr]
  63028. Construct an empty [link boost_asio.reference.windows__overlapped_ptr `windows::overlapped_ptr`].
  63029. ``[link boost_asio.reference.windows__overlapped_ptr.overlapped_ptr.overload1 overlapped_ptr]``();
  63030. `` [''''&raquo;''' [link boost_asio.reference.windows__overlapped_ptr.overlapped_ptr.overload1 more...]]``
  63031. Construct an [link boost_asio.reference.windows__overlapped_ptr `windows::overlapped_ptr`] to contain the specified handler.
  63032. template<
  63033. typename ExecutionContext,
  63034. typename ``[link boost_asio.reference.Handler Handler]``>
  63035. explicit ``[link boost_asio.reference.windows__overlapped_ptr.overlapped_ptr.overload2 overlapped_ptr]``(
  63036. ExecutionContext & context,
  63037. Handler && handler,
  63038. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  63039. `` [''''&raquo;''' [link boost_asio.reference.windows__overlapped_ptr.overlapped_ptr.overload2 more...]]``
  63040. template<
  63041. typename ``[link boost_asio.reference.Executor1 Executor]``,
  63042. typename ``[link boost_asio.reference.Handler Handler]``>
  63043. explicit ``[link boost_asio.reference.windows__overlapped_ptr.overlapped_ptr.overload3 overlapped_ptr]``(
  63044. const Executor & ex,
  63045. Handler && handler,
  63046. typename enable_if< is_executor< Executor >::value >::type * = 0);
  63047. `` [''''&raquo;''' [link boost_asio.reference.windows__overlapped_ptr.overlapped_ptr.overload3 more...]]``
  63048. [section:overload1 windows::overlapped_ptr::overlapped_ptr (1 of 3 overloads)]
  63049. Construct an empty [link boost_asio.reference.windows__overlapped_ptr `windows::overlapped_ptr`].
  63050. overlapped_ptr();
  63051. [endsect]
  63052. [section:overload2 windows::overlapped_ptr::overlapped_ptr (2 of 3 overloads)]
  63053. Construct an [link boost_asio.reference.windows__overlapped_ptr `windows::overlapped_ptr`] to contain the specified handler.
  63054. template<
  63055. typename ExecutionContext,
  63056. typename ``[link boost_asio.reference.Handler Handler]``>
  63057. overlapped_ptr(
  63058. ExecutionContext & context,
  63059. Handler && handler,
  63060. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  63061. [endsect]
  63062. [section:overload3 windows::overlapped_ptr::overlapped_ptr (3 of 3 overloads)]
  63063. Construct an [link boost_asio.reference.windows__overlapped_ptr `windows::overlapped_ptr`] to contain the specified handler.
  63064. template<
  63065. typename ``[link boost_asio.reference.Executor1 Executor]``,
  63066. typename ``[link boost_asio.reference.Handler Handler]``>
  63067. overlapped_ptr(
  63068. const Executor & ex,
  63069. Handler && handler,
  63070. typename enable_if< is_executor< Executor >::value >::type * = 0);
  63071. [endsect]
  63072. [endsect]
  63073. [section:release windows::overlapped_ptr::release]
  63074. [indexterm2 boost_asio.indexterm.windows__overlapped_ptr.release..release..windows::overlapped_ptr]
  63075. Release ownership of the OVERLAPPED object.
  63076. OVERLAPPED * release();
  63077. [endsect]
  63078. [section:reset windows::overlapped_ptr::reset]
  63079. [indexterm2 boost_asio.indexterm.windows__overlapped_ptr.reset..reset..windows::overlapped_ptr]
  63080. Reset to empty.
  63081. void ``[link boost_asio.reference.windows__overlapped_ptr.reset.overload1 reset]``();
  63082. `` [''''&raquo;''' [link boost_asio.reference.windows__overlapped_ptr.reset.overload1 more...]]``
  63083. Reset to contain the specified handler, freeing any current OVERLAPPED object.
  63084. template<
  63085. typename ExecutionContext,
  63086. typename ``[link boost_asio.reference.Handler Handler]``>
  63087. void ``[link boost_asio.reference.windows__overlapped_ptr.reset.overload2 reset]``(
  63088. ExecutionContext & context,
  63089. Handler && handler,
  63090. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  63091. `` [''''&raquo;''' [link boost_asio.reference.windows__overlapped_ptr.reset.overload2 more...]]``
  63092. template<
  63093. typename ``[link boost_asio.reference.Executor1 Executor]``,
  63094. typename ``[link boost_asio.reference.Handler Handler]``>
  63095. void ``[link boost_asio.reference.windows__overlapped_ptr.reset.overload3 reset]``(
  63096. const Executor & ex,
  63097. Handler && handler,
  63098. typename enable_if< is_executor< Executor >::value >::type * = 0);
  63099. `` [''''&raquo;''' [link boost_asio.reference.windows__overlapped_ptr.reset.overload3 more...]]``
  63100. [section:overload1 windows::overlapped_ptr::reset (1 of 3 overloads)]
  63101. Reset to empty.
  63102. void reset();
  63103. [endsect]
  63104. [section:overload2 windows::overlapped_ptr::reset (2 of 3 overloads)]
  63105. Reset to contain the specified handler, freeing any current OVERLAPPED object.
  63106. template<
  63107. typename ExecutionContext,
  63108. typename ``[link boost_asio.reference.Handler Handler]``>
  63109. void reset(
  63110. ExecutionContext & context,
  63111. Handler && handler,
  63112. typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type * = 0);
  63113. [endsect]
  63114. [section:overload3 windows::overlapped_ptr::reset (3 of 3 overloads)]
  63115. Reset to contain the specified handler, freeing any current OVERLAPPED object.
  63116. template<
  63117. typename ``[link boost_asio.reference.Executor1 Executor]``,
  63118. typename ``[link boost_asio.reference.Handler Handler]``>
  63119. void reset(
  63120. const Executor & ex,
  63121. Handler && handler,
  63122. typename enable_if< is_executor< Executor >::value >::type * = 0);
  63123. [endsect]
  63124. [endsect]
  63125. [section:_overlapped_ptr windows::overlapped_ptr::~overlapped_ptr]
  63126. [indexterm2 boost_asio.indexterm.windows__overlapped_ptr._overlapped_ptr..~overlapped_ptr..windows::overlapped_ptr]
  63127. Destructor automatically frees the OVERLAPPED object unless released.
  63128. ~overlapped_ptr();
  63129. [endsect]
  63130. [endsect]
  63131. [section:windows__random_access_handle windows::random_access_handle]
  63132. [indexterm1 boost_asio.indexterm.windows__random_access_handle..windows::random_access_handle]
  63133. Typedef for the typical usage of a random-access handle.
  63134. typedef basic_random_access_handle random_access_handle;
  63135. [heading Types]
  63136. [table
  63137. [[Name][Description]]
  63138. [
  63139. [[link boost_asio.reference.windows__basic_random_access_handle__rebind_executor [*rebind_executor]]]
  63140. [Rebinds the handle type to another executor. ]
  63141. ]
  63142. [
  63143. [[link boost_asio.reference.windows__basic_random_access_handle.executor_type [*executor_type]]]
  63144. [The type of the executor associated with the object. ]
  63145. ]
  63146. [
  63147. [[link boost_asio.reference.windows__basic_random_access_handle.lowest_layer_type [*lowest_layer_type]]]
  63148. [An overlapped_handle is always the lowest layer. ]
  63149. ]
  63150. [
  63151. [[link boost_asio.reference.windows__basic_random_access_handle.native_handle_type [*native_handle_type]]]
  63152. [The native representation of a handle. ]
  63153. ]
  63154. ]
  63155. [heading Member Functions]
  63156. [table
  63157. [[Name][Description]]
  63158. [
  63159. [[link boost_asio.reference.windows__basic_random_access_handle.assign [*assign]]]
  63160. [Assign an existing native handle to the handle. ]
  63161. ]
  63162. [
  63163. [[link boost_asio.reference.windows__basic_random_access_handle.async_read_some_at [*async_read_some_at]]]
  63164. [Start an asynchronous read at the specified offset. ]
  63165. ]
  63166. [
  63167. [[link boost_asio.reference.windows__basic_random_access_handle.async_write_some_at [*async_write_some_at]]]
  63168. [Start an asynchronous write at the specified offset. ]
  63169. ]
  63170. [
  63171. [[link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle [*basic_random_access_handle]]]
  63172. [Construct a random-access handle without opening it.
  63173. [hr]
  63174. Construct a random-access handle on an existing native handle.
  63175. [hr]
  63176. Move-construct a random-access handle from another. ]
  63177. ]
  63178. [
  63179. [[link boost_asio.reference.windows__basic_random_access_handle.cancel [*cancel]]]
  63180. [Cancel all asynchronous operations associated with the handle. ]
  63181. ]
  63182. [
  63183. [[link boost_asio.reference.windows__basic_random_access_handle.close [*close]]]
  63184. [Close the handle. ]
  63185. ]
  63186. [
  63187. [[link boost_asio.reference.windows__basic_random_access_handle.get_executor [*get_executor]]]
  63188. [Get the executor associated with the object. ]
  63189. ]
  63190. [
  63191. [[link boost_asio.reference.windows__basic_random_access_handle.is_open [*is_open]]]
  63192. [Determine whether the handle is open. ]
  63193. ]
  63194. [
  63195. [[link boost_asio.reference.windows__basic_random_access_handle.lowest_layer [*lowest_layer]]]
  63196. [Get a reference to the lowest layer.
  63197. [hr]
  63198. Get a const reference to the lowest layer. ]
  63199. ]
  63200. [
  63201. [[link boost_asio.reference.windows__basic_random_access_handle.native_handle [*native_handle]]]
  63202. [Get the native handle representation. ]
  63203. ]
  63204. [
  63205. [[link boost_asio.reference.windows__basic_random_access_handle.operator_eq_ [*operator=]]]
  63206. [Move-assign a random-access handle from another. ]
  63207. ]
  63208. [
  63209. [[link boost_asio.reference.windows__basic_random_access_handle.read_some_at [*read_some_at]]]
  63210. [Read some data from the handle at the specified offset. ]
  63211. ]
  63212. [
  63213. [[link boost_asio.reference.windows__basic_random_access_handle.write_some_at [*write_some_at]]]
  63214. [Write some data to the handle at the specified offset. ]
  63215. ]
  63216. ]
  63217. [heading Protected Data Members]
  63218. [table
  63219. [[Name][Description]]
  63220. [
  63221. [[link boost_asio.reference.windows__basic_random_access_handle.impl_ [*impl_]]]
  63222. []
  63223. ]
  63224. ]
  63225. The [link boost_asio.reference.windows__basic_random_access_handle `windows::basic_random_access_handle`] class provides asynchronous and blocking random-access handle functionality.
  63226. [heading Thread Safety]
  63227. ['Distinct] ['objects:] Safe.
  63228. ['Shared] ['objects:] Unsafe.
  63229. [heading Requirements]
  63230. ['Header: ][^boost/asio/windows/random_access_handle.hpp]
  63231. ['Convenience header: ][^boost/asio.hpp]
  63232. [endsect]
  63233. [section:windows__stream_handle windows::stream_handle]
  63234. [indexterm1 boost_asio.indexterm.windows__stream_handle..windows::stream_handle]
  63235. Typedef for the typical usage of a stream-oriented handle.
  63236. typedef basic_stream_handle stream_handle;
  63237. [heading Types]
  63238. [table
  63239. [[Name][Description]]
  63240. [
  63241. [[link boost_asio.reference.windows__basic_stream_handle__rebind_executor [*rebind_executor]]]
  63242. [Rebinds the handle type to another executor. ]
  63243. ]
  63244. [
  63245. [[link boost_asio.reference.windows__basic_stream_handle.executor_type [*executor_type]]]
  63246. [The type of the executor associated with the object. ]
  63247. ]
  63248. [
  63249. [[link boost_asio.reference.windows__basic_stream_handle.lowest_layer_type [*lowest_layer_type]]]
  63250. [An overlapped_handle is always the lowest layer. ]
  63251. ]
  63252. [
  63253. [[link boost_asio.reference.windows__basic_stream_handle.native_handle_type [*native_handle_type]]]
  63254. [The native representation of a handle. ]
  63255. ]
  63256. ]
  63257. [heading Member Functions]
  63258. [table
  63259. [[Name][Description]]
  63260. [
  63261. [[link boost_asio.reference.windows__basic_stream_handle.assign [*assign]]]
  63262. [Assign an existing native handle to the handle. ]
  63263. ]
  63264. [
  63265. [[link boost_asio.reference.windows__basic_stream_handle.async_read_some [*async_read_some]]]
  63266. [Start an asynchronous read. ]
  63267. ]
  63268. [
  63269. [[link boost_asio.reference.windows__basic_stream_handle.async_write_some [*async_write_some]]]
  63270. [Start an asynchronous write. ]
  63271. ]
  63272. [
  63273. [[link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle [*basic_stream_handle]]]
  63274. [Construct a stream handle without opening it.
  63275. [hr]
  63276. Construct a stream handle on an existing native handle.
  63277. [hr]
  63278. Move-construct a stream handle from another. ]
  63279. ]
  63280. [
  63281. [[link boost_asio.reference.windows__basic_stream_handle.cancel [*cancel]]]
  63282. [Cancel all asynchronous operations associated with the handle. ]
  63283. ]
  63284. [
  63285. [[link boost_asio.reference.windows__basic_stream_handle.close [*close]]]
  63286. [Close the handle. ]
  63287. ]
  63288. [
  63289. [[link boost_asio.reference.windows__basic_stream_handle.get_executor [*get_executor]]]
  63290. [Get the executor associated with the object. ]
  63291. ]
  63292. [
  63293. [[link boost_asio.reference.windows__basic_stream_handle.is_open [*is_open]]]
  63294. [Determine whether the handle is open. ]
  63295. ]
  63296. [
  63297. [[link boost_asio.reference.windows__basic_stream_handle.lowest_layer [*lowest_layer]]]
  63298. [Get a reference to the lowest layer.
  63299. [hr]
  63300. Get a const reference to the lowest layer. ]
  63301. ]
  63302. [
  63303. [[link boost_asio.reference.windows__basic_stream_handle.native_handle [*native_handle]]]
  63304. [Get the native handle representation. ]
  63305. ]
  63306. [
  63307. [[link boost_asio.reference.windows__basic_stream_handle.operator_eq_ [*operator=]]]
  63308. [Move-assign a stream handle from another. ]
  63309. ]
  63310. [
  63311. [[link boost_asio.reference.windows__basic_stream_handle.read_some [*read_some]]]
  63312. [Read some data from the handle. ]
  63313. ]
  63314. [
  63315. [[link boost_asio.reference.windows__basic_stream_handle.write_some [*write_some]]]
  63316. [Write some data to the handle. ]
  63317. ]
  63318. ]
  63319. [heading Protected Data Members]
  63320. [table
  63321. [[Name][Description]]
  63322. [
  63323. [[link boost_asio.reference.windows__basic_stream_handle.impl_ [*impl_]]]
  63324. []
  63325. ]
  63326. ]
  63327. The [link boost_asio.reference.windows__basic_stream_handle `windows::basic_stream_handle`] class provides asynchronous and blocking stream-oriented handle functionality.
  63328. [heading Thread Safety]
  63329. ['Distinct] ['objects:] Safe.
  63330. ['Shared] ['objects:] Unsafe.
  63331. [heading Requirements]
  63332. ['Header: ][^boost/asio/windows/stream_handle.hpp]
  63333. ['Convenience header: ][^boost/asio.hpp]
  63334. [endsect]
  63335. [section:write write]
  63336. [indexterm1 boost_asio.indexterm.write..write]
  63337. The `write` function is a composed operation that writes a certain amount of data to a stream before returning.
  63338. Write all of the supplied data to a stream before returning.
  63339. template<
  63340. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63341. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  63342. std::size_t ``[link boost_asio.reference.write.overload1 write]``(
  63343. SyncWriteStream & s,
  63344. const ConstBufferSequence & buffers,
  63345. typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type * = 0);
  63346. `` [''''&raquo;''' [link boost_asio.reference.write.overload1 more...]]``
  63347. template<
  63348. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63349. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  63350. std::size_t ``[link boost_asio.reference.write.overload2 write]``(
  63351. SyncWriteStream & s,
  63352. const ConstBufferSequence & buffers,
  63353. boost::system::error_code & ec,
  63354. typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type * = 0);
  63355. `` [''''&raquo;''' [link boost_asio.reference.write.overload2 more...]]``
  63356. Write a certain amount of data to a stream before returning.
  63357. template<
  63358. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63359. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  63360. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  63361. std::size_t ``[link boost_asio.reference.write.overload3 write]``(
  63362. SyncWriteStream & s,
  63363. const ConstBufferSequence & buffers,
  63364. CompletionCondition completion_condition,
  63365. typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type * = 0);
  63366. `` [''''&raquo;''' [link boost_asio.reference.write.overload3 more...]]``
  63367. template<
  63368. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63369. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  63370. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  63371. std::size_t ``[link boost_asio.reference.write.overload4 write]``(
  63372. SyncWriteStream & s,
  63373. const ConstBufferSequence & buffers,
  63374. CompletionCondition completion_condition,
  63375. boost::system::error_code & ec,
  63376. typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type * = 0);
  63377. `` [''''&raquo;''' [link boost_asio.reference.write.overload4 more...]]``
  63378. Write all of the supplied data to a stream before returning.
  63379. template<
  63380. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63381. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
  63382. std::size_t ``[link boost_asio.reference.write.overload5 write]``(
  63383. SyncWriteStream & s,
  63384. DynamicBuffer_v1 && buffers,
  63385. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  63386. `` [''''&raquo;''' [link boost_asio.reference.write.overload5 more...]]``
  63387. template<
  63388. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63389. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
  63390. std::size_t ``[link boost_asio.reference.write.overload6 write]``(
  63391. SyncWriteStream & s,
  63392. DynamicBuffer_v1 && buffers,
  63393. boost::system::error_code & ec,
  63394. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  63395. `` [''''&raquo;''' [link boost_asio.reference.write.overload6 more...]]``
  63396. Write a certain amount of data to a stream before returning.
  63397. template<
  63398. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63399. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
  63400. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  63401. std::size_t ``[link boost_asio.reference.write.overload7 write]``(
  63402. SyncWriteStream & s,
  63403. DynamicBuffer_v1 && buffers,
  63404. CompletionCondition completion_condition,
  63405. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  63406. `` [''''&raquo;''' [link boost_asio.reference.write.overload7 more...]]``
  63407. template<
  63408. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63409. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
  63410. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  63411. std::size_t ``[link boost_asio.reference.write.overload8 write]``(
  63412. SyncWriteStream & s,
  63413. DynamicBuffer_v1 && buffers,
  63414. CompletionCondition completion_condition,
  63415. boost::system::error_code & ec,
  63416. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  63417. `` [''''&raquo;''' [link boost_asio.reference.write.overload8 more...]]``
  63418. Write all of the supplied data to a stream before returning.
  63419. template<
  63420. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63421. typename Allocator>
  63422. std::size_t ``[link boost_asio.reference.write.overload9 write]``(
  63423. SyncWriteStream & s,
  63424. basic_streambuf< Allocator > & b);
  63425. `` [''''&raquo;''' [link boost_asio.reference.write.overload9 more...]]``
  63426. template<
  63427. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63428. typename Allocator>
  63429. std::size_t ``[link boost_asio.reference.write.overload10 write]``(
  63430. SyncWriteStream & s,
  63431. basic_streambuf< Allocator > & b,
  63432. boost::system::error_code & ec);
  63433. `` [''''&raquo;''' [link boost_asio.reference.write.overload10 more...]]``
  63434. Write a certain amount of data to a stream before returning.
  63435. template<
  63436. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63437. typename Allocator,
  63438. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  63439. std::size_t ``[link boost_asio.reference.write.overload11 write]``(
  63440. SyncWriteStream & s,
  63441. basic_streambuf< Allocator > & b,
  63442. CompletionCondition completion_condition);
  63443. `` [''''&raquo;''' [link boost_asio.reference.write.overload11 more...]]``
  63444. template<
  63445. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63446. typename Allocator,
  63447. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  63448. std::size_t ``[link boost_asio.reference.write.overload12 write]``(
  63449. SyncWriteStream & s,
  63450. basic_streambuf< Allocator > & b,
  63451. CompletionCondition completion_condition,
  63452. boost::system::error_code & ec);
  63453. `` [''''&raquo;''' [link boost_asio.reference.write.overload12 more...]]``
  63454. Write all of the supplied data to a stream before returning.
  63455. template<
  63456. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63457. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
  63458. std::size_t ``[link boost_asio.reference.write.overload13 write]``(
  63459. SyncWriteStream & s,
  63460. DynamicBuffer_v2 buffers,
  63461. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  63462. `` [''''&raquo;''' [link boost_asio.reference.write.overload13 more...]]``
  63463. template<
  63464. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63465. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
  63466. std::size_t ``[link boost_asio.reference.write.overload14 write]``(
  63467. SyncWriteStream & s,
  63468. DynamicBuffer_v2 buffers,
  63469. boost::system::error_code & ec,
  63470. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  63471. `` [''''&raquo;''' [link boost_asio.reference.write.overload14 more...]]``
  63472. Write a certain amount of data to a stream before returning.
  63473. template<
  63474. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63475. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
  63476. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  63477. std::size_t ``[link boost_asio.reference.write.overload15 write]``(
  63478. SyncWriteStream & s,
  63479. DynamicBuffer_v2 buffers,
  63480. CompletionCondition completion_condition,
  63481. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  63482. `` [''''&raquo;''' [link boost_asio.reference.write.overload15 more...]]``
  63483. template<
  63484. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63485. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
  63486. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  63487. std::size_t ``[link boost_asio.reference.write.overload16 write]``(
  63488. SyncWriteStream & s,
  63489. DynamicBuffer_v2 buffers,
  63490. CompletionCondition completion_condition,
  63491. boost::system::error_code & ec,
  63492. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  63493. `` [''''&raquo;''' [link boost_asio.reference.write.overload16 more...]]``
  63494. [heading Requirements]
  63495. ['Header: ][^boost/asio/write.hpp]
  63496. ['Convenience header: ][^boost/asio.hpp]
  63497. [section:overload1 write (1 of 16 overloads)]
  63498. Write all of the supplied data to a stream before returning.
  63499. template<
  63500. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63501. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  63502. std::size_t write(
  63503. SyncWriteStream & s,
  63504. const ConstBufferSequence & buffers,
  63505. typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type * = 0);
  63506. This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
  63507. * 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.
  63508. * An error occurred.
  63509. This operation is implemented in terms of zero or more calls to the stream's write\_some function.
  63510. [heading Parameters]
  63511. [variablelist
  63512. [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
  63513. [[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.]]
  63514. ]
  63515. [heading Return Value]
  63516. The number of bytes transferred.
  63517. [heading Exceptions]
  63518. [variablelist
  63519. [[boost::system::system_error][Thrown on failure.]]
  63520. ]
  63521. [heading Example]
  63522. To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  63523. boost::asio::write(s, boost::asio::buffer(data, size));
  63524. See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  63525. [heading Remarks]
  63526. This overload is equivalent to calling:
  63527. boost::asio::write(
  63528. s, buffers,
  63529. boost::asio::transfer_all());
  63530. [endsect]
  63531. [section:overload2 write (2 of 16 overloads)]
  63532. Write all of the supplied data to a stream before returning.
  63533. template<
  63534. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63535. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  63536. std::size_t write(
  63537. SyncWriteStream & s,
  63538. const ConstBufferSequence & buffers,
  63539. boost::system::error_code & ec,
  63540. typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type * = 0);
  63541. This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
  63542. * 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.
  63543. * An error occurred.
  63544. This operation is implemented in terms of zero or more calls to the stream's write\_some function.
  63545. [heading Parameters]
  63546. [variablelist
  63547. [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
  63548. [[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.]]
  63549. [[ec][Set to indicate what error occurred, if any.]]
  63550. ]
  63551. [heading Return Value]
  63552. The number of bytes transferred.
  63553. [heading Example]
  63554. To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  63555. boost::asio::write(s, boost::asio::buffer(data, size), ec);
  63556. See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  63557. [heading Remarks]
  63558. This overload is equivalent to calling:
  63559. boost::asio::write(
  63560. s, buffers,
  63561. boost::asio::transfer_all(), ec);
  63562. [endsect]
  63563. [section:overload3 write (3 of 16 overloads)]
  63564. Write a certain amount of data to a stream before returning.
  63565. template<
  63566. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63567. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  63568. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  63569. std::size_t write(
  63570. SyncWriteStream & s,
  63571. const ConstBufferSequence & buffers,
  63572. CompletionCondition completion_condition,
  63573. typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type * = 0);
  63574. This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
  63575. * 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.
  63576. * The completion\_condition function object returns 0.
  63577. This operation is implemented in terms of zero or more calls to the stream's write\_some function.
  63578. [heading Parameters]
  63579. [variablelist
  63580. [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
  63581. [[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.]]
  63582. [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
  63583. ``
  63584. std::size_t completion_condition(
  63585. // Result of latest write_some operation.
  63586. const boost::system::error_code& error,
  63587. // Number of bytes transferred so far.
  63588. std::size_t bytes_transferred
  63589. );
  63590. ``
  63591. A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's write\_some function.]]
  63592. ]
  63593. [heading Return Value]
  63594. The number of bytes transferred.
  63595. [heading Exceptions]
  63596. [variablelist
  63597. [[boost::system::system_error][Thrown on failure.]]
  63598. ]
  63599. [heading Example]
  63600. To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  63601. boost::asio::write(s, boost::asio::buffer(data, size),
  63602. boost::asio::transfer_at_least(32));
  63603. See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  63604. [endsect]
  63605. [section:overload4 write (4 of 16 overloads)]
  63606. Write a certain amount of data to a stream before returning.
  63607. template<
  63608. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63609. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  63610. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  63611. std::size_t write(
  63612. SyncWriteStream & s,
  63613. const ConstBufferSequence & buffers,
  63614. CompletionCondition completion_condition,
  63615. boost::system::error_code & ec,
  63616. typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type * = 0);
  63617. This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
  63618. * 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.
  63619. * The completion\_condition function object returns 0.
  63620. This operation is implemented in terms of zero or more calls to the stream's write\_some function.
  63621. [heading Parameters]
  63622. [variablelist
  63623. [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
  63624. [[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.]]
  63625. [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
  63626. ``
  63627. std::size_t completion_condition(
  63628. // Result of latest write_some operation.
  63629. const boost::system::error_code& error,
  63630. // Number of bytes transferred so far.
  63631. std::size_t bytes_transferred
  63632. );
  63633. ``
  63634. A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's write\_some function.]]
  63635. [[ec][Set to indicate what error occurred, if any.]]
  63636. ]
  63637. [heading Return Value]
  63638. The number of bytes written. If an error occurs, returns the total number of bytes successfully transferred prior to the error.
  63639. [endsect]
  63640. [section:overload5 write (5 of 16 overloads)]
  63641. Write all of the supplied data to a stream before returning.
  63642. template<
  63643. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63644. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
  63645. std::size_t write(
  63646. SyncWriteStream & s,
  63647. DynamicBuffer_v1 && buffers,
  63648. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  63649. This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
  63650. * All of the data in the supplied dynamic buffer sequence has been written.
  63651. * An error occurred.
  63652. This operation is implemented in terms of zero or more calls to the stream's write\_some function.
  63653. [heading Parameters]
  63654. [variablelist
  63655. [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
  63656. [[buffers][The dynamic buffer sequence from which data will be written. Successfully written data is automatically consumed from the buffers.]]
  63657. ]
  63658. [heading Return Value]
  63659. The number of bytes transferred.
  63660. [heading Exceptions]
  63661. [variablelist
  63662. [[boost::system::system_error][Thrown on failure.]]
  63663. ]
  63664. [heading Remarks]
  63665. This overload is equivalent to calling:
  63666. boost::asio::write(
  63667. s, buffers,
  63668. boost::asio::transfer_all());
  63669. [endsect]
  63670. [section:overload6 write (6 of 16 overloads)]
  63671. Write all of the supplied data to a stream before returning.
  63672. template<
  63673. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63674. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``>
  63675. std::size_t write(
  63676. SyncWriteStream & s,
  63677. DynamicBuffer_v1 && buffers,
  63678. boost::system::error_code & ec,
  63679. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  63680. This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
  63681. * All of the data in the supplied dynamic buffer sequence has been written.
  63682. * An error occurred.
  63683. This operation is implemented in terms of zero or more calls to the stream's write\_some function.
  63684. [heading Parameters]
  63685. [variablelist
  63686. [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
  63687. [[buffers][The dynamic buffer sequence from which data will be written. Successfully written data is automatically consumed from the buffers.]]
  63688. [[ec][Set to indicate what error occurred, if any.]]
  63689. ]
  63690. [heading Return Value]
  63691. The number of bytes transferred.
  63692. [heading Remarks]
  63693. This overload is equivalent to calling:
  63694. boost::asio::write(
  63695. s, buffers,
  63696. boost::asio::transfer_all(), ec);
  63697. [endsect]
  63698. [section:overload7 write (7 of 16 overloads)]
  63699. Write a certain amount of data to a stream before returning.
  63700. template<
  63701. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63702. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
  63703. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  63704. std::size_t write(
  63705. SyncWriteStream & s,
  63706. DynamicBuffer_v1 && buffers,
  63707. CompletionCondition completion_condition,
  63708. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  63709. This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
  63710. * All of the data in the supplied dynamic buffer sequence has been written.
  63711. * The completion\_condition function object returns 0.
  63712. This operation is implemented in terms of zero or more calls to the stream's write\_some function.
  63713. [heading Parameters]
  63714. [variablelist
  63715. [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
  63716. [[buffers][The dynamic buffer sequence from which data will be written. Successfully written data is automatically consumed from the buffers.]]
  63717. [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
  63718. ``
  63719. std::size_t completion_condition(
  63720. // Result of latest write_some operation.
  63721. const boost::system::error_code& error,
  63722. // Number of bytes transferred so far.
  63723. std::size_t bytes_transferred
  63724. );
  63725. ``
  63726. A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's write\_some function.]]
  63727. ]
  63728. [heading Return Value]
  63729. The number of bytes transferred.
  63730. [heading Exceptions]
  63731. [variablelist
  63732. [[boost::system::system_error][Thrown on failure. ]]
  63733. ]
  63734. [endsect]
  63735. [section:overload8 write (8 of 16 overloads)]
  63736. Write a certain amount of data to a stream before returning.
  63737. template<
  63738. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63739. typename ``[link boost_asio.reference.DynamicBuffer_v1 DynamicBuffer_v1]``,
  63740. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  63741. std::size_t write(
  63742. SyncWriteStream & s,
  63743. DynamicBuffer_v1 && buffers,
  63744. CompletionCondition completion_condition,
  63745. boost::system::error_code & ec,
  63746. typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
  63747. This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
  63748. * All of the data in the supplied dynamic buffer sequence has been written.
  63749. * The completion\_condition function object returns 0.
  63750. This operation is implemented in terms of zero or more calls to the stream's write\_some function.
  63751. [heading Parameters]
  63752. [variablelist
  63753. [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
  63754. [[buffers][The dynamic buffer sequence from which data will be written. Successfully written data is automatically consumed from the buffers.]]
  63755. [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
  63756. ``
  63757. std::size_t completion_condition(
  63758. // Result of latest write_some operation.
  63759. const boost::system::error_code& error,
  63760. // Number of bytes transferred so far.
  63761. std::size_t bytes_transferred
  63762. );
  63763. ``
  63764. A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's write\_some function.]]
  63765. [[ec][Set to indicate what error occurred, if any.]]
  63766. ]
  63767. [heading Return Value]
  63768. The number of bytes written. If an error occurs, returns the total number of bytes successfully transferred prior to the error.
  63769. [endsect]
  63770. [section:overload9 write (9 of 16 overloads)]
  63771. Write all of the supplied data to a stream before returning.
  63772. template<
  63773. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63774. typename Allocator>
  63775. std::size_t write(
  63776. SyncWriteStream & s,
  63777. basic_streambuf< Allocator > & b);
  63778. This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
  63779. * All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written.
  63780. * An error occurred.
  63781. This operation is implemented in terms of zero or more calls to the stream's write\_some function.
  63782. [heading Parameters]
  63783. [variablelist
  63784. [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
  63785. [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written.]]
  63786. ]
  63787. [heading Return Value]
  63788. The number of bytes transferred.
  63789. [heading Exceptions]
  63790. [variablelist
  63791. [[boost::system::system_error][Thrown on failure.]]
  63792. ]
  63793. [heading Remarks]
  63794. This overload is equivalent to calling:
  63795. boost::asio::write(
  63796. s, b,
  63797. boost::asio::transfer_all());
  63798. [endsect]
  63799. [section:overload10 write (10 of 16 overloads)]
  63800. Write all of the supplied data to a stream before returning.
  63801. template<
  63802. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63803. typename Allocator>
  63804. std::size_t write(
  63805. SyncWriteStream & s,
  63806. basic_streambuf< Allocator > & b,
  63807. boost::system::error_code & ec);
  63808. This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
  63809. * All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written.
  63810. * An error occurred.
  63811. This operation is implemented in terms of zero or more calls to the stream's write\_some function.
  63812. [heading Parameters]
  63813. [variablelist
  63814. [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
  63815. [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written.]]
  63816. [[ec][Set to indicate what error occurred, if any.]]
  63817. ]
  63818. [heading Return Value]
  63819. The number of bytes transferred.
  63820. [heading Remarks]
  63821. This overload is equivalent to calling:
  63822. boost::asio::write(
  63823. s, b,
  63824. boost::asio::transfer_all(), ec);
  63825. [endsect]
  63826. [section:overload11 write (11 of 16 overloads)]
  63827. Write a certain amount of data to a stream before returning.
  63828. template<
  63829. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63830. typename Allocator,
  63831. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  63832. std::size_t write(
  63833. SyncWriteStream & s,
  63834. basic_streambuf< Allocator > & b,
  63835. CompletionCondition completion_condition);
  63836. This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
  63837. * All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written.
  63838. * The completion\_condition function object returns 0.
  63839. This operation is implemented in terms of zero or more calls to the stream's write\_some function.
  63840. [heading Parameters]
  63841. [variablelist
  63842. [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
  63843. [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written.]]
  63844. [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
  63845. ``
  63846. std::size_t completion_condition(
  63847. // Result of latest write_some operation.
  63848. const boost::system::error_code& error,
  63849. // Number of bytes transferred so far.
  63850. std::size_t bytes_transferred
  63851. );
  63852. ``
  63853. A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's write\_some function.]]
  63854. ]
  63855. [heading Return Value]
  63856. The number of bytes transferred.
  63857. [heading Exceptions]
  63858. [variablelist
  63859. [[boost::system::system_error][Thrown on failure. ]]
  63860. ]
  63861. [endsect]
  63862. [section:overload12 write (12 of 16 overloads)]
  63863. Write a certain amount of data to a stream before returning.
  63864. template<
  63865. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63866. typename Allocator,
  63867. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  63868. std::size_t write(
  63869. SyncWriteStream & s,
  63870. basic_streambuf< Allocator > & b,
  63871. CompletionCondition completion_condition,
  63872. boost::system::error_code & ec);
  63873. This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
  63874. * All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written.
  63875. * The completion\_condition function object returns 0.
  63876. This operation is implemented in terms of zero or more calls to the stream's write\_some function.
  63877. [heading Parameters]
  63878. [variablelist
  63879. [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
  63880. [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written.]]
  63881. [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
  63882. ``
  63883. std::size_t completion_condition(
  63884. // Result of latest write_some operation.
  63885. const boost::system::error_code& error,
  63886. // Number of bytes transferred so far.
  63887. std::size_t bytes_transferred
  63888. );
  63889. ``
  63890. A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's write\_some function.]]
  63891. [[ec][Set to indicate what error occurred, if any.]]
  63892. ]
  63893. [heading Return Value]
  63894. The number of bytes written. If an error occurs, returns the total number of bytes successfully transferred prior to the error.
  63895. [endsect]
  63896. [section:overload13 write (13 of 16 overloads)]
  63897. Write all of the supplied data to a stream before returning.
  63898. template<
  63899. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63900. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
  63901. std::size_t write(
  63902. SyncWriteStream & s,
  63903. DynamicBuffer_v2 buffers,
  63904. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  63905. This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
  63906. * All of the data in the supplied dynamic buffer sequence has been written.
  63907. * An error occurred.
  63908. This operation is implemented in terms of zero or more calls to the stream's write\_some function.
  63909. [heading Parameters]
  63910. [variablelist
  63911. [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
  63912. [[buffers][The dynamic buffer sequence from which data will be written. Successfully written data is automatically consumed from the buffers.]]
  63913. ]
  63914. [heading Return Value]
  63915. The number of bytes transferred.
  63916. [heading Exceptions]
  63917. [variablelist
  63918. [[boost::system::system_error][Thrown on failure.]]
  63919. ]
  63920. [heading Remarks]
  63921. This overload is equivalent to calling:
  63922. boost::asio::write(
  63923. s, buffers,
  63924. boost::asio::transfer_all());
  63925. [endsect]
  63926. [section:overload14 write (14 of 16 overloads)]
  63927. Write all of the supplied data to a stream before returning.
  63928. template<
  63929. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63930. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``>
  63931. std::size_t write(
  63932. SyncWriteStream & s,
  63933. DynamicBuffer_v2 buffers,
  63934. boost::system::error_code & ec,
  63935. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  63936. This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
  63937. * All of the data in the supplied dynamic buffer sequence has been written.
  63938. * An error occurred.
  63939. This operation is implemented in terms of zero or more calls to the stream's write\_some function.
  63940. [heading Parameters]
  63941. [variablelist
  63942. [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
  63943. [[buffers][The dynamic buffer sequence from which data will be written. Successfully written data is automatically consumed from the buffers.]]
  63944. [[ec][Set to indicate what error occurred, if any.]]
  63945. ]
  63946. [heading Return Value]
  63947. The number of bytes transferred.
  63948. [heading Remarks]
  63949. This overload is equivalent to calling:
  63950. boost::asio::write(
  63951. s, buffers,
  63952. boost::asio::transfer_all(), ec);
  63953. [endsect]
  63954. [section:overload15 write (15 of 16 overloads)]
  63955. Write a certain amount of data to a stream before returning.
  63956. template<
  63957. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63958. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
  63959. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  63960. std::size_t write(
  63961. SyncWriteStream & s,
  63962. DynamicBuffer_v2 buffers,
  63963. CompletionCondition completion_condition,
  63964. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  63965. This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
  63966. * All of the data in the supplied dynamic buffer sequence has been written.
  63967. * The completion\_condition function object returns 0.
  63968. This operation is implemented in terms of zero or more calls to the stream's write\_some function.
  63969. [heading Parameters]
  63970. [variablelist
  63971. [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
  63972. [[buffers][The dynamic buffer sequence from which data will be written. Successfully written data is automatically consumed from the buffers.]]
  63973. [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
  63974. ``
  63975. std::size_t completion_condition(
  63976. // Result of latest write_some operation.
  63977. const boost::system::error_code& error,
  63978. // Number of bytes transferred so far.
  63979. std::size_t bytes_transferred
  63980. );
  63981. ``
  63982. A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's write\_some function.]]
  63983. ]
  63984. [heading Return Value]
  63985. The number of bytes transferred.
  63986. [heading Exceptions]
  63987. [variablelist
  63988. [[boost::system::system_error][Thrown on failure. ]]
  63989. ]
  63990. [endsect]
  63991. [section:overload16 write (16 of 16 overloads)]
  63992. Write a certain amount of data to a stream before returning.
  63993. template<
  63994. typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
  63995. typename ``[link boost_asio.reference.DynamicBuffer_v2 DynamicBuffer_v2]``,
  63996. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  63997. std::size_t write(
  63998. SyncWriteStream & s,
  63999. DynamicBuffer_v2 buffers,
  64000. CompletionCondition completion_condition,
  64001. boost::system::error_code & ec,
  64002. typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
  64003. This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
  64004. * All of the data in the supplied dynamic buffer sequence has been written.
  64005. * The completion\_condition function object returns 0.
  64006. This operation is implemented in terms of zero or more calls to the stream's write\_some function.
  64007. [heading Parameters]
  64008. [variablelist
  64009. [[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
  64010. [[buffers][The dynamic buffer sequence from which data will be written. Successfully written data is automatically consumed from the buffers.]]
  64011. [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
  64012. ``
  64013. std::size_t completion_condition(
  64014. // Result of latest write_some operation.
  64015. const boost::system::error_code& error,
  64016. // Number of bytes transferred so far.
  64017. std::size_t bytes_transferred
  64018. );
  64019. ``
  64020. A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's write\_some function.]]
  64021. [[ec][Set to indicate what error occurred, if any.]]
  64022. ]
  64023. [heading Return Value]
  64024. The number of bytes written. If an error occurs, returns the total number of bytes successfully transferred prior to the error.
  64025. [endsect]
  64026. [endsect]
  64027. [section:write_at write_at]
  64028. [indexterm1 boost_asio.indexterm.write_at..write_at]
  64029. The `write_at` function is a composed operation that writes a certain amount of data at a specified offset before returning.
  64030. Write all of the supplied data at the specified offset before returning.
  64031. template<
  64032. typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
  64033. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  64034. std::size_t ``[link boost_asio.reference.write_at.overload1 write_at]``(
  64035. SyncRandomAccessWriteDevice & d,
  64036. uint64_t offset,
  64037. const ConstBufferSequence & buffers);
  64038. `` [''''&raquo;''' [link boost_asio.reference.write_at.overload1 more...]]``
  64039. template<
  64040. typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
  64041. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  64042. std::size_t ``[link boost_asio.reference.write_at.overload2 write_at]``(
  64043. SyncRandomAccessWriteDevice & d,
  64044. uint64_t offset,
  64045. const ConstBufferSequence & buffers,
  64046. boost::system::error_code & ec);
  64047. `` [''''&raquo;''' [link boost_asio.reference.write_at.overload2 more...]]``
  64048. Write a certain amount of data at a specified offset before returning.
  64049. template<
  64050. typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
  64051. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  64052. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  64053. std::size_t ``[link boost_asio.reference.write_at.overload3 write_at]``(
  64054. SyncRandomAccessWriteDevice & d,
  64055. uint64_t offset,
  64056. const ConstBufferSequence & buffers,
  64057. CompletionCondition completion_condition);
  64058. `` [''''&raquo;''' [link boost_asio.reference.write_at.overload3 more...]]``
  64059. template<
  64060. typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
  64061. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  64062. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  64063. std::size_t ``[link boost_asio.reference.write_at.overload4 write_at]``(
  64064. SyncRandomAccessWriteDevice & d,
  64065. uint64_t offset,
  64066. const ConstBufferSequence & buffers,
  64067. CompletionCondition completion_condition,
  64068. boost::system::error_code & ec);
  64069. `` [''''&raquo;''' [link boost_asio.reference.write_at.overload4 more...]]``
  64070. Write all of the supplied data at the specified offset before returning.
  64071. template<
  64072. typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
  64073. typename Allocator>
  64074. std::size_t ``[link boost_asio.reference.write_at.overload5 write_at]``(
  64075. SyncRandomAccessWriteDevice & d,
  64076. uint64_t offset,
  64077. basic_streambuf< Allocator > & b);
  64078. `` [''''&raquo;''' [link boost_asio.reference.write_at.overload5 more...]]``
  64079. template<
  64080. typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
  64081. typename Allocator>
  64082. std::size_t ``[link boost_asio.reference.write_at.overload6 write_at]``(
  64083. SyncRandomAccessWriteDevice & d,
  64084. uint64_t offset,
  64085. basic_streambuf< Allocator > & b,
  64086. boost::system::error_code & ec);
  64087. `` [''''&raquo;''' [link boost_asio.reference.write_at.overload6 more...]]``
  64088. Write a certain amount of data at a specified offset before returning.
  64089. template<
  64090. typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
  64091. typename Allocator,
  64092. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  64093. std::size_t ``[link boost_asio.reference.write_at.overload7 write_at]``(
  64094. SyncRandomAccessWriteDevice & d,
  64095. uint64_t offset,
  64096. basic_streambuf< Allocator > & b,
  64097. CompletionCondition completion_condition);
  64098. `` [''''&raquo;''' [link boost_asio.reference.write_at.overload7 more...]]``
  64099. template<
  64100. typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
  64101. typename Allocator,
  64102. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  64103. std::size_t ``[link boost_asio.reference.write_at.overload8 write_at]``(
  64104. SyncRandomAccessWriteDevice & d,
  64105. uint64_t offset,
  64106. basic_streambuf< Allocator > & b,
  64107. CompletionCondition completion_condition,
  64108. boost::system::error_code & ec);
  64109. `` [''''&raquo;''' [link boost_asio.reference.write_at.overload8 more...]]``
  64110. [heading Requirements]
  64111. ['Header: ][^boost/asio/write_at.hpp]
  64112. ['Convenience header: ][^boost/asio.hpp]
  64113. [section:overload1 write_at (1 of 8 overloads)]
  64114. Write all of the supplied data at the specified offset before returning.
  64115. template<
  64116. typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
  64117. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  64118. std::size_t write_at(
  64119. SyncRandomAccessWriteDevice & d,
  64120. uint64_t offset,
  64121. const ConstBufferSequence & buffers);
  64122. This function is used to write a certain number of bytes of data to a random access device at a specified offset. The call will block until one of the following conditions is true:
  64123. * 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.
  64124. * An error occurred.
  64125. This operation is implemented in terms of zero or more calls to the device's write\_some\_at function.
  64126. [heading Parameters]
  64127. [variablelist
  64128. [[d][The device to which the data is to be written. The type must support the SyncRandomAccessWriteDevice concept.]]
  64129. [[offset][The offset at which the data will be written.]]
  64130. [[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.]]
  64131. ]
  64132. [heading Return Value]
  64133. The number of bytes transferred.
  64134. [heading Exceptions]
  64135. [variablelist
  64136. [[boost::system::system_error][Thrown on failure.]]
  64137. ]
  64138. [heading Example]
  64139. To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  64140. boost::asio::write_at(d, 42, boost::asio::buffer(data, size));
  64141. See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  64142. [heading Remarks]
  64143. This overload is equivalent to calling:
  64144. boost::asio::write_at(
  64145. d, offset, buffers,
  64146. boost::asio::transfer_all());
  64147. [endsect]
  64148. [section:overload2 write_at (2 of 8 overloads)]
  64149. Write all of the supplied data at the specified offset before returning.
  64150. template<
  64151. typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
  64152. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
  64153. std::size_t write_at(
  64154. SyncRandomAccessWriteDevice & d,
  64155. uint64_t offset,
  64156. const ConstBufferSequence & buffers,
  64157. boost::system::error_code & ec);
  64158. This function is used to write a certain number of bytes of data to a random access device at a specified offset. The call will block until one of the following conditions is true:
  64159. * 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.
  64160. * An error occurred.
  64161. This operation is implemented in terms of zero or more calls to the device's write\_some\_at function.
  64162. [heading Parameters]
  64163. [variablelist
  64164. [[d][The device to which the data is to be written. The type must support the SyncRandomAccessWriteDevice concept.]]
  64165. [[offset][The offset at which the data will be written.]]
  64166. [[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.]]
  64167. [[ec][Set to indicate what error occurred, if any.]]
  64168. ]
  64169. [heading Return Value]
  64170. The number of bytes transferred.
  64171. [heading Example]
  64172. To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  64173. boost::asio::write_at(d, 42,
  64174. boost::asio::buffer(data, size), ec);
  64175. See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  64176. [heading Remarks]
  64177. This overload is equivalent to calling:
  64178. boost::asio::write_at(
  64179. d, offset, buffers,
  64180. boost::asio::transfer_all(), ec);
  64181. [endsect]
  64182. [section:overload3 write_at (3 of 8 overloads)]
  64183. Write a certain amount of data at a specified offset before returning.
  64184. template<
  64185. typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
  64186. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  64187. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  64188. std::size_t write_at(
  64189. SyncRandomAccessWriteDevice & d,
  64190. uint64_t offset,
  64191. const ConstBufferSequence & buffers,
  64192. CompletionCondition completion_condition);
  64193. This function is used to write a certain number of bytes of data to a random access device at a specified offset. The call will block until one of the following conditions is true:
  64194. * 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.
  64195. * The completion\_condition function object returns 0.
  64196. This operation is implemented in terms of zero or more calls to the device's write\_some\_at function.
  64197. [heading Parameters]
  64198. [variablelist
  64199. [[d][The device to which the data is to be written. The type must support the SyncRandomAccessWriteDevice concept.]]
  64200. [[offset][The offset at which the data will be written.]]
  64201. [[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.]]
  64202. [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
  64203. ``
  64204. std::size_t completion_condition(
  64205. // Result of latest write_some_at operation.
  64206. const boost::system::error_code& error,
  64207. // Number of bytes transferred so far.
  64208. std::size_t bytes_transferred
  64209. );
  64210. ``
  64211. A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the device's write\_some\_at function.]]
  64212. ]
  64213. [heading Return Value]
  64214. The number of bytes transferred.
  64215. [heading Exceptions]
  64216. [variablelist
  64217. [[boost::system::system_error][Thrown on failure.]]
  64218. ]
  64219. [heading Example]
  64220. To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
  64221. boost::asio::write_at(d, 42, boost::asio::buffer(data, size),
  64222. boost::asio::transfer_at_least(32));
  64223. See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
  64224. [endsect]
  64225. [section:overload4 write_at (4 of 8 overloads)]
  64226. Write a certain amount of data at a specified offset before returning.
  64227. template<
  64228. typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
  64229. typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
  64230. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  64231. std::size_t write_at(
  64232. SyncRandomAccessWriteDevice & d,
  64233. uint64_t offset,
  64234. const ConstBufferSequence & buffers,
  64235. CompletionCondition completion_condition,
  64236. boost::system::error_code & ec);
  64237. This function is used to write a certain number of bytes of data to a random access device at a specified offset. The call will block until one of the following conditions is true:
  64238. * 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.
  64239. * The completion\_condition function object returns 0.
  64240. This operation is implemented in terms of zero or more calls to the device's write\_some\_at function.
  64241. [heading Parameters]
  64242. [variablelist
  64243. [[d][The device to which the data is to be written. The type must support the SyncRandomAccessWriteDevice concept.]]
  64244. [[offset][The offset at which the data will be written.]]
  64245. [[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.]]
  64246. [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
  64247. ``
  64248. std::size_t completion_condition(
  64249. // Result of latest write_some_at operation.
  64250. const boost::system::error_code& error,
  64251. // Number of bytes transferred so far.
  64252. std::size_t bytes_transferred
  64253. );
  64254. ``
  64255. A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the device's write\_some\_at function.]]
  64256. [[ec][Set to indicate what error occurred, if any.]]
  64257. ]
  64258. [heading Return Value]
  64259. The number of bytes written. If an error occurs, returns the total number of bytes successfully transferred prior to the error.
  64260. [endsect]
  64261. [section:overload5 write_at (5 of 8 overloads)]
  64262. Write all of the supplied data at the specified offset before returning.
  64263. template<
  64264. typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
  64265. typename Allocator>
  64266. std::size_t write_at(
  64267. SyncRandomAccessWriteDevice & d,
  64268. uint64_t offset,
  64269. basic_streambuf< Allocator > & b);
  64270. This function is used to write a certain number of bytes of data to a random access device at a specified offset. The call will block until one of the following conditions is true:
  64271. * All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written.
  64272. * An error occurred.
  64273. This operation is implemented in terms of zero or more calls to the device's write\_some\_at function.
  64274. [heading Parameters]
  64275. [variablelist
  64276. [[d][The device to which the data is to be written. The type must support the SyncRandomAccessWriteDevice concept.]]
  64277. [[offset][The offset at which the data will be written.]]
  64278. [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written.]]
  64279. ]
  64280. [heading Return Value]
  64281. The number of bytes transferred.
  64282. [heading Exceptions]
  64283. [variablelist
  64284. [[boost::system::system_error][Thrown on failure.]]
  64285. ]
  64286. [heading Remarks]
  64287. This overload is equivalent to calling:
  64288. boost::asio::write_at(
  64289. d, 42, b,
  64290. boost::asio::transfer_all());
  64291. [endsect]
  64292. [section:overload6 write_at (6 of 8 overloads)]
  64293. Write all of the supplied data at the specified offset before returning.
  64294. template<
  64295. typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
  64296. typename Allocator>
  64297. std::size_t write_at(
  64298. SyncRandomAccessWriteDevice & d,
  64299. uint64_t offset,
  64300. basic_streambuf< Allocator > & b,
  64301. boost::system::error_code & ec);
  64302. This function is used to write a certain number of bytes of data to a random access device at a specified offset. The call will block until one of the following conditions is true:
  64303. * All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written.
  64304. * An error occurred.
  64305. This operation is implemented in terms of zero or more calls to the device's write\_some\_at function.
  64306. [heading Parameters]
  64307. [variablelist
  64308. [[d][The device to which the data is to be written. The type must support the SyncRandomAccessWriteDevice concept.]]
  64309. [[offset][The offset at which the data will be written.]]
  64310. [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written.]]
  64311. [[ec][Set to indicate what error occurred, if any.]]
  64312. ]
  64313. [heading Return Value]
  64314. The number of bytes transferred.
  64315. [heading Remarks]
  64316. This overload is equivalent to calling:
  64317. boost::asio::write_at(
  64318. d, 42, b,
  64319. boost::asio::transfer_all(), ec);
  64320. [endsect]
  64321. [section:overload7 write_at (7 of 8 overloads)]
  64322. Write a certain amount of data at a specified offset before returning.
  64323. template<
  64324. typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
  64325. typename Allocator,
  64326. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  64327. std::size_t write_at(
  64328. SyncRandomAccessWriteDevice & d,
  64329. uint64_t offset,
  64330. basic_streambuf< Allocator > & b,
  64331. CompletionCondition completion_condition);
  64332. This function is used to write a certain number of bytes of data to a random access device at a specified offset. The call will block until one of the following conditions is true:
  64333. * All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written.
  64334. * The completion\_condition function object returns 0.
  64335. This operation is implemented in terms of zero or more calls to the device's write\_some\_at function.
  64336. [heading Parameters]
  64337. [variablelist
  64338. [[d][The device to which the data is to be written. The type must support the SyncRandomAccessWriteDevice concept.]]
  64339. [[offset][The offset at which the data will be written.]]
  64340. [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written.]]
  64341. [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
  64342. ``
  64343. std::size_t completion_condition(
  64344. // Result of latest write_some_at operation.
  64345. const boost::system::error_code& error,
  64346. // Number of bytes transferred so far.
  64347. std::size_t bytes_transferred
  64348. );
  64349. ``
  64350. A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the device's write\_some\_at function.]]
  64351. ]
  64352. [heading Return Value]
  64353. The number of bytes transferred.
  64354. [heading Exceptions]
  64355. [variablelist
  64356. [[boost::system::system_error][Thrown on failure. ]]
  64357. ]
  64358. [endsect]
  64359. [section:overload8 write_at (8 of 8 overloads)]
  64360. Write a certain amount of data at a specified offset before returning.
  64361. template<
  64362. typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
  64363. typename Allocator,
  64364. typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``>
  64365. std::size_t write_at(
  64366. SyncRandomAccessWriteDevice & d,
  64367. uint64_t offset,
  64368. basic_streambuf< Allocator > & b,
  64369. CompletionCondition completion_condition,
  64370. boost::system::error_code & ec);
  64371. This function is used to write a certain number of bytes of data to a random access device at a specified offset. The call will block until one of the following conditions is true:
  64372. * All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written.
  64373. * The completion\_condition function object returns 0.
  64374. This operation is implemented in terms of zero or more calls to the device's write\_some\_at function.
  64375. [heading Parameters]
  64376. [variablelist
  64377. [[d][The device to which the data is to be written. The type must support the SyncRandomAccessWriteDevice concept.]]
  64378. [[offset][The offset at which the data will be written.]]
  64379. [[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written.]]
  64380. [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
  64381. ``
  64382. std::size_t completion_condition(
  64383. // Result of latest write_some_at operation.
  64384. const boost::system::error_code& error,
  64385. // Number of bytes transferred so far.
  64386. std::size_t bytes_transferred
  64387. );
  64388. ``
  64389. A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the device's write\_some\_at function.]]
  64390. [[ec][Set to indicate what error occurred, if any.]]
  64391. ]
  64392. [heading Return Value]
  64393. The number of bytes written. If an error occurs, returns the total number of bytes successfully transferred prior to the error.
  64394. [endsect]
  64395. [endsect]
  64396. [section:yield_context yield_context]
  64397. [indexterm1 boost_asio.indexterm.yield_context..yield_context]
  64398. Context object that represents the currently executing coroutine.
  64399. typedef basic_yield_context< unspecified > yield_context;
  64400. [heading Types]
  64401. [table
  64402. [[Name][Description]]
  64403. [
  64404. [[link boost_asio.reference.basic_yield_context.callee_type [*callee_type]]]
  64405. [The coroutine callee type, used by the implementation. ]
  64406. ]
  64407. [
  64408. [[link boost_asio.reference.basic_yield_context.caller_type [*caller_type]]]
  64409. [The coroutine caller type, used by the implementation. ]
  64410. ]
  64411. ]
  64412. [heading Member Functions]
  64413. [table
  64414. [[Name][Description]]
  64415. [
  64416. [[link boost_asio.reference.basic_yield_context.basic_yield_context [*basic_yield_context]]]
  64417. [Construct a yield context to represent the specified coroutine.
  64418. [hr]
  64419. Construct a yield context from another yield context type. ]
  64420. ]
  64421. [
  64422. [[link boost_asio.reference.basic_yield_context.operator_lb__rb_ [*operator\[\]]]]
  64423. [Return a yield context that sets the specified error_code. ]
  64424. ]
  64425. ]
  64426. The [link boost_asio.reference.basic_yield_context `basic_yield_context`] class is used to represent the currently executing stackful coroutine. A [link boost_asio.reference.basic_yield_context `basic_yield_context`] may be passed as a handler to an asynchronous operation. For example:
  64427. template <typename Handler>
  64428. void my_coroutine(basic_yield_context<Handler> yield)
  64429. {
  64430. ...
  64431. std::size_t n = my_socket.async_read_some(buffer, yield);
  64432. ...
  64433. }
  64434. 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.
  64435. [heading Requirements]
  64436. ['Header: ][^boost/asio/spawn.hpp]
  64437. ['Convenience header: ]None
  64438. [endsect]
  64439. [section:is_error_code_enum_lt__addrinfo_errors__gt_ boost::system::is_error_code_enum< boost::asio::error::addrinfo_errors >]
  64440. template<>
  64441. struct boost::system::is_error_code_enum< boost::asio::error::addrinfo_errors >
  64442. [heading Data Members]
  64443. [table
  64444. [[Name][Description]]
  64445. [
  64446. [[link boost_asio.reference.is_error_code_enum_lt__addrinfo_errors__gt_.value [*value]]]
  64447. []
  64448. ]
  64449. ]
  64450. [heading Requirements]
  64451. ['Header: ][^boost/asio/error.hpp]
  64452. ['Convenience header: ][^boost/asio.hpp]
  64453. [section:value boost::system::is_error_code_enum< boost::asio::error::addrinfo_errors >::value]
  64454. [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 >]
  64455. static const bool value = true;
  64456. [endsect]
  64457. [endsect]
  64458. [section:is_error_code_enum_lt__basic_errors__gt_ boost::system::is_error_code_enum< boost::asio::error::basic_errors >]
  64459. template<>
  64460. struct boost::system::is_error_code_enum< boost::asio::error::basic_errors >
  64461. [heading Data Members]
  64462. [table
  64463. [[Name][Description]]
  64464. [
  64465. [[link boost_asio.reference.is_error_code_enum_lt__basic_errors__gt_.value [*value]]]
  64466. []
  64467. ]
  64468. ]
  64469. [heading Requirements]
  64470. ['Header: ][^boost/asio/error.hpp]
  64471. ['Convenience header: ][^boost/asio.hpp]
  64472. [section:value boost::system::is_error_code_enum< boost::asio::error::basic_errors >::value]
  64473. [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 >]
  64474. static const bool value = true;
  64475. [endsect]
  64476. [endsect]
  64477. [section:is_error_code_enum_lt__misc_errors__gt_ boost::system::is_error_code_enum< boost::asio::error::misc_errors >]
  64478. template<>
  64479. struct boost::system::is_error_code_enum< boost::asio::error::misc_errors >
  64480. [heading Data Members]
  64481. [table
  64482. [[Name][Description]]
  64483. [
  64484. [[link boost_asio.reference.is_error_code_enum_lt__misc_errors__gt_.value [*value]]]
  64485. []
  64486. ]
  64487. ]
  64488. [heading Requirements]
  64489. ['Header: ][^boost/asio/error.hpp]
  64490. ['Convenience header: ][^boost/asio.hpp]
  64491. [section:value boost::system::is_error_code_enum< boost::asio::error::misc_errors >::value]
  64492. [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 >]
  64493. static const bool value = true;
  64494. [endsect]
  64495. [endsect]
  64496. [section:is_error_code_enum_lt__netdb_errors__gt_ boost::system::is_error_code_enum< boost::asio::error::netdb_errors >]
  64497. template<>
  64498. struct boost::system::is_error_code_enum< boost::asio::error::netdb_errors >
  64499. [heading Data Members]
  64500. [table
  64501. [[Name][Description]]
  64502. [
  64503. [[link boost_asio.reference.is_error_code_enum_lt__netdb_errors__gt_.value [*value]]]
  64504. []
  64505. ]
  64506. ]
  64507. [heading Requirements]
  64508. ['Header: ][^boost/asio/error.hpp]
  64509. ['Convenience header: ][^boost/asio.hpp]
  64510. [section:value boost::system::is_error_code_enum< boost::asio::error::netdb_errors >::value]
  64511. [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 >]
  64512. static const bool value = true;
  64513. [endsect]
  64514. [endsect]
  64515. [section:is_error_code_enum_lt__ssl_errors__gt_ boost::system::is_error_code_enum< boost::asio::error::ssl_errors >]
  64516. template<>
  64517. struct boost::system::is_error_code_enum< boost::asio::error::ssl_errors >
  64518. [heading Data Members]
  64519. [table
  64520. [[Name][Description]]
  64521. [
  64522. [[link boost_asio.reference.is_error_code_enum_lt__ssl_errors__gt_.value [*value]]]
  64523. []
  64524. ]
  64525. ]
  64526. [heading Requirements]
  64527. ['Header: ][^boost/asio/ssl/error.hpp]
  64528. ['Convenience header: ][^boost/asio/ssl.hpp]
  64529. [section:value boost::system::is_error_code_enum< boost::asio::error::ssl_errors >::value]
  64530. [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 >]
  64531. static const bool value = true;
  64532. [endsect]
  64533. [endsect]
  64534. [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 >]
  64535. template<>
  64536. struct boost::system::is_error_code_enum< boost::asio::ssl::error::stream_errors >
  64537. [heading Data Members]
  64538. [table
  64539. [[Name][Description]]
  64540. [
  64541. [[link boost_asio.reference.is_error_code_enum_lt__boost__asio__ssl__error__stream_errors__gt_.value [*value]]]
  64542. []
  64543. ]
  64544. ]
  64545. [heading Requirements]
  64546. ['Header: ][^boost/asio/ssl/error.hpp]
  64547. ['Convenience header: ][^boost/asio/ssl.hpp]
  64548. [section:value boost::system::is_error_code_enum< boost::asio::ssl::error::stream_errors >::value]
  64549. [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 >]
  64550. static const bool value = true;
  64551. [endsect]
  64552. [endsect]
  64553. [endsect]