{
udpSocket = new DatagramSocket();
}
catch (java.net.SocketException e)
{
NamingException ne = new ConfigurationException();
ne.setRootCause(e);
throw ne;
}
this.servers = new InetAddress[servers.length];
serverPorts = new int[servers.length];
for (int i = 0; i < servers.length; i++)
{
// Is optional port given?
int colon = servers[i].indexOf(':', servers[i].indexOf(']') + 1);
serverPorts[i] = (colon < 0) ? DEFAULT_PORT : Integer
.parseInt(servers[i].substring(colon + 1));
String server = (colon < 0) ? servers[i] : servers[i].substring(0,
colon);
try
{
this.servers[i] = InetAddress.getByName(server);
}
catch (java.net.UnknownHostException e)
{
NamingException ne = new ConfigurationException(
"Unknown DNS server: " + server);
ne.setRootCause(e);
throw ne;
}
}
reqs = Collections.synchronizedSet(new HashSet<Integer>());
resps = Collections.synchronizedMap(new HashMap<Integer, byte[]>());