当前位置:网站首页>Network Protocol 01 - Basic Concepts
Network Protocol 01 - Basic Concepts
2022-07-30 07:41:00 【Rhubarb _ yellow】
The server code mainly starts withJava为主
客户端 - Basic Concepts of the Server(1)
Java跨平台的原理

其实JavaCross-platform and interpreted languages are similar,例如JavaScript、Python等,像JavaScriptFrom a shallow perspective, browser parsing,Essentially a browser engine(如Chrome的V8)
C/C++跨平台原理

服务器环境
The structure of the server environment is roughly as follows:
- 服务器:Essentially a computer,Multiple port numbers can be set(The port is equivalent to the window through which the server provides services to the client)
- JVM:Java虚拟机(Java Virtual Machine)
- 服务器软件Tomcat:Monitor data flow on a port, 执行我们编写的Java代码,respond by port
- 开发人员的Java代码:指的就是Java代码项目,例如QQ、WeChat's background service
计算机之间的通信基础
- 首先需要知道对方的IP地址
- 其次是获取MAC地址(也就是网卡地址),输送数据到网卡,accepted by the network card
- If the network card finds that the destination address of the data is itself,就会将数据传递给上一层进行处理
- If the network card finds that the destination address of the data is not itself,就会将数据丢弃,不会传递给上一层进行处理
网卡:network interface controller,网络适配器,有一个被称为MAC地址的独一无二的48位串行号,被写在卡上的一块ROM中
计算机之间的连接方式(2)
网线直连(过程)
首先举个例子,用Cisco Packet Tracer Software Demonstration Two Computers Sending Data Packets(本质就是:Ping 对方的地址)的过程
首先计算机0通过 ICMP协议 send packets to computer0
However, the computer0Need to get the other party'sMAC地址,So you need to go firstARP协议,发出广播,which will mark the sourceIP地址和目标IP地址,以及源MAC地址,同时目标MAC地址为FFFF.FFFF.FFFF(全是1Delegate is broadcast,All NICs on the same network segment can receive)
当计算机1接收到广播,Mark the sourceIP、目标IP、源MAC、目标MAC,back to computer0
然后再通过ICMP协议传输数据

整个过程如下
Then introduce the coaxial cable、集线器、网桥、交换机、Connection methods and features of routers and other devices
同轴电缆

缺点:
- 半双工通信:Only one direction of the two computer connection channels is allowed to send data
- 容易冲突:Often two computers sending data at the same time on the same channel can cause conflicts
- 不安全:没有智商,All data will be sent once according to the connected channel,Easy to be captured by non-target computers
- 可靠性差:Once a link is broken in the middle,整个网络就会瘫痪
集线器(Hub)

相比同轴电缆
优点:more reliable,A computer disconnection does not affect global connections
缺点:Still half-duplex communication,容易冲突,不安全,没有智商
网桥(Bridge)

相比集线器:
优点:有智商,You can learn the interface on the side of each interface by learning.MAC地址,从而可以起到隔绝冲突域的作用,block non-targetMAC地址的请求
缺点:只有两个接口,All computers on the same interface side will still form a collision domain,且不安全
交换机

相比网桥:
优点:接口多,支持全双工通信,Data can be transferred between multiple devices at the same time,更安全,according to the targetMACAddress direct send the data in the past,非目标MACAddress will be blocked
缺点:Only supports connections within the same network segment:Switches can be said to be the ultimate solution for LANs,Not suitable for large-scale connections,因为需要通过Arpbroadcast to all connections(If computers all over the world were connected,就会造成广播风暴)
以上的连接方式,The connected devices all need to be in the same broadcast domain(同一网段),Once it comes to a wide range of connections,You need to set up multiple network segments to isolate the broadcast domain,However, because two hosts on different network segments cannot send data across network segments,Then the router appears
路由器
如下图所示,There are two different network segments on the left and right of the router.(默认子网掩码为255.255.255.0)
主机发送数据之前,首先会判断目标主机的IP地址是否在同一个网段
- 在同一个网段: 发ARP广播,通过交换机\集线器传递数据
- 不在同一个网段:通过路由器转发数据
The main function of the router is to isolate the broadcast domain,可以在不同网段之间转发数据,So how does the router forward data across network segments??
Want to forward data across network segments,Through the gateway,That is, the two ports of the router in the above figure Fa0/0和Fa1/0,Every gateway hasIP地址和MAC地址,而且MACThe address needs to be on the same network segment as the host on the connected side,Generally recommended for gatewaysIPThe last decimal digit of the address is1,例如常见的192.168.0.1等
And the host on the same side as the gateway needs to configure the same side gatewayIP地址
Next suppose that the computers in the connection diagram2send data to computer5,其过程为:
- 计算机2通过ARP协议(目标地址为Fa0网关的IP地址)获取Fa0网关的MAC地址
- 计算机2通过ICMPprotocol to send packets toFa0网关
- Fa0Gateway forwards data toFa1网关
- Fa1网关通过ARPagreement to acquire computer5的MAC地址
- Fa1网关通过ICMPprotocol to send packets to the computer5
- 计算机5沿着Fa1网关、Fa0网关,return the packet to the computer2
边栏推荐
猜你喜欢

【JVM】线上应用故障排查

牛顿迭代法求方程的根

基于精灵(Sprite)管道烟雾流动效果

Biotin-NH2|CAS:111790-37-5(生物素-氨基)是一种生物素化化合物

图扑软件携手华为云再创合作共赢新局面
测试开发工程师成长日记010 - Jenkins中的CI/CD/CT(持续集成构建/持续交付/持续测试)

Biotin-Dadps-azide|CAS:1260247-50-4|生物素-DADPS-叠氮

OP tokens and non-transferable NFTs work to build a new digital democracy

元宇宙与图扑国风的碰撞,科技与文化的虚实融合

力扣题解
随机推荐
从 Vertex 到 Subgraph 再到 PIE: 并行图计算编程模型概览
如何将matlab数据导入modelsim仿真
OP tokens and non-transferable NFTs work to build a new digital democracy
二、2队列
Jenkins一些常见问题
ParseException line 8:13 mismatched input ‘(‘ expecting ) near ‘int‘ in create table statement
D-Desthiobiotin Amine_D-脱硫生物素-胺相关的产品性质
【Exhibition of some projects】
DADPS Biotin Azide( CAS:1260247-50-4生物素基团和叠氮基团的 PEG 衍生物
Biotin-PEG4-DADPS-Picolyl-azide(CAS:2599839-59-3)生物素试剂
快速开发 GraphScope 图分析应用
多线程进阶(CountDownLatch,死锁,线程安全集合类)
05-Theos
矩阵键盘
wsl2设置静态ip(固定ip)static ip
独立按键控制led
单向链表的操作(带头结点)
Event Delivery and Responder Chains
JSP自定义标签
含 3 个单元 PEG 的 ADC linker的PC DBCO-PEG3-Biotin