Code Monkey home page Code Monkey logo

Comments (5)

bdraco avatar bdraco commented on August 28, 2024 1

Thanks for the explanation:

When I look at the man page for ping:

     -t timeout
             Specify a timeout, in seconds, before ping exits regardless of how many packets have been received.

My expectation was that it worked in the same way as -t

ping -t 1 -c 5 (times out in 1 second)

% time ping -t 1 -c 5 192.168.1.1     
PING 192.168.1.1 (192.168.1.1): 56 data bytes
Request timeout for icmp_seq 0

--- 192.168.1.1 ping statistics ---
2 packets transmitted, 0 packets received, 100.0% packet loss
ping -t 1 -c 5 192.168.1.1  0.00s user 0.00s system 0% cpu 1.006 total

ping -t 2 -c 5 (times out in 1 second)

bdraco@Js-MacBook-Pro-3 ~ % time ping -t 2 -c 5 192.168.1.1
PING 192.168.1.1 (192.168.1.1): 56 data bytes
Request timeout for icmp_seq 0

--- 192.168.1.1 ping statistics ---
2 packets transmitted, 0 packets received, 100.0% packet loss
ping -t 2 -c 5 192.168.1.1  0.00s user 0.01s system 0% cpu 2.013 total
bdraco@Js-MacBook-Pro-3 ~ % 

Adjusting the timeout to 1 on the Home Assistant side should resolve the issue that user is reporting.

from icmplib.

ValentinBELYN avatar ValentinBELYN commented on August 28, 2024

This is the normal behavior of the library. It is also the case with the ping command integrated in your system. A ping corresponds to the sending of an ICMP request to a remote host and the receiving of an ICMP reply indicating the reachability of the host. In the event of no response from the latter, a timer is decremented, the timeout, before considering the request or the response as lost (probably because the host cannot be reached).

If you make two pings and the remote host does not respond, you wait twice for this timeout. With 30 pings, you will wait 30 times for this timeout in the event of no response. Obviously, if the host responds, this timeout is never considered.

Consequently, the timeout that you specified in parameter applies to each request and the maximum waiting time can be count * timeout in the event of no response.

from icmplib.

ValentinBELYN avatar ValentinBELYN commented on August 28, 2024

From README.md:

  • timeout

    The maximum waiting time for receiving a reply in seconds.

    • Type: int or float
    • Default: 2

from icmplib.

bdraco avatar bdraco commented on August 28, 2024

Adjusted here home-assistant/core#41620

from icmplib.

ValentinBELYN avatar ValentinBELYN commented on August 28, 2024

Um... What I meant is this is my normal behavior: to tend to be sure of myself and not to check my sources when I am tired 😭.

I am really sorry. This behavior is unique to Windows and even though I am working on Linux, I thought the ping command had a similar timeout parameter.

from icmplib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.