clear TCP/IP Input buffer

Hello,

I tried to clear the Input buffer for TCP/IP with the function
tcflush(fd_sock, TCIFLUSH).
But it doesn’t work: it says: “Opperation not supported”. Why? Is there a
function which works?
For the serial buffer it is no problem. For example you can write:
tcflush(fd_ser1, TCIFLUSH)

Could someone give me an advice?

Tobias.

Hello, Tobias Moeglich

I tried to clear the Input buffer for TCP/IP with the function
tcflush(fd_sock, TCIFLUSH).
But it doesn’t work: it says: “Opperation not supported”. Why? Is there a
function which works?
For the serial buffer it is no problem. For example you can write:
tcflush(fd_ser1, TCIFLUSH)

Could someone give me an advice?
tcflush only work with terminals.


kris

Tobias Moeglich <Tobias.Moeglich@tu-bs.de> wrote:

Hello,

I tried to clear the Input buffer for TCP/IP with the function
tcflush(fd_sock, TCIFLUSH).
But it doesn’t work: it says: “Opperation not supported”. Why? Is there a
function which works?
For the serial buffer it is no problem. For example you can write:
tcflush(fd_ser1, TCIFLUSH)

tc stands for “terminal control” and will only work on a terminal
device, such as serial port.

Could someone give me an advice?

I don’t think there is a built-in way to flush the buffer for TCP/IP that way.

You could set the socket to non-block, then read from it until
you get a return of -1, errno EWOULDBLOCK, but if the other side
starts writing, you will start to get the new data.



Tobias.


QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.