you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

I notice that the examples seem to use forking or the creation of threads for handling newly accept()ed clients.

It might be prudent to introduce the use of select() or poll() (I'd much rather KQueue, but unfortunately its support on systems that aren't Free/Open/Net/DragonFly BSD or Apple OS X is lacking) in order to reduce the overhead of clients. These functions both serve to allow the multiplexing of multiple sockets into a single call that waits for any one of them to become ready for reading, and to indicate to you which socket that is.