def discover_methods(iface):
    sniffers = []
    for port in listening_ports():
        sniff = discover_on_port(port, iface, MsgHandler(port))
        sniffers.append(sniff)

    # done when all sniffers are done (or the user gets tired)
    try:
        while True:
            if all(not sniff.isAlive() for sniff in sniffers):
                break
    except __HOLE__:
        pass
dataset/ETHPy150Open pinterest/thrift-tools/examples/methods_per_port.py/discover_methods