I am trying to implement a server / multi client program in Linux with C using select() and fd\_sets. I am trying to broadcast messages sent from one connected client to all other connected clients but I don't know how to access the sockets for other clients in the fd\_set once they are added dynamically. I am trying to replicate an implementation of this I found in C++ but the fd\_set in C doesn't have the properties as C++. This is the code I'm trying to replicate:

```
for(int i = 0; i < master.fd_count; i++)
{
    SOCKET outSock = master.fd_array[i];
    if(outSock != listening && outSock != sock)
    {
        send(outSock, buffer, 250);
    }
}

```

where `master` is the fd\_set, `listening` is the original socket listening for new clients and `sock` is the socket the message about to be broadcast came from.

Can any one help me learn how to access the fd\_set socket elements to be able to do `!=` comparisons on them like in the example. Or alternatively, point me to another method to implement the multi client setup where I can broadcast a message back to all connected clients. I initially tried using multi processes with `fork()` pipes but I could not find enough information on how to implement that properly.