'Read from socket but return nothing if we get an exception.'

def _ReadExactlyFailAfterFirst(self, sock, n):

    ret = ''
    left = n
    while left:
        try:
            ret += sock.recv(left)
            if (not ret):
                return ''
            left = (n - len(ret))
        except socket.timeout:
            if (left < n):
                return ''
        except socket.error:
            return ''
    return ret
