views:

125

answers:

2

Hey all,

I'm currently searching for a way of measuring the amount of downloaded data on my computer while i am connected to the network / the Internet.

I'd need a method that would work either for Mac OS X or Windows XP/Vista and can't manage to find anything in the Java API related to that kind of feature. I hope you'll be able to help me :)

Thanks !

+1  A: 

I've once created my own DU meter using Java. I read the output of

NET STATISTICS

(command line) and parsed it. Running this task every second and calculating the difference in Bytes Received does the trick. Rather crude yes, but it worked.

Only works on Windows of course. I'm sure there's some command to run on Mac.

Tommy
Hum yes, one solution would be to use a win/*nix console line and parse the return value...but I thought that maybe the java api would provide such a method and prevent me from making the whole parsing stuff
LePad
+1  A: 

There won't be a cross platform way. To measure the amount of traffic you need to monitor the data of the network driver/subsystem. On windows this will be "net statistics" on linux "ifconfig" but the output is of course not the same.

Patrick Cornelissen