Programming for linux: Most efficient way to handle a client connection (socket programming) on newest questions tagged linux – Stack Overflow

For every single tutorials and examples I have seen on the internet for Linux/Unix socket tutorials, the server side code always involves an infinite loop that checks for client connection every single time.
Example:

http://www.thegeekstuff.com/2011/12/c-socket-programming/

http://tldp.org/LDP/LG/issue74/tougher.html#3.2

Is there a more efficient way to structure the server side code so that it does not involve an infinite loop, or code the infinite loop in a way that it will take up less system resource?

See Answers


source: http://stackoverflow.com/questions/11687215/most-efficient-way-to-handle-a-client-connection-socket-programming
Programming for linux: programming-for-linux



online applications demo