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 lay开发者_如何学编程er 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).
精彩评论