5.2.1.6. ping_tcp_port

mfutil.net.ping_tcp_port(host, port, timeout=5)[source]

Ping a TCP host/port with a configurable timeout.

It’s not really a ping but a little connection attempt to see if the port is open and listened. The timeout is useful when there is a kind of firewall between.

No Exception are raised in any case.

Parameters
  • host (string) – the hostname/ip to ping.

  • port (int) – the TCP port to ping.

  • timeout (int) – timeout in seconds.

Returns

True if the port is open and listened.

Return type

boolean