异常描述:
socket保持长连接,但当连接超过5秒钟后,服务器断开了连接,可是本地isClosed的值未变化,但closed的值改变了(可惜不能用)。这让我感到莫名其妙。麻烦哪位大侠来解释一下,我相信许多人都未碰到过。下面是我写的连接IOS推送服务器的代码
SSLContext sslc;
KeyManagerFactory kmf = KeyManagerFactory.getInstance(ALGORITHM);
KeyStore keystore = KeyStore.getInstance(KEYSTORE_TYPE_PKCS12);
keystore.load(new BufferedInputStream(new FileInputStream(new File(KEY_STORE))),PASSWORD.toCharArray());
kmf.init(keystore, PASSWORD.toCharArray());
sslc = SSLContext.getInstance("TLS");
sslc.init(kmf.getKeyManagers(), null, new SecureRandom());
ssf = sslc.getSocketFactory();
s = (SSLSocket) ssf.createSocket("gateway.sandbox.push.apple.com", 2195);
Java socketjavasocket
socket保持长连接,但当连接超过5秒钟后,服务器断开了连接,可是本地isClosed的值未变化,但closed的值改变了(可惜不能用)。这让我感到莫名其妙。麻烦哪位大侠来解释一下,我相信许多人都未碰到过。下面是我写的连接IOS推送服务器的代码
SSLContext sslc;
KeyManagerFactory kmf = KeyManagerFactory.getInstance(ALGORITHM);
KeyStore keystore = KeyStore.getInstance(KEYSTORE_TYPE_PKCS12);
keystore.load(new BufferedInputStream(new FileInputStream(new File(KEY_STORE))),PASSWORD.toCharArray());
kmf.init(keystore, PASSWORD.toCharArray());
sslc = SSLContext.getInstance("TLS");
sslc.init(kmf.getKeyManagers(), null, new SecureRandom());
ssf = sslc.getSocketFactory();
s = (SSLSocket) ssf.createSocket("gateway.sandbox.push.apple.com", 2195);
Java socketjavasocket
解决方案 »
- 求助 The encoding 'GBK' is not supported by the Java runtime
- 500分求 snmp agent的详细开发
- 怎样插入BOBL类型
- 学妹,找java师傅!难!
- 请教MyEclipse插件新建Servlet向导的一个问题
- 关于tomcat5.5配置数据源的问题,请问应该如何配置?多谢了!
- JSP在生成xml格式文件时候的嵌入脚本不发挥作用??++如何HttpResponseWrapper获取JSP生成的页面??
- 非常有意思:tomcat-5.5.2不支持中文?struts-1.2.4自带例子Logon.jsp页面数据JS验证出错?
- EJB主键的问题!
- 按照东方一蛇翻译的EJB系列教程(EJB系列教程之二),不过我用的是Weblogic5.1,知道最后make project都没有问题,可是RUN的时候出错,该如何解决呢?
- 求助hibernate自动插入中间表数据
- 请求帮忙!程序的配置调用
Returns the closed state of the socket. Returns:
true if the socket has been closed
public void close()
throws IOException
Closes this socket.
Any thread currently blocked in an I/O operation upon this socket will throw a SocketException. Once a socket has been closed, it is not available for further networking use (i.e. can't be reconnected or rebound). A new socket needs to be created. Closing this socket will also close the socket's InputStream and OutputStream. If this socket has an associated channel then the channel is closed as well.
Specified by:
close in interface Closeable
Throws:
IOException - if an I/O error occurs when closing this socket.