[Python-Dev] noreply@sourceforge.net: [Python-bugs-list] [Bug #111620] lots of use of send() without verifyi ng amount of data sent.

Sam Rushing rushing@nightmare.com
Fri, 11 Aug 2000 09:59:07 -0700 (PDT)


Guido van Rossum writes:
 > Really?!?!
 > 
 > I just read the man page for send() (Red Hat linux 6.1) and it doesn't
 > mention sending fewer than all bytes at all.  In fact, while it says
 > that the return value is the number of bytes sent, it at least
 > *suggests* that it will return an error whenever not everything can be
 > sent -- even in non-blocking mode.
 > 
 > Under what circumstances can send() return a smaller number?

It's a feature of Linux... it will send() everything.  Other unixen
act in the classic fashion (it bit me on FreeBSD), and send only what
fits right into the buffer that awaits.

I think this could safely be added to the send method in
socketmodule.c.  Linux users wouldn't even notice.  IMHO this is the
kind of feature that people come to expect from programming in a HLL.
Maybe disable the feature if it's a non-blocking socket?

-Sam