mysql 10053_10053 您的主机中的软件中止了一个已建立的连接

场景

在不同的开发机器上,建立HTTP1.1连接,有的机器会进行一两次交互后,会检测到断开连接。这种情况下,会需要重连服务器。一般断开的原因包括硬件/路由/代理服务器。

目前尝试添加Keep-Alive字段,目前来看估计跟机器有关

摘自

You are assuming that the connection is staying open after each HTTP response is received,but that is

not guaranteed. You have to look at the server's actual HTTP response (specifically,at the HTTP

version reported in the status line,and at the Connection header) to know if the server is leaving the

connection open or not.

You are sending an HTTP 1.1 request,but there is no guarantee that the server will reply with an HTTP

1.1 response.

If the response is using HTTP 0.9,you must close the socket and reconnect before sending the next HTTP

request.

If the response is using HTTP 1.0,and if the Connection header does not say keep-alive,then you must

close the socket and reconnect before sending the next HTTP request.

If the response is using HTTP 1.1,and if the Connection header does not say close,then the server

left the connection open on its end,and you can reuse the same connection for the next request.

However,you do still need to take into account the possibility that the connection might be closed

externally (by a firewall/router/proxy,etc) before you actually send the next HTTP request.

So in the case of either HTTP 1.0 or 1.1,if you are expecting the connection to remain open,but send

() fails with an error indicating the connection was lost,simply close the socket and reconnect and

then send the same HTTP request again.

总结

如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。

如您喜欢交流学习经验,点击链接加入交流1群:1065694478(已满)交流2群:163560250

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值