1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>Requirements on synchronous socket operations</title> 5<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../../boost_asio.html" title="Boost.Asio"> 8<link rel="up" href="../reference.html" title="Reference"> 9<link rel="prev" href="read_write_operations.html" title="Requirements on read and write operations"> 10<link rel="next" href="asynchronous_socket_operations.html" title="Requirements on asynchronous socket operations"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td> 15<td align="center"><a href="../../../../index.html">Home</a></td> 16<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td> 17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 19<td align="center"><a href="../../../../more/index.htm">More</a></td> 20</tr></table> 21<hr> 22<div class="spirit-nav"> 23<a accesskey="p" href="read_write_operations.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="asynchronous_socket_operations.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h3 class="title"> 27<a name="boost_asio.reference.synchronous_socket_operations"></a><a class="link" href="synchronous_socket_operations.html" title="Requirements on synchronous socket operations">Requirements 28 on synchronous socket operations</a> 29</h3></div></div></div> 30<p> 31 In this section, <span class="emphasis"><em>synchronous socket operations</em></span> are those 32 member functions specified as two overloads, with and without an argument 33 of type <code class="computeroutput">error_code&</code>: 34 </p> 35<pre class="programlisting"><span class="bold"><strong><span class="emphasis"><em>R f</em></span></strong></span>(<span class="emphasis"><em><span class="bold"><strong>A1</strong></span></em></span> a1, <span class="emphasis"><em><span class="bold"><strong>A2</strong></span></em></span> a2, ..., <span class="emphasis"><em><span class="bold"><strong>AN</strong></span></em></span> aN); 36<span class="bold"><strong><span class="emphasis"><em>R f</em></span></strong></span>(<span class="emphasis"><em><span class="bold"><strong>A1</strong></span></em></span> a1, <span class="emphasis"><em><span class="bold"><strong>A2</strong></span></em></span> a2, ..., <span class="emphasis"><em><span class="bold"><strong>AN</strong></span></em></span> aN, error_code& ec); 37</pre> 38<p> 39 For an object <code class="computeroutput">s</code>, the conditions under which its synchronous 40 socket operations may block the calling thread (C++Std [defns.block]) are 41 determined as follows. 42 </p> 43<p> 44 If: 45 </p> 46<p> 47 — <code class="computeroutput">s.non_blocking() == true</code>, 48 </p> 49<p> 50 — the synchronous socket operation is specified in terms of a <span class="emphasis"><em>POSIX</em></span> 51 function other than <code class="computeroutput"><a href="http://www.opengroup.org/onlinepubs/9699919799/functions/poll.html" target="_top"><code class="computeroutput"><span class="identifier">poll</span><span class="special">()</span></code></a></code>, 52 </p> 53<p> 54 — that <span class="emphasis"><em>POSIX</em></span> function lists <code class="computeroutput">EWOULDBLOCK</code> or 55 <code class="computeroutput">EAGAIN</code> in its failure conditions, and 56 </p> 57<p> 58 — the effects of the operation cannot be established immediately 59 </p> 60<p> 61 then the synchronous socket operation shall not block the calling thread. 62 [<span class="emphasis"><em>Note:</em></span> And the effects of the operation are not established. 63 —<span class="emphasis"><em>end note</em></span>] 64 </p> 65<p> 66 Otherwise, the synchronous socket operation shall block the calling thread 67 until the effects are established. 68 </p> 69</div> 70<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 71<td align="left"></td> 72<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M. 73 Kohlhoff<p> 74 Distributed under the Boost Software License, Version 1.0. (See accompanying 75 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) 76 </p> 77</div></td> 78</tr></table> 79<hr> 80<div class="spirit-nav"> 81<a accesskey="p" href="read_write_operations.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="asynchronous_socket_operations.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> 82</div> 83</body> 84</html> 85