tcping icon indicating copy to clipboard operation
tcping copied to clipboard

by pinging a hostname instead of an IP, errors do not count as "failed"

Open dayjaby opened this issue 4 years ago • 0 comments

When I ping a hostname, which can not be resolved, I get this error:

>>> ping.ping(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/tcping.py", line 171, in ping
    ((self._host, self._port), None))
  File "/usr/local/lib/python3.6/dist-packages/tcping.py", line 108, in cost
    func(*arg)
  File "/usr/local/lib/python3.6/dist-packages/tcping.py", line 45, in connect
    self._s.connect((host, int(port)))
socket.gaierror: [Errno -2] Name or service not known

However, this does not count as failed:

>>> ping._failed
0

dayjaby avatar Dec 04 '20 09:12 dayjaby