Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

How to uniquely identify a computer on the net using java?

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure if this is the correct place to post this - my apologies if this is not the place

I need to find out if java can be used to uniquely identify any given computer on the internet - I think that java can be used to identify a given computers IP address but there are problems with that approach relating to dynamic IP addresses and so on (I admit I don't really understand those problems - I have just been told that they exist and complicate the process of using IP addresses as a unique identifier)

I have also read that components of a given computer system (hard-drive say) have unique identifying id codes - Is this true? What other components have such id codes? Can java be used to identify them?

Sorry to be a little vague on this - I am just researching this area quite seriously to see if such a task can be achieved using java

Any help, pointers comments, links to further reading, etc would be very helpfull

Thank you for your time
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


complicate the process of using IP addresses as a unique identifier


IP addresses are always unique (within the context of the network they are on). How else could network calls work if you can't be sure which machine you are calling? Typically on a LAN when a machine joins the network it is given an IP address. This may well not be the same address it had last time it was on the network, but it is unique on the LAN. Its not safe looking up machines via IP address if the IP is dynamically allocated, which is a reason why we have DNS. The machine I'm on just now might have the IP address 10.10.10.200 when I joined the network yesterday, and 10.10.10.231 when I joined today, but it is always identifiable by its name, because DNS resolves that to whatever IP address I have today.
[ October 29, 2004: Message edited by: Paul Sturrock ]
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't do this through pure Jave as the procedures required are hardware and operating system dependent.
You'll have to rely on bits of JNI code to retrieve the hardware information and then process that in your Java application.

By querying a network card for example you can get the MAC address of that card, but there's no Java call to do so AFAIK (I've looked for it before in java.net packages after similar, nay identical, questions to yours).
The MAC address is unique for a given card but of course no guarantee that you're talking to the same machine as the last time because the card may now be in a different machin (especially with PCMCIA cards in laptops).
Different MAC address also doesn't mean different computers as the computer may have received a new network card.

As to other components having unique IDs, this is somewhat true.
Most manufacturers of harddisks and some other components like CPUs and motherboards include a code you can query which usually will contain among other things the serial number.
There is no guarantee that this serial is unique of course, different manufacturers may use the same ranges and even a single manufacturer may duplicate ranges between products.
But it's a decent key to take, especially if you can also retrieve the type ID of the component.
The harddisk serial you may have heard of is created during partitioning and isn't necessarilly a constant for a given disk. Next time the disk is partitioned it may (though doesn't usually this depends on the OS) change.
 
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are way to identify SUBSEQUENT client requests if that is what you are after.

Basically the algorithm goes something like this:
1. you server accepts a client connection
2. your server calulates a GUID for that client
3. whenever, in the future, the clinet connects again,
it identifies itself by that GUID value, not by the possibly
changed IP address.


If this sounds like it may be what you need, check out java.rmi.server.UID and java.rmi.dgc.VMID
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic