iperf3-python icon indicating copy to clipboard operation
iperf3-python copied to clipboard

Client connection resilience on busy

Open pau1a opened this issue 6 years ago • 0 comments

Im trying to add some resilience to my clients such that if they attempt to connect to a port on the server that is busy, they automatically increment the port number within the range of open server ports. This is what I am trying. The problem is it seems never to trigger the exception. If I make port 5200 busy with another client, the test seems just to fail silently. Surely I can't be the first person to attempt this. Any ideas how I can force a retry?

client = iperf3.Client()
client.duration = 15
client.server_hostname = 'x.x.x.x'
client.verbose = True
client.reverse = True
print('a')
i = 0
while i < 9:
        print('b')
        try:
                client.port = 5200 + i
                print('c')
                result = client.run()
                print(result.received_Mbps)
                i = 10
                print(str(client.port))
        except:
                i = i + 1

pau1a avatar Mar 10 '19 22:03 pau1a