> > The same problem occurs with one thread. Consider the > > following code, > > assume blocking sockets:
> > 1) do some stuff > > 2) do a huge write, don't check for short writes since our socket is > > blocking > That code is broken. Fix it. You must _always_ check for short > writes. Not > doing so is buggy code. Nothing in POSIX, SUSvn, or any other standard > requires that write blocks until everything is written. That is my whole point. Nothing in POSIX, SUSvn, or any other standard requires that a read after a select not block. So assuming it won't is buggy code. You must always set a socket non-blocking if you want a socket not to block because nothing else guarantees you won't block, just as setting a socket blocking does not guarantee that it will block until all the data is sent. > And on many > operating systems, it won't. That's really not the issue. The point is that on any system it could. Even if no system currently existed that had this property, the behavior is still not guaranteed, and that's what matters. In fact, assuming no signals, I don't know of any operating system that does have short writes (except in the face of fatal errors) on blocking TCP sockets. However, the fact that I don't know of (or even can't imagine) such a system doesn't provide me a *guarantee*. Now if there was no way at all to get a guarantee, we'd just be screwed and would have no choice but to hope for the best. But in this case, we have an easy way to get the guarantee. So assuming would be error. Assuming blocking TCP sockets won't show a short write unless there's a signal or fatal error is precisely the same error as assuming a blocking read after a select won't block. And, I'd like to point out one more time, we know of cases where a blocking read after a select will block. For example, if someone interposes OpenSSL between select/read/write and the OS. Someone *can* do this and people *do* do this. DS ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]