当前位置:网站首页>互联网协议
互联网协议
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
边栏推荐
- Records on the use of easyflash v3.3
- 基于DE2 115开发板驱动HC_SR04超声波测距模块【附源码】
- Go Slice 比较
- Unity determines whether the mouse clicks on the UI
- Array object sorting
- [untitled]
- [pyqt] the cellwidget in tablewidget uses signal and slot mechanism
- 90后,辞职创业,说要卷死云数据库
- JS array delete the specified element
- July 10, 2022 "five heart public welfare" activity notice + registration entry (two-dimensional code)
猜你喜欢
[untitled]
2021-04-08
Ping tool ICMP message learning
高考作文,高频提及科技那些事儿……
[C #] the solution of WinForm operation zoom (blur)
【亲测可行】error while loading shared libraries的解决方案
PostgreSQL中的表复制
Transaction rolled back because it has been marked as rollback-only解决
Qtcreator sets multiple qmake
2021 summary and 2022 outlook
随机推荐
Network foundation (1)
uniapp 在onLaunch中跳转页面后,点击事件失效解决方法
“梦想杯”2017 年江苏省信息与未来小学生夏令营 IT 小能手 PK 之程序设计试题
IDEA快捷键大全
[OneNote] can't connect to the network and can't sync the problem
[STM32] actual combat 3.1 - drive 42 stepper motors with STM32 and tb6600 drivers (I)
What are the contents of the intermediate soft test, the software designer test, and the test outline?
Unable to open kernel device '\.\vmcidev\vmx': operation completed successfully. Reboot after installing vmware workstation? Module "devicepoweron" failed to start. Failed to start the virtual machine
Deep understanding of Apache Hudi asynchronous indexing mechanism
Network engineer test questions and answers in May of the first half of 2022
Still cannot find RPC dispatcher table failed to connect in virtual KD
Introduction to shell programming
Go redis Middleware
MPX plug-in
The gun startles the dragon, and the crowd "locks" Zhou Zhi
Verilog 实现数码管显视驱动【附源码】
Arduino receives and sends strings
Shardingsphere sub database and table examples (logical table, real table, binding table, broadcast table, single table)
[untitled]
【C#】WinForm运行缩放(变糊)的解决方法