unresolved_address = _unresolved_address;
address = _address;
port = _port;
if ( address == null ){
// see if we've been passed an IP address as unresolved
// TODO: IPV6 one day?
int dots = 0;
boolean ok = true;
for (int i=0;i<unresolved_address.length();i++){
char c = unresolved_address.charAt(i);
if ( c == '." ){
dots++;
if ( dots>3 ){
ok = false;
break;
}
}else if ( !Character.isDigit( c )){
ok = false;
break;
}else{
// nnn.nnn.nnn.nnn
if ( i > 15 ){
ok = false;
break;
}
}
}
if ( ok && dots == 3 ){
try{
address = HostNameToIPResolver.syncResolve( unresolved_address );
}catch( Throwable e ){
Debug.printStackTrace(e);
}
}
}