This project has moved and is read-only. For the latest updates, please go here.

Client with framework 2.0 and server with Nito Async

Sep 3, 2010 at 1:28 PM


i want make an app client -server and i'm using Nito Async in side Server, but i want make a client only with framework 2.0 and without Nito Async.

When the client connect to server run good , but when try to send a serialized message the server in "ChildSocket_PacketArrived" function have an Exception.

How can i do to send and receive a simple message to Nito Asyncand framework 2.0


Regards and tnx




Sep 3, 2010 at 5:02 PM

The Nito.Async.Sockets library does not specify any particular protocol. You'll have to design this yourself.

The sample code uses a simple protocol which uses length-prefixed binary-serialized objects. The length prefix is a 4-byte unsigned integer.

In your client, you could try sending the uint length before sending the serialized data. However, there are a couple of other possible problems, due to the binary serialization:

  1. It expects the same actual type to exist in both client and server. The sample code handles this by compiling the message types into a separate dll which is referenced by both client and server.
  2. There have been some versioning issues reported when using different major versions of .NET. From what I've heard, it sounds like .NET binary serialization is simply not backwards compatible.

I think the binary serialization may be tripping you up here. You could use another type of serialization (e.g., xml) which is backwards compatible, or serialize the messages by hand.