Bind remote server by ip address

This should worke better than binding by hostname or 'localhost'
This commit is contained in:
Bryan Schumaker 2010-11-13 22:12:37 -05:00
parent d6d1c5f56c
commit ee8106e373
1 changed files with 3 additions and 1 deletions

View File

@ -88,7 +88,9 @@ def start_server():
# Set up a socket
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
server.bind((socket.gethostname(), 4242))
ip = socket.gethostbyname(socket.gethostname())
print "Remote server binding to: %s" % ip
server.bind((ip, 4242))
except:
print "Could not open port 4242"
server.listen(5)