Communication method based on coroutine mechanism

A communication method and coroutine technology, which is applied in the computer field, can solve problems such as the complexity of communication data interaction, and achieve the effects of avoiding data access conflicts, solving waiting problems, and increasing complexity

Active Publication Date: 2016-07-13
NANJING BALANCE NETWORK TECH CO LTD
View PDF3 Cites 20 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

However, in this process, the necessary information must be saved through the heap or global memory, and the callback mechanism will lead to the complexity of communication data interaction

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Communication method based on coroutine mechanism
  • Communication method based on coroutine mechanism
  • Communication method based on coroutine mechanism

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0026] In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention, not to limit the present invention.

[0027] Unless the context clearly states otherwise, the number of elements and components in the present invention can exist in a single form or in multiple forms, and the present invention is not limited thereto. Although the steps in the present invention are arranged with labels, they are not used to limit the order of the steps. Unless the order of the steps is clearly stated or the execution of a certain step requires other steps as a basis, the relative order of the steps can be adjusted. It can be understood that the term "and / or" used herein refers to and covers any and all possible combina...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention provides a communication method based on a coroutine mechanism. The communication method based on the coroutine mechanism comprises the following steps that firstly, in a main thread circulation process, a socket is monitored; secondly, whether data is input into the socket or not is judged, and the third step is executed if yes; thirdly, the input data is subjected to decoding analysis, whether the input data is request data or response data is judged, the fourth step is executed if the data is request data, and the fifth step is executed if the data is response data; fourthly, a coroutine function is established and used for processing the request data; fifthly, a coroutine function corresponding to the response data is searched for according to the response data, and the coroutine function is switched to process the response data. By means of the communication method based on the coroutine mechanism, the problem of waiting in a blockage mode can be solved, and data access conflict in multi-thread implement can be avoided.

Description

【Technical field】 [0001] The invention belongs to the technical field of computers, and in particular relates to a communication method based on a coroutine mechanism. 【Background technique】 [0002] In the existing computer technology, traditional inter-process or inter-host communication is carried out in the form of Socket. The existing Socket communication includes two modes: blocking mode and non-blocking mode. [0003] Blocking mode, also called serial mode, refers to: implement in a thread or a function, after sending data through the send function, immediately call the recv function to obtain the remote response data in a blocking manner. Moreover, during this process, the thread has been in a waiting state and cannot perform other operations. In this case, multithreading is generally used to implement concurrent operations on the same connection, and shared data uses semaphores to prevent access conflicts. [0004] The non-blocking method, also called the paralle...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Applications(China)
IPC IPC(8): G06F9/52
CPCG06F9/524
Inventor 王乾马红兵
Owner NANJING BALANCE NETWORK TECH CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products