On 6/30/10, Sean Kelly <s...@invisibleduck.org> wrote: > I've been thinking about this and I think this is probably what the majority > of apps want anyway. It isn't scalable, but server apps are a whole 'nother > ball of wax.
Blocking calls are convenient for simple apps, since you just call the read and write functions and don't worry about the packets. For servers, they are still pretty useful. You can use the select() call on unix to wait for any one of a set of connections to be ready for you, and when it is, you then call the same blocking read/write functions. Since you know ahead of time that they are ready, it doesn't actually wait. I imagine you could do the same with threads, but I've never actually tried it. Does this scale well? Honestly, I don't know. Every network server I've ever written has only had a handful of concurrent users anyway.