Measuring bytes of packet sent from python application

Jonathan Gardner jgardner at jonathangardner.net
Mon Jan 5 18:36:42 EST 2009


On Jan 5, 3:23 pm, Kangkook Jee <aixe... at gmail.com> wrote:
> Jonathan Gardner wrote:
> > A good universal tool on the Linux platform is tcpdump. It takes some
> > learning, but is very useful for this kind of task. You can use a tool
> > like ethereal to visualize the data that tcpdump gathers.
>
> That seems like a good solution for my issue but how can I distinguish
> traffics from my application to others?
>

There are a variety of ways to distinguish traffic with tcpdump and
ethereal. Usually you should have some idea of what ports or hosts
your traffic is going to. If not, then you will have some indicator
within the packets themselves. Note that tcpdump is remarkable since
it can identify TCP sessions, and not just individual packets.

> I'm still struggling to solve it within python process since it looks
> cleaner but it doesn't seems to be easy at all.

Replacing a lower-level component of a 3rd party library is difficult
at best. If you can get it to work without rewriting the library,
congratulations. At the very least, you'll probably have to do some
low-level things within the libraries themselves.



More information about the Python-list mailing list