I just start to learn to code for Linux server.
After coding a simple server with multithreading, I don't know when we should use select
.
My server with multithreading is very simple:
while(true)
{
client = accept(sock);
pthread_create(client, processClientFunc);
}
Each client has its own thread so it can communicate with the server.
How I've heard that there were three functions: select, poll and epoll
.
Google told me that select
could monitor multiple file descriptors.
Well, OK, I understand but I think the multithreading can cover all of needs. Also, I think I still need to use multithreading even if I use select
.
So my question is: when should we use select
.