On Aug 18, 12:56 am, Atif Aziz <
aziza...@gmail.com> wrote:
> > So it seems as if JsonTextReader
> > caches the EOF value of the underlying stream. Can anyone confirm this
> > for me?
>
> It doesn't do that. Once the JsonTextReader enter the EOF state, it remains
> there. If you want to continue to read another, disjoint, JSON data from the
> underlying stream then you need to create a new JsonTextReader instance over
> the same stream. You cannot rewind an existing JsonTextReader into the BOF
> state.
>
> - Atif
>
> On Tue, Aug 17, 2010 at 10:39 PM, drewpvogel <
drewpvo...@gmail.com> wrote:
> > I have a client/server application that uses the .Net TcpListener and
> > TcpClient classes. It currently uses a line based protocol. I would
> > like to convert it to use JSON objects as the basis of the protocol.
> > To this end I tried to do:
>
> > Stream stream = client.GetStream();
> > StreamReader streamReader = new StreamReader(stream);
> > JsonTextReader jsonReader = new JsonTextReader(streamReader);
>
> > The first call to JsonConvert.Import(jsonReader) succeeds. The
> > underlying stream is then at EOF. Then another message comes in, moves
> > the EOF for the stream. However JsonConvert.Import throws an exception
> > with the message "Unexpected EOF". So it seems as if JsonTextReader
> > caches the EOF value of the underlying stream. Can anyone confirm this
> > for me?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Jayrock" group.
> > To post to this group, send email to
jay...@googlegroups.com.
> > To unsubscribe from this group, send email to