Errno 10060]连接尝试失败,因为连接方在一段时间后没有正确响应 [英] Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time

查看:175
本文介绍了Errno 10060]连接尝试失败,因为连接方在一段时间后没有正确响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

def check_web_server(host, port, path):
        h = httplib.HTTPConnection(host, port)
        h.request('GET',path)
        resp = h.getresponse()
        print 'HTTP Response:'
        print '   status =', resp.status
        print '   reason =', resp.reason
        print 'HTTP Headers:'
        for hdr in resp.getheaders():
                print '  %s: %s' % hdr

我这样调用了这个函数 check_web_server('www.python.org',80,'/')
但它给了我这个错误
错误:[Errno 10060]连接尝试失败,因为连接方在一段时间后没有正确响应,或者由于连接主机发生故障而建立连接失败回复

I called this function like this check_web_server('www.python.org',80,'/') but it gave me this error error: [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

你可以在这里清楚地看到代码
http://pastebin.com/V9KpGkvw

You can see the code clearly here http://pastebin.com/V9KpGkvw

我哈我在Stackoverflow搜索了这里,但我没有找到任何相关的问题
对不起我是网站的新手,如果我做错了。

I have searched here in Stackoverflow but I didnt find any relevant questions sorry I am new to site ,if I Did anything wrong.

推荐答案

As ping 有效,但 telnet 到端口 80 没有,您的计算机上的HTTP端口 80 已关闭。我假设您的浏览器的HTTP连接通过代理(因为浏览有效,您还会如何阅读stackoverflow?)。
您需要在python程序中添加一些代码来处理代理,如下所述:

As ping works, but telnetto port 80 does not, the HTTP port 80 is closed on your machine. I assume that your browser's HTTP connection goes through a proxy (as browsing works, how else would you read stackoverflow?). You need to add some code to your python program, that handles the proxy, like described here:

使用HTTP PROXY - Python

这篇关于Errno 10060]连接尝试失败,因为连接方在一段时间后没有正确响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆