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

Robert Brewer fumanchu at amor.org
Sat Jan 8 14:04:58 EST 2005


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

Good question! Something like:

        # Receive reply.
        data = []
        while True:
            try:
                chunk = conn.recv(8192)
            except Exception, x:
                if x.args[0] != 10035:
                    raise x
            else:
                if chunk == '':
                    break
                data.append(chunk)

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.


Robert Brewer
MIS
Amor Ministries
fumanchu at amor.org



More information about the Python-list mailing list