int i;
sock = null;
synchronized(this) {
for (i = 0; i < hosts.length && sock == null; i++) {
ConnectThread th =
new ConnectThread(hosts[i],
port, this);
target = th;
th.start();
try {
wait(30 * 1000);
} catch (InterruptedException ie) {}
if (sock == null)
th.interrupt();
}
}
return sock;