Python socket server: listening to multiple clients -


i must listen incoming connections @ same time have receive messages connected clients. listen(1) makes socket waiting can't receive them. do? (i have messages client sends them)

in short, have 3 main options:

  1. open thread per client, spawns after accept(), , run loop in context, read() => .... => write()

  2. run main loop uses select() on clients after accept() each, , handle dispatching yourself.

  3. best option - use async networking framework tornado, gevent, twisted or few more handle transparently.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -