* binds for the watchdog.
*/
public QServerSocket bindForWatchdog()
throws java.io.IOException
{
QServerSocket ss;
// use same method for ports for testability reasons
/*
if (_port >= 1024)
return null;
else
*/
if (_sslFactory instanceof JsseSSLFactory) {
if (_port < 1024) {
log.warning(this + " cannot bind jsse in watchdog");
}
return null;
}
if (_socketAddress != null) {
ss = QJniServerSocket.createJNI(_socketAddress, _port);
if (ss == null)
return null;
log.fine(this + " watchdog binding to " + _socketAddress.getHostName() + ":" + _port);
}
else {
ss = QJniServerSocket.createJNI(null, _port);
if (ss == null)
return null;
log.fine(this + " watchdog binding to *:" + _port);
}
if (! ss.isJni()) {
ss.close();
return ss;
}
if (_tcpNoDelay)
ss.setTcpNoDelay(_tcpNoDelay);
ss.setConnectionSocketTimeout((int) getSocketTimeout());
return ss;
}