realpython / realpython/materials
Multiconnection server can't handle Connection Reset events
未关闭
还没有人认领这个 Issue。
- 主要语言
- Jupyter Notebook
- 星标
- 5.2k
- 派生
- 5.3k
- 平均合并
- 4 天 10 小时
- 30 天内合并 PR
- 10
描述
It seems the Muli-connection server example doesn't properly handle the Connection Reset Error;
Traceback (most recent call last):
File "server.py", line 65, in <module>
service_connection(key, mask)
File "server.py", line 24, in service_connection
recv_data = sock.recv(1024) # Should be ready to read
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
This error occurs when, for example, the Windows Command Prompt running the client.py (connected to the server) is closed. In this case, a peer reset is sent to the server, but since the server can't handle it, it simply exits with the above error.
Is there any specific event to catch this error and avoid breaking the server?
Thanks
SS
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 server.py 开始,重点查看第 24 行的 service_connection 和第 65 行的事件循环调用。关闭 Windows 客户端连接以重现该问题,然后确认服务器能够处理重置并继续为其他连接提供服务,而不是因 ConnectionResetError 退出。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- networking
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 55/100