• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to get MAC Address
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get MAC Address


  • Subject: Re: How to get MAC Address
  • From: Peter Sichel <email@hidden>
  • Date: Mon, 25 Feb 2002 11:57:33 -0500

Does this work for multiple active adaptors such as:

Ethernet Built-in (en0)
PCI Ethernet Port 3, slot C (en1)
AirPort (en2)

Or just the primary interface?
What if Ethernet isn't the primary interface?

Another way might be to use the SystemConfiguration framework
to lookup the hardware address (if any) for each active configuration.

- Peter


This will do it:

void getEthernetAddress()
{
InetInterfaceInfo myInetInterfaceInfo;
int i, adaptorInterface;

NSLog(@"Ethernet addresses: ");

adaptorInterface=0;
do {
OTInetGetInterfaceInfo(&myInetInterfaceInfo, adaptorInterface);
if (myInetInterfaceInfo.fHWAddrLen > 0) {
for(i=0; i<myInetInterfaceInfo.fHWAddrLen; i++) {
printf("x ",myInetInterfaceInfo.fHWAddr[i]);
}
printf("\n");
}
adaptorInterface++;
}
while (myInetInterfaceInfo.fHWAddrLen > 0);
}

--
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: How to get MAC Address
      • From: Georg Tuparev <email@hidden>
References: 
 >Re: How to get MAC Address (From: Georg Tuparev <email@hidden>)

  • Prev by Date: Re: Project Builder Eating Resource Files..?
  • Next by Date: Re: application quit right after launching
  • Previous by thread: Re: How to get MAC Address
  • Next by thread: Re: How to get MAC Address
  • Index(es):
    • Date
    • Thread