'Receive response from server on socket \'s\' and return it as
(status,bufsize,payload).'

def receiveResponse(self, minBytes=0):

    resp_hdr = self.sock.recv(8)
    while (len(resp_hdr) < 8):
        resp_hdr += self.sock.recv((8 - len(resp_hdr)))
    (version, command, bufsize) = struct.unpack('HHI', resp_hdr)
    if (version != VERSION):
        self.disconnect()
        raise IOError('Bad    response    from    buffer    server    -    disconnecting')
    if (bufsize > 0):
        payload = self.sock.recv(bufsize)
        while (len(payload) < bufsize):
            payload += self.sock.recv((bufsize - len(payload)))
    else:
        payload = None
    return (command, bufsize, payload)
