1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-27 14:47:59 +01:00

Searh for records of type SRV and class IN. SMACK-146

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@4084 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2006-06-23 17:47:23 +00:00 committed by gato
parent 8fe7e46330
commit 0bc5b7b404

View file

@ -19,9 +19,9 @@
package org.jivesoftware.smack.util;
import javax.naming.directory.Attributes;
import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;
import javax.naming.directory.Attributes;
import java.util.Hashtable;
import java.util.Map;
@ -83,7 +83,8 @@ public class DNSUtil {
String host = domain;
int port = 5222;
try {
Attributes dnsLookup = context.getAttributes("_xmpp-client._tcp." + domain);
Attributes dnsLookup =
context.getAttributes("_xmpp-client._tcp." + domain, new String[]{"SRV"});
String srvRecord = (String)dnsLookup.get("SRV").get();
String [] srvRecordEntries = srvRecord.split(" ");
port = Integer.parseInt(srvRecordEntries[srvRecordEntries.length-2]);
@ -134,7 +135,8 @@ public class DNSUtil {
String host = domain;
int port = 5269;
try {
Attributes dnsLookup = context.getAttributes("_xmpp-server._tcp." + domain);
Attributes dnsLookup =
context.getAttributes("_xmpp-server._tcp." + domain, new String[]{"SRV"});
String srvRecord = (String)dnsLookup.get("SRV").get();
String [] srvRecordEntries = srvRecord.split(" ");
port = Integer.parseInt(srvRecordEntries[srvRecordEntries.length-2]);
@ -143,7 +145,8 @@ public class DNSUtil {
catch (Exception e) {
// Attempt lookup with older "jabber" name.
try {
Attributes dnsLookup = context.getAttributes("_jabber._tcp." + domain);
Attributes dnsLookup =
context.getAttributes("_jabber._tcp." + domain, new String[]{"SRV"});
String srvRecord = (String)dnsLookup.get("SRV").get();
String [] srvRecordEntries = srvRecord.split(" ");
port = Integer.parseInt(srvRecordEntries[srvRecordEntries.length-2]);