try {
send( request, response, RETRY_TIMEOUT );
} catch( IOException ioe ) {
if( DebugFile.trace )
new ErrorHandler (ioe);
throw new UnknownHostException( name.name );
}
if( response.received && response.resultCode == 0 ) {
response.addrEntry.hostName.srcHashCode = addr.hashCode();
return response.addrEntry;
}
} while( --n > 0 && request.isBroadcast );
throw new UnknownHostException( name.name );
}
/* If a target address to query was not specified explicitly
* with the addr parameter we fall into this resolveOrder routine.
*/
for( int i = 0; i < resolveOrder.length; i++ ) {
try {
switch( resolveOrder[i] ) {
case RESOLVER_LMHOSTS:
NbtAddress ans = Lmhosts.getByName( name );
if( ans != null ) {
ans.hostName.srcHashCode = 0; // just has to be different
// from other methods
return ans;
}
break;
case RESOLVER_WINS:
case RESOLVER_BCAST:
if( resolveOrder[i] == RESOLVER_WINS &&
name.name != NbtAddress.MASTER_BROWSER_NAME &&
name.hexCode != 0x1d ) {
request.addr = NbtAddress.getWINSAddress();
request.isBroadcast = false;
} else {
request.addr = baddr;
request.isBroadcast = true;
}
n = RETRY_COUNT;
while( n-- > 0 ) {
try {
send( request, response, RETRY_TIMEOUT );
} catch( IOException ioe ) {
if( DebugFile.trace )
new ErrorHandler(ioe);
throw new UnknownHostException( name.name );
}
if( response.received && response.resultCode == 0 ) {
/* Before we return, in anticipation of this address being cached we must
* augment the addresses name's hashCode to distinguish those resolved by
* Lmhosts, WINS, or BCAST. Otherwise a failed query from say WINS would
* get pulled out of the cache for a BCAST on the same name.
*/
response.addrEntry.hostName.srcHashCode =
request.addr.hashCode();
return response.addrEntry;
} else if( resolveOrder[i] == RESOLVER_WINS ) {
/* If WINS reports negative, no point in retry
*/
break;
}
}
break;
}
} catch( IOException ioe ) {
}
}
throw new UnknownHostException( name.name );
}