二进制与文本协议 [英] binary vs text protocols

查看:16
本文介绍了二进制与文本协议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道二进制和基于文本的协议之间有什么区别.我读到二进制协议更紧凑/处理速度更快.效果如何?由于您必须发送相同数量的数据?没有?

I am wondering what the differences are between binary and text based protocols. I read that binary protocols are more compacts/faster to process. How does that work out? Since you have to send the same amount of data? No?

例如,字符串hello"在二进制格式中的大小有何不同?

E.g how would the string "hello" differ in size in binary format?

推荐答案

如果您所做的只是传输文本,那么是的,两者之间的差异不是很大.但请考虑尝试传输以下内容:

If all you are doing is transmitting text, then yes, the difference between the two isn't very significant. But consider trying to transmit things like:

  • 数字 - 您使用数字的字符串表示还是二进制表示?特别是对于大数,二进制会更紧凑.
  • 数据结构 - 如何在文本协议中表示字段的开始和结束?有时,具有固定长度字段的二进制协议更紧凑.

这篇关于二进制与文本协议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆