开发者

In python, when using select.select on socket objects, how should I handle sockets that end up on the error list?

开发者 https://www.devze.com 2023-01-05 19:31 出处:网络
read, write, error = select.select(sockets,开发者_开发技巧 sockets, sockets, 60.0) What is recommended if something ends up in the error list?On the operating systems I know, there\'s nothing you ca
read, write, error = select.select(sockets,开发者_开发技巧 sockets, sockets, 60.0)

What is recommended if something ends up in the error list?


On the operating systems I know, there's nothing you can do with the sockets suffering "exceptional conditions", except trying to close them (which may raise an exception, so be sure to use a try/except around the attempt). You know that the connections those sockets stood for have terminated abnormally, and may want to write some log information about that, show the problem to the user, or the like. In some situations, it may be appropriate to try to establish those connections again (this may of course fail, depending on what exceptional condition was encountered, so be prepared for that).

0

精彩评论

暂无评论...
验证码 换一张
取 消