<legend id='KcvXt'><style id='KcvXt'><dir id='KcvXt'><q id='KcvXt'></q></dir></style></legend>
    <tfoot id='KcvXt'></tfoot>

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

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

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

        重复的 POST 请求导致错误“socket.error: (99, 'Cannot assign reques

        Repeated POST request is causing error quot;socket.error: (99, #39;Cannot assign requested address#39;)quot;(重复的 POST 请求导致错误“socket.error: (99, Cannot assign requested address))

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

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

                <tfoot id='kKOMf'></tfoot>
                • 本文介绍了重复的 POST 请求导致错误“socket.error: (99, 'Cannot assign requested address')"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我的盒子里部署了一个网络服务.我想通过各种输入检查此服务的结果.这是我正在使用的代码:

                  I have a web-service deployed in my box. I want to check the result of this service with various input. Here is the code I am using:

                  import sys
                  import httplib
                  import urllib
                  
                  apUrl = "someUrl:somePort"
                  
                  fileName = sys.argv[1]
                  conn = httplib.HTTPConnection(apUrl)
                  
                  titlesFile = open(fileName, 'r')
                  
                  try:
                      for title in titlesFile:
                  
                          title = title.strip()
                          params = urllib.urlencode({'search': 'abcd', 'text': title})
                          conn.request("POST", "/somePath/", params)
                          response = conn.getresponse()
                          data = response.read().strip()
                          print data+"	"+title
                  
                          conn.close()
                  
                  finally:
                      titlesFile.close()
                  

                  此代码在打印相同数量的行后出现错误 (28233).错误信息:

                  This code is giving an error after same number of lines printed (28233). Error message:

                  Traceback (most recent call last):
                    File "testService.py", line 19, in ?
                      conn.request("POST", "/somePath/", params)
                    File "/usr/lib/python2.4/httplib.py", line 810, in request
                      self._send_request(method, url, body, headers)
                    File "/usr/lib/python2.4/httplib.py", line 833, in _send_request
                      self.endheaders()
                    File "/usr/lib/python2.4/httplib.py", line 804, in endheaders
                      self._send_output()
                    File "/usr/lib/python2.4/httplib.py", line 685, in _send_output
                      self.send(msg)
                    File "/usr/lib/python2.4/httplib.py", line 652, in send
                      self.connect()
                    File "/usr/lib/python2.4/httplib.py", line 636, in connect
                      raise socket.error, msg
                  socket.error: (99, 'Cannot assign requested address')
                  

                  我正在使用 Python 2.4.3.我也在做 conn.close() .但是为什么会出现这个错误呢?

                  I am using Python 2.4.3. I am doing conn.close() also. But why is this error being given?

                  推荐答案

                  这不是python问题.

                  This is not a python problem.

                  在 linux 内核 2.4 中,临时端口范围是从 32768 到 61000.因此可用端口数 = 61000-32768+1 = 28233.据我了解,因为所讨论的 Web 服务非常快(<5ms实际上)因此所有端口都用完了.程序必须等待大约一两分钟才能关闭端口.

                  In linux kernel 2.4 the ephemeral port range is from 32768 through 61000. So number of available ports = 61000-32768+1 = 28233. From what i understood, because the web-service in question is quite fast (<5ms actually) thus all the ports get used up. The program has to wait for about a minute or two for the ports to close.

                  我所做的是统计 conn.close() 的数量.当数字为 28000 时,等待 90 秒并重置计数器.

                  What I did was to count the number of conn.close(). When the number was 28000 wait for 90sec and reset the counter.

                  这篇关于重复的 POST 请求导致错误“socket.error: (99, 'Cannot assign requested address')"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Initialize Multiple Numpy Arrays (Multiple Assignment) - Like MATLAB deal()(初始化多个 Numpy 数组(多重赋值) - 像 MATLAB deal())
                  How to extend Python class init(如何扩展 Python 类初始化)
                  What#39;s the difference between dict() and {}?(dict() 和 {} 有什么区别?)
                  What is a wrapper_descriptor, and why is Foo.__init__() one in this case?(什么是 wrapper_descriptor,为什么 Foo.__init__() 在这种情况下是其中之一?)
                  Initialize list with same bool value(使用相同的布尔值初始化列表)
                  setattr with kwargs, pythonic or not?(setattr 与 kwargs,pythonic 与否?)

                  • <legend id='eZVqX'><style id='eZVqX'><dir id='eZVqX'><q id='eZVqX'></q></dir></style></legend>

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

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

                          • <bdo id='eZVqX'></bdo><ul id='eZVqX'></ul>
                            <tfoot id='eZVqX'></tfoot>