Hi,
I'm currently developing a local client-server multiplayer game using sockets, where the client has to manually connect to a server that is running by entering its IP address. Instead, I want to display all the currently running servers (Ip addresses) on their local network so that they can chose one and connect to it. Anyone know how to do this? It will be very helpful thanks.
Here's a portion of the code from the server side:
I'm currently developing a local client-server multiplayer game using sockets, where the client has to manually connect to a server that is running by entering its IP address. Instead, I want to display all the currently running servers (Ip addresses) on their local network so that they can chose one and connect to it. Anyone know how to do this? It will be very helpful thanks.
Here's a portion of the code from the server side:
totalConnections = 0 port = 5555 host=socket.gethostname() # This just gets my IP address and connects to the server with it, since I normally run the server on the same machine during testing IP = socket.gethostbyname(host) server = IP s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: s.bind((server, port)) except socket.error as e: str(e) s.listen(2) print("Waiting for a connection, Server Started")