Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2007

Tip: Looking for answers? Try searching our database.

Problem with java and Domain Name Resolution

Thread view: 
Lars Both - 18 May 2007 13:47 GMT
Hi Everybody,

I have a really annoying problem. I've implemented an application, which  
connects to a server, which IP does change rather often. I came upon the  
problem, that my application would not connect to the server after it's IP  
has changed.
I did some investigation and found out, that the default time for  
dns-caching is infinite. And I found the property, that is supposed to  
change it:

 java.security.Security.setProperty("networkaddress.cache.ttl" , "0");

But it did not seem to change anything. I am still stuck with my problem.  
I have to restart my application everytime the server gets a new ip.

Has anybody got experience with that?

Regards
LArs
Martin Gregorie - 18 May 2007 15:28 GMT
> Hi Everybody,
>
[quoted text clipped - 13 lines]
>
> Has anybody got experience with that?

The really interesting TTL is the value set in the master zone file for
the server's domain. If that's set long in relation to the rate at which
the server changes its IP then you're in deep doo-doo.

Your attempt to set the TTL can at most affect your local cache. It
doesn't affect the master DNS or any additional caches between that and
the local cache. These caches expire their cache entry using the TTL set
by the master domain.

How often does your client close and re-open its server connection? How
does that compare with the rate at which the server changes IP?

Signature

martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

Lars Both - 21 May 2007 08:22 GMT
>> I did some investigation and found out, that the default time for  
>> dns-caching is infinite. And I found the property, that is supposed to  
[quoted text clipped - 16 lines]
> How often does your client close and re-open its server connection? How  
> does that compare with the rate at which the server changes IP?

Hi Martin!

Thank you for your answer! The answer to the questions you asked are:

- The server changes maybe once a day and may as well be offline for days.  
It is a moving server for a demo application and therefore uses a dial up  
line.
- Even after days, my client is not able to reconnect. I have to restart  
the application, afterwards it does work..
- I can see, that the server-name (it's a dynamic IP hoster) is resolved  
accurately on that machine.

If you take all this into account, can you maybe give me another hint?

Regards
Lars

Signature

Erstellt mit Operas revolutionärem E-Mail-Modul: http://www.opera.com/mail/

Martin Gregorie - 21 May 2007 18:04 GMT
>>> I did some investigation and found out, that the default time for
>>> dns-caching is infinite. And I found the property, that is supposed
[quoted text clipped - 26 lines]
> - Even after days, my client is not able to reconnect. I have to restart
> the application, afterwards it does work..

Sounds to me as if your client should close and reopen the connection
more often.

You don't say anything about the application protocol used to talk to
the server, but if its uses request/response message pairs the simplest
approach would be to connect, send the request, read the response and
disconnect every time. A slightly more complex solution would drop the
connection after x minutes of client inactivity and reconnect when the
next request is to be sent.

> - I can see, that the server-name (it's a dynamic IP hoster) is resolved
> accurately on that machine.
[quoted text clipped - 3 lines]
> Regards
> Lars

Signature

martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

Lars Both - 31 May 2007 15:19 GMT
Am 18.05.2007, 14:47 Uhr, schrieb Lars Both <lars.both@atip.de>:

> I did some investigation and found out, that the default time for  
> dns-caching is infinite. And I found the property, that is supposed to  
[quoted text clipped - 5 lines]
> problem. I have to restart my application everytime the server gets a  
> new ip.

I recently found the solution and wanted to complete this thread by  
providing it. Finally I solved my problem by changing the mentioned  
property in the java.security-file which I was not aware of before. (D'oh!)

We are using a heterogenous enviroment, so that I could observe the  
following:

Using Java 1.5.0_09 on Linux results in the property set at runtime  being  
ignored. The same holds for Java 1.4.2_08 on Linux.
The same code executed with Java 1.6.0 running on Windows works fine (the  
ttl is correctly set and the domain name resolution is done properly).

I am not going to examine it beyond this point, just wanted to share.

Regards
Lars


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.