<[EMAIL PROTECTED]> wrote: > Yes but before going deeper ( too deep ) i would like to play with a > toy python example. Basically what i want to study first is a socket or > socket+select server and 5 clients that get time updated from the > server. > > Don't really know how to keep hot connections without blocking the > server ? If someone can show me a quick and dirty example of the > client/server i'll apprciate it a lot.
Download the zipfile with the examples from Python in a Nutshell (freely available at <http://examples.oreilly.com/pythonian/pythonian-examples.zip>) and look at the examples for chapter 19 -- several sample servers and clients for a trivial "echo" protocol that progress from a server that's only able to deal with one client at a time, to multithreaded ones, to ones implemented with the better scalability of asynchronous socket handling, via select, asyncore, asynchat, and Twisted (there are also UDP clients and servers for an otherwise perfectly analogous task). I strongly recommend asynchronous socket handling, by far the best scalable and best performing approach to network programming. Doing it all by yourself with the select module is quite the learning experience, although in real-life I'd always recommend Twisted instead (it's an extremely rich framework, normally used at vastly higher semantics level, but in the mentioned examples I show instead how to use it at nearly the same semantics level as asyncore &c). Alex -- http://mail.python.org/mailman/listinfo/python-list