当前位置:网站首页>Computer network learning notes 7-tcp programming process and interview questions
Computer network learning notes 7-tcp programming process and interview questions
2022-07-22 18:23:00 【Lewin~】
As a client, you need to meet the conditions
1、 know “ The server ” Of ip、port
2、Connect Active connection “ The server ”
3、 The functions you need to use
socket— establish “ Take the initiative TCP Socket ”
connect— Connect “ The server ”
send— Send data to “ The server ”
recv— Accept “ The server ” Response
close— Close the connection
As TCP The conditions that the server needs to meet
1、 Have a known address bind
2、 Let the operating system know that it is a server , Not the client listen
3、 Waiting for the connection accpet
For connection oriented TCP Agreement for , The establishment of the connection really means the beginning of data communication .
tcp The programming flow of the client
1) Create a TCP Socket
2)bind binding ( Optional )
3)connect Link server
4) Send data to the server send
5) Receive server data recv
6) Close socket
tcp Programming process of server
1) Create a tcp Listening socket
2) Use bind function Give listening socket Binding fixed ip And the port
3) Use listen Create a connection queue Active to passive
4) Use accpet Function from the connection queue Extract completed connections Get connected socket
5) Get the client's request as well as Respond to clients
6) Close the connected socket
7) Close listening socket
1、listen The role of ?
Change socket from active to passive .
Causes the operating system to set up a connection queue for the socket , Used to record all connections connected to the socket
2、listen The link queue created is divided into several parts ?
Two parts Complete the connection Incomplete connection Switch after three handshakes
3、 tcp Socket Listening socket and The difference between connected sockets ?
The listening socket is used to accept connection requests from clients .
The socket is connected to communicate with the client .
4、tcp Why can't the application layer receive 0 Length packet ?
0 The length data is used as the other socket application layer to close
边栏推荐
- Gbase8s database set collection statement
- 基于攻防博弈的网络防御决策方法研究综述
- QT笔记——操作Execl
- "Review of software engineering in Wuhan University of technology" Chapter III software requirements
- What level do programmers need to reach to get 20K monthly salary without pressure?
- Super practical transformation strategy: 2022 central state-owned enterprise cloud native landing practical guide was officially released
- Installation and introduction of Lin UI component library of wechat applet - Advanced
- Understand relevant concepts of prosody. XMPP, jabber, bosh, etc
- Applet sorted by an element of the structure (fishing_3)
- Dokcer运行Nacos容器自动退出问题
猜你喜欢
随机推荐
可重入函数
基于攻防博弈的网络防御决策方法研究综述
Excel import export controller
2021-10-18使用eop烧写裸板程序
C语言结构体初始化的四种方法
About the external entity key operation spinbox control in stemwin (fishing_2)
Yunyuanyuan (10) | introduction to kubernetes in kubernetes
如何消除 MySQL表中的字段特别设置的字符集和排序规则?
Microsoft SQL Server数据库语言及功能使用(十二)
What is the routing protocol
Hblock盘活企业级存储市场
What level do programmers need to reach to get 20K monthly salary without pressure?
Fcntl function
"Review of software engineering in Wuhan University of technology" Chapter 5 | software architecture
Summary of front-line Internet P7 interview questions - Supplementary
How to build a clear and understandable data Kanban?
"Review of software engineering in Wuhan University of technology" Chapter III software requirements
Research on network slicing security for 5g mmtc
QT笔记——QJson
QT笔记—— VS一个项目生成多个exe文件