0

How to calculate the bandwidth of a particular port using socket programming in Java ?

Any sample code please.. Thanks for the help in advance.

Preetha
  • 11
  • Summing up the data transferred divided by the time needed for this? Windowing and computing moving averages might be useful, too. – deets Oct 19 '14 at 09:05

1 Answers1

0

Hi unfortunately there is no simple solution to this. You will have to actually transfer some data through the socket to determine the bandwidth.

Take a look at the first class in this web page. We use a similar code in our distributed computing cluster:

http://docstore.mik.ua/orelly/java-ent/dist/ch08_04.htm

If you just need to figure out the maximum bandwith of a network device you will most probably need to call platform specific tools (such as ifconfig on Linux) and parse the network link parameters from the tools output.

Matthias Steinbauer
  • 1,786
  • 11
  • 24