Giter Site home page Giter Site logo

quiet_ping() loops about python-ping HOT 8 CLOSED

l4m3rx avatar l4m3rx commented on August 13, 2024
quiet_ping() loops

from python-ping.

Comments (8)

l4m3rx avatar l4m3rx commented on August 13, 2024 1

Closing this one for now.... we'll reopen it if needed.

from python-ping.

l4m3rx avatar l4m3rx commented on August 13, 2024

Due to the fact that quiet_ping() should run in background and we only care about the end result (and infinite quiet ping is not really something ppl will really need) maybe it will be better if we only keep verbose_ping() as generator and revert quiet_ping() to the old way....
@EclectickMedia What do you think?

from python-ping.

l4m3rx avatar l4m3rx commented on August 13, 2024

I found the issue.

        if count is not None and i < count:
            i += 1
        elif count is not None:
            yield myStats.pktsSent
        elif count is not None and i >= count:
            break

Should be


        if count is not None and i < count:
            i += 1
        elif count is not None and i >= count:
            break
        elif count is not None:
            yield myStats.pktsSent

Or it will never brake.

Fix: f969f9d

from python-ping.

EclectickMedia avatar EclectickMedia commented on August 13, 2024

On the note of reverting quiet_ping to non-generator code,

I somewhat agree. I'm working with this repository in my own code and have found single_ping more useful for extension anyways.

Im able to just create a generator that uses single_ping as many times as needed (in my case, generally infinitely as I am using the software to collect large datasets) via:

import ping as pythonping  # I have another function named ping that is higher level than this
def generate_pings(address, **kwargs):
    i = 0
    while 1:
        yield pyping.single_ping('google.com', host_name, 3000, timeout, i, 64)
        i += 1

I use this generator to generate my own statistics and visualize them via MatPlotLib (unfortunately matplotlib doesnt like the frequency at which I can generate data.... grumbles angrily)

*The current implementation was able to receive new data up to 70% more often than Nix's implemented ping utility.

As to your comment about no one needing to infinitely ping:

I need ping's to run for up to 6 months at a time to collect data and run analysis on the variance over time. I know several other IT pro's that maintain data about their response rate over time. This feature set is standard accross low level ping implementations across OS's. I think it is a feature worth implementing.

While most people collect data off each request (i.e saving the output to a CSV file), I can't really see anyone leaving the quiet_ping running for the same usages.

For an example of the software generating information exceptionally quickly, try out [my software](www.github.com/eclectickeclipse/pingstats]. Use $sudo python3 PingStats.py -a google.ca -sNF

from python-ping.

l4m3rx avatar l4m3rx commented on August 13, 2024

How do you suggest we proceed ?

I already did checkout ur project (PingStats) 👍

from python-ping.

EclectickMedia avatar EclectickMedia commented on August 13, 2024

I believe limiting features because you think the user won't need them sets you up for needing to add the feature later.

May as well allow the user the option regardless of the number of people that use it.

from python-ping.

l4m3rx avatar l4m3rx commented on August 13, 2024

In this case I preffer going the KISS way.
quiet_ping() will be used mainly when ping.py is used as a lib... with that in mind, whoever is using it can just loop on single_ping() , so we're really saving him what... 2-3 lines of code...

from python-ping.

EclectickMedia avatar EclectickMedia commented on August 13, 2024

Pretty much yeah. Thats fair.

from python-ping.

Related Issues (15)

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.