I have this python code...
The point of the code is to simulate a peer to peer network, where if you run the code on different command prompt , one of them will become the server (where its role is to only manage the other clients, and print the local IP address, with there special port number when they're connected) , and the others become clients that can communicate together...
However, if the current server disconnect, the other clients will print that the "Connection with the server forcibly closed." , then try to reconnect to the new server.. (I want one of the current clients to become the new server).
my issue, is that all of them show that they have become a server (by printing "Server is running...") but only one actually becomes the server if other new clients try to connect. whereas the others will print "Connection with the server forcibly closed." and stop running.
How can I correct this so that only one of these clients prints and become the server, while the others that already where connected, try to reconnect to the new server and not just forcibly close??
Please Download txt to see the code <3