Web Crawler发生java.net.SocketException:软件导致连接中止:recv失败

时间:2017-08-11 07:39:21

标签: java web web-crawler

java.net.SocketException: Software caused connection abort: recv failed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.URL.openStream(Unknown Source)
at TestHttpClient.testURL3(TestHttpClient.java:196)
at TestHttpClient.main(TestHttpClient.java:226)

我设置了useragent / cooike和其他类似浏览器的设置,但它仍然是这样的例外。我测试其他网站程序是可以的,所以我猜它可能是反爬行策略。 我希望你能帮助我找出错误的原因或我应该怎么做。 THX !!!!!

1 个答案:

答案 0 :(得分:0)

好吧,我知道为什么我的程序出错了。因为GFW强制断开TCP连接。