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

Socket programming: Icano Model

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

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

In the blog post on TCP server programming, we mentioned a more optimized connection, which is actually about the transport model of Icano:

Several of our common Ithumb O models:

Blocking Imax O model:

When the process makes a data transmission connection, it can only block and wait for the data to arrive, but cannot do anything else, and devote all the energy of the service process to deal with the current connection.

Illustration:

two。 Non-blocking Istroke O model:

The waiting response of the data is changed into polling waiting. When polling fails, EMOULODBLOCK is returned, and then the query is made again after a period of time, and the data will be copied successfully.

Graphic illustration

3. Signal response IPUBO:

The process polling is carried out, and then the handler of SIGIO is set up to respond when there is data access, and then copy the data, which is equivalent to tying a bell to the fishing rod when fishing and processing only when you hear the message.

Illustration:

4. Reuse the Istroke O model:

The use of other functions to help multiple listeners is equivalent to the ability of a process to respond to multiple event sets, and data transfer occurs after the response occurs when recvfrom (transfer data) is called. It is equivalent to one person controlling multiple fishing rods and responding to all the event sets of the current fishing rod.

Illustration:

The above are all synchronous Istroke O models, and they all have their own data responses carried out by the processes to which they belong.

The following is the asynchronous IWeiO model, in which the waiting response of the data is handed over to others, and you only need to get one result:

Illustration:

The above are some of our common Igamot O models.

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

Network Security

Wechat

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

12
Report