Click here to Skip to main content
13,046,281 members (111,347 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I just need to know that how can you find the mac address of motherboard out of available mac addresses when you connect with your Internet dongle .
Actually in my software I need to check for the motherboard mac address for some security check but when your internet dongle is connected ,you can see through ipconfig under command prompt that it shows many mac addresses .
How i want to check against the motherboard mac address only.

How can I find that .
Posted 20-Feb-13 22:43pm
Updated 24-Feb-13 22:21pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

The MAC address is not actually connected to the motherboard. It is unique to the network adapter (one per adapter if there are more than one). There are several ways to do get this info. Here is one:

#include <stdio.h>
#include <WinSock.h>
#pragma comment(lib, "wsock32.lib")
int main(int argc, char *argv[])
 WORD wVersionRequested;
 WSADATA wsaData;
 char name[255];
 PHOSTENT hostinfo;
 wVersionRequested = MAKEWORD( 1, 1 );
 char *ip;
 if ( WSAStartup( wVersionRequested, &wsaData ) == 0 )
  if( gethostname ( name, sizeof(name)) == 0)
   printf("Host name: %s\n", name);
   if((hostinfo = gethostbyname(name)) != NULL)
    int nCount = 0;
     ip = inet_ntoa(*(
          struct in_addr *)hostinfo->h_addr_list[nCount]);
     printf("IP #%d: %s\n", ++nCount, ip);
 return 0;

Also, here[^]is an article on how to get it 3 different ways. You need to come up with your own way to determine the one you want in the case that you get multiple answers.
iampradeepsharma 25-Feb-13 4:20am
thnx brydon , now as you have cleared that thr is no such thing like motherboard's mac address so no my question is how can i determine the mac address of the on board network adapter out of many others which are connected .
H.Brydon 25-Feb-13 14:29pm
I would look at "Method Three: Use GetAdaptersInfo" at the link I provided above.
iampradeepsharma 25-Feb-13 21:58pm
Brydon !! how would I know out of array of all those NIC 's mac address , how would I identify ... :(

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 25 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100