[En-Nut-Discussion] Empty a stream

raphael deimel raphael at russe.ods.org
Mon Nov 11 20:32:55 CET 2002

Mikael E.Pedersen (MEP) wrote:

>I am trying to write a small POP3 client for Ethernut, but i am having a
>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?
imho you should split it into different threads, because this makes it a 
lot easier to deal if something unexpected happens with the data stream.
anyway, it's just my 2 cents

btw. nice to hear you're (trying) writing pop3 client :)

>Best regards,
>En-Nut-Discussion mailing list
>En-Nut-Discussion at egnite.de

More information about the En-Nut-Discussion mailing list