socket.error: (32, 'Broken pipe') 怎么解决?

zhezh80 2008-08-01 05:48:50
我的目的是在连接到server以后,不断输入字符,代码如下:

#!/usr/bin/python
import socket

host = "172.16.1.100"
port = 80
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET,socket.SO_KEEPALIVE,1)

s.connect((host,port))
filename = ['1.txt','2.txt','eicar.txt']
times = 10000

for t in range(times):
for i in filename:
print "Getting %s ... " % i
s.sendall("GET %s " % i)
print "Done."


为什么总是跑一阵就提示Traceback (most recent call last):
File "./piplining.py", line 17, in ?
s.sendall("GET /%s HTTP/1.1HOSTn" % i)
File "<string>", line 1, in sendall
socket.error: (32, 'Broken pipe') 然后程序自动退出了
...全文
1171 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhezh80 2008-08-04
  • 打赏
  • 举报
回复
没有人知道么?急用
zhezh80 2008-08-04
  • 打赏
  • 举报
回复
没有人知道么?急用

37,743

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • WuKongSecurity@BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧