RE: Received Bytes, transmited bytes and connection speed



On Thu, 2010-03-18 at 20:17 -0700, Nguyen Canh Toan wrote:
> Dear Dan,
> 
> I only want to get an approximate connection speed but not a actual
> connection speed. 
> As you mention, with 3G devices, I only get a general access technology, but
> I don't care what is this. All things I interest in the speed and/or total
> bytes transmitted and received. How can I get it?

Until we implement it through the NM D-Bus API, you can always either:

1) scrape /proc/net/dev, which is what /sbin/ifconfig does

2) talk directly to netlink, which is what NM will do too

Dan

> Toannc.
> 
> -----Original Message-----
> From: Dan Williams [mailto:dcbw redhat com] 
> Sent: Wednesday, March 17, 2010 5:29 PM
> To: Nguyen Canh Toan
> Cc: networkmanager-list gnome org
> Subject: Re: Received Bytes, transmited bytes and connection speed
> 
> On Thu, 2010-03-18 at 03:40 -0700, Nguyen Canh Toan wrote:
> > Dear all,
> > 
> >  
> > 
> > I am wondering how to get current connection speed. Or, alternatively,
> > how to get total bytes received and transmited (so current speed ~
> > RX[n]-RX[n-1]).
> 
> Using bytes received and transmitted won't really get you a connection
> speed, since devices are usually not transmitting at full capacity all
> the time.  It'll give you a "current DL/UL rate", but certainly not the
> actual connection speed of the device.
> 
> Current connection speed is tricky, and depends on the specific device
> and the technology that the device is using.
> 
> For Ethernet, you have the 'Speed' property in the D-Bus interface,
> which reports the current network device speed (10Mb, 100Mb, 1000Mb,
> etc) in Mb/s.
> 
> For Wifi, there's the 'Bitrate' property in the D-Bus interface, which
> while the device is associated to an access point, reports the device's
> current rate in Kb/s (since wifi devices can transmit in odd rates, we
> can't just use Mb/s).
> 
> For 3G, you can only get the general access technology that the device
> is using, not a raw bitrate.  ModemManager reports current access
> technology for devices that support it via the AccessTechnology property
> of the device for GSM devices, which we'll also probably use for CDMA
> when that support gets folded in.
> 
> For Bluetooth, it'll be the same as either Ethernet or 3G depending on
> how you're using the bluetooth device.
> 
> Dan
> 
> 
> 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]