OK, actually I have been searching all over the web. I should refine my question.
I have read about measuring network usage with the help of various languages, particularly I want to ask that in java, is it possible to do such a thing using a proxy server or using a particular methods that wrap the OS functionality (if any such thing exists). All I now want to do is to record per unit time the number of bytes transferred across, without bothering about what kind of packets they are or where they are headed.
I just want a brief answer so as to which method will be the best, I don't want anybody to do research on my behalf but programming experts may know the possibility of using a particular method. A brief explanation will be of great help.