Permalink
Browse files

now chooses a socket automatically

  • Loading branch information...
cobbal committed Jun 5, 2012
1 parent b424a65 commit 50fcb1d9c2ca628c58d7e5d3ccde2d70f0e452d7
Showing with 2 additions and 6 deletions.
  1. +2 −6 RemoteInteractive.py
View
@@ -1,12 +1,8 @@
import code, socket, sys
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-for port in range(5000, 5010):
- try:
- server_socket.bind(('', 5000))
- break
- except socket.error:
- pass
+server_socket.bind(('', 0))
+print "listening for connection on on %s:%s" % server_socket.getsockname()
server_socket.listen(1)
client_socket, address = server_socket.accept()
print 'I got a connection from ', address

0 comments on commit 50fcb1d

Please sign in to comment.