def extract_port_num(arg):
    """Extract port number from command line argument."""
    port = 0
    try:
        port = int(arg)
    except ValueError:
        print("Invalid port number\n")
    return port