• 请不要在回答技术问题时复制粘贴 AI 生成的内容
ithelloworld
V2EX  ›  程序员

连接服务器时的socket问题

  •  
  •   ithelloworld · Feb 27, 2013 · 3212 views
    This topic created in 4885 days ago, the information mentioned may be changed or developed.
    写个脚本计算服务器端数据,用的是python的httplib包(http://docs.python.org/2/library/httplib.html)。
    有时数据突然出现socket问题,走到一半不走了,花了很长时间等了半天,再从头来挺郁闷。
    有什么好的解决办法?
    2 replies    1970-01-01 08:00:00 +08:00
    phuslu
        1
    phuslu  
       Feb 27, 2013
    用 urllib2, 支持 urllib2.urlopen 支持 timeout 参数。
    另外还有更强大的第三方库 requests
    ithelloworld
        2
    ithelloworld  
    OP
       Feb 27, 2013
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3236 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 00:32 · PVG 08:32 · LAX 17:32 · JFK 20:32
    ♥ Do have faith in what you're doing.