romana / multi-ping

Python library to monitor one or many IP addresses via ICMP echo (ping) requests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiple uses of MultiPing() // return of receive()

sausix opened this issue · comments

The same MultiPing instance can't be used twice.
It's ugly to create a new object if you want to ping to the same address again.
At least some kind of reset() method would be great.

    pinger = MultiPing(['192.168.112.1'])

    pinger.send()
    ok, nok = pinger.receive(2)
    print(ok, nok)

    time.sleep(3)

    pinger.send()
    ok, nok = pinger.receive(2)
    print(ok, nok)

multiping.MultiPingError: No responses pending


receive() returns a tuple[dict, list].
Is there a reason for that? If i send two packets at once, what seems to be allowed in this way, only one response per given destination is being returned.
MultiPing(['192.168.112.1', '192.168.112.1'])

{'192.168.112.1': 0.0020570755004882812} []