Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The basic working principle of Socket (socket) between server and client

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

The connection process between Sockets can be summarized into the following three steps:

The server establishes monitoring: the client initializes the Socket dynamic library and creates a socket, then specifies the address of the client Socket, binds the Socket cyclically until success, and then starts to establish monitoring. At this time, the client is in a waiting state and monitors the network status in real time.

Client requests: Client Socket requests server connection, client describes the Socket it wants to connect to, points out the relevant attributes of the Socket to connect to, and then requests server Socket;

Connection confirmation and establishment: When the socket on the server side detects the connection request from the client side, it immediately responds to the request and establishes a new process, and then feeds back the description of the socket on the server side to the client side. After the client side confirms, the connection is successfully established. Then the client side and the server side can communicate with each other and transmit data. At this time, the socket on the server side continues to wait for the request from other clients.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report