19 Socket iostreams [socket.iostreams]

19.1 Class template basic_socket_streambuf [socket.streambuf]

19.1.1 basic_socket_streambuf constructors [socket.streambuf.cons]


Effects: Initializes socket_ with ctx, where ctx is an unspecified object of class io_context.

Postconditions: expiry() == time_point::max() and !error().

explicit basic_socket_streambuf(basic_stream_socket<protocol_type> s);

Effects: Initializes socket_ with std::move(s).

Postconditions: expiry() == time_point::max() and !error().

basic_socket_streambuf(basic_socket_streambuf&& rhs);

Effects: Move constructs from the rvalue rhs. It is implementation-defined whether the sequence pointers in *this (eback(), gptr(), egptr(), pbase(), pptr(), epptr()) obtain the values which rhs had. Whether they do or not, *this and rhs reference separate buffers (if any at all) after the construction. Additionally *this references the socket which rhs did before the construction, and rhs references no open socket after the construction.

Postconditions: Let rhs_p refer to the state of rhs just prior to this construction and let rhs_a refer to the state of rhs just after this construction.

  • is_open() == rhs_p.is_open()

  • rhs_a.is_open() == false

  • error() == rhs_p.error()

  • !rhs_a.error()

  • expiry() == rhs_p.expiry()

  • rhs_a.expiry() == time_point::max()

  • gptr() - eback() == rhs_p.gptr() - rhs_p.eback()

  • egptr() - eback() == rhs_p.egptr() - rhs_p.eback()

  • ptr() - pbase() == rhs_p.pptr() - rhs_p.pbase()

  • pptr() - pbase() == rhs_p.epptr() - rhs_p.pbase()

  • if (eback()) eback() != rhs_a.eback()

  • if (gptr()) gptr() != rhs_a.gptr()

  • if (egptr()) egptr() != rhs_a.egptr()

  • if (pbase()) pbase() != rhs_a.pbase()

  • if (pptr()) pptr() != rhs_a.pptr()

  • if (epptr()) epptr() != rhs_a.epptr()

virtual ~basic_socket_streambuf();

Effects: If a put area exists, calls overflow(traits_type::eof()) to flush characters. [ Note: The socket is closed by the basic_stream_socket<protocol_type> destructor.  — end note ]

basic_socket_streambuf& operator=(basic_socket_streambuf&& rhs);

Effects: Calls this->close() then move assigns from rhs. After the move assignment *this and rhs have the observable state they would have had if *this had been move constructed from rhs.

Returns: *this.