@retry(wait_exponential_multiplier=500, wait_exponential_max=30000, stop_max_attempt_number=7)
def tcp_test(host, port):
    LOG.debug("TCP test called")
    my_sock = None
    try:
        my_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        my_sock.settimeout(1)
        my_sock.connect((host, port))
        print("Connecting to {0} on port {1} {2}".format(host, port, COLOURS.to_green("[PASS]")))
        my_sock.shutdown(2)
        my_sock.close()
    except socket.error:
        my_sock.close()
        print("Connecting to {0} on port {1} {2}".format(host, port, COLOURS.to_yellow("[FAIL]")))
        LOG.debug("Waiting for {0}:{1} to accept a connection".format(host, port))
        raise
    except Exception as error:
        print("Connecting to {0} on port {1} {2}".format(host, port, COLOURS.to_yellow("[FAIL]")))
        LOG.debug("TCP test failed: {0}".format(error))
        raise
Notify the user that Airplayer has started.
dataset/ETHPy150Open sky-shiny/smolder/charcoal/tcptest.py/tcp_test--crossover with--dataset/ETHPy150Open pascalw/Airplayer/airplayer/mediabackends/base_media_backend.py/BaseMediaBackend.notify_started