当前位置:网站首页>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
…
边栏推荐
- Render follows, encapsulating a form and adding data to the table
- Unity C basic review 28 - delegation with return (p449)
- GWD:基于高斯Wasserstein距离的旋转目标检测 | ICML 2021
- message from server: “Host ‘xxxxxx‘ is blocked because of many connection errors; unblock with ‘m
- 打造一个 API 快速开发平台,牛逼!
- 深入理解 Promise 之手把手教你写一版
- 极化SAR地表分类
- js获取上个月第一天以及本月的最后一天
- swift JSONSerialization
- 上次给我们发福利的 TDesign ,今天讲讲它的开源故事
猜你喜欢

Imgutil image processing tool class, text extraction, image watermarking

stlink故障修复
![Abnormal logic reasoning problem of Huawei software test written test [2] Huawei hot interview problem](/img/f0/5c2504d51532dcda0ac115f3703384.gif)
Abnormal logic reasoning problem of Huawei software test written test [2] Huawei hot interview problem

File common tool class, stream related application (record)

89.(cesium篇)cesium聚合图(自定义图片)

Solution to the problem that the assembly drawing cannot be recognized after the storage position of SolidWorks part drawing is changed

Classe d'outils commune de fichier, application liée au flux (enregistrement)

MCS: multivariate random variable - discrete random variable

分页sql(rownum、row_number、dense_rank、rank)

数字图像处理复习
随机推荐
List集合详细讲解
Lumiprobe reactive dye cycloalkyne dye: af488 dbco, 5 isomer
C SQLite class library
LeetCode-1188. 设计有限阻塞队列
LeetCode-1188. Designing finite blocking queues
Lumiprobe 活性染料丨杂染料:BDP FL 神经酰胺
在shop工程中,实现一个菜单(增删改查)
Unity C basic review 28 - delegation with return (p449)
postgresql源码学习(25)—— 事务日志⑥-等待日志写入完成
获取Text组件内容的宽度
LeetCode笔记:Weekly Contest 299
Basic use of text preprocessing library Spacy (quick start)
Symfony framework security component firewall configuration
For example, the visual appeal of the live broadcast of NBA Finals can be seen like this?
MCS: discrete random variable Poisson distribution
Lumiprobe reactive dye - amino dye: cyanine 5 amine
Differential equations of satellite motion
极化SAR地表分类
Deeply understand promise's hand and teach you to write a version
【力扣10天SQL入门】Day7+8 计算函数