Ive wrote a server in c using select to handle the data received by the clients however im using the select function only for receiving data and not sending. When i need to send Im currently looping through a linked list of connected sockets and using a send() system call to send out the data.
This would appear to be a bad idea as if I have 200 clients connected I have to loop through the entire list each time I need to send some data out.
A friend had told me I could use a buffer for each socket structure, fill it up with data and then send with selects "write". Im having some trouble getting my head around this though.
If i add a buf_out in the socket structure do I still need to loop through the list but just somehow pass it into the select to write ?
Ive searched around the web, found loads of examples using selects read but very few regarding the write.
Could anyone post a little code or point me in the right direction as to where I can learn about sending data from buffers with selects write.
Thoroughly Stumped Stan.