LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-04-2007, 02:10 PM   #1
Aenema
LQ Newbie
 
Registered: Apr 2007
Posts: 3

Rep: Reputation: 0
[C] Network Card MaxBandwidth


Hi,
i'm trying to write a program that detects the speed of the network card connection of the host where it is running.
For example 10Mbps, 100Mbps or else.
Somebody can help me?

Thanks a Lot
Daniele
 
Old 04-04-2007, 04:08 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
Do you want to measure it or read from the driver stats?
 
Old 04-05-2007, 02:03 AM   #3
Aenema
LQ Newbie
 
Registered: Apr 2007
Posts: 3

Original Poster
Rep: Reputation: 0
I can measure the current traffic by reading the file /proc/net/dev.
What i want to know is the Total Bandwidth ( or also the free Bandwidth ). i haven't found it anywhere...
Thanks!
 
Old 04-05-2007, 02:39 PM   #4
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
Then it's rather tricky. For Ethernet, for instance, you can read it from driver settings. But you will never reach the theoretical maximum. For wireless interfaces it's even worse. There's theory, but you (usually) have no guarantee. For wireless the only way is to measure.
 
Old 04-05-2007, 03:28 PM   #5
Aenema
LQ Newbie
 
Registered: Apr 2007
Posts: 3

Original Poster
Rep: Reputation: 0
so you say that the best way to get an indication is to measure the traffic.ok!
Anyway i'm interested on the theoretical Bandwidth, i don't mind if it is not reacheable... is there any API that can help me?
you also said to give a look at the driver settings... can you give me some advice?
THANKS!

PS: What a Beatiful city Warsaw!
 
Old 04-07-2007, 02:52 PM   #6
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
You should be able to get the stats using the netlink socket, while getting all possible interface info. libnl, which makes dealing with netlink easier, does not support it, however, so you would need to do that manually. If you have never tried it, it may be quite complicated, mostly because lack of full documentation so you need to browse the kernel code to see all you need.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Slackware 10 network configuration. Problem with 8139 network card drivers ! Padmakiran Linux - Networking 8 03-27-2007 06:48 AM
Linux and Network card compatbility, will any network card work ? MrMark Linux - Networking 6 02-12-2007 08:17 PM
linux shuts down built in network card then windows tells me network card is unplugge lesmoxhaybaker SUSE / openSUSE 8 08-29-2006 05:10 PM
3c905C network card in docking station. Cannot activate network device eth0. pathelms Linux - Networking 4 04-12-2006 02:55 PM
network card issue (the card itself no network problem) Youri Linux - Hardware 2 01-23-2006 08:58 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration