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
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?