On Wed, Sep 26, 2018 at 07:40:08PM +0200, Pino Toscano wrote:
On Thursday, 20 September 2018 10:50:14 CEST Richard W.M. Jones wrote:
+# Choose a random port number in range [50000,59999] +imageio_port = random.randint(50000,60000) + [...] + +def server(): + server_address = ("", imageio_port) + httpd = HTTPServer(server_address, RequestHandler) + httpd.serve_forever()
The random port can be chosen directly by the OS, using the special port 0:
from http.server import HTTPServer, SimpleHTTPRequestHandler server_address = ("", 0) httpd = HTTPServer(server_address, SimpleHTTPRequestHandler) print(httpd.server_address) ('0.0.0.0', 44725)
Of course :-) Thanks, will fix. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/