
From: "Iain K. Hanson" <ikh@hansons.demon.co.uk>
Using iostreams there must be a buffer ( usually a streambuf ). The buffer size *must* be equal tp the MSS / path MTU.
As the application protocol writter you have to know how much you have written to the buffer *at all times* and you must know when an overflow / flush will happen.
Errors can *only* happen when the buffer writes to the socket ( overflow/flush ) therefore if a programmer does his/her job correctly there will not be multiple operator << traversing and overflow boundary. This is irrespective of sync/async.
According to this, there is no way to use streams with sockets. Otherwise, clients of the stream interface would need to keep track of the size of formatted output of each object inserted on the stream to avoid overflow between insertion operators. How can they do that? -- Rob Stewart stewart@sig.com Software Engineer http://www.sig.com Susquehanna International Group, LLP using std::disclaimer;