[Mono-dev] Problem in Mono's implementation of System.IO.StreamReader?
procopie.roman at gmail.com
Sun Jul 11 03:42:15 EDT 2010
I had same problem, in similar circumstances. It seems that you need to pass
the actual StreamReader to the further use of the stream.
On 8 July 2010 22:22, Thiago Padilha <tpadilha84 at gmail.com> wrote:
> I'm using StreamReader to read some text from a network stream that
> will contain a two part message : the first part(the one I'm reading)
> contains some headers in plain text, the second part may contain any
> kind of data.
> It doesnt matter the data in the second part of the message, I
> intend to pass the underlying Stream to another code that will
> correctly deserialize it. The problem is that the StreamReader decodes
> a lot of text on my first call to ReadLine() (much more than one
> line). The result is that the NetworkStream advances more than it
> should, and I cant deserialize the second part of the message.
> Is this intended behavior? I can easily work arround this by
> buffering the second part of the message and wrapping a MemoryStream
> arround it, but I'd rather pass the NetworkStream directly.
> Also, sometimes I intend to close the network connection and discard
> the second part depending on the headers I find.(And since the reader
> will already have buffered it, the data will have to wait for garbage
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-devel-list