什么是在TCP上序列化/反序列化数据并发送的最佳方法

huangapple go评论98阅读模式
英文:

What is the best way to serialize/deserialize data and send over TCP

问题

基本上,我有一个Go服务器,它解析一些XML文件并创建一个包含数据的结构,我想将其通过TCP发送到一个IOS应用程序。

目前,我尝试使用Protocol Buffers,但在IOS端遇到了问题。所以根据你的经验,这是我传输数据的最佳方式吗?还有其他建议吗?

我首先要考虑的是速度。

英文:

Basically I have a Go server which parses some XML file and creates a structure with the data which I want to send over TCP to an IOS app.

At the moment I tried to use Protocol Buffers, but I am having problems with this on the IOS side. So from your experience is this the best way I should transmit my data ? Any other suggestions ?

The first thing I am looking for it's speed.

答案1

得分: 3

没有最好的方法。有很多跨平台序列化格式可供选择。只需选择您最熟悉且适合您需求的即可。

一个明显的选择是json(易读且在所有平台上都有很好的支持)。

如果您更注重速度,可以看看msgpack:

英文:

There is no best way. There are plenty of cross-platform serialization formats out there. Just pick the one you are the most comfortable with, and which suits your needs.

An obvious choice is json (human readable and well supported on all platforms).

If you favor speed, then have a look at msgpack:

huangapple
  • 本文由 发表于 2013年5月25日 16:49:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/16747925.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定