Comments (5)
For my own software, it would be nice to be able to retrieve, and log the TTL information.
The TTL information is retrieved from the call to _recieve
as iphTTL
here: (d735df8)
146
147 recvTime, dataSize, iphSrcIP, icmpSeqNumber, iphTTL \
148 = _receive(mySocket, my_ID, timeout, ipv6)
149
And is only used in a print statement here: (d735df8)
164
165 if verbose:
166 print("%d bytes from %s: icmp_seq=%d ttl=%d time=%.2f ms" % (
167 dataSize, host_addr, icmpSeqNumber, iphTTL, delay)
168 )
169
My proposed change would be to extend the return statement for send_one
by returning the results of the request as a tuple after the delay value:
return delay, (recvTime, dataSize, host_addr, icmpSeqNumber, iphTTL)
Not only does this allow developers to access the TTL information, but it allows them to access the information about each request response as it is recieved. For example, right now my code needs to log a time as to when single_ping
completes executing, but this information is already stored with ping.single_ping.recvTime
, and I need access to the TTL information that is stored at ping.single_ping.iphTTL
. Previous iterations of my software used to just capture the STDOUT
data and sift through it for the TTL, and I'd rather not have to do that again. This allows me to retrieve it naturally.
This way, our code can be refactored to just use single_ping()[0]
to access the delay value.
from python-ping.
Got for it 👍
from python-ping.
We're displaying the actual TTL data
python ping.py 8.8.4.4
PYTHON PING 8.8.4.4 (8.8.4.4): 64 data bytes
64 bytes from 8.8.4.4: icmp_seq=0 ttl=61 time=3.92 ms
64 bytes from 8.8.4.4: icmp_seq=1 ttl=61 time=3.93 ms
64 bytes from 8.8.4.4: icmp_seq=2 ttl=61 time=3.96 ms
^C
----8.8.4.4 PYTHON PING Statistics----
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip (ms) min/avg/max = 3.9/3.9/4.0
(Terminated with signal 2)
python ping.py 195.24.90.1
PYTHON PING 195.24.90.1 (195.24.90.1): 64 data bytes
64 bytes from 195.24.90.1: icmp_seq=0 ttl=64 time=0.19 ms
64 bytes from 195.24.90.1: icmp_seq=1 ttl=64 time=0.26 ms
----195.24.90.1 PYTHON PING Statistics----
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip (ms) min/avg/max = 0.2/0.2/0.3
from python-ping.
We are displaying it, but we arent collecting the data into MStats
.
TTL's can change over time.
Really, I just think single_ping
should allow developers access to the data instead of just dropping it. It may not be useful for the end user, but it is useful for data tracking and network monitoring.
Maybe just add it to the return
statement?
from python-ping.
Can you show an example of what you have in mind?
from python-ping.
Related Issues (15)
- do_one is named obtusely HOT 1
- quiet and verbose_ping cannot ping continuously HOT 3
- Python 2.7 spits out a traceback on [Error 65] HOT 2
- The current experimental generator functionality breaks myStats. HOT 5
- quiet_ping() loops HOT 8
- Should we submit a pull to samuel/python-ping? HOT 2
- The current repository name breaks python import structures in python3 and above HOT 5
- The current license has outdated information HOT 1
- single_ping blocks threading.Thread.join HOT 1
- There is a set of logic in single_ping that potentially blocks out ipv6 decoding HOT 1
- Doesn't work anymore on Windows HOT 3
- Needs more 3.6 compatibility
- Broadcast Pings do not appear to be working HOT 1
- How to hide 'Request timed out' message when calling quiet_ping() ? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-ping.