当前位置:网站首页>Yyds dry goods inventory TCP & UDP
Yyds dry goods inventory TCP & UDP
2022-07-04 05:06:00 【Soda 233】
difference
TCP Who initiated the connection in , stay UDP Who sent the message in .
TCP stay IP Based on the message , Added such as retransmission 、 confirm 、 Orderly transmission 、 Congestion control and other capabilities , Both sides of the communication work in a certain context .
UDP It is an unreliable communication protocol , No retransmission and confirmation , No orderly control , There's no congestion control , Effective transmission and orderly message are not guaranteed .
TCP The sending and receiving of are always in The same definite context in
UDP Every time you receive or send a Independent context
Socket (socket)
When communication , The endpoint in the respective communication connection
Definition and advantages :
TCP( Stream socket : Connection oriented “ Data flow ” agreement ): Is reliable , Two way connected communication streamUDP( Socket datagram : No connection “ The datagram ” agreement ): Fast
The server receives the connection
1、 establish socket
2、bind Associate socket address and port
3、listen Convert socket to passive receive ( The socket created by default is Initiatively requesting )
4、accept After the connection with the client is established , The operating system kernel notifies the application .
TCP
Connection process
1、 Server initialization2、 Client initialization socket, And the server TCP Three handshakes
3、 Client side and server side Establishing a connection ( Once the connection is established , Data transmission is no longer one-way , It's two-way , This is also TCP One of the salient features of )
4、 client close , send out FIN Package to the server , After the server receives it Perform passive shutdown , The server side will also execute close function , The entire link is completely shut down
The client initiates the connection process
1、 establish socket
2、connect Server side TCP Connection required
TCP Three handshake process
- The protocol stack of the client sends... To the server SYN package , And tell the server the serial number currently sent j, Client access SYNC_SENT state ;
- After the server-side protocol stack receives the packet , Communicate with the client ACK The reply , The value of the response is j+1, Said to SYN package j The confirmation of , At the same time, the server also sends a SYN package , Tell the client that my current sending serial number is k, Server access SYNC_RCVD state ;
- Client protocol stack received ACK after , Make the application from connect Call return , Indicates that the one-way connection from the client to the server is successfully established , The status of the client is ESTABLISHED, At the same time, the client protocol stack will also affect the server SYN Packet response , The response data is k+1;
- After the response packet arrives at the server , The server-side protocol stack makes accept Blocking call return , At this time, the one-way connection from the server to the client is also established successfully , The server also enters ESTABLISHED state .
Send buffer
TCP After the connection is successfully established , The operating system kernel will create for each connection Send buffer . call write Function time , The actual thing to do is to put the data The send buffer copied from the application to the operating system kernel in , It's not necessarily to write data through sockets .
about send Come on , Returning success only means that the data is written to the send buffer successfully , It does not mean that the opposite end has successfully received .
about read Come on , Need to read data circularly , And you need to think about EOF Other abnormal conditions .
UDP
apply
For delay 、 Packet loss is not a particularly sensitive scenario
边栏推荐
- 中科磐云—2022广东木马信息获取解析
- 2022年T电梯修理操作证考试题库及模拟考试
- Use units of measure in your code for a better life
- Error response from daemon: You cannot remove a running container 8d6f0d2850250627cd6c2acb2497002fc3
- Error response from daemon: You cannot remove a running container 8d6f0d2850250627cd6c2acb2497002fc3
- 测试 CS4344 立体声DA转换器
- 记几个智能手表相关芯片 蓝牙芯片 低功耗
- RPC - grpc simple demo - learn / practice
- COMP1721 Creating Classes
- 拼夕夕二面:说说布隆过滤器与布谷鸟过滤器?应用场景?我懵了。。
猜你喜欢
6-4 vulnerability exploitation SSH banner information acquisition
Flutter ‘/usr/lib/libswiftCore. dylib‘ (no such file)
Headache delayed double deletion
中科磐云—D模块解析以及评分标准
附件五:攻击过程简报.docx
STM32F1与STM32CubeIDE编程实例-74HC595驱动4位7段数码管
Utiliser des unités de mesure dans votre code pour une vie meilleure
Share some of my telecommuting experience
每日刷题记录 (十二)
Zhongke panyun-2022 Guangdong Trojan horse information acquisition and analysis
随机推荐
Fault analysis | mongodb 5.0 reports an error, and the legal instruction solves it
小程序毕业设计---美食、菜谱小程序
【MATLAB】通信信号调制通用函数 — 带通滤波器
laravel 中获取刚刚插入的记录的id
[matlab] matlab simulation - simulate the AM modulation process of the modulation system
Annex VI: defense work briefing docx
Qt QTableView数据列宽度自适应
A summary of the 8544 problem that SolidWorks Standard cannot obtain a license
[技术发展-25]:广播电视网、互联网、电信网、电网四网融合技术
RAC delete damaged disk group
[matlab] communication signal modulation general function - low pass filter
[matlab] matlab simulation modulation system - DSB system
关于solidworks standard无法获得许可 8544问题的总结
拼夕夕二面:说说布隆过滤器与布谷鸟过滤器?应用场景?我懵了。。
Flutter 调用高德地图APP实现位置搜索、路线规划、逆地理编码
Notes on the paper "cross view transformers for real time map view semantic segmentation"
Annex 2-2 confidentiality commitment docx
每日刷题记录 (十二)
《Cross-view Transformers for real-time Map-view Semantic Segmentation》论文笔记
Binary search tree