java.net.SocketException:Unexcepted end of file from server


通过ccproxy连接服务器的时候遇到这样一个错误。网上的解释如下:
"Unexpected end of file" implies that the remote server accepted and closed the connection without sending a response. It's possible that the remote system is too busy to handle the request, or that there's a network bug that randomly drops connections.
With the information available it's impossible to say what's going wrong. If you have access to the servers in question you can use packet sniffing tools to find what exactly is sent and received, and look at logs to of the server process to see if there are any error messages.


也就是说光从这个错误信息判断不出是什么原因。后来找到了我们的原因:代理服务器无法解析所访问的域名,在hosts文件中加入这个域名便能够正常访问了。
感觉这个设计实在是太烂了,不能解析域名你就返回不能解析域名不就完了嘛,你直接关闭连接是几个意思。一定要多读一读源码,了解具体实现,应该就能理解为啥这么设计了。


这种东西经验性太强,分享出来,希望能帮到遇到同样问题的人。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值