import socket
mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
mysock.connect(('www.pythonlearn.com/code/intro-short.txt', 80))
mysock.send('GET http://www.pythonlearn.com/code/intro-short.txt HTTP/1.0\n\n')
while True:
data = mysock.recv(512)
if ( len(data) < 1 ) :
break
print data;
mysock.close()
[Errno 11004] getaddrinfo失败 我无法想象我的错是什么。请帮帮我!
答案 0 :(得分:2)
您需要从您尝试连接的域中删除路径:
mysock.connect('www.pythonlearn.com', 80)