Does every computer have at least 2 MAC addresses?

As far as I can tell, my laptop has at least 4 different MAC addresses.

I would need the MAC data to use a nunique identifier, to seperate one user from the other. Would it be safe to assume that every computer has at least two different MAC addresses? Or, are there computers out there with only one MAC address?

n = System.GetNetworkInterface(5)
MsgBox n.MACAddress

This generates an error using my computer. How do I prevent errors in this kind of code!?

[quote]A media access control address (MAC address) of a computer is a unique identifier assigned to network interfaces for communications at the data link layer of a network segment. MAC addresses are used as a network address for most IEEE 802 network technologies, including Ethernet and WiFi.
[/quote]
https://en.wikipedia.org/wiki/MAC_address

A MAC address is unique to the network interface, so a computer could have one for each interface it has, so there is no “safe” assumption really. Most of the MAC address stuff I’ve seen around the forum just uses the interface at index 0 for a unique identifier.

http://documentation.xojo.com/index.php/System.NetworkInterfaceCount may be helpful.

[quote=291418:@Tim Parnell]https://en.wikipedia.org/wiki/MAC_address

A MAC address is unique to the network interface, so a computer could have one for each interface it has, so there is no “safe” assumption really. Most of the MAC address stuff I’ve seen around the forum just uses the interface at index 0 for a unique identifier.[/quote]
Not a particularly good idea though. The interface at 0 can change depending on enabled devices, at least on Mac. I would have three network locations defined: Home, Wireless, and Auto. Home had only Ethernet enabled, Wireless only Wifi enabled, and Auto was just that.

As I would switch locations, the interface at 0 would change. Ages ago REALbasic used exactly this to encrypt the license file, so any time I’d change my location, the license would break.

MAC address is not a good computer identifier. Boot volume UUID is better. Not fool proof by any means, but nothing is.

Depending on the usage you have, this is not a good idea too because the computer can be booted from a different hard disk. I have a bunch of them with different OS X installed (say macSierra, macSierra.1b, El Capitan, etc.)

While true, an argument could be made that it is a different “computer” without being different hardware.

Oh I agree, I was doing that thing where I try to be helpful but not directly say “doing it wrong” :stuck_out_tongue:

[quote=291413:@Jakob Krabbe]n = System.GetNetworkInterface(5)
MsgBox n.MACAddress

This generates an error using my computer. How do I prevent errors in this kind of code!?[/quote]

I assume you see an OutOfBoundsException. Just make sure you are not trying to access an item outside the bounds of an array. See here: http://documentation.xojo.com/index.php/System.GetNetworkInterface and here: http://developer.xojo.com/outofboundsexception

Short answer: No

Yes :wink:

I’m sure there computers out there with no MAC addresses.

Since the MAC address can change (you can replace the ethernet card on a tower system, for instance) I would recommend against using it as a unique identifier. What are you really trying to do?

Sad and lonely computers…

Not sad nor lonely. They would not have to see all the nonsense on Instagram and Facebook :wink:

There certainly are : I’ve met this in the last year or so where the only net interface was via a USB->ethernet device and so when unplugged there was no internet access.

It’s fair enough! My purpose are for programmers. In my software I do a check if the user is using the latest version.
Then, it hit me, I could actually log these requests… and by sending a unique identifier I could seperate one user from the other.

If a person change computer or hardware, it’s not a big deal. One user will go, a new will come…
It’s for my eyes only. For this purpose, it’s good enough! :-))
Thank you for all input!

[quote=291633:@Jakob Krabbe]It’s fair enough! My purpose are for programmers. In my software I do a check if the user is using the latest version.
Then, it hit me, I could actually log these requests… and by sending a unique identifier I could seperate one user from the other.

If a person change computer or hardware, it’s not a big deal. One user will go, a new will come…
It’s for my eyes only. For this purpose, it’s good enough! :-))
Thank you for all input![/quote]

MAC Addresses should be unique but they arent. In my lab at the office, I have several VMs that all have the same MAC Address as come from the same vendor and that vendor hard codes the MAC Address to be something specific if the VM is a POC (Proof of Concept). And I have seen other shenanigans. If I was you (and I am not), I would generate a unique ID myself based on some criteria that you come up with. Over using a single item on a computer.

More power to you.