[Python-Dev] [Bug #111620] lots of use of send() without verifying amount of data sent (original) (raw)

Charles G Waldman cgw@fnal.gov
Fri, 18 Aug 2000 02:01:59 -0500 (CDT)


I'm jumping in late to this discussion to mention to mention that even for sockets in blocking mode, you can do sends with the MSG_DONTWAIT flag:

sock.send(msg, socket.MSG_DONTWAIT)

and this will send only as much data as can be written immediately. I.E., a per-message non-blocking write, without putting the socket into blocking mode.

So if somebody decides to raise an exception on short TCP writes, they need to be aware of this. Personally I think it's a bad idea to be raising an exception at all for short writes.