0

Is there a way to obtain the maximum and current data transfer rate (kbps) with ifconfig or route for any given network interface? I am not sure i completely understand what exactly it is that i am looking for.

I thought about parsing /proc/net/dev and finding the analogy between bytes received and bytes transmmited. Also is MTU the same thing as maximum data transfer rate? if so could i use netstat -in instead?

P.S Working in Java. (ubuntu 10.04)

Stelios Savva
  • 812
  • 1
  • 10
  • 30

1 Answers1

1

Reading out /proc/net/dev on a regular base will give you transfer rates.

Update (to clarify what I wanted to denote using the wording: "Reading ... on a regular base ..."):

/proc/bnet/dev gives you the amount of data transfered. To get the transfer rate you need to read this twice and divide the difference by the time elapsed between the two reads.

alk
  • 69,737
  • 10
  • 105
  • 255
  • Does it affect the outcome that the data from /proc/net/dev reset once they reach the 4GB threshold? thanks btw – Stelios Savva Oct 27 '12 at 13:24
  • This depends on how you interpret what you are reading. If for example `bytes-tx(T-1) > bytes-tx(T)` you indeed should assume the counter had been reset between `T-1` and `T`. @Stelsavva – alk Oct 27 '12 at 13:28