LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-05-2006, 08:04 AM   #1
trscookie
Member
 
Registered: Apr 2004
Location: oxford
Distribution: gentoo
Posts: 463

Rep: Reputation: 30
calculate the RTT of a datagram


hello all i have been asked to calculate the RTT(Round trip time) of a network, i have created a program that sends a packet to a server program then the server program sends a packet back to the client. so far i have got it to calculate the time in milliseconds to send the packet to the server and calculate the difference here is a sample output from my program:

SERVER:
cookie@HAL ~$ mono server.exe
Server started...
port: 2555
Waiting for client input:

time: 469842688960
Client Time: 469842688960
Server Time: 469842933160
Time taken is: 244200 ( milliseconds )


CLIENT:
cookie@HAL ~$ mono client.exe 127.0.0.1
type help for information, exit or quit to close the application
Waiting for Message to send:
time
time: 469842688960
server: reply no0



so the chain of events are: i type time in my client program it takes 'tick' of the time of day: 469842688960 (in milliseconds)

it sends that in a packet to the server who finds out the 'tick' of that time of day: 469842688960

the server then takes the client time: 469842688960 and the server time 469842933160 and detects it to make the difference Time taken is: 244200 ( milliseconds )
.

so from this is it possible to find the RTT? cheers
 
Old 04-05-2006, 09:09 AM   #2
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,499
Blog Entries: 2

Rep: Reputation: 68
Wow ! Use ping ! From the ping man page, option -U, it says:
Quote:
Originally Posted by ping man page
...Normally ping prints network round trip time...
So, the ping without the -U option prints the RTT in the time= field.
 
Old 04-05-2006, 09:16 AM   #3
trscookie
Member
 
Registered: Apr 2004
Location: oxford
Distribution: gentoo
Posts: 463

Original Poster
Rep: Reputation: 30
cheers for the reply, the problem is i have to write my own application to calculate it, its for part of my studies.

i just cant find much information on how to make the calculations i think that im in the right area just not sure. thanks again trscookie
 
Old 04-05-2006, 02:20 PM   #4
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,499
Blog Entries: 2

Rep: Reputation: 68
I am a poor sys admin, not a programmer, but I think you could use the same ping aprouch: Sends a single packet to the target machine, and get back the reply. Than measure the time elapsed beetween two. Send several packets in a row and calculate the arithmetic mean. Each packet must have a label or something like that in the payload area, so you can track the order its arrives.

Anyone else has a better idea ?
 
Old 04-05-2006, 05:47 PM   #5
trscookie
Member
 
Registered: Apr 2004
Location: oxford
Distribution: gentoo
Posts: 463

Original Poster
Rep: Reputation: 30
ahr cheers, thats more what i was after, i thought that it was going to be some sort of hard core calculation!! so do i measure it in milliseconds or nanoseconds etc....does it matter? i think that im going to measure it in milliseconds unless someone suggests otherwise. cheers trscookie.
 
Old 04-06-2006, 07:07 AM   #6
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,499
Blog Entries: 2

Rep: Reputation: 68
No hard core calculations, just plain math. milliseconds, nanoseconds, whatever ! Just keep a consistent unit.

Good luck !
 
Old 04-06-2006, 07:33 AM   #7
trscookie
Member
 
Registered: Apr 2004
Location: oxford
Distribution: gentoo
Posts: 463

Original Poster
Rep: Reputation: 30
nice! for those interested you can view the project here:


http://homepages.feis.herts.ac.uk/~ca5ae/


on the left hand side, i know there is no source available yet and its a little buggy, but it will be released in due time. (you need the .net arch to run it (or mono)) im quite proud of it as its my first c# project!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to calculate bandwidth on linux epsharma Linux - Software 4 07-02-2006 11:45 AM
How to calculate Server power needs psychobyte Linux - Hardware 1 08-11-2005 03:59 AM
calculate (in & out) traffic shahg_shahg Linux - Networking 1 01-17-2005 09:02 AM
How to read udp datagram length? sceadu Programming 1 01-05-2005 09:22 PM
calculate traffic using iptables p_nanda2002 Linux - Software 4 11-01-2002 03:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration