Good,
I'm learning how to work with sockets (I've never worked) and decided to start with winsocks. At the moment I'm using winsock2.h
and in the tutorial I'm following I came to a part that I can not understand how it works.
The part that I have doubts is how the handle of the various clients is done.
//add master socket to fd set
FD_SET(master, &readfds);
//add child sockets to fd set
for ( i = 0 ; i < max_clients ; i++)
{
s = client_socket[i];
if(s > 0)
{
FD_SET( s , &readfds);
}
}
if (FD_ISSET(master , &readfds))
{....}
Why is this if statement
not always true and how does it work? The master
socket is always set. At first I thought it was because it was done set
to client sockets, but none of them is greater than 0.