def recvall(self, sock):
        'Receives an entire string over a socket.'
        string = str()
        while True:
            buf = sock.recv(self.RECV_SIZE)
            if buf:
                string += buf
            else:
                sock.shutdown(socket.SHUT_RD)
                return string
Receives an entire string over a socket.
recipes/Python/496872_zservicepy/recipe-496872.py