silverlight - C# DatacontractSerializer over Sockets multiple root elements -
I am writing a Sivlerlight chat application using Sockets and DataContractSerializer.
I have a class categorization with serializable objects that have been shared between the Silverlight client and the C # server.
When a friend logs, he sends messages to the server and if they are verified they receive a receipt after a number of messages which tells them who is online (and some other messages as well). The customer is again waiting on the socket and ready bytes. This will then attempt to cancel the result of the byte stream object. However, because the server has sent many messages, the byte stream will contain XML for more than one element and when a DSR is done, a multi-root exception is thrown.
What is the standard solution for deserializing a stream of objects away from a socket using DatacontractSerializer?
Thanks
I found a solution It looks like a little heck Is it
Because the data contract produces serializer XML, so I decided to write an extra '\ 0' byte in the stream after each object. Then in the end I just searched for objects by bit stream (b => b! = 0), it still works, but it seems that maybe I do not know about the side case.
...
Comments
Post a Comment