src/eric7/EricNetwork/EricJsonStreamReader.py

branch
eric7-maintenance
changeset 9549
67295777d9fe
parent 9442
906485dcd210
parent 9521
a663a8be64da
child 9654
7328efba128b
--- a/src/eric7/EricNetwork/EricJsonStreamReader.py	Mon Oct 31 14:07:57 2022 +0100
+++ b/src/eric7/EricNetwork/EricJsonStreamReader.py	Wed Nov 30 09:19:51 2022 +0100
@@ -10,11 +10,10 @@
 import json
 
 from PyQt6.QtCore import pyqtSignal, pyqtSlot
-from PyQt6.QtNetwork import QTcpServer, QHostAddress
-
-from eric7.EricWidgets import EricMessageBox
+from PyQt6.QtNetwork import QHostAddress, QTcpServer
 
 from eric7 import Preferences, Utilities
+from eric7.EricWidgets import EricMessageBox
 
 
 class EricJsonReader(QTcpServer):
@@ -48,22 +47,29 @@
         # setup the network interface
         if ip is None:
             networkInterface = Preferences.getDebugger("NetworkInterface")
-            if networkInterface == "all" or "." in networkInterface:
+            if networkInterface in ("allv4", "localv4") or "." in networkInterface:
                 # IPv4
                 self.__hostAddress = "127.0.0.1"
-            else:
+            elif networkInterface in ("all", "allv6", "localv6"):
                 # IPv6
                 self.__hostAddress = "::1"
+            else:
+                self.__hostAddress = networkInterface
         else:
             self.__hostAddress = ip
         self.listen(QHostAddress(self.__hostAddress))
 
         self.newConnection.connect(self.handleNewConnection)
 
-        ## Note: Need the port if writer is started external in debugger.
+        ## Note: Need the address and port if client is started external in debugger.
+        hostAddressStr = (
+            "[{0}]".format(self.__hostAddress)
+            if ":" in self.__hostAddress
+            else self.__hostAddress
+        )
         print(  # __IGNORE_WARNING_M801__
-            "JSON reader ({1}) listening on: {0:d}".format(
-                self.serverPort(), self.__name
+            "JSON server ({2}) listening on: {0}:{1:d}".format(
+                hostAddressStr, self.serverPort(), self.__name
             )
         )
 

eric ide

mercurial