Example #1
0
def test_unused_free_port_unconstrained():
    port = sockets.unused_port()

    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    # would throw exception if port was not free.
    s.bind(('localhost', port))
    s.close()
Example #2
0
 def __init__(self, host=None, port=None):
     if host is None:
         host = DEFAULT_PROXY_TO_HOST
     if port is None:
         port = sockets.unused_port()
         log.info("Obtained unused port %d" % port)
     self.host = host
     self.port = port
Example #3
0
 def __init__(self, host=None, port=None):
     if host is None:
         host = DEFAULT_PROXY_TO_HOST
     if port is None:
         port = sockets.unused_port()
         log.info("Obtained unused port %d" % port)
     self.host = host
     self.port = port