带有 C++ 客户端和 C# 后端的协议缓冲区? [英] protocol buffers with C++ client and C# back-end?
问题描述
如何通过 HTTP 或等效的 Web 服务将 C# 后端与 C++ 前端连接起来?
How do you connect C# back-end with a C++ front-end via HTTP or web-service equivalent?
推荐答案
这里分为三个部分;服务器(听起来像 C#)、客户端(听起来像 C++)和传输.把它们分开,从最重要的开始:
There are three parts here; the server (sounds like C#), the client (sounds like C++) and the transport. Taking them separately, and starting with the most important:
传输:这里的重要决定是您希望数据采用什么形状.您提到了协议缓冲区,所以我们说的是二进制 - 但那可能是:
the transport: big decision here is what shape you want the data to be in. You mention protocol buffers, so we're talking binary - but that could be:
- 原始八位字节流(想想:从网络服务器下载图像)
- 返回流或字节的 SOAP 网络服务[]
- 返回 MTOM 的相同 SOAP 网络服务
任何都应该工作;选择哪个取决于可用的工具.重要的是:通过网络获取一大块二进制文件.
Any should work; which to choose depends on the tools available. The important thing is : get a chunk of binary over the wire.
此时你还需要考虑数据定义;.proto 文件可以定义您的架构,以及大多数协议缓冲区实现包括生成匹配类的工具.
You also need to think about the data definition at this point; a .proto file can define your schema, and most protocol buffers implementations include a tool to generate matching classes.
在此处列出了各种 protobuf 实现(C++、C# 等).
这篇关于带有 C++ 客户端和 C# 后端的协议缓冲区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!