- #1
zeion
- 466
- 1
Hi,
So I have written a server that will detect activity by connected clients using select. I am able to detect when a client has typed something from their keyboard, and then it will send send a message to the client in response.
The problem is that select() seems to be returning the same client fd in every iteration. So I would type one character from the client, then the server non-stop spams the client with the response message because it thinks that the client has still typed something.
How do I make it so that select() will only send the response message once and not forever?
I've already tried to remove client FD from the fd list and fflush but they don't do jack.
So I have written a server that will detect activity by connected clients using select. I am able to detect when a client has typed something from their keyboard, and then it will send send a message to the client in response.
The problem is that select() seems to be returning the same client fd in every iteration. So I would type one character from the client, then the server non-stop spams the client with the response message because it thinks that the client has still typed something.
How do I make it so that select() will only send the response message once and not forever?
I've already tried to remove client FD from the fd list and fflush but they don't do jack.