I am developing a multiplayer game using python (pygame and podsixnet). Every time the client has to connect to the server, it has to type the server's hostname and port. I want to bypass this stage by automatically providing the client with this information. How can I find the address of my server? The game has been developed by following the tutorial: https://www.raywenderlich.com/38732/multiplayer-game-programming-for-teens-with-python
def __init__(self):
self.justplaced=10
n = self.dialog()
print n
pygame.init()
self.clock = pygame.time.Clock()
self.screen = pygame.display.set_mode((WINDOWWIDTH, WINDOWHEIGHT))
pygame.display.set_caption('Scrabble')
self.gameid=None
self.num=None
self.lastx, self.lasty = 0, 0
self.mousex = 0 # used to store x coordinate of mouse event
self.mousey = 0 # used to store y coordinate of mouse event
#print BGCOLOR
self.screen.fill(BGCOLOR)
#pygame.display.update()
self.is_Placed = self.generateBoxData(False)
self.placed_Letter = self.generateBoxData("")
self.is_Formed = self.generateBoxData(False)
self.owner = self.generateBoxData(99)
self.is_Clicked = self.generateBoxData(False)
address=raw_input("Address of Server: ")
try:
if not address:
host, port="localhost", 8000
else:
host,port=address.split(":")
self.Connect(("localhost" ,int(port)))
except:
print "Error Connecting to Server"
print "Usage:", "host:port"
print "e.g.", "localhost:31425"
exit()
print "Boxes client started"