On Mon, 16 Jul 2007 05:33:34 -0700, Rogier <Ro********@gmail.comwrote:
I'm Writing my own NZb download App, using Async Network Streams en
Callback delegates. The Problem is that if I Want tot Receive Large
chunks of data (for instance the LIST NEWSGROUPS Response). I do not get
the Data at once.
This is by design. A network stream is going to return data received as
soon as it has _some_ data, and necessarily wait until it has _all_ data.
This is true whether you use synchronous or asynchronous methods (other
than ReadToEnd(), of course).
You are required to use whatever information is available in the protocol
to indicate the length of the data, and read repeatedly until you have
enough data to process. Depending on the protocol, this could mean
receive a count of bytes in advance, looking for a delimiter at the end of
the data, or simply reading until the connection is closed.
Pete