- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Python Program to calculate the Round Trip Time (RTT)
Here we will see how Python can be used to get the Round Trip Time (RTT). The RTT is the time which is taken by the entire trip of a signal. It means the time between the starting time when a signal is sent and the receiving time of the acknowledge signal.
The RTT results varies on different parameters like.
- The data transfer rate of the sender’s side.
- The nature of the transmission media.
- The actual distance between the sender and receiver.
- The number of nodes between sender and receiver.
- The amount of traffic on LAN.
- Number of requests handled by intermediate points.
Example Code
import time import requests import sys deffind_roundtriptime(url): initial_time = time.time() #Store the time when request is sent request = requests.get(url) ending_time = time.time() #Time when acknowledged the request elapsed_time = str(ending_time - initial_time) print('The Round Trip Time for {} is {}'.format(url, elapsed_time)) find_roundtriptime(sys.argv[1])
Output
$ python3 319.RoundTripTime.py https://www.tutorialspoint.com/ The Round Trip Time for https://www.tutorialspoint.com/ is 0.8301455974578857 $ python3 319.RoundTripTime.py https://www.google.com The Round Trip Time for https://www.google.com is 0.5217089653015137 $
Advertisements