Skip to main content

Dinamic IP problem

6 replies [Last post]
iiggoorr
Offline
Joined: 2008-09-22

Hy,
I would like to have what i call passive peer. What i mean is I start it in the morning at home, and then i would like to have access to it from any ware at any time. The problem is that my internet provider changes my IP address from time to time.
Is something like that possible?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
hamada
Offline
Joined: 2003-06-12

The feature would entail watching the server socket for a socket exception, then interrogate the interface addresses for changes then subsequently updating the route advertisements in the endpoint.

enygma2002
Offline
Joined: 2008-12-22

Hi!

From what I have read on the JXTA documentation and features overview, I found mentioning of the DHCP IP change problem as fixed by JXTA by the fact that JXTA uses IDs instead of IPs and this is a greater layer of abstraction.

From what you say, the layer of abstraction is kept, but you have to manually watch out for IP changes on the peer side and reinitialize the peer (stop->start).

Why isn't this done automatically or at least by request throught a setter on the networkConfiguration like setDetectDHCPChanges(true) or something similar. Could this be a future feature?

Merry Christmas!

adamman71
Offline
Joined: 2007-01-31

It would definitely be a valuable new feature...!!! If there is a volunteer to work on it...

J.

adamman71
Offline
Joined: 2007-01-31

Hi,

Java does not provide an automatic way to detect changes in IP addresses. However, you could retrieve the your IP address from time to time in Java and restart the JXTA network when this happens.

Cheers,

J.

iiggoorr
Offline
Joined: 2008-09-22

thx. Well that is just what i want to do, but the problem is that from time to time is not rely working for me, because i would like to be able to contact "passive" peer at any time.
I guess what i need is one threat that is constantly checking my IP address, and another with JXTA PEER. The thing is i don't know how to make one threet "listen" to another without having to check some shared variable.

I guess what i need is listener of some kind... Well my problem is probably more JAVA then JXTA related.

Thanks for helping

adamman71
Offline
Joined: 2007-01-31

Hi Igor,

You won't need to implement threads if you use: ScheduledThreadPoolExecutor.scheduleWithFixedDelay(...). The runnable you submit as a parameter will be called at a regular interval. If your IP address changes, you just need to invoke the stop and start methods on the NetworkManager.

Cheers,

J.