import socket


def check_free_port(ip, port):
    """
    Check if a requested port is idle
    @param ip: ip address of the host
    @param port: the port number to check its availability
    @return: a boolean determining if the port is idle of not
    """
    #

    # Create a TCP socket
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    try:
        s.connect((ip, port))
        return False
    except socket.error:
        return True
    finally:
        s.close()