util.network
Module Contents
- util.network.wait_for_tcp(host, port, *, timeout=600, to_shutdown=False, compare=None)
Wait for a TCP server to start responding on a given ‘host’ and ‘port’.
Optionally, read len(compare) bytes from the socket and compare them to the bytestring specified in ‘compare’. If they are different, close the socket and (re)try again later. With ‘to_shutdown’ set as well, return once the endpoint stops returning the comparison bytes, even if TCP still accepts connections. Useful for waiting for b’SSH-’ to start or stop answering on a forwarded port.