当前位置:网站首页>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
边栏推荐
- SolidWorks的GB库(钢型材库,包括铝型材、铝管等结构)安装及使用教程(生成铝型材为例)
- 一条慢SQL拖死整个系统
- LM11丨重构K线构建择时交易策略
- sqlserver多线程查询问题
- 基于JS的迷宫小游戏
- 大促过后,销量与流量兼具,是否真的高枕无忧?
- 途家、木鸟、美团……民宿暑期战事将起
- 从零到一,教你搭建「CLIP 以文搜图」搜索服务(二):5 分钟实现原型
- The latest trends of data asset management and data security at home and abroad
- Installing redis and windows extension method under win system
猜你喜欢

ip地址那点事

Graduation design game mall

Maze games based on JS

How can clothing stores make profits?

Abnova 膜蛋白脂蛋白体技术及类别展示

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

MySQL的主从复制原理

关于数据库数据转移的问题,求各位解答下

. Net 5 fluentftp connection FTP failure problem: this operation is only allowed using a successfully authenticated context

unity3d学习笔记
随机推荐
7天零基础能考证HCIA吗?华为认证系统学习路线分享
关于数据库数据转移的问题,求各位解答下
. Net 5 fluentftp connection FTP failure problem: this operation is only allowed using a successfully authenticated context
Networkx绘图和常用库函数坐标绘图
.net core 访问不常见的静态文件类型(MIME 类型)
ANR 原理及实践
2018年江苏省职业院校技能大赛高职组“信息安全管理与评估”赛项任务书
Leetcode T1165: 日志分析
MOS tube parameters μ A method of Cox
This article introduces you to the characteristics, purposes and basic function examples of static routing
Sqlserver multithreaded query problem
【luogu P1971】兔兔与蛋蛋游戏(二分图博弈)
Installing redis and windows extension method under win system
Tool class: object to map hump to underline underline hump
Brand · consultation standardization
品牌电商如何逆势增长?在这里预见未来!
The startup of MySQL installed in RPM mode of Linux system failed
Leetcode t1165: log analysis
循环肿瘤细胞——Abnova 解决方案来啦
分布式id解决方案