C - how select() understand a connection from same client

104 views Asked by At

i have this question, that i think is more theoretical than pratical.

I have a server, that receives connections from clients, with select() function.

Server has a pattern master-slave where slave are threads that take file descriptor from master and manage request from specific client.

(Every request from client start with a connection request)

I think that select() function must understand that same client asks some requests, because if same client asks two requests and select function can't understand that is same client, select create two file descriptor for same client with accept() and after two different threads manage a different request from same client and i think this can create a lot of concurrency problems because different threads write in different file descriptors but the real channel with client is the same.

So, i would like to know, how can select() recognise a client after the first request?

0

There are 0 answers