V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
ithelloworld
V2EX  ›  程序员

连接服务器时的socket问题

  •  
  •   ithelloworld · 2013-02-27 17:54:54 +08:00 · 2370 次点击
    这是一个创建于 4082 天前的主题,其中的信息可能已经有所发展或是发生改变。
    写个脚本计算服务器端数据,用的是python的httplib包(http://docs.python.org/2/library/httplib.html)。
    有时数据突然出现socket问题,走到一半不走了,花了很长时间等了半天,再从头来挺郁闷。
    有什么好的解决办法?
    2 条回复    1970-01-01 08:00:00 +08:00
    phuslu
        1
    phuslu  
       2013-02-27 17:59:33 +08:00
    用 urllib2, 支持 urllib2.urlopen 支持 timeout 参数。
    另外还有更强大的第三方库 requests
    ithelloworld
        2
    ithelloworld  
    OP
       2013-02-27 18:20:00 +08:00
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2200 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 10:13 · PVG 18:13 · LAX 03:13 · JFK 06:13
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.