Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ethernet cards

Status
Not open for further replies.

Zebra2k

Programmer
Aug 12, 2002
11
US
How would I do in a C/C++ program to detect if there is any ethernet card installed in a system?. If one exists, the program needs to get its interface name or the IP address to which it binds to.

Thanks for your help.
zb
 
If your target is diagnostic, you have to go deep in
the system and look for routines that manages cards not
ip address ( remember that your tcpip may not be still
configured or a card may have more than an address).

However, for normal purposes, you have first to configure, then test the network at system layer ( network neighb., ping local and after remote address, and so on) and then
use high level (application layer) api ( sockets, ftp, http)
making accurate attention to the return code of these.

 
You can try

int result = GetSystemMetrics( SM_NETWORK ) ;

if( 0 == result )
{
// No network
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top