diff options
author | Ike Devolder <ike.devolder@gmail.com> | 2019-07-04 23:33:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-04 23:33:56 +0200 |
commit | d8fc3734f02e0f9cde40329794d3c7435d934c9f (patch) | |
tree | a49f07cd0e45f6d093c2a95abfb8dc4d62227e34 /python3 | |
parent | 1006a5ae7bfb2adc36c5085c0af625e0cc6deff3 (diff) | |
parent | 6936eecc9930b27654efa6fc5ab6c030ac6da7e5 (diff) | |
download | vdebug-d8fc3734f02e0f9cde40329794d3c7435d934c9f.zip |
Merge pull request #407 from Garethp/port-checking
Reports to the user if the port they want is already taken
Diffstat (limited to 'python3')
-rw-r--r-- | python3/vdebug/connection.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/python3/vdebug/connection.py b/python3/vdebug/connection.py index 2c1f343..a73aa11 100644 --- a/python3/vdebug/connection.py +++ b/python3/vdebug/connection.py @@ -1,3 +1,4 @@ +import errno import queue import socket import sys @@ -187,7 +188,15 @@ class BackgroundSocketCreator(threading.Thread): except socket.error: # No connection pass + except socket.error as socket_error: + self.log("Error: %s" % str(sys.exc_info())) + self.log("Stopping server") + + if socket_error.errno == errno.EADDRINUSE: + self.log("Address already in use") + print("Socket is already in use") except Exception: + print("Exception caught") self.log("Error: %s" % str(sys.exc_info())) self.log("Stopping server") finally: |