Doing successive read(2)/write(2) operations

Hello everyone,

In the event where two read and/or write calls are performed close together, how can I prevent the second call from simply returning what was in the socket during the first call?

For example: If my Client performs two consecutive read operations, I want the first call to read() to return a message, discard it, then have the second call to read() return an entirely new message. What ends up happening sometimes however is that the second call to read() simply returns what was read during the first call to read()

NP
Topic archived. No new replies allowed.