异常描述:
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
解决方案 »
- 用IO将信息写成一个压缩文件,提示文件格式未知或损坏
- java jquery 提交action 报错:Access is denied
- 高分求高手指教
- 反射如何调用父类的方法
- (急)求教:用webservice建一个工程,然后从MySQL数据库的一个表test中取出所有的数据,在jsp页面上显示
- oracle数据缓存的问题
- webwork乱码
- 在jb9里添加xerces2.6.2的引用,org.apache.xerces.parsers.DOMParser就没有了?
- 寻找合作开发的朋友
- SessionBean中同时调用EntityBean和DAO的问题
- 求助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.