return immediatelyor omitted to mean wait until at least one object is ready (as done in our server scriptthe call returns triple of ready objects--subsets of the first three arguments--any or all of which may be empty if the timeout expired before sources became ready select portability like threadingbut unlike forkingthis server works in standard windows pythontoo technicallythe select call works only for sockets on windowsbut also works for things like files and pipes on unix and macintosh for servers running over the internetof coursethe primary devices we are interested in are sockets nonblocking sockets select lets us be sure that socket calls like accept and recv won' block (pausethe callerbut it' also possible to make python sockets nonblocking in general call the setblocking method of socket objects to set the socket to blocking or nonblocking mode for examplegiven call like sock setblocking(flag)the socket sock is set to nonblocking mode if the flag is zero and to blocking mode otherwise all sockets start out in blocking mode initiallyso socket calls may always make the caller wait howeverwhen in nonblocking modea socket error exception is raised if recv socket call doesn' find any dataor if send call can' immediately transfer data script can catch this exception to determine whether the socket is ready for processing in blocking modethese calls always block until they can proceed of coursethere may be much more to processing client requests than data transfers (requests may also require long-running computations)so nonblocking sockets don' guarantee that servers won' stall in general they are simply another way to code multiplexing servers like selectthey are better suited when client requests can be serviced quickly the asyncore module framework if you're interested in using selectyou will probably also be interested in checking out the asyncore py module in the standard python library it implements classbased callback modelwhere input and output callbacks are dispatched to class methods by precoded select event loop as suchit allows servers to be constructed without threads or forksand it is select-based alternative to the sock etserver module' threading and forking module we met in the prior sections as for this type of server in generalasyncore is best when transactions are short-what it describes as " / boundinstead of "cpu boundprogramsthe latter of which still require threads or forks see the python library manual for details and usage example twisted for other server optionssee also the open source twisted system (matrix comtwisted is an asynchronous networking framework written in python that supports tcpudpmulticastssl/tlsserial communicationand more it handling multiple clients