diff options
Diffstat (limited to 'module')
-rw-r--r-- | module/remote/SocketServer.py | 9 | ||||
-rw-r--r-- | module/web/WebServer.py | 6 |
2 files changed, 11 insertions, 4 deletions
diff --git a/module/remote/SocketServer.py b/module/remote/SocketServer.py index d2fa912dd..2edd1d9f3 100644 --- a/module/remote/SocketServer.py +++ b/module/remote/SocketServer.py @@ -46,9 +46,12 @@ class MainServerSocket(asyncore.dispatcher): asyncore.dispatcher.__init__(self) pycore.logger.info('initing Remote-Server') self.pycore = pycore - self.create_socket(socket.AF_INET, socket.SOCK_STREAM) - self.bind(('', port)) - self.listen(5) + try: + self.create_socket(socket.AF_INET, socket.SOCK_STREAM) + self.bind(('', port)) + self.listen(5) + except: + raise Exception("Can't create socket") def handle_accept(self): newSocket, address = self.accept() self.pycore.logger.info("Connected from " + str(address)) diff --git a/module/web/WebServer.py b/module/web/WebServer.py index 5497439da..8cef0de2f 100644 --- a/module/web/WebServer.py +++ b/module/web/WebServer.py @@ -283,4 +283,8 @@ class WebServer(threading.Thread): def run(self): self.core.logger.info("Starting Webinterface on %s port %s" % (self.core.config['webinterface']['listenaddr'],self.core.config['webinterface']['port'])) - run(host=self.core.config['webinterface']['listenaddr'], port=int(self.core.config['webinterface']['port']), quiet=True) + try: + run(host=self.core.config['webinterface']['listenaddr'], port=int(self.core.config['webinterface']['port']), quiet=True) + except: + self.core.logger.error("Failed starting webserver, no webinterface available: Can't create socket") + exit() |