LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-01-2005, 03:15 AM   #1
Bassam
Member
 
Registered: Mar 2003
Location: Malaysia
Posts: 63

Rep: Reputation: 15
Question How to the no of attached ethernet adapters


Hi all,
I am writing a network application for the Red Hat system that requires to know the number of the network cards eth (ethernet adapters) attached to the system where the application is installed.

The way that I am using now to determine the number of NIC cards is by counting the number of the files that their names taking the form ifcfg-eth, where ifcfg-eth0, ifcfg-eth1 and so on are the configuration files for each adapter.

Is there another way by using C language that helps me to determine the number of adapters attached to my Red Hat system??


Regards
Bassam
 
Old 03-01-2005, 03:40 AM   #2
angrybeaver
Member
 
Registered: Aug 2004
Location: .au
Distribution: debian, BSD
Posts: 104

Rep: Reputation: 17
depending on the kernel you're running, you could just open /proc/pci and match on 'Ethernet Controller' ... or match eth* on /proc/sys/net/ipv4/conf either or, there's a few ways to do it - up to you to decide which is the best..
 
  


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
a lil help with ethernet adapters... bmxwrestler180 Linux - Hardware 14 09-01-2006 06:20 PM
Wireless Adapters superdude_876 Slackware 7 10-18-2005 06:11 PM
Virtual Adapters ImpactDNI Linux - Networking 2 08-12-2005 07:38 AM
How do I use 2 ethernet adapters? elspxvwcyr Linux - Networking 4 12-07-2004 03:48 PM
USB Adapters sihere Linux - Software 2 12-30-2001 05:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:16 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