tags:

views:

410

answers:

5

I have a PC with dual cores, it has two MAC addresses : 00-1D.... & 00-21..... Are these IDs for the two cores ? If I want to get hold of a unique ID for this PC, how to get it with a Java call ? Maybe there is something in Java like "System.getId()" ?

Frank

+1  A: 

From Google :: Media Access Control address (MAC address) is a unique identifier assigned to most network adapters or network interface.

The ID's are for network interfaces. They are also not immutable, and not always unique because of this.

Look into java.net.NetworkInterface and java.net.InetAddress for methods of fetching MAC information.

Mimisbrunnr
A: 

MAC stands for Media Access Control. The MAC address usually represents a unique id for your network adapter(s). You must have two network adapters in your pc (LAN, WLAN?).

Have a look here this describes how to get a unique system identifier in JAVA: http://stackoverflow.com/questions/1986732/how-to-get-a-unique-computer-identifier-in-java-like-disk-id-or-motherboard-id

And .NET: http://sowkot.blogspot.com/2008/08/generating-unique-keyfinger-print-for.html

Michael

Michael Ulmann
+1  A: 

(at the time I answered this, it was already answered what exactly a MAC address is, so I am not going to repeat it, so I just answered an unanswered question, the downvote makes no sense)

If I want to get hold of a unique ID for this PC, how to get it with a Java call

You should not bind unique identifiers to hardware, but to enduser. Hardware can be changed, the enduser not. So, ask enduser to fill some registration form (or provide a dongle, as answered by Pascal).

BalusC
+1 to counter balance the downvote
Pascal Thivent
@Pascal: thanks.
BalusC
Filling out a form won't work, someone might fill in a form with fake info and 100 other people can use this published fake info to access the program.I've thought about using user name or machine name, they won't work either, because someone can use that user name or re-name his PC to that machine name to use the app.
Frank
I meant to provide a key by email or so when the user has filled and sent a form (including user's email). If necessary add a challenge-response system over network to your problem to verify if the key is still legit. But still, one can reverse-engineer your program and recompile it with the checking parts removed or spoofed. After all, **everything** is hackable ;)
BalusC
+3  A: 

A MAC address is a number that identifies a Network Card Interface. You can't use that to identify a particular machine in a reliable way (a user can change his NIC, a power user can even change the MAC address dynamically).

Maybe you could use a software-protection dongle (looks like there are Java solutions). But note that even this solution doesn't solve the whole trusted client problem.

Pascal Thivent
+1 As I wanted to comment on your deleted comment, the dongle is a great idea. It's however hackable, but the edge is higher.
BalusC
+1  A: 

The MAC is a media access control identification, the first two bytes represent the country and the 4 bytes represent the Manufacturer. No two adapters are the same, unfortunately, due to the advent of modern mass-production of NIC's, the MAC can be easily changed dynamically. Back in the old days, the NIC's consisted of DIP Switches (Dual Inline Pins) which allowed you to change the setting of the NIC such as IRQ, jumper address and so on...

They have nothing to do with processor cores, that's a separate hardware thing.

There is no portable way of getting the MAC address, theoretically you could use the ifconfig command for *nix/Linux variants. For the Windows environment you could use the ipconfig command, using either, you could search for the relevant adapter in question... as this example under Linux would show...my network adapter is called 'eth0'...

ifconfig eth0 | grep HWaddr | cut -d\t -f4

would return:

  HWaddr 00:02:03:04:05:06
tommieb75