• Post Reply Bookmark Topic Watch Topic
  • New Topic

Trying to get IP address of the client CPU

 
Ronwaldo Cruz
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm working on a Swing application which needs to determine the IP address of the CPU of the client using the app.

The original code is as follows:

mIpAddress = (InetAddress.getLocalHost()).getHostAddress();
mHostName = (InetAddress.getLocalHost().getHostName());

The problem with this is that if there are other devices that have IP addresses such as mobile phones, the last one gets picked not necessarily the IP address of the CPU.

Is there a way to get just the CPU? Thanks.
 
Henry Wong
author
Sheriff
Posts: 22519
109
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IP addresses are assigned to NICs... not to anything else. So, if a client has multiple IP addresses, it is for different NICs. (okay, there is also the concept of VIPs, but they too, are attached to NICs).

So, what do you mean by the IP address of the CPU?

Henry
 
Ronwaldo Cruz
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Sorry I have misunderstood things before the post and so the question was not sensible at all. I got it now though. Thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!