Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects, and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
ItJava
Python24
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
Python24
/
03Thread
/
day04
/
basic03.py
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
31 lines (27 loc) · 1.96 KB
master
Breadcrumbs
Python24
/
03Thread
/
day04
/
basic03.py
Copy path
Top
File metadata and controls
Code
Blame
31 lines (27 loc) · 1.96 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""
请求网页的流程具体分析
1- 输入jd.com 进行DNS域名解析
2- 在同一网络的话,交换机直接转发给同局域网中的电脑
3- 不在同一网络的话,交换机ARP广播获取网卡路由器的MAC,并将网关的mac添加到数据包的,将这个包发送到网关路由
4- 路由根据ip地址,发送到网络中
5- dns服务器根据域名查询到相应的ip地址,返回给本机
6- 创建和服务器tcp发送网页请求,其中经历了三次握手
"""
"""
交换机是集线器的升级版本,用来发送ARP包来**交换**对方的MAC地址
1- 集线器不具备学习功能,接到数据包就进行大声的念出来进行广播
2- 交换机具备学习功能,内部记忆读取交换过的ip-mac表,如果没有记录过,那么就进行全网广播
3- 交换机是知道对方的ip,来arp获取mac地址的,例如dns解析
4- 获取MAC地址后进行数据包目的地下一站的更新
5- 现在的路由器基本都包含交换机的功能,交换机中的DHCP动态主机配置协议,用来自动分配ip地址
"""
"""
ip地址指的是收件人是谁,mac地址就是指下一站在哪,mac会在变化添加到数据包中
NAT地址转换器,解决的问题是公网私网地址转换,有限的公网ip地址供更多的设备上网,具体原理:
1- 现在的路由器基本上(交换机+路由)的功能,私网中每个设备拥有各自的ip
2- 但是数据包访问外网的时候,会走运营商路由器的一个单独的公网ip,此时用到了NAT转换
3- 不同的设备ip在NAT的作用下转换为例如:125.2.1.1:1122, 125.2.1.1:2233, 125.2.1.1:3344
4- 运营商公网的ip是固定的,用不同的端口号区别私网的机器
5- 黑心运营商,会嵌套多层NAT,公网中有私网,私网中还有私网,导致网速下降
6- 一句话概括就是:使用公网ip的不同端口进行上网
"""
You can’t perform that action at this time.