2007年06月21日 星期四 10:06
比如: data = self.rfile.read(ssize) self.wfile.write("y") 潜在下面的错误,由于socket连接断开,write就会有错误,是应该用try except 包起来,还是其他什么手段处理?(比如c中检察返回值),我不了解try except,不敢随意使用try except,怕影响性能。请大家指教一下,谢谢! Traceback (most recent call last): File "/home/forum/Python-2.5/Lib/SocketServer.py", line 222, in handle_request self.process_request(request, client_address) File "/home/forum/Python-2.5/Lib/SocketServer.py", line 241, in process_request self.finish_request(request, client_address) File "/home/forum/Python-2.5/Lib/SocketServer.py", line 254, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/forum/Python-2.5/Lib/SocketServer.py", line 521, in __init__ self.handle() File "baoba.py", line 86, in handle self.wfile.write("y") File "/home/forum/Python-2.5/Lib/socket.py", line 261, in write self.flush() File "/home/forum/Python-2.5/Lib/socket.py", line 248, in flush self._sock.sendall(buffer) error: (32, 'Broken pipe')
Zeuux © 2025
京ICP备05028076号