[En-Nut-Discussion] Empty a stream

Mikael E.Pedersen (MEP) MEP at tt.dk
Mon Nov 11 14:55:46 CET 2002


Hi.

I am trying to write a small POP3 client for Ethernut, but i am having a
problem:
I want to get rid of any incoming data from a TCP stream, before i send a
command to the server.
I have tried this:

while(NutDeviceGetLine(sostream, buffer, sizeof(buffer)-1) > 0);

But when the stream is empty, it just sits and wait for more data (that
never arrives).
Can i empty the stream in some other way? And if so: How?
Or should i rather split my program into two seperate threads. One that
transmit commands, and one that listens for the response?

Best regards,
Mikael




More information about the En-Nut-Discussion mailing list