- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 $
- Related Articles
- C Program to calculate the Round Trip Time (RTT)
- C# Round-trip ("R") Format Specifier
- C++ Program to find out if a round trip is possible from a particular city
- Java Program to Calculate the Execution Time of Methods
- Java Program to calculate the time of sorting an array
- C Program to calculate the difference between two time periods
- C++ Program to Calculate Difference Between Two Time Period
- PHP program to calculate the total time given an array of times
- Program to find out the minimum number of intercountry travels in a road trip in Python
- Python Program to calculate the area of Cube
- Python Program to calculate the volume of Cube
- Python Program to Calculate Standard Deviation
- Python Program to calculate the area of the rhombus
- Python Program to calculate the area of a Tetrahedron
- Python Program to calculate the volume and area of Cone

Advertisements