We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 551c5c4 commit 5128f44Copy full SHA for 5128f44
1 file changed
reflex/utils/processes.py
@@ -61,8 +61,16 @@ def is_process_on_port(port: int) -> bool:
61
Returns:
62
Whether a process is running on the given port.
63
"""
64
+ # Test IPv4 localhost (127.0.0.1)
65
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:
- return sock.connect_ex(("127.0.0.1", port)) == 0
66
+ ipv4_result = sock.connect_ex(("127.0.0.1", port)) == 0
67
+
68
+ # Test IPv6 localhost (::1)
69
+ with closing(socket.socket(socket.AF_INET6, socket.SOCK_STREAM)) as sock:
70
+ ipv6_result = sock.connect_ex(("::1", port)) == 0
71
72
+ # Port is in use if either IPv4 or IPv6 is listening
73
+ return ipv4_result or ipv6_result
74
75
76
def change_port(port: int, _type: str) -> int:
0 commit comments