当前位置:网站首页>Network foundation - header, encapsulation and unpacking
Network foundation - header, encapsulation and unpacking
2022-07-07 07:03:00 【abs(ln(1+NaN))】
Catalog
One 、 understand " Headlines "
3、 What information does the header contain ?
Two 、 understand " encapsulation "
3、 ... and 、 understand " Unpack "
2、 Who is going to pass it on to the upper level
The following is an example of express delivery , To understand the header 、 Package and unpack .
Suppose you buy a bottle of shampoo online , The seller helped you put it in the box , The quality of this product is marked on the box ( How many grams? ) Etc , And then gave it to the express station , The express station pasted the express bill and sent the express .
One 、 understand " Headlines "
1、 What is a header ?
There are two things mentioned above , The product information on the express order or box here 、 The seller's address is similar to the information contained in the header .
From the perspective of network , This product is data , Before the application layer sends this data to the transport layer , Need to add a header , The header contains the effective length of the data 、 What is the upper layer protocol .
2、 Why do I need a header ?
Take a counterexample , If there is no header , That is to say, there are no express orders and product boxes , We have no idea where this thing comes from , I don't know where to send it , In this case, data transmission cannot be carried out .
3、 What information does the header contain ?
From the application layer to the data link layer , Each layer has its own protocol , And almost every layer will add a header , The header contains two important information as follows , These two information will be of great use in the unpacking process !
- The length of the current layer header
- The protocol used by the current layer
Because different hosts need to communicate , The protocol used by the corresponding layer must be the same , For example, you ship goods in SF , The other party is waiting for express delivery in Yuantong , This is obviously unreasonable .
Two 、 understand " encapsulation "
So what is encapsulation ?? We put shampoo in a box , Stick the express bill on the box , This process is encapsulation !!

The blue square in the above figure represents the header added by the application layer —— Including the length of the payload ( Later, the data is uniformly called load )
The orange square in the figure above represents the addition of the transport layer " Headlines " —— It includes who the upper layer agreement is ( That is, where it came from )、 Added by the current layer " Headlines " length .
Network transmission , Every time a layer is passed down, a layer of content will be added at the top .
3、 ... and 、 understand " Unpack "
Suppose the seller receives the express , The outer layers of packaging 、 Express bill 、 And the product box for sellers , It's all unnecessary , The seller disassembles the express , The process of unpacking is called unpacking !

Each layer only unlocks the header corresponding to the current layer , Now the two important contents in the header can be used
- The length of the current layer header ( For unpacking )
- Upper layer protocol ( Which agreement to pass to the upper layer )
1、 How to unpack
Standing on the OS The kernel angle , We only have a pointer to the beginning of the packet , Now we know the length of the header of the current layer , We just need to move the pointer to the right by the corresponding position .

2、 Who is going to pass it on to the upper level
Now unpacking is over , Then continue to pass up , Who should I give it to ? You may ask , This is not a direct layer " Transport layer " Do you ?
To be exact, which agreement should be given to the upper layer , For example, the seller is SF shipping , But you are waiting at Yuantong Express Station , This must be unreasonable .
From the perspective of network , The other side of using UDP agreement , The header contains this information , You should send it to the transport layer UDP
边栏推荐
- ESXI挂载移动(机械)硬盘详细教程
- unity3d学习笔记
- Algorithm --- bit count (kotlin)
- 企业如何进行数据治理?分享数据治理4个方面的经验总结
- LVS+Keepalived(DR模式)学习笔记
- Jetpack Compose 远不止是一个UI框架这么简单~
- 栈题目:有效括号的嵌套深度
- Big coffee gathering | nextarch foundation cloud development meetup is coming
- .net 5 FluentFTP连接FTP失败问题:This operation is only allowed using a successfully authenticated context
- 7天零基础能考证HCIA吗?华为认证系统学习路线分享
猜你喜欢

JWT的基础介绍

Several index utilization of joint index ABC

.net 5 FluentFTP连接FTP失败问题:This operation is only allowed using a successfully authenticated context

Leetcode t1165: log analysis

剑指offer-高质量的代码

使用TCP/IP四层模型进行网络传输的基本流程

Prime partner of Huawei machine test questions

Can 7-day zero foundation prove HCIA? Huawei certification system learning path sharing

MySQL view bin log and recover data

2018年江苏省职业院校技能大赛高职组“信息安全管理与评估”赛项任务书
随机推荐
libcurl返回curlcode说明
偏执的非合格公司
精准时空行程流调系统—基于UWB超高精度定位系统
Comment les entreprises gèrent - elles les données? Partager les leçons tirées des quatre aspects de la gouvernance des données
from . onnxruntime_ pybind11_ State Import * noqa ddddocr operation error
Distributed ID solution
MySQL的主从复制原理
【luogu P1971】兔兔与蛋蛋游戏(二分图博弈)
常用函数detect_image/predict
请教一下,监听pgsql ,怎样可以监听多个schema和table
Please answer the questions about database data transfer
二十岁的我4面拿到字节跳动offer,至今不敢相信
Leetcode t1165: log analysis
Answer to the first stage of the assignment of "information security management and evaluation" of the higher vocational group of the 2018 Jiangsu Vocational College skills competition
华为机试题素数伴侣
CompletableFuture使用详解
企业如何进行数据治理?分享数据治理4个方面的经验总结
Unity C# 函数笔记
途家、木鸟、美团……民宿暑期战事将起
Mysql---- import and export & View & Index & execution plan