Boost logo

Boost :

Subject: [boost] Will the boost::asio::streambuf keep in sequency order when ostream write to boost::asio::streambuf multiple time?
From: hh h (jupiter.hce_at_[hidden])
Date: 2018-12-08 06:59:56


Hi,

Are there any problems in following statements? The receiver works a
few minutes, then got wrong number in header field.

std::shared_ptr<boost::asio::streambuf> buffer =
std::make_shared<boost::asio::streambuf>();
std::ostream os(buffer.get());
os.write((char *) &sendHeader, sizeof(sendHeader));
os.write((char *) sb.data(), sb.size());
boost::asio::async_write(socket_, *buffer.get(), .....);

Thank you.

- JHH


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk