Timestamps for TCP packets?

Discussion in 'Python' started by Thomas Johnson, Oct 2, 2009.

  1. 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.
     
    Thomas Johnson, Oct 2, 2009
    #1
    1. Advertising

  2. 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
     
    Miles Kaufmann, Oct 2, 2009
    #2
    1. Advertising

  3. On 2009-10-02, 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?


    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
     
    Grant Edwards, Oct 2, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chumma Dede
    Replies:
    2
    Views:
    403
    Chumma Dede
    Feb 11, 2005
  2. antoine
    Replies:
    3
    Views:
    4,842
    antoine
    Dec 7, 2005
  3. Chris
    Replies:
    2
    Views:
    299
    Howard
    May 14, 2004
  4. Tiger
    Replies:
    5
    Views:
    977
    Dave Thompson
    May 1, 2006
  5. Zsdfhdfgasdf Gsfgsdgsdgsd

    Sending packets over TCP server

    Zsdfhdfgasdf Gsfgsdgsdgsd, Jul 15, 2010, in forum: Ruby
    Replies:
    6
    Views:
    358
    Zsdfhdfgasdf Gsfgsdgsdgsd
    Jul 15, 2010
Loading...

Share This Page