Order of IP addresses for getAllByName()

K

kasour

Hi all,

I have DNS name for a "fooServer" that can be on a primary server (eg:
1.2.3.1) and a secondary server (eg: 1.2.3.2).

Both are referenced in a DNS with a different weight (DNS SRV of
rfc2782):
fooServer SRV 1 (prio 1) 1.2.3.1
fooServer SRV 2 (prio 2) 1.2.3.2

I would like to know whether a call to
InetAddress.getAllByName("fooServer") will return the list of
InetAddress according to the weight declared in the DNS Server.

Best Regards,
P. Kasour
 
J

John C. Bollinger

I would like to know whether a call to
InetAddress.getAllByName("fooServer") will return the list of
InetAddress according to the weight declared in the DNS Server.

It is not so specified in the API docs, so you cannot safely depend on
it being so. InetAddress explicitly delegates most details to the
system's configured name service (which might or might not even use DNS
in any particular case).

If it is essential that you rank the servers by the weights recorded in
their DNS resource records then you must obtain the necessary
information direct from DNS; there are third-party libraries that could
help you to do that from Java, or you could download and use Sun's JNDI
service provider for DNS.


John Bollinger
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top