Program to calculate the Round Trip Time (RTT) Last Updated : 13 Feb, 2023 Comments Improve Suggest changes 5 Likes Like Report Round trip time(RTT) is the length of time it takes for a signal to be sent plus the length of time it takes for an acknowledgment of that signal to be received. This time, therefore, consists of the propagation times between the two-point of the signal. On the Internet, an end-user can determine the RTT to and from an IP(Internet Protocol) address by pinging that address. The result depends on various factors:- The data rate transfer of the source's internet connection.The nature of transmission medium.The physical distance between source and destination.The number of nodes between source and destination.The amount of traffic on the LAN(Local Area Network) to which end-user is connected.The number of other requests being handled by intermediate nodes and the remote server.The speed with which the intermediate node and the remote server function.The presence of Interference in the circuit. Examples: Input : www.geeksforgeeks.org Output : Time in seconds : 0.212174892426 Input : www.cricbuzz.com Output : Time in seconds : 0.55425786972 Python # Python program to calculate RTT import time import requests # Function to calculate the RTT def RTT(url): # time when the signal is sent t1 = time.time() r = requests.get(url) # time when acknowledgement of signal # is received t2 = time.time() # total time taken tim = str(t2-t1) print("Time in seconds :" + tim) # driver program # url address url = "http://www.google.com" RTT(url) C# //c# program to calculate RTT using System; using System.Net; class Program { static void Main(string[] args) { string url = "http://www.google.com"; // time when the signal is sent var t1 = DateTime.Now; using (var client = new WebClient()) { var result = client.DownloadString(url); } // time when acknowledgement of signal // is received var t2 = DateTime.Now; // total time taken var timeTaken = t2 - t1; Console.WriteLine("Time in seconds : " + timeTaken.TotalSeconds); } } //this code is contributed by snehalsalokhe -> (Snehal Salokhe) Output: Time in seconds :0.0579478740692 Create Quiz Comment K kartik 5 Improve K kartik 5 Improve Article Tags : DSA Explore DSA FundamentalsLogic Building Problems 2 min read Analysis of Algorithms 1 min read Data StructuresArray Data Structure 3 min read String in Data Structure 2 min read Hashing in Data Structure 2 min read Linked List Data Structure 2 min read Stack Data Structure 2 min read Queue Data Structure 2 min read Tree Data Structure 2 min read Graph Data Structure 3 min read Trie Data Structure 15+ min read AlgorithmsSearching Algorithms 2 min read Sorting Algorithms 3 min read Introduction to Recursion 15 min read Greedy Algorithms 3 min read Graph Algorithms 3 min read Dynamic Programming or DP 3 min read Bitwise Algorithms 4 min read AdvancedSegment Tree 2 min read Binary Indexed Tree or Fenwick Tree 15 min read Square Root (Sqrt) Decomposition Algorithm 15+ min read Binary Lifting 15+ min read Geometry 2 min read Interview PreparationInterview Corner 3 min read GfG160 3 min read Practice ProblemGeeksforGeeks Practice - Leading Online Coding Platform 1 min read Problem of The Day - Develop the Habit of Coding 5 min read Like