Péha
Péha

Reputation: 2933

Measuring the volume of downloaded data

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 !

Upvotes: 1

Views: 379

Answers (2)

Patrick Cornelissen
Patrick Cornelissen

Reputation: 7958

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.

Upvotes: 1

Tommy
Tommy

Reputation: 4111

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.

Upvotes: 1

Related Questions