in reply to How to monitor internet speed in real time?
Your question is not really exact.
Are you trying to monitor internet traffic of a certain machine from the machine itself, or from a different machine? Do you want to mesure all network usage or only that to certain destinations, protocols, ports or programs? And most importantly, what OS are you using?
Anyway, here's some starting point for linux. In linux, there is a counter that counts the total incoming and outgoing bytes on a network interface. You access this counter with the ifconfig program, or directly from /proc/net/dev (this is linux 2.4.25, the /proc interface might be different in other versions). If you read that counter every few seconds, you can see how much data comes in and out.
If you need more detailed statistics, you have to use iptables.
Every iptables rule has a byte counter similar to that above.
To read this, you run iptables -L -nvx or figure out
how iptables gets the data from the kernel.
The drawback of this is that iptables requires root permissions,
while netstat ifconfig (Update: I meant to say ifconfig here, just as above) does not normally.
Update: see also Re: measuring IN/OUT traffic on your computer which is about the same problem but has code.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to monitor internet speed in real time?
by rockmountain (Sexton) on Oct 06, 2004 at 07:26 UTC | |
by ambrus (Abbot) on Oct 06, 2004 at 16:06 UTC |