• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

"packet length" or "captured length" in "Jpcap" library !?

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all
I recently downloaded the jpcap library and read all docs and
tutorials.
I want to develop a very simple application just calculates the total
traffic (send/receive) on my network interface.
But i don't know which parameter i should consider, and i know this is
because of my knowledge lack in (inter)networking.
Also i don't know which types of packet i should consider(just guess
something,e.g:i should survey every packet for destination & source
address and if source are my address and destination is my router(or other
clients in LAN) i should not increment the total bytes with this packet's length or captured length

I also tried in last two days to find out resources in web(Google /Wikipedia) to find out what are all kinds of packets and didn't found anything useful .Although i learned some types from the API documentations (such IPPacket including TCPPacket, ICMPPacket, UDPPacket or ARPPacket and one or two more),so ,while i think i know how to capture packets and even how to filter them, but i am confusing about which packets i should consider for my goal (to just counting traffic to/from Internet).

And in this API there is two field in class packet: caplen as "captured length" and len as "packet length" and i used the example application "Jpcapdumper" and i see when it captures packets, in udp packets, the "packet length" and the "captured length" are different (captured length is bigger than packet length)

Thus i need you people to help
Sorry for long writing

Thanks in advance
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!!

I think you should brush up your networking knowledge because it's upto you what type of packets you want to capture.
You can find here, what type of packets you can capture.
http://netresearch.ics.uci.edu/kfujii/jpcap/doc/faq.html
Like for internet, you want to capture all the http packets, then you know that all request goes through port 80.
So, connect to that interface and filter packets on port 80.
You can use this for help : http://jainhim.blogspot.com/2010/05/filter-packets-through-jpcap.html

And if you want to capture all the traffic of internet coming and going through your PC then,
connect to the interface that is associated with your internet, e.g., eth0.

Hope this helped
 
Esmaeil Ashrafi
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for answering...
I posted this a while ago,however i wrote my application and by studying precisely on filter expression from libpcap/winpcap documentations i create the best filter based on my needs.
But beside the question "which packets..." about the library, my another main question was about what is captured length in compare with packet length and i posted this topic to SDN and finally figure out that i should read throughly the tcpdump documentation as soon as i can...

if you can briefly explain what is the difference would be great

Thank you very much
 
him jain
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Captured length is the length of your received packet and
packet length is the length of packet specified by you means how much bytes at maximum you want to capture.
 
"To do good, you actually have to do something." -- Yvon Chouinard
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic