I am confused: is it possible/advisable to combine threads and select on fd? For example: I want to make a threaded tcp client-server program where the client can sent a message to the server and the server spreads this to all connected clients (and the client can continue to communicate).
I made a server-client program where all the clients get a separate thread when connecting; but i read in beej guide "What if you're blocking on an accept() call? How are you going to recv() data at the same time? "Use non-blocking sockets!" No way! You don't want to be a CPU hog. What, then?"
I don't see what blocking means in this case; because in my program when I enter a text and i push enter the text is send to the server but why does he mean by receiving data at the same time? While I am typing the text? How is that possible? I think I am confused :p Than I think these are completely different ways of tackling the program but than again i don't see the advantage the select provides? Thx