English 中文(简体)
我如何检查一下是否在贾瓦打上了SSLS电话连接线?
原标题:How do I check if a SSLSocket connection is sane on Java?

我拥有一个SSLS袖珍库,我需要检查的是,在借款之前,车库连接是否停止。

由于双方没有联系,如果我试图从书状中书写或读出,我可能会收到一张小盘。

我的《联系测试守则》:

if(sslSocket.isConnected() && 
       !sslSocket.isInputShutdown() && 
       !sslSocket.isOutputShutdown()){
    valid = true;
}

如上文所解释的,该法典不算工作。

因此,如何最好地检查SSLS(或普通Socket)的收费情况?

最佳回答

如果通过“灯塔”连接你,你只能发现,一旦你试图写给它的话,TCP的袖珍材料就失去联系:

rel=“nofollow noreferer”>http://lkml.indiana.edu/hypermail/linux/kernel/0106.1/1154.html

因此,你需要在 Java使用这一例外情况。

问题回答

是否试图从袖珍中读取和捕获一只袖珍外观?

阅读时,通过Socket.setSotimeout()和SocketoutException,或撰写和捕获一个IOException:链接重新版。 没有其他机制。 iii 页: 1 页: 1 他们没有告诉你linkion>的状况。

我也存在同样的问题,这里是: 由于slSocket是从slServerSocket创建的,关闭服务器目录,而不是从目录上运行。

利用所建议的时间,赶上SSLException,并关闭袖珍目录,将有助于确保在不需要翻新的情况下保持连接。

sslserversocket = (SSLServerSocket) sslserversocketfactory.createServerSocket(sslServerSocketPort);
sslsocket = (SSLSocket) sslserversocket.accept();
sslsocket.setSoTimeout(5000);

// Restart connections
if(sslserversocket.isClosed() || sslserversocket == null){
    sslserversocket.close();
    startSSLServer();
}




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签