通信链实施
我正在设计一个新系统,需要支持使用多种不同通信协议的通信。我不需要一起使用它们,只是为了能够轻松地在它们之间切换。另外,有时协议由几层组成,我想单独实现每一层。 我想知道这类软件的最佳设计是什么 - 我的 OOP 方法说我应该使用一个代表一个层(具有读/写)的基类,并从中继承所有协议。此外,基类应该有一个“下一层”属性,该属性将指向通信链中的下一层。 我需要为每个协议(HTTP、加密等)实现一个层,并为每个终端链路(RS232、TCP/IP、蓝牙等)实现一个“底层”,
这听起来很标准。但我确信还有更好的东西。当今网络上有哪些现有选项?我从 Boost 库中知道 ASIO 实现了类似的东西。但我还没有找到任何适合这份工作的东西。
这是一个基于 Windows 的项目。我正在考虑 C++(我的母语),但我还没有锁定它。 C# 也是一个不错的选择(我的半母语)。
I'm designing a new system that needs to support communication using several different communication protocols. I don't need to use them together, just to be able to switch between them easily. Also, sometimes protocol consist of several layers, and I would like to implement each layer separately.
I was wondering what is the best design for these kind of software - My OOP approach says I should use a base class that'll represent a layer (with read/write), and inherit from it all protocols. Also the base class should have a "next layer" property that will point to the next layer in the communication chain.
I'll need to implement a layer for each protocol (HTTP, Encryption, etc), and a "bottom" layer for each end link (RS232, TCP/IP, Bluetooth, etc)
This sounds standard. But I'm sure that there's something better. What are the existing options on the web today? I know of ASIO from the Boost libraries that implements something kinda similiar. But I haven't found anything that seems right for the job.
It's a Windows based project. I'm thinking about C++ (my native), but I'm not locked on it yet. C# is a strong option as well (my semi-native).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论