Beispiel #1
0
def main():
    start_time = time.time()
    lossy_socket.sim = lossy_socket.SimulationParams(
        loss_rate=0.1,
        corruption_rate=0.1,
        max_delivery_delay=0.1,
        become_reliable_after=100000.0)

    if len(sys.argv) < 4:
        print("usage is: python3 test.py [port1] [port2] [1|2]")
        print(
            "First run with last argument set to 1, then with 2 (in two different terminals on the same machine"
        )
        sys.exit(-1)
    port1 = int(sys.argv[1])
    port2 = int(sys.argv[2])

    if sys.argv[3] == "1":
        host1(port1, port2)
    elif sys.argv[3] == "2":
        host2(port2, port1)
    else:
        print("Unexpected last argument: " + sys.argv[2])

    print("ELAPSED_TIME=", time.time() - start_time)
Beispiel #2
0
def main():
    lossy_socket.sim = lossy_socket.SimulationParams(loss_rate=0.0, corruption_rate=0.0, max_delivery_delay=1)

    if len(sys.argv) < 4:
        print("usage is: python3 test.py [port1] [port2] [1|2]")
        print("First run with last argument set to 1, then with 2 (in two different terminals on the same machine")
        sys.exit(-1)
    port1 = int(sys.argv[1])
    port2 = int(sys.argv[2])

    if sys.argv[3] == "1":
        host1(port1, port2)
    elif sys.argv[3] == "2":
        host2(port2, port1)
    else:
        print("Unexpected last argument: " + sys.argv[2])