Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Timestamps for TCP packets?

Reply
Thread Tools

Timestamps for TCP packets?

 
 
Thomas Johnson
Guest
Posts: n/a
 
      10-02-2009
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.
 
Reply With Quote
 
 
 
 
Miles Kaufmann
Guest
Posts: n/a
 
      10-02-2009
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
 
Reply With Quote
 
 
 
 
Grant Edwards
Guest
Posts: n/a
 
      10-02-2009
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
send tcp raw socket (bogus tcp header length) Tiger C Programming 5 05-01-2006 05:53 AM
tcp/ip vs microsoft tcp/ip ver 6 john Computer Support 1 08-05-2005 02:45 PM
NAT two outside TCP ports to one inside TCP port Kevin Cisco 1 11-10-2004 08:15 AM
Secure and compressed TCP/IP connection (for any TCP/IP services and applications) Pavel Aronovich Computer Security 0 02-22-2004 08:35 AM
LPR/Standard, TCP/IP, HP TCP/IP Ports DJ Chiro MCSE 1 11-07-2003 08:06 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57