Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2005-04-26 11:52:26


From: "Iain K. Hanson" <ikh_at_[hidden]>
> On Tue, Apr 26, 2005 at 02:31:43AM +0300, Boris wrote:
> >
> > However I withdraw the idea of non-blocking I/O support in socket streams
> > anyway as we can't know with the standard interface if "s << a" fails
> > partially.
> >
> Whether it is non-blocking or not is AFAICS is irrelevant. if is sizeof char
> then a is not in the buffer and the failure is because of buffer write.
> if a is > size of char then some part of a is in the buffer upto the point that
> the buffer overflows. If you know the sizeof the buffer, where you are in the
> buffer and the size of a then you know how much of a is in the buffer.

Async is an issue because you have to deal with the EWOULDBLOCK
condition. However, you are raising a new issue regarding the
possibility that an internal buffer of the data to be written on
the socket can't be written. That can mean that a portion of an
object written with << will be in the buffer, but there's no way
to know which portion. Have I got your point right?

> However, only a fool would allow the buffer to overflow across a single <<.

Statements like this aren't helpful.

Try, "The mistake is allowing the buffer to overflow across a
single <<." And then follow it up with guidance on the approach
that should be taken.

-- 
Rob Stewart                           stewart_at_[hidden]
Software Engineer                     http://www.sig.com
Susquehanna International Group, LLP  using std::disclaimer;

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