Hi!
I am currently trying to learn C#, and have started by developinga simple messaging application with a client and server. Byusing callback delegates, I can asynchronously send and recievetext as byte arrays.
Because I wanted to be able to send more advanced messagesbetween the client and server, I decided to create my ownmessage class, serialize it, and deserialize it at the other end(using XmlSerializer).
Now to my question:
Because the XmlSerializer uses a network stream, I do not reallyunderstand how to recieve it on the other end.
I realize that you call(myMessage)myXmlSerializer.Deserialize(myNetwo rkStream), but howdo I know when the networkstream contains data? It was simplewhen just sending byte arrays, as I could just callmySocket.BeginReceive(...) and it would sit and wait for dataand stuff it in a byte[]. I guess I could still use this methodby making a memorystream out of the byte array, and pass it toDeserialize(). Is there any way to do this without worryingabout byte arrays?
I realize my question may be hard to understand, as I am havingtrouble putting it into words. If it is unclear, I will try todescribe it more thoroughly. Also, as previously stated, I amnew to C#, so forgive any ignorance =).
-- Daniel Lindros
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>CqCFNe4c20uT8o/wIix1bw==</Id>