blocking socket dilemma

Donn Cave donn at u.washington.edu
Wed Sep 11 12:04:47 EDT 2002


Quoth "Gumuz" <gumuz at looze.net>:
| I am a little bit stuck with my design (again!).
|
| I have this server class, which creates a session object for every accepted
| incoming connection. The session object has a RequestHandler function which
| is then run in a new thread.
|
| all fine, but...
|
| This RequestHandler function actually does a infinite loop. The loop wil
| receive data and take some action and it will send data which is piled up in
| this session's queue. The problem that i'm having is that the loop will hang
| on socket.recv if the client is not sending anything. Ofcourse this is very
| obvious and logical, but i can't think of another way of constructing my
| design, so that this problem doesn't occur.

If it helps, you can use select.select() to determine whether the
device has more input ready, immediately or with a timeout at your
discretion.

	Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list