From d00033ff0720ce9d017f4839c251cf38c02d80b8 Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Wed, 27 May 2026 01:32:39 +0300 Subject: [PATCH] RemoteOperations::is_port_free is updated (comment) --- src/remote_ops.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/remote_ops.py b/src/remote_ops.py index c2e2164..5f7fbce 100644 --- a/src/remote_ops.py +++ b/src/remote_ops.py @@ -690,13 +690,14 @@ def is_port_free(self, number: int) -> bool: assert number >= 0 assert number <= 65535 # OK? - # grep -q returns 0 if a listening socket on that port is found port_hex = format(number, '04X') # sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt ... # 137: 0A01A8C0:EC08 1DA2A959:01BB 01 00000000:00000000 02:00000000 00000000 ... C_REGEXP = r"^\s*[0-9]+:\s*[0-9a-fA-F]{8}:" + re.escape(port_hex) + r"\s+[0-9a-fA-F]{8}:[0-9a-fA-F]{4}\s+" + # grep -q returns 0 if a listening socket on that port is found + # Search /proc/net/tcp for any entry with this port # NOTE: grep requires quote string with regular expression # TODO: added a support for tcp/ip v6