def recvall(sock, n):
    """
    returns the data from a recieved bytestream, helper function 
    to receive n bytes or return None if EOF is hit
    :param sock: socket
    :param n: length in bytes (number of bytes)
    :return: message
    """
    #
    data = b''
    while len(data) < n:
        print("Start function sock.recv")
        packet = sock.recv(n - len(data))
        if not packet:
            return None
        data += packet
    return data