当前位置:网站首页>11. application layer data transmission format / port number -bite
11. application layer data transmission format / port number -bite
2022-06-29 15:36:00 【Aeolian u】
Application layer protocol
Design application layer protocol , It mainly includes two jobs : Specify the information to be transmitted and the organization format of the data ( Refer to the existing template :xml,json,protobuffer)
It is precisely because of the application layer protocol here , You can specify as you like , This leads to very serious polarization !!
The agreements designed by the boss are very good .
The agreement of vegetable chicken design is very bad
Because of that , The big guys have invented some better protocol templates , Let's go straight up :
Some popular templates of this kind of agreement ( Organization format of data )
Good readability , But the operation efficiency is not high :
1.xml
2. json
3. Poor readability , High operating efficiency :
4. protobuffer
1.xml:
Format consists of tag name :< Tag name > Content </ Tag name >
< Tag name >: The start tag
</ Tag name >: End tag
The tag name is key
The content is value
Improved readability : But too much supporting information is introduced , It takes up more network bandwidth
therefore , xml Now it is rarely used as the design template of application layer protocol , Now use xml Mainly as some configuration files .
2.json
adopt {} Key value structure . One {(} There are many key value pairs in . Use commas to separate key value pairs . Use colons between keys and values . There are many types of values that require that the key must be a string ( Numbers , character string , Boolean , Array , the other one json…)
{
key : value ,
key : value ,
…
}
json requirement key It must be a string , therefore key The quotation marks here can be omitted unless key It contains some special symbols ( Like spaces , perhaps - …) Must be quoted
json Represents a string , Single quotation marks or double quotation marks are OK ( Be similar to SQL)
The last key value pair , There can be a comma after , There can be no .( There are no standard requirements , But in general json Parser , Don't care about this detail )
Compared with xml, json It also ensures readability without xml So complicated ( Use less bandwidth )
however , When representing a more complex data , For example, there are many arrays here key Will repeat N Time , It takes up more extra bandwidth
3.protobuffer:
Is a binary format of data :
stay protobuffer Data in , No longer include the above key The name of . But through order and some special symbols , To distinguish the meaning of each field
At the same time, pass another IDL File to describe the data format ( What does each part mean ), IDL Just play an auxiliary development effect , It won't really transmit . Only binary pure data is transmitted
This is a simplified representation version :
1\3\3 Fried rice with egg \210\21\210\3 Stir-Fried Noodles with Vegetables \28\2\1\28 Rearrange the content here through binary data , There may even be some data compression .
In this way, the transmission efficiency will be higher , But it will also make this data difficult to observe with the naked eye , Debugging is inconvenient .
summary :
json The scope of application is wider than protobuffer More open
Hair efficiency > Operational efficiency
If something goes wrong with the online environment
If it is to use json, Requests and responses that go wrong , Be clear at a glance , If it is to use protobuffer, Binary data , Can't see with the naked eye , You have to develop a special program to analyze this data , Analyze the problem here
The most famous application layer protocol :HTTP
Port number
0-65535 Integer between
Well known port number : hold 0-1024 These port numbers , It has been divided into some specific functions , Many network services are very commonly used , For a wide range of services, special port numbers are assigned to these services for better management , It's not mandatory , It's just advice :
80 http The server
443 https The server
22 ssh
23 ftp
…
边栏推荐
- postgresql源码学习(24)—— 事务日志⑤-日志写入WAL Buffer
- ImgUtil 图片处理工具类,文字提取,图片水印
- postgresql源码学习(23)—— 事务日志④-日志组装
- Pytorch two-dimensional multi-channel convolution operation method
- Lumiprobe 活性染料丨杂染料:BDP FL 神经酰胺
- Paging SQL (rownum, row_number, deny_rank, rank)
- MySQL development specification pdf
- Render follows, encapsulating a form and adding data to the table
- 14.IP协议-bite
- 第九章 APP项目测试(4) 测试工具
猜你喜欢

第九章 APP项目测试(4) 测试工具

About sql+nosql: newsql database

Excel中构建SQL语句

在shop工程中,实现一个菜单(增删改查)

Imgutil image processing tool class, text extraction, image watermarking

Implementing redis distributed locks using custom annotations

MCS: multivariate random variable polynomial distribution

12.UDP协议-bite

关于SQL+NoSQL : NewSQL数据库

MCS: discrete random variable - binomial distribution
随机推荐
Abnormal logic reasoning problem of Huawei software test written test [2] Huawei hot interview problem
Mysql database naming conventions PDF
Construction and application of medical field Atlas of dingxiangyuan
Lumiprobe 点击化学丨非荧光炔烃:己酸STP酯
服务器的数据库连不上了【服务已起、防火墙已关、端口已开、netlent 端口不通】
c#Sqlite类库
获取Text组件内容的宽度
SSL V**技术原理
Unity C basic review 28 - delegation with return (p449)
中序和后序遍历构建二叉树[递归划分区间与回溯拼接子树+中后序和中前序的相似与不同]
Chapter IX app project test (4) test tools
Lumiprobe click chemistry - non fluorescent alkyne: hexanoic acid STP ester
第九章 APP项目测试(此章完结)
NFT链游开发应用:2022年值得关注的6大NFT趋势
I am 35 years old. Can I change my career to be a programmer?
Unity C basic review 27 - delegation example (p448)
12.UDP协议-bite
极化SAR几种成像模式
89.(cesium篇)cesium聚合图(自定义图片)
雷达基本组成