高冗余度的 C# 对象通过网络流传递
我需要通过非常规的慢速、低带宽、不稳定的连接发送带有元数据的二进制有效负载,该连接基本上可以像第 3 层及以上第 3 层及以上的任何其他正常连接一样对待。我预计二进制有效负载不超过 512kb,但可能会只有16kb左右。 我的客户端正在运行 .NET Compact Framework,而我的服务器可以运行普通的 .NET Framework。
我正在寻找一种方法或库,以随机间隔(始终处于连接状态)通过流(特别是 SslStream 或类似的东西)连续序列化和传输对象,并具有大量冗余,基本上是消息队列。 我研究了各种 XML、SOAP、JSON、protobuf 实现和 WCF,但有些不兼容、太重、没有足够高的冗余或文档很差。
我愿意自己写一些东西或移植一些东西,但是有一些东西可以工作并得到一些想法会非常有帮助。
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, basically 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我发现了一个名为 NetSockets 的东西,它有一些错误,但它简单、小、多线程,我可以将其更改为使用我想要的流、数据对象和序列化器,并将其移植到我的客户端。我的答案是在该实现的 NetBasePayloadStream、NetBaseStream 和 NetObjectStream 类中。
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.
我会尝试 MSMQ。 .Net CF 和所有 MS 服务器平台均支持它:
http://msdn.microsoft.com/en-us/library/ms229665%28v=VS.90%29.aspx
我还没有使用过它“不可靠”的连接,但它支持事务队列和可靠的交付,这就是为什么它听起来像你想要的。在这个特定的空间中,你真的不想为了这个目的而发明一些东西或重新利用其他东西,因为要做好它是非常困难的。我认为 WCF 也支持 Net CF 上的 MSMQ 传输,这将提供一个干净的消息传递抽象来使用。
因此需要澄清的是,WCF 具有 MSMQ 传输(如果支持)。
然而,这里的关键是在您描述的场景下评估和测试它,因为没有什么是 100% 完美的。
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.