This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Kubernetes in Action and have Marko Luksa on-line!
See this thread for details.
Win a copy of Kubernetes in Action this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Networking  RSS feed

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to determine the ip-address of my computer (stand alone pc)
from another pc. Both are connected to the internet
I tried using InetAddress.getByName(my computer name)
it works on my pc but not in other pc's
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

what do you mean by stand alone pc
and then you say connected to internet

- satya
 
vinod ac
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

c satya when u get connected to the net ur ISP server will assign u an ip-address right ??
imagine u r connected 2 the internet. Certainly u will have some ip-address assigned by ur ISP. I want 2 determine that address assigned by the server using my java program from my computer.
did u get me now ???
any way thanxxx 4 responding......
- Vinod
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When the stand alone PC gets connected to the network, the PC is assigned a dynamic IP address ( if the PC is configured so). All you can do is, use java.net.InetAddress.getByName() call to get an InetAddress object and call the getAddress() method on that object. That will give you the eact IP address in byte[].
Hope this helps your problem.
-mo ibrahim
 
vinod ac
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ibrahim ,
Saw ur reply. Thanks a lot !
But i have a doubt, u need 2 pass an arguement to the InetAddress.getByName() method (String arguement)
what will u pass in the arguement
hostname ??? computer name ?? what else ???
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!