Python——IO多路复用

Pythhon的select() 方法直接调用操作系统的IO接口,它监控socket,open,files,and pipes(所有带fileno()方法的文件句柄)何时变成readable和writeable,或者通信错误,select()使得同时监控多个连接变的简单,并且这比写一个长循环来等待和监控多客户端连接要高效很多,因为select直接通过操作系统提供的C的网络接口进行操作,而不是通过Python的解释器。

注意: Using Python's file objects with select() works for Unix, but is not supported under Windows.

posted @ 2020-04-24 21:13  籽俊  阅读(120)  评论(0)    收藏  举报