52 self.__clientProcess = None |
52 self.__clientProcess = None |
53 self.__connection = None |
53 self.__connection = None |
54 |
54 |
55 # setup the network interface |
55 # setup the network interface |
56 networkInterface = Preferences.getDebugger("NetworkInterface") |
56 networkInterface = Preferences.getDebugger("NetworkInterface") |
57 if networkInterface == "all" or "." in networkInterface: |
57 if networkInterface in ("allv4", "localv4") or "." in networkInterface: |
58 # IPv4 |
58 # IPv4 |
59 self.__hostAddress = "127.0.0.1" |
59 self.__hostAddress = "127.0.0.1" |
60 else: |
60 elif networkInterface in ("all", "allv6", "localv6"): |
61 # IPv6 |
61 # IPv6 |
62 self.__hostAddress = "::1" |
62 self.__hostAddress = "::1" |
|
63 else: |
|
64 self.__hostAddress = networkInterface |
63 self.listen(QHostAddress(self.__hostAddress)) |
65 self.listen(QHostAddress(self.__hostAddress)) |
64 |
66 |
65 self.newConnection.connect(self.handleNewConnection) |
67 self.newConnection.connect(self.handleNewConnection) |
66 |
68 |
67 ## Note: Need the port if client is started external in debugger. |
69 ## Note: Need the address and port if client is started external in debugger. |
|
70 hostAddressStr = ( |
|
71 "[{0}]".format(self.__hostAddress) |
|
72 if ":" in self.__hostAddress |
|
73 else self.__hostAddress |
|
74 ) |
68 print( # __IGNORE_WARNING_M801__ |
75 print( # __IGNORE_WARNING_M801__ |
69 "JSON server ({1}) listening on: {0:d}".format( |
76 "JSON server ({2}) listening on: {0}:{1:d}".format( |
70 self.serverPort(), self.__name |
77 hostAddressStr, self.serverPort(), self.__name |
71 ) |
78 ) |
72 ) |
79 ) |
73 |
80 |
74 @pyqtSlot() |
81 @pyqtSlot() |
75 def handleNewConnection(self): |
82 def handleNewConnection(self): |