18 Sockets [socket]

18.2 Requirements [socket.reqmts]

18.2.1 Requirements on synchronous socket operations [socket.reqmts.sync]

In this subclause, synchronous socket operations are those member functions specified as two overloads, with and without an argument of type error_code&:

R f(A1 a1, A2 a2, ..., AN aN);
R f(A1 a1, A2 a2, ..., AN aN, error_code& ec);

For an object s, the conditions under which its synchronous socket operations may block the calling thread (C++ 2014 [defns.block]) are determined as follows.

If:

  • s.non_blocking() == true,

  • the synchronous socket operation is specified in terms of a POSIX function other than poll,

  • that POSIX function lists EWOULDBLOCK or EAGAIN in its failure conditions, and

  • the effects of the operation cannot be established immediately

then the synchronous socket operation shall not block the calling thread. [ Note: And the effects of the operation are not established.  — end note ]

Otherwise, the synchronous socket operation shall block the calling thread until the effects are established.