mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-22 01:13:00 +02:00
If ping succeed but fail to check if netconf port is open, the testsystem will hang forever. This will allow totally broken images to be loaded at the device.
9 lines
222 B
Python
9 lines
222 B
Python
import socket
|
|
|
|
def tcp_port_is_open(host, port, timeout=3):
|
|
try:
|
|
with socket.create_connection((host, port), timeout=timeout):
|
|
return True
|
|
except (socket.timeout, OSError):
|
|
return False
|