Unix Programming - Time between sending and receiving of Ethernet Packet

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > March 2006 > Time between sending and receiving of Ethernet Packet





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Time between sending and receiving of Ethernet Packet
Yash

2006-03-13, 7:51 am

Hi all,

I need a solution, by which i can measure time between sending and
receiving of packet from one application to another one.
I am working with application with uses unicast( both TCP and UDP) and
broadcast.
Also i am having "Ethereal" tool to see when packet leaving one
port/NIC and reaching
other port/NIC. But i want more precise solution, by which i can know
delay for
application to application.

One solution which i thought off, is that i can get the system time
before
sending the packet, put it into packet with regular data and extract
the time at other end.
By comparing the current time with this time, i can get time
difference. Is it a
correct approch. I am not sure, how precise it is. Is there any better
method or
tool available.

I will be grateful to you for suggestions and solutions.
best regards,
Yashpal

Pascal Bourguignon

2006-03-13, 5:54 pm

"Yash" <yash_mbm@yahoo.com> writes:

> Hi all,
>
> I need a solution, by which i can measure time between sending and
> receiving of packet from one application to another one.
> I am working with application with uses unicast( both TCP and UDP) and
> broadcast.
> Also i am having "Ethereal" tool to see when packet leaving one
> port/NIC and reaching
> other port/NIC. But i want more precise solution, by which i can know
> delay for
> application to application.


ping(1)

> One solution which i thought off, is that i can get the system time
> before
> sending the packet, put it into packet with regular data and extract
> the time at other end.


This doesn't work because time is relative. Even with ntp
synchronized hosts, there may be a difference.

> By comparing the current time with this time, i can get time
> difference. Is it a
> correct approch. I am not sure, how precise it is. Is there any better
> method or
> tool available.


Yes, you can re-implement ping functionality in your application. It
could give you a different number of nanoseconds, given that ping uses
the icmp protocol, while your application may use udp or tcp.

You send data to the other application which sends a response
immediately when it receives it. You measure the time between sending
and receiving the response, and divide by 2.


> I will be grateful to you for suggestions and solutions.
> best regards,
> Yashpal



--
__Pascal Bourguignon__ http://www.informatimago.com/
Un chat errant
se soulage
dans le jardin d'hiver
Shiki
Yash

2006-03-16, 7:51 am

Hi,
Thanks for your inputs,

Pascal Bourguignon wrote:
> "Yash" <yash_mbm@yahoo.com> writes:
>
>
> ping(1)
>
>
> This doesn't work because time is relative. Even with ntp
> synchronized hosts, there may be a difference.
>
>
> Yes, you can re-implement ping functionality in your application. It
> could give you a different number of nanoseconds, given that ping uses
> the icmp protocol, while your application may use udp or tcp.
>
> You send data to the other application which sends a response
> immediately when it receives it. You measure the time between sending
> and receiving the response, and divide by 2.


I was doing the same thing, but it could not satisfy my seniors.

>
>
>
>
> --
> __Pascal Bourguignon__ http://www.informatimago.com/
> Un chat errant
> se soulage
> dans le jardin d'hiver
> Shiki


NTP can be a good solution but is there any possibility of getting this
time information
without using NTP. I know that there has to be one common time
reference between systems.
In my code (of which,most of the part i got from google group only
;-)), i am using gettimeofday(). So i am sending this time with packet
and after receiving this packet, extracting this time and comparing
with current time. With loopback it seems to work fine but when i use
two linux machines it doesn't work.

Any help is welcome.

Regards
YASHPAL

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com