Send serialised object via socket

Posted by RubbleFord on Stack Overflow See other posts from Stack Overflow or by RubbleFord
Published on 2009-10-08T07:30:48Z Indexed on 2010/04/16 16:03 UTC
Read the original article Hit count: 186

Filed under:
|
|

Whats the best way to format a message to a server, at moment I'm serilising an object using the binaryformatter and then sending it to the server.

At the server end its listening in an async fashion and then when the buffer size recieved is not 100% it assumes that the transfer has complete.

This is working and the moment, and I can deserialise the object at the other end, I'm just concerned that if I start sending async this method will fail has message's could be blurred.

I know that I need to mark the message somehow as to say that's the end of message one, this other bit belongs to message 2, but I'm unsure of the correct way to do this.

Could anyone point me in the right direction and maybe give me some examples?

Thanks

© Stack Overflow or respective owner

Related posts about sockets

Related posts about c#