2 lymlylllllllllllll lymlylllllllllllll 于 2013.09.29 10:50 提问

java.net.SocketException: socket closed

返回的httpresponse 内容如下
HTTP/1.1 200 OK [Server: zhihu_nginx, Date: Sun, 29 Sep 2013 02:08:35 GMT, Content-Type: application/json, Transfer-Encoding: chunked, Connection: keep-alive, Vary: Accept-Encoding, Expires: Fri, 02 Jan 2000 00:00:00 GMT, Pragma: no-cache, Cache-Control: private, no-store, max-age=0,no-cache, must-revalidate, post-check=0, pre-check=0]

报错如下:
Exception in thread "main" java.net.SocketException: socket closed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:136)
at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:152)
at org.apache.http.impl.io.SessionInputBufferImpl.read(SessionInputBufferImpl.java:203)
at org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:174)
at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:137)
at java.util.zip.InflaterInputStream.fill(Unknown Source)
at java.util.zip.InflaterInputStream.read(Unknown Source)
at java.util.zip.GZIPInputStream.read(Unknown Source)
at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
at sun.nio.cs.StreamDecoder.read(Unknown Source)
at java.io.InputStreamReader.read(Unknown Source)
at java.io.Reader.read(Unknown Source)
at org.apache.http.util.EntityUtils.toString(EntityUtils.java:244)
at org.apache.http.util.EntityUtils.toString(EntityUtils.java:288)
at zhihu.ZhihuDownload.getAnswersList(ZhihuDownload.java:138)
at zhihu.ZhihuDownload.main(ZhihuDownload.java:54)

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐
Android:使用Socket网络通信时异常:java.net.SocketException: socket closed
java.net.SocketException: socket closed
java.net.SocketException: Socket closed
遇见问题: 在使用HttpClient4.5写爬虫时,遇见如下异常: java.net.SocketException: Socket closed at java.net.SocketInputStream.socketRead0(Native Method) ~[?:1.8.0_11] at java.net.SocketInputStream.read
java.net.SocketException: socket closed 解决方式
因为前段时间一直比赛做项目,没有时间写博客,最后缓过来又开始写起来了这个问题其实困扰了我很多天socket 编程其实不难 如果是在 Android端的话 只需要 new一个 之后ip 端口号之后进行相应的IO流的控制即可 但是我在线程里 每次通过socket发送 data都可以 或是每次只接受 也可以 但是 接收 和 发送放在一起就会出现 socket closed 的错误后来才
使用HttpClient时遇到的 java.net.SocketException: Socket closed异常
使用httpClient时,报 java.net.SocketException: Socket closed异常的解决
Android Studio 中出现 java.net.SocketException “Socket closed” 问题的解决方法
在 Android Studio 中运行模拟器,出现以下问题提示: 解决方法 —— 确保下图中画圈的部分,运行的是 app: 如果画圈的部分是 “项目名称[build]”,就会出现这个问题。...
eclipse里启动rabbitmq报错 java.net.SocketException: Connection reset
是因为当前用户设置 Virtual Hosts有问题,问题具体描述可以看看http://blog.csdn.net/only09080229/article/details/43304543 如何解决这个问题?只要正确设置当前用户的 Virtual Hosts并和用户绑定就行了。 例如你想添加一个/Admin 的virtual hosts 并和用户绑定。 设置办法见图: 步骤一:添加vir
OKhttp使用中出现java.net.SocketException: socket failed: EACCES (Permission denied)
在新建一个工程使用okhttp时测试post方法出现该错误,因为使用okhttp需要获取网络权限,所以需要在manifest中加入网络权限<uses-permission android:name=“android.permission.INTERNET”/>  ...
解决Idea 无法启动tomcat项目。unable to open debugger port , java.net.SocketException "socket closed"
Unable to open debugger port (127.0.0.1:63777): java.net.BindException "Address already in use: JVM
httpclient遇到socket closed解决办法
本人在做接口功能自动化测试的过程中遇到一个一个问题,如果请求过于频繁后,总会报一个java.net.SocketException: socket closed异常,在研究完代码之后发现了一个问题,在请求结束之后我做一个释放释放链接的方法。 异常想信息如下: java.net.SocketException: socket closed 下面是我的错误代码: request.relea
Unable to open debugger port (127.0.0.1:55180): java.net.SocketException "socket closed"
运行项目的时候出现 Unable to open debugger port (127.0.0.1:55180): java.net.SocketException "socket closed" 的问题,以为55180端口被占用了,用netstat -ano查了下,端口并没有占用。 打开idea的Event Log,发现在原有报错上多了一条 Address localhost:1099 is