I am trying to create a server which uses select() to handle multiple clients, as opposed to multi-threading which I have already accomplished. However select() just doesn't seem to do anything? I have all the necessary system calls e.g. socket() returning to an int called listener. bind() then listen(), all with suitable error checking, which isnt returning any problems. It also compiles just fine.
FD_ZERO(&fileDescriptors);
FD_ZERO(&tempSet);
.....
FD_SET(listener, &fileDescriptors);
fdmax = listener;
.....
while(1){
if(select(fdmax+1, &tempSet, NULL, NULL, &timeout) == -1){
//error occured
}
.....
}
The client cant establish a connection, however WSAGetLastError() Returns 0 on the client side. And the server, never gets passed select(), apart from returning 0 due to a timeout. Im really struggling to see the problem in my code.