I am trying to create a socket server in C for a Collaborative real-time editor http://en.wikipedia.org/wiki/Collaborative_real-time_editor but I don't know what is the best server architecture for it.
At the first, I was trying to use select for the socket server but after that, I was reading about epoll and now I think that epoll is the best choice because the client will send every letter, that the user will write on textarea, to the server, so the server will have allot of data to process.
Also, I want to use threads with epoll but I don't know exactly how to use them. I want to use threads because I think is better to use 2 or all CPUs on the target machine.
My plan is
create 2 threads when the server start
first thread will analyze the new clients and prepare them for reading or sending
the second thread will have the job to read and send data from/to clients
The problem is that this 2 threads will use a while(1) with a epoll_wait.
My questions are, is this a good server architecture for using epoll with threads ? If not, what options I have ?
EDIT: I can't use libevent or libev or other libraries because this is a college project and I'm not allow to use external libraries.