select.select()

Bhanu Karthik bhanukarthik2002 at gmail.com
Sat Nov 23 00:41:32 EST 2013


On Friday, 22 November 2013 18:29:12 UTC-8, Steven D'Aprano  wrote:
> On Fri, 22 Nov 2013 17:42:07 -0800, Bhanu Karthik wrote:
> 
> 
> 
> > please help me.. what does the following line do?
> 
> > 
> 
> > read_sockets,write_sockets,error_sockets =
> 
> > select.select(CONNECTION_LIST,[],[])
> 
> 
> 
> The select.select function takes three arguments (plus an optional 
> 
> fourth):
> 
> 
> 
> select.select(read_list, write_list, exception_list)
> 
> 
> 
> Each list should a list of the file descriptors you want to wait for. On 
> 
> Windows, only sockets are valid file descriptors. On Unix or Linux, you 
> 
> can use sockets, open file objects, or low-level file descriptors.
> 
> 
> 
> In this case, you only pass CONNECTION_LIST, the others are empty lists 
> 
> []. CONNECTION_LIST is probably a list of sockets to be read. When they 
> 
> are ready for reading, select() will return three lists:
> 
> 
> 
> read_sockets  - a list of the sockets open for reading
> 
> 
> 
> write_sockets and error_sockets should both be empty lists, since you 
> 
> didn't request any of those to be opened.
> 
> 
> 
> 
> 
> 
> 
> -- 
> 
> Steven

Thank you ,your message answered the question exactly.

instead of using select.select,can we do like below?

read_sockets=connection_list
write_sockets=[]
error_sockets=[]




More information about the Python-list mailing list