File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes General Computing and the fly likes IP address keeps changing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » General Computing
Bookmark "IP address keeps changing" Watch "IP address keeps changing" New topic
Author

IP address keeps changing

Agr Raj
Greenhorn

Joined: Feb 03, 2012
Posts: 9
Hi everyone. My IP address keeps changing every time I connect to the Internet. I need the ip address for RMI Connection.

Naming.lookup("rmi://127.0.0.1/Compute")

I need to put my IP address in the above but dont know how to go about it.

Thankx.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
You want to access the machine from remote, over the internet? IN that case, check out services like DynDNS. Or do you want to connect from some other machine on your local network?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38519
    
  23
Wecome to the Ranch

So does mine. I think there is dynamic and static IP assignment.
I tried googling and this was the first hit. I don’t know how helpful it will be. It is full of annoying abbreviations which confirm we are right to have this FAQ.
naga eswar
Ranch Hand

Joined: Jan 25, 2012
Posts: 120
if i am correct you can use the below code to fetch local IPaddress


Agr Raj
Greenhorn

Joined: Feb 03, 2012
Posts: 9
Guys thank you for your Greetings.

Let me explain the problem more clearly
When i run the application on the same machine using the IP address as 127.0.0.1 it works well. But, when i run the client on a separate machine using the current IP address that is 120.138.114.167 I get some sxception saying Connection refused to host address 120.138.114.167. I tried running the same application after turning my firewall off but still got the same exception

Note: the IP address that i have is dynamic that means it keeps changing every time I restart my router. I manually update the client file whenever the IP changes.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
That's how I understood the question. What are the answers to the 2 questions I asked?
Agr Raj
Greenhorn

Joined: Feb 03, 2012
Posts: 9
Tim Moores wrote:That's how I understood the question. What are the answers to the 2 questions I asked?


I want to connect from some other machine to my local network
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Let me emphasize what I'm asking:
You want to access the machine from remote, over the internet? ... Or do you want to connect from some other machine on your local network?
Agr Raj
Greenhorn

Joined: Feb 03, 2012
Posts: 9
Tim Moores wrote:Let me emphasize what I'm asking:
You want to access the machine from remote, over the internet? ... Or do you want to connect from some other machine on your local network?


over the internet
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Then DynDNS (or some service like it) is the answer.
Agr Raj
Greenhorn

Joined: Feb 03, 2012
Posts: 9
This is the server class



The Client Class



The Remote Interface



Runs perfectly on the same machine.
Then,
I changed the IP address in the ClientClass to 111.119.254.32, turned the firewall off and tried accessing the server from a different machine over the Internet and got the following error
Connection refused to host: 111.119.254.32 and some more nested Exception

Please help me spot where I'm Going wrong.


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: IP address keeps changing