I have the below Python code which checks whether the ssh host is up or not:
`for hostname ,ipaddr in host_dict.items(): if tcp_conn.tcp_port_is_open(ipaddr, constants.TCP_PORT, constants.TCP_TIMEOUT) == True : print("host is Up") else: print("Host is Down")`
I want to add retry logic which checks if the host is having some issue then it reconnects and checks whether it is up or not, the retry count will be 3.
I tried running the code and it works fine, but i want to add the retry logic in case the host is down or having some issues then retry should try to connect again with the host.