there's a socket.sendall(), so why no socket.recvall()?

Irmen de Jong irmen at -nospam-remove-this-xs4all.nl
Sat Jan 8 15:04:29 EST 2005


Robert Brewer wrote:
> Irmen de Jong wrote:
> 
>>Subject says it all;
>>there's a socket.sendall(), so why no socket.recvall()?
> 
[...]

> If you call .makefile() and then .read() the _fileobject, you get the
> same behavior (only better). Adding recvall would just duplicate that, I
> think. But that's desirable IMO.

Hm, I didn't consider makefile(). But I'm not sure if that
works in all cases. Until now, I've been using a loop rather
like the one you posted.

But, as I pointed out earlier, there is the MSG_WAITALL option
on various platforms (Linux for instance).

So instead of sticking it in an explicitly programmed loop
in Python, or using an extension module such as this one:
http://mail.python.org/pipermail/python-list/2003-January/143051.html
, I'd rather have a recvall method on the socket object that
essentially uses MSG_WAITALL if available, and uses a
loop construction if not.

I may even write a patch for socketmodule.c right now :-D

--Irmen de Jong



More information about the Python-list mailing list