def recvFixedLength(s, lengthMsg):
    """
    Receive a fixed length message on socket s.
    Parm
        lengthMsg, an integer, which is the length in characters of the 
                   message to receive.
    Return
        the message received as a string.
    """
    pieces = []
    nbBytesRecv = 0
    while nbBytesRecv < lengthMsg:
        piece = s.recv(min(lengthMsg - nbBytesRecv, 4096))
        if piece == b'':
            # Give up now because nothing was received.
            return ''.join(pieces)
        pieces.append(piece.decode('utf-8'))
        nbBytesRecv = nbBytesRecv + len(piece)
    # print('Fixed receive: ',  ''.join(pieces))
    return ''.join(pieces)