当前位置:网站首页>Deep understanding of UDP, TCP
Deep understanding of UDP, TCP
2022-07-07 09:46:00 【Don't ask me y】
I have learned these two concepts several times
Every time, it seems that I don't understand
I listened to it several times today
I made a simple summary
If the description is not clear, please correct
1.UDP
A、UDP No client and server side , The connection must be initiated by the client , Because only the server port number and IP The address is fixed , Be sure to use IP Address and port number , namely bind() Method ; And use send() send data , When the other party receives data recvfrom() receive , When disconnecting, either party can disconnect , Because the server has recorded the client's IP Address and port number ;
B、UDP Is an unreliable connection protocol , Send a lot of , It is allowed to use UDP Protocol for transmission , Like audio , Video and other documents , The result of losing some data has no effect on the viewer .
2.TCP
)TCP It's connection-oriented , reliable , Byte transfer protocol .
A、 Connection oriented , There are clients and servers , When connecting for the first time , There must be three handshake agreements , When disconnected , It's a four wave agreement ;connect,read,write,close.
B、 Monitor the network status at all times , Use the sliding window to control the transmission of data packets , When the network state becomes worse , The number of transmitted bytes is the original 1/2, When the network state recovers , If the current data transmission volume > The original 1/2, The transmission speed will be doubled ; If the current data transmission volume < The original 1/2, Then every transmission , Add a byte .
Simple communication based on client and server :
Server side :
client :
Output results :
principle :
The client determines the service port number , establish socket service , Define a socke, For reception accept Method returns a message from the server , use bufferedreader , use getinputstream Method to input information from the client , use printwriter,getoutputstream Method to send a message from the server to the client . take pw For message system.out.println Write output stream ,flush Method to the client , The client with bufferedreader,getinputstream Method reception . Close input stream , Close output stream , Close socket .
边栏推荐
- Oracle installation enhancements error
- 第十四次试验
- H5 web player easyplayer How does JS realize live video real-time recording?
- Niuke - Huawei question bank (61~70)
- How does mongodb realize the creation and deletion of databases, the creation of deletion tables, and the addition, deletion, modification and query of data
- 第一讲:鸡蛋的硬度
- 【frida实战】“一行”代码教你获取WeGame平台中所有的lua脚本
- IIS faked death this morning, various troubleshooting, has been solved
- 【原创】程序员团队管理的核心是什么?
- Esp8266 uses TF card and reads and writes data (based on Arduino)
猜你喜欢

H5 web player easyplayer How does JS realize live video real-time recording?

Lecture 1: stack containing min function
![[4G/5G/6G专题基础-147]: 6G总体愿景与潜在关键技术白皮书解读-2-6G发展的宏观驱动力](/img/21/6a183e4e10daed90c66235bdbdc3bf.png)
[4G/5G/6G专题基础-147]: 6G总体愿景与潜在关键技术白皮书解读-2-6G发展的宏观驱动力

数据建模中利用3σ剔除异常值进行数据清洗

flex弹性布局

信息安全实验二 :使用X-SCANNER扫描工具

网易云微信小程序

Use 3 in data modeling σ Eliminate outliers for data cleaning
![[Frida practice]](/img/20/fc68bcf2f55b140d6754af6364896b.png)
[Frida practice] "one line" code teaches you to obtain all Lua scripts in wegame platform
![[4g/5g/6g topic foundation -147]: Interpretation of the white paper on 6G's overall vision and potential key technologies -2-6g's macro driving force for development](/img/21/6a183e4e10daed90c66235bdbdc3bf.png)
[4g/5g/6g topic foundation -147]: Interpretation of the white paper on 6G's overall vision and potential key technologies -2-6g's macro driving force for development
随机推荐
章鱼未来之星获得25万美金奖励|章鱼加速器2022夏季创业营圆满落幕
C# 初始化程序时查看初始化到哪里了示例
Unity shader (learn more about vertex fragment shaders)
CDZSC_2022寒假个人训练赛21级(1)
flink. CDC sqlserver. 可以再次写入sqlserver中么 有连接器的 dem
# Arthas 简单使用说明
Strategic cooperation subquery becomes the secret weapon of Octopus web browser
HCIP 第一天 笔记整理
根据热门面试题分析Android事件分发机制(二)---事件冲突分析处理
Network request process
第一讲:鸡蛋的硬度
小程序弹出半角遮罩层
12、 Sort
JMeter JDBC batch references data as input parameters (the simplest method for the whole website)
其实特简单,教你轻松实现酷炫的数据可视化大屏
Information Security Experiment 3: the use of PGP email encryption software
C# Socke 服务器,客户端,UDP
Scratch crawler mysql, Django, etc
创建一个长度为6的int型数组,要求数组元素的值都在1-30之间,且是随机赋值。同时,要求元素的值各不相同。
liunx命令