Timestamps for TCP packets?

Grant Edwards invalid at invalid.invalid
Fri Oct 2 09:52:12 EDT 2009


On 2009-10-02, Thomas Johnson <thomas.j.johnson at 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            



More information about the Python-list mailing list