• <small id='UaaCr'></small><noframes id='UaaCr'>

      • <bdo id='UaaCr'></bdo><ul id='UaaCr'></ul>
      1. <tfoot id='UaaCr'></tfoot>
        <i id='UaaCr'><tr id='UaaCr'><dt id='UaaCr'><q id='UaaCr'><span id='UaaCr'><b id='UaaCr'><form id='UaaCr'><ins id='UaaCr'></ins><ul id='UaaCr'></ul><sub id='UaaCr'></sub></form><legend id='UaaCr'></legend><bdo id='UaaCr'><pre id='UaaCr'><center id='UaaCr'></center></pre></bdo></b><th id='UaaCr'></th></span></q></dt></tr></i><div id='UaaCr'><tfoot id='UaaCr'></tfoot><dl id='UaaCr'><fieldset id='UaaCr'></fieldset></dl></div>
        <legend id='UaaCr'><style id='UaaCr'><dir id='UaaCr'><q id='UaaCr'></q></dir></style></legend>
      2. 如何解决 10054 错误

        时间:2023-10-18

              1. <i id='7Kp4j'><tr id='7Kp4j'><dt id='7Kp4j'><q id='7Kp4j'><span id='7Kp4j'><b id='7Kp4j'><form id='7Kp4j'><ins id='7Kp4j'></ins><ul id='7Kp4j'></ul><sub id='7Kp4j'></sub></form><legend id='7Kp4j'></legend><bdo id='7Kp4j'><pre id='7Kp4j'><center id='7Kp4j'></center></pre></bdo></b><th id='7Kp4j'></th></span></q></dt></tr></i><div id='7Kp4j'><tfoot id='7Kp4j'></tfoot><dl id='7Kp4j'><fieldset id='7Kp4j'></fieldset></dl></div>

                  <tbody id='7Kp4j'></tbody>

                <tfoot id='7Kp4j'></tfoot>

                <small id='7Kp4j'></small><noframes id='7Kp4j'>

                <legend id='7Kp4j'><style id='7Kp4j'><dir id='7Kp4j'><q id='7Kp4j'></q></dir></style></legend>
                  <bdo id='7Kp4j'></bdo><ul id='7Kp4j'></ul>
                • 本文介绍了如何解决 10054 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用某个网站提供的应用程序定期从该网站收集一些数据,例如一次 30 秒.然后将返回的响应记录在数据库中.

                  I'm using an app provided by some website to collect some data from the website periodly, say, 30s a time. The returned response is then recorded in database.

                  我通过导入请求使用请求模块并编写代码来捕获异常.main函数的代码如下:

                  I use the requests modular by import requests and write codes to catch Exception. The codes for the main function are as following:

                  def get_response(self):
                      try:
                         response = requests.get(self.request_url)
                         if response.status_code == 200:
                            return response.json()
                         except Exception as e:
                            msg = "Exception is:
                   %s 
                  " % e
                            print msg
                  

                  上述功能在最初的几个小时内运行良好.该函数还可以从一些异常中恢复,例如:('连接中止.', BadStatusLine("''",))
                  或者('连接中止.', error(10053, ''))它忽略异常(通过在数据库中记录 Null)并继续获得下一个周期的响应.

                  The above function works quite well for the first several hours. The function can also recover from some exceptions like: ('Connection aborted.', BadStatusLine("''",))
                  or ('Connection aborted.', error(10053, '')) It omits the exception (by recording a Null in database) and continues to get the response of next period.

                  但是,当遇到 10054 错误时,该函数停止工作.

                  However, the function stops working when encoutering a 10054 error.

                  Exception is:
                   ('Connection aborted.', error(10054, '')) 
                  

                  我查看数据库发现在10054错误到来之后所有的响应都是Null.我首先猜测该网站可能会崩溃,因此没有收到任何回复.但是当我手动重新启动该功能时,它又开始得到响应.所以这与网站故障无关.

                  I check the database to find that all the response is Null after the time that the 10054 error comes. I firstly guess that the website may breakdown, thus no response is received. But when I manually restart the function, it starts to get response again. So that's no realated with breakdown of the website.

                  我在stackoverflow中搜索,发现:Errno 10054 An现有连接被远程主机强行关闭.但是不知道怎么解决.

                  I search in stackoverflow and find: Errno 10054 An existing connection was forcibly closed by the remote host. But I don't know how to resolve it.

                  您能否针对这个问题提供一些解决方案?(理想情况下)或提供一些解决方案来重新启动功能而无需手动重新启动?(看起来一旦我重新启动该功能,它就会再次工作.)

                  Could you please provide some solotion to this problem?(ideally speaking) or provide some solution to restart the function without manually restarting? (It looks like once I restart the funtion and it works again.)

                  提前致谢.

                  推荐答案

                  Web 服务器主动拒绝了您的连接.这通常是因为它拥塞、有速率限制或认为您正在发起拒绝服务攻击.如果你从服务器上得到这个,你应该在重试之前睡一会儿.事实上,如果你在重试前不睡觉,你就是一个拒绝服务攻击.礼貌的做法是实现(1,2,4,8,16,32)秒的渐进式睡眠.

                  The web server actively rejected your connection. That's usually because it is congested, has rate limiting or thinks that you are launching a denial of service attack. If you get this from a server, you should sleep a bit before trying again. In fact, if you don't sleep before retry, you are a denial of service attack. The polite thing to do is implement a progressive sleep of, say, (1,2,4,8,16,32) seconds.

                  这篇关于如何解决 10054 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何绕过消息-“您的连接不是私密的"在使用 Selenium 的非安全页面上? 下一篇:确保 psycopg2 数据库连接处于活动状态

                  相关文章

                • <tfoot id='zCOTE'></tfoot>
                  <i id='zCOTE'><tr id='zCOTE'><dt id='zCOTE'><q id='zCOTE'><span id='zCOTE'><b id='zCOTE'><form id='zCOTE'><ins id='zCOTE'></ins><ul id='zCOTE'></ul><sub id='zCOTE'></sub></form><legend id='zCOTE'></legend><bdo id='zCOTE'><pre id='zCOTE'><center id='zCOTE'></center></pre></bdo></b><th id='zCOTE'></th></span></q></dt></tr></i><div id='zCOTE'><tfoot id='zCOTE'></tfoot><dl id='zCOTE'><fieldset id='zCOTE'></fieldset></dl></div>
                  1. <legend id='zCOTE'><style id='zCOTE'><dir id='zCOTE'><q id='zCOTE'></q></dir></style></legend>

                    • <bdo id='zCOTE'></bdo><ul id='zCOTE'></ul>

                    <small id='zCOTE'></small><noframes id='zCOTE'>