I am sending serialized objects via a NetWorkStream to another computer, on the receiving end I would like to deserialize these objects.
I will be sending many consecutive objects, when I am receiving data via the NetworkStream, how do I know when the first JSON Document ended in order to have JSON.NET Parse the document from the received string?
Or better yet, is there any way to have Json.NET read directly from the NetworkStream and Deserialize/Parse the resulting JSON document?
Let me know
Regards
Albert
If you implementing some custom protocol you could send a marker to indicate the current object end so that the client can deserialize it and add it to a resulting list. Another option is to read the whole stream and deserialize the entire array at one go which could of course consume more memory.