Commit 0e5cfed7 authored by Chris Harris's avatar Chris Harris
Browse files

Add server option to chose host to listen on

Add -i or --host option to allow host to be selected, useful if
machine has multiple network interfaces. Had to use -i as -h is
taken by help.

Change-Id: Ic3d524e0a6d3fd8ed4937d03d5d4dba825f15156
parent 734f1d1a
......@@ -6,6 +6,8 @@ r"""
Any VTK Web executable script come with a set of standard arguments that
can be overriden if need be::
--host localhost
Interface on which the HTTP server will listen on.
--port 8080
Port number on which the HTTP server will listen to.
......
......@@ -18,6 +18,8 @@ r"""
Any VTK Web executable script come with a set of standard arguments that
can be overriden if need be::
--host localhost
Interface on which the HTTP server will listen on.
--port 8080
Port number on which the HTTP server will listen to.
......
......@@ -46,6 +46,8 @@ def add_arguments(parser):
parser.add_argument("-s", "--nosignalhandlers",
help="Prevent Twisted to install the signal handlers so it can be started inside a thread.",
action="store_true")
parser.add_argument("-i", "--host", type=str, default='localhost',
help="the interface for the web-server to listen on (default: localhost)")
parser.add_argument("-p", "--port", type=int, default=8080,
help="port number for the web-server to listen on (default: 8080)")
parser.add_argument("-t", "--timeout", type=int, default=300,
......@@ -89,6 +91,7 @@ def start_webserver(options, protocol=wamp.ServerProtocol, disableLogging=False)
"""
Starts the web-server with the given protocol. Options must be an object
with the following members:
options.host : the interface for the web-server to listen on
options.port : port number for the web-server to listen on
options.timeout : timeout for reaping process on idle in seconds
options.content : root for web-pages to serve.
......@@ -103,7 +106,7 @@ def start_webserver(options, protocol=wamp.ServerProtocol, disableLogging=False)
# setup the server-factory
wampFactory = wamp.ReapingWampServerFactory(
"ws://localhost:%d" % options.port, options.debug, options.timeout)
"ws://%s:%d" % (options.host, options.port), options.debug, options.timeout)
wampFactory.protocol = protocol
# Do we serve static content or just websocket ?
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment