Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Timestamps for TCP packets? (http://www.velocityreviews.com/forums/t700149-timestamps-for-tcp-packets.html)

Thomas Johnson 10-02-2009 07:03 AM

Timestamps for TCP packets?
 
Is there any way to get kernel-level timestamps for TCP packets while
still using the standard python sockets library for communication? I
need to communicate over a TCP connection as easily as possible, but
also record the timestamps of the incoming and outgoing timestamps at
microsecond or nanosecond resolution.

The sockets library is of course great for the communication, and I've
seen some python libraries that do packet sniffing and record
timestamps, but it's not clear that I can do both at the same time.

Miles Kaufmann 10-02-2009 08:20 AM

Re: Timestamps for TCP packets?
 
On Oct 2, 2009, at 12:03 AM, Thomas Johnson wrote:

> Is there any way to get kernel-level timestamps for TCP packets while
> still using the standard python sockets library for communication? I
> need to communicate over a TCP connection as easily as possible, but
> also record the timestamps of the incoming and outgoing timestamps at
> microsecond or nanosecond resolution.
>
> The sockets library is of course great for the communication, and I've
> seen some python libraries that do packet sniffing and record
> timestamps, but it's not clear that I can do both at the same time.


Have you tried it? I don't know of any reason that using sockets and
doing a packet capture would interfere with each other. What are you
trying to accomplish with the packet sniffing, though?

-Miles

Grant Edwards 10-02-2009 01:52 PM

Re: Timestamps for TCP packets?
 
On 2009-10-02, Thomas Johnson <thomas.j.johnson@gmail.com> wrote:

> Is there any way to get kernel-level timestamps for TCP packets while
> still using the standard python sockets library for communication?


libpcap

http://sourceforge.net/projects/pylibpcap/

> I need to communicate over a TCP connection as easily as
> possible, but also record the timestamps of the incoming and
> outgoing timestamps at microsecond or nanosecond resolution.


That shouldn't be a problem, except for the communication API
and the capture-packets-with-timestamp API are separate.
Remember that there's no guarantee that send() recv() calls
correspond in any way to the actual packets sent/recevied.

> The sockets library is of course great for the communication,
> and I've seen some python libraries that do packet sniffing
> and record timestamps, but it's not clear that I can do both
> at the same time.


Yes, you can do both at the same time. But you have to use
separate APIs.

--
Grant Edwards grante Yow! TONY RANDALL! Is YOUR
at life a PATIO of FUN??
visi.com


All times are GMT. The time now is 02:49 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.