So im making this p2p chat program and ive made it so that if one persn disconnect it wil find a new host but whe i first start it up it loops trying to connect
while True:
try:
print("Trying to connect ...")
time.sleep(randint(1,5))
for peer in p2p.peers:
try:
client = Client(peer)
except KeyboardInterrupt:
sys.exit(0)
except:
pass
if randint(1, 20) == 1:
try:
server = Server()
except KeyboardInterrupt:
sys.exit(0)
except:
print("Couldn't start the server ...")
except KeyboardInterrupt:
sys.exit(0)
i have the p2p set up just not the reconnect part