I need to send a binary payload with metadata over an unconventional slow, low-bandwidth, jittery connection which can basically be treated like any other normal connection at and above Layer 3. I expect the binary payload to be no more than 512kb but will probably only be around 16kb. My client is running .NET Compact Framework and my server can running the normal .NET Framework.
I'm looking for a method or library to serialize and transfer objects over a stream (Specifically an SslStream or some equivalent) consecutively at randomly spaced intervals (always on connection) with a high amount of redundancy, basical开发者_运维百科ly message queuing. I've looked at various XML, SOAP, JSON, protobuf implementations and WCF but some aren't compatible, are too heavy, don't have high enough redundancy or have poor documentation.
I'm willing to write something myself or to port something but it would be very helpful to have something to work and get some ideas off.
I've found something called NetSockets, it has a few bugs but it's simple, small, multi-threaded and I can change it to use the streams, data objects and serializer I want and port it to my client. My answer was in the NetBasePayloadStream, NetBaseStream and NetObjectStream classes of that implementation.
I'd trial MSMQ. It's supported on the .Net CF and all MS server platforms:
http://msdn.microsoft.com/en-us/library/ms229665%28v=VS.90%29.aspx
I've not used it over "unreliable" connections but it supports transactional queues and reliable delivery which is why it sounds like you want. In this particular space, you really don't want to go and invent something for the purpose or repurpose something else as it's terribly difficult to get it right. I think WCF supports MSMQ transport on Net CF as well which would give a clean messaging abstraction to work with.
So to clarify, WCF with MSMQ transport, if it is supported.
The key thing here it to evaluate and test it under the scenarios you describe however, as nothing is 100% perfect.
精彩评论