Boost C++ Libraries: Ticket #12875: ip::tcp::iostream flush() doesn't clear the buffer. Neither does clear(); https://svn.boost.org/trac10/ticket/12875 <p> Code something like the below shows the issue: </p> <p> std::string postData = "This is my post data."; </p> <p> ip::tcp::iostream stream; </p> <p> stream.expires_from_now(boost::posix_time::seconds(10)); </p> <p> stream.connect("192.168.1.128", "http"); </p> <p> stream &lt;&lt; "POST /myRestfulPath HTTP/1.1\r\n"; </p> <p> stream &lt;&lt; "Content-Type: application/x-www-form-urlencoded\r\n"; </p> <p> stream &lt;&lt; "Host: 192.168.1.128:8080\r\n"; </p> <p> stream &lt;&lt; "Content-Length: " &lt;&lt; postData.size() &lt;&lt; "\r\n"; </p> <p> stream &lt;&lt; "Connection: Close\r\n\r\n"; </p> <p> stream.flush(); </p> <p> stream &lt;&lt; postData.c_str(); </p> <p> stream.flush(); </p> <p> Using Wireshark, the headers show up with the first flush, but also show up from the second, with the postData appended. </p> <p> I understand that I do not need the first flush in this example. However, the server requires an "Expect: 100-Continue" so therefore I need to send before the postData, and then receive the "Continue", and then send the postData. (Not shown.) </p> <p> stream.clear() doesn't clear what flush left behind, either. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12875 Trac 1.4.3 John Maddock Sun, 16 Apr 2017 08:41:00 GMT component changed; owner set https://svn.boost.org/trac10/ticket/12875#comment:1 https://svn.boost.org/trac10/ticket/12875#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Ion Gaztañaga</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">interprocess</span> </li> </ul> Ticket Ion Gaztañaga Sun, 16 Apr 2017 09:31:26 GMT owner, component changed https://svn.boost.org/trac10/ticket/12875#comment:2 https://svn.boost.org/trac10/ticket/12875#comment:2 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Ion Gaztañaga</span> to <span class="trac-author">chris_kohlhoff</span> </li> <li><strong>component</strong> <span class="trac-field-old">interprocess</span> → <span class="trac-field-new">asio</span> </li> </ul> <p> Seems like an Asio problem to be. Re-assigning. </p> Ticket