0

I'm trying to find a way to get the number of bytes transferred from a network interface in the last 24 hours (or any other timeframe), excluding HTTP traffic.

I've come across several threads like this one, but this just gives me one flat number -- optimally, I'd like to get separate numbers for each protocol used.

Can you give me some pointers on how I could achieve this? I'm not looking for software that can do this, I'm looking for code. (Though of course, if the software is open source, I can dig around in it)

Community
  • 1
  • 1
Harry Lachenmayer
  • 968
  • 1
  • 6
  • 7
  • 2
    Just wanted to make sure you're aware that operating systems don't track those stats by default, so your code will need to have been monitoring traffic for the last 24 hours and inspecting the packets for itself. – Karl Bielefeldt Nov 29 '11 at 18:21

2 Answers2

1

Wireshark can do this and it is open source

elitalon
  • 9,191
  • 10
  • 50
  • 86
TJD
  • 11,800
  • 1
  • 26
  • 34
  • (And it does it using libpcap on UN\*X, including OS X, and WinPcap on Windows.) –  May 21 '12 at 17:32
1

Have you taken a look at libpcap?

elitalon
  • 9,191
  • 10
  • 50
  • 86
Nerdtron
  • 1,486
  • 19
  • 32