I once wrote a program in a differnet language which was a server to support multi connections and I would like to know if the same tecnique could work in C++.
I know you can use the select() statment for a multi-threaded server to see if there is any data for any of the sockets to read/write. However this is how id rather code this server.
First of all when a new connection is made on the main socket it creates a new socket to handle the connection. A new task is then made for the new connection which handles all communication with the socket. When the connection closes (recv() returning 0) the task should hault and add itself to a task buffer ready to be restarted with a new connection. This way infinite tasks are not being created. So whenever a new connection is made on a new socket it first checks the task buffer for any idle tasks to restart to handle the connection. If there arent any then a new task is created for the connection.
I do completely understand how to use the select() statement so im not trying to avoid using it. Id just rather do it this way because im more familiar with the method and could create a more efficient server.
Thanks for any help.