more srv lookup fixes

This commit is contained in:
Daniel Gultsch 2014-03-25 18:12:27 +01:00
parent 0b9e089ac6
commit 956b646e2a

View File

@ -96,12 +96,23 @@ public class DNSHelper {
++i;
}
builder.replace(0, 1, "");
//TODO: workaround. speak proper dns later
if (!builder.toString().contains(".")) {
namePort.putString("error", "nosrv");
return namePort;
}
namePort.putString("name",builder.toString());
return namePort;
}
static int calcPort(byte hb, byte lb) {
return ((int) hb << 8) | ((int) lb & 0xFF);
int port = ((int) hb << 8) | ((int) lb & 0xFF);
if (port>=0) {
return port;
} else {
return 65536 + port;
}
}
final protected static char[] hexArray = "0123456789ABCDEF".toCharArray();