当前位置:网站首页>互联网协议
互联网协议
2022-07-07 09:07:00 【全栈程序员站长】
## 互联网协议 – 概括:从上到下,越上越接近用户,越下越接近硬件 – 应用层: + 规定应用程序的数据格式 + [HEAD(以太网标头) [HEAD(IP标头) [HEAD(TCP标头) DATA(应用层数据包)]]]
– 传输层(端口到端口的通信): 定义端口号 + 端口: * 0到65535(2^16)的整数 * 进程使用网卡的编号 * 通过IP+mac确定主机,只要确定主机+端口(套接字socket),就能进行程序间的通信 + UDP协议: * 数据包中加入端口依赖的新协议 * 数据包[HEAD(发送、接收mac) [HEAD(发送、接收ip) [HEAD(发送、接收端口) DATA]]] * 简单,可靠性差,不知道对方是否接受包 + TCP协议: * 带有确认机制的UDP协议 * 过程复杂,实现困难,消耗资源 “` tcp/ip connect: tcp/ip的三次握手 标有syn的数据包 ————-> 标有syn/ack的数据包 client <————- server 标有ack的数据包 ————–> “`
– 网络层(主机到主机的通信):定义IP “` tcp/ip finish: tcp/ip的四次握手 fin <————- ack client ————-> server fin ————-> ack <————- “`
– 网络层(主机到主机的通信): + IP协议 * ipv4: – 32个二进制位表示,由网络部分和主机部分构成, – 子网掩码: 网络部分都为1,主机部分都为0,目的判断ip的网络部分,如255.255.255.0(11111111.11111111.11111111.00000000) – IP数据包:标头Head+数据Data,放进以太网数据包的Data部分[HEAD [HEAD DATA]] – IP数据包的传递: + 非同一网络:无法获得mac地址,发送数据到网关,网关处理 – ARP(Address Resolation Protocol): 解析地址协议,通过ip解析mac地址 + 同一网络:mac地址填写FF:FF:FF:FF:FF:FF:FF,广播数据,对比ip,不符合丢包
– 链接层:定义mac + 定义数据包(帧Frame) * 标头(Head):数据包的一些说明项, 如发送者、接收者、数据类型 * 数据(Data):数据包的具体内容 * 数据包:[HEAD DATA] + 定义网卡和网卡唯一的mac地址 * 以太网规定接入网络的所有终端都应该具有网卡接口,数据包必须是从一个网卡的mac地址到另一网卡接口的mac地址 * mac全球唯一,16位16位进制组成,前6厂商编号,后6网卡流水号 + 广播发送数据 * 向本网络内的所有设备发送数据包,对比接收者mac地址,不是丢包,是接受
– 实体层:物理层 + 终端(pc,phone,pad…)的物理连接(光缆,电缆,路由…),负责传递0和1信号
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/113825.html原文链接:https://javaforall.cn
边栏推荐
- After the uniapp jumps to the page in onlaunch, click the event failure solution
- 毕业季|与青春作伴,一起向未来!
- Seata 1.3.0 four modes to solve distributed transactions (at, TCC, Saga, XA)
- 基于Retrofit框架的金山API翻译功能案例
- [untitled]
- The use of list and Its Simulation Implementation
- 数据库同步工具 DBSync 新增对MongoDB、ES的支持
- Activity生命周期
- Debezium同步之Debezium架构详解
- 90后,辞职创业,说要卷死云数据库
猜你喜欢

The concept, implementation and analysis of binary search tree (BST)

关于jmeter中编写shell脚本json的应用

MPX plug-in

JSON format query of MySQL

"Dream Cup" 2017 Jiangsu information and future primary school summer camp it expert PK program design questions

Qtcreator sets multiple qmake

從色情直播到直播電商

Simple and easy to modify spring frame components

Operation method of Orange Pie orangepi 4 lts development board connecting SATA hard disk through mini PCIe

uniCloud
随机推荐
CSAPP bomb lab parsing
[machine learning 03] Lagrange multiplier method
2022.7.4DAY596
Introduction to shell programming
單調性約束與反單調性約束的區別 monotonicity and anti-monotonicity constraint
The seventh training assignment
A simple example of delegate usage
[pyqt] the cellwidget in tablewidget uses signal and slot mechanism
VR development optimization
2021-05-21
Vuthink正确安装过程
[OneNote] can't connect to the network and can't sync the problem
Interprocess communication (IPC)
[untitled]
Arduino board description
Hash / (understanding, implementation and application)
Unity determines whether the mouse clicks on the UI
Array object sorting
2021-04-23
Still cannot find RPC dispatcher table failed to connect in virtual KD