简体   繁体   English

客户端-服务器数据交换格式

[英]client-server data exchange format

We create client-server erp system with huge amount(in the future) of data and use c# for client and c for server. 我们创建具有大量(将来)数据的客户端-服务器erp系统,并将c#用于客户端,将c用于服务器。 We started with xml for small requests/responses and it looks ok for now. 我们从xml开始处理小型请求/响应,目前看来还不错。 But what is the best data exchange format for increasing amount of data per response(up to 100MB i think)? 但是,增加每个响应的数据量(我认为最大为100MB)的最佳数据交换格式是什么?

PS 聚苯乙烯

  1. Highest priority is encode/decode speed. 最高优先级是编码/解码速度。
  2. We use Sockets to transfer data. 我们使用套接字传输数据。

我建议您看一下JSON: http//www.json.org/

It really depends on what kind of data you are going to send to and receive back from the server. 这实际上取决于要发送到服务器以及从服务器接收回来的数据类型。 If “data” is some sort of a buffer with the known length and the usual operations are to put / get an object to / from the server, then I would recommend you to take a look at HTTP : it's a very simple protocol, there are many libraries and applications that support it, you can easily extend the protocol, add an encryption ( HTTPS ) and compression (gzip), and this protocol is easy to debug and work with. 如果“数据”是某种已知长度的缓冲区,并且通常的操作是将对象放入服务器或从服务器获取对象,那么我建议您看一下HTTP :这是一个非常简单的协议,有很多支持它的库和应用程序,您可以轻松扩展协议,添加加密( HTTPS )和压缩(gzip),并且该协议易于调试和使用。

If you want to send network packets that contain many data fields of different types, then you want to encode and decode such packet (serialize) before sending to the network. 如果要发送包含许多不同类型数据字段的网络数据包,则要在发送到网络之前对这种数据包进行编码和解码(序列化)。 There are a plenty of open source libraries in the Internet which support both C and C# languages (you can even write your own implementation, it's not that hard). 互联网上有很多支持C和C#语言的开源库(您甚至可以编写自己的实现,并不难)。 I would recommend you to take a look at XML / JSON (text-based standards for data exchange), you will find it much more easier to debug communication problem when working with a textural data. 我建议您看一下XML / JSON (用于数据交换的基于文本的标准),您会发现在处理纹理数据时调试通信问题要容易得多。

Hope it helps ! 希望能帮助到你 !

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM