Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Asynchronous I/O operation method and device based on socket

An asynchronous operation, socket technology, applied in the field of network communication, can solve problems such as universal discount

Active Publication Date: 2021-07-23
航天新通科技有限公司
View PDF10 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

This greatly reduces the generalizability of the method

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
  • Asynchronous I/O operation method and device based on socket

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0038] A method for socket-based asynchronous I / O operations of the present embodiment comprises the following steps:

[0039] Management socket creation steps: create a socket to be used as a management socket, and bind it to the local address. The management socket is used to receive asynchronous operation requests from all users, and convert the asynchronous operation requests into specific operation objects and object attributes of the proxy thread described below. Object properties include: operation type, data storage space and asynchronous processing method, etc.

[0040] Proxy thread creation steps: Create a thread as a proxy thread to serve all users' asynchronous operation requests. Add the management socket to the operation object set of the proxy thread, and set its object properties. Add the management socket to the read operation control information of the I / O multiplexing function (such as the select function), and call the I / O multiplexing function. Because ...

Embodiment 2

[0055] A socket-based asynchronous I / O operation method in this embodiment includes two stages of starting and running.

[0056] One: Start-up phase:

[0057] Management socket creation steps: Create a non-connection type UDP socket, for the convenience of description, the following description calls it OpsSock. Bind the socket to the local loopback address 127.0.0.1. The binding port can be statically specified or automatically selected by the operating system;

[0058] Because the scheme of this embodiment relies on the standard socket interface function (such as select, poll or epoll) for realizing I / O multiplexing, so, in order to illustrate this implementation scheme more clearly, its function is now briefly described. Take the select function as an example (other functions such as poll and epoll have similar functions although their interfaces are different), this function can simultaneously track multiple user-specified sockets, and its interface is defined as follows...

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 relates to the technical field of network communication, and particularly discloses a socket-based asynchronous I / O operation method and device. The method comprises the following steps: a management socket creation step: creating a management socket, and binding the management socket on a local address; a proxy thread creating step: creating a proxy thread, adding the management socket into read operation control information of the I / O multiplexing function, and calling the I / O multiplexing function; and a proxy thread running step: receiving an asynchronous operation request of a user by the management socket, executing a corresponding action according to the asynchronous operation request, and then sending a message to the user thread. By adopting the technical scheme of the invention, the adaptability to the operating system can be improved.

Description

technical field [0001] The invention relates to the technical field of network communication, in particular to a socket-based asynchronous I / O operation method and device. Background technique [0002] Two commonly used network communication models are the blocking I / O model and the non-blocking I / O model. The main difference lies in the processing strategy when the requested resource cannot be satisfied. The blocking I / O model will block the caller thread until the resource is satisfied, and the blocked thread can continue to execute; the non-blocking I / O model will directly return an indicative error message without blocking the caller thread. [0003] In the blocking I / O model, the caller usually applies for another thread to handle the I / O operation, otherwise, the entire program may be blocked due to waiting for the I / O operation. Although non-blocking I / O will not block the caller thread, the caller needs to choose an appropriate time to repeatedly execute the same I...

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
IPC IPC(8): H04L29/06G06F13/38
CPCH04L69/162G06F13/382
Inventor 李江卫吴少勇朱明星华峰
Owner 航天新通科技有限公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products