Single-port connection multiplexing management method, device and computer equipment
Through the single-port connection multiplexed management method based on the CST protocol, the resource waste caused by frequent opening and closing of multiple requested short links is solved, efficient port utilization and fast connection are achieved, and the application layer experience speed is improved.
Patent Information
- Application Number
- CN202211187448.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-27
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2042-09-27
AI Technical Summary
In the field of computer network communication, frequent opening and closing of network ports by multiple requests or single requests lead to waste of resources and excessive time consumption.
Using a multiplexed management method of single-port connected multiplex flow based on CST protocol, the memory and network transmission module are initialized through the session management module, cyclic reading and writing data is started, and the multi-stream management module is used to identify the structured data of the CST protocol format. and state initialization to avoid unnecessary port opening and closing.
Without increasing port resources, improve port utilization efficiency, reduce server resource usage, improve the speed and performance of application layer multi-channel data flow requests, and reduce resource waste and delay.
Smart Images

Figure CN115604334B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer network communication technology, and in particular to a method, device and computer equipment for multiplexing management of multiple streams connected to a single port. Background Art
[0002] In the field of computer network communications, with the popularization of the Internet, mobile Internet and the Internet of Things, the number of users and terminal devices has shown an explosive growth trend, but the maximum number of network ports that can actually be used by computers has not changed. Since a single data request will occupy one or more network ports to send and receive data, and with the increase in different applications or services, this has led to a shortage of network port resources and resource exhaustion; at the same time, although technological development can use network port multiplexing to reduce the burden of network port resources, most Internet standard protocols or private protocols process end-to-end, while multiple requests for short links or single requests will frequently open and close network ports and then establish links, which makes opening and closing network ports and then opening network ports to establish links extremely wasteful of resources and time. Summary of the invention
[0003] The present application provides a multiplexing management method for connecting multiple streams on a single port based on the CST protocol, aiming to solve the technical problem in the prior art that multiple requests for short links or a single request will frequently open and close the network port, resulting in excessive resource loss and long time consumption.
[0004] The present application provides a multiplexing management method for connecting multiple streams to a single port, including:
[0005] The session management module reads the peer configuration information and performs session initialization on the memory management module, network transmission management module, CST protocol management module and multi-channel stream management module according to the peer configuration information;
[0006] The network transmission management module starts a loop to read and write data, and starts at least two threads or coroutines at the same time, where one thread or coroutine is responsible for receiving network packets, and the other thread or coroutine is responsible for reading the data input by the application layer and transmitting the data to the CST protocol management module;
[0007] The CST protocol management module parses the data and obtains structured data in the CST protocol format;
[0008] The multi-channel stream management module identifies the structured data in the CST protocol format and initializes the stream status;
[0009] Determine whether the ID exists based on the identified CST protocol format structured data;
[0010] If it does not exist, the identification flow is established successfully;
[0011] If it exists, read the application data and store it in the memory management module.
[0012] Preferably, before the step of the session management module reading the peer configuration information, the step further includes:
[0013] The CST definition module defines the following fields for the CST data transmission protocol:
[0014] Set the protocol version;
[0015] Set the protocol description;
[0016] Set the protocol identifier and formulate the definition information of the data flow state according to the protocol identifier;
[0017] Set the protocol flow identifier and confirm the ownership of the flow identifier according to the protocol flow identifier;
[0018] Set the data length flag;
[0019] Protocol application data and user data.
[0020] Preferably, the application data and the user data are both packaged and unpacked according to the fields of the CST data transmission protocol.
[0021] Preferably, the session management module reads the peer configuration information, and performs session initialization on the memory management module, the network transmission management module, the CST protocol management module, and the multi-channel flow management module according to the peer configuration information, including:
[0022] The session management module establishes peer network communication based on the TCP / IP protocol stack, reads peer configuration parameters, and sets the session mode according to the peer configuration parameters, wherein the peer configuration parameters include a maximum number of streams parameter and a memory initialization parameter;
[0023] Initialize the memory management module, network transmission module, CST protocol management module and multi-channel flow management module according to the maximum flow number parameter and memory initialization parameter.
[0024] Preferably, the step of marking the successful establishment of the flow if it does not exist comprises:
[0025] Obtain the protocol flow identifier of the CST protocol, and establish a hash mapping table according to the protocol flow identifier;
[0026] Searching the actual structure data area of the flow in the hash mapping table according to the protocol flow identifier;
[0027] Get the length value of the CST protocol, read the application data in the actual structure data area according to the length value, and store the user data in the memory management module.
[0028] Preferably, the memory management module can store a memory value that is half of the maximum value.
[0029] Preferably, the network transmission management module is used to simultaneously read data packets sent by the network and application data written into the user layer.
[0030] The present application also provides a multiplexing management device for connecting multiple streams with a single port, comprising:
[0031] The session management module is used to read the peer configuration information and perform session initialization on the memory management module, network transmission management module, CST protocol management module and multi-channel stream management module according to the peer configuration information;
[0032] The network transmission management module is used to start a loop to read and write data, and at least two threads or coroutines are started at the same time, where one thread or coroutine is responsible for receiving network packets, and the other thread or coroutine is responsible for reading the data input by the application layer and transmitting the data to the CST protocol management module;
[0033] The CST protocol management module is used to parse the data and obtain structured data in the CST protocol format;
[0034] The multi-channel stream management module is used to identify the structured data in the CST protocol format and initialize the stream status;
[0035] It is also used to determine whether the stream connection is successful based on the identified fields of the CST protocol format structured data;
[0036] If the stream connection is successful, read the application data and store it in the memory management module;
[0037] If the stream connection fails, read the user data and store it in the memory management module.
[0038] The present application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0039] The present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the above method are implemented.
[0040] The beneficial effects of the present application are: without increasing port resources or repeatedly opening and closing ports, port utilization efficiency is improved, server resource usage is reduced, and multi-channel data stream requests or initial launches at the application layer are realized, thereby improving the application layer experience speed; it effectively meets users' multi-channel requests for high-performance connections and reduces resource waste and delays caused by opening and closing, greatly improving resource utilization and connection speed performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 The figure is a schematic diagram of a method flow of an embodiment of the present application.
[0042] Figure 2 Schematic diagram of the device structure of an embodiment of the present application.
[0043] Figure 3 A schematic diagram of the internal structure of a computer device according to an embodiment of the present application.
[0044] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0045] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0046] like Figure 1 As shown, the present application provides a multiplexing management method for connecting multiple streams with a single port, including:
[0047] S1. The session management module reads the peer configuration information and initializes the session for the memory management module, network transmission management module, CST protocol management module and multi-channel flow management module according to the peer configuration information;
[0048] S2. The network transmission management module starts a loop to read and write data, and at least two threads or coroutines are started at the same time, wherein one thread or coroutine is responsible for receiving network packets, and the other thread or coroutine is responsible for reading the data input by the application layer and transmitting the data to the CST protocol management module;
[0049] S3, the CST protocol management module parses the data to obtain structured data in the CST protocol format;
[0050] S4, the multi-channel flow management module identifies the structured data in the CST protocol format and initializes the flow state;
[0051] S5. Determine whether the ID exists based on the identified CST protocol format structured data;
[0052] S6. If it does not exist, the identification flow is established successfully;
[0053] S7. If it exists, read the application data and store the application data into the memory management module.
[0054] As described in the above steps S1-S7, the TCP / IP protocol stack is used to establish a link, and all data transmissions use CST protocol packets, including: a session management module, a memory management module, a network transmission management module, a CST protocol management module, and a multi-channel stream management module, thereby realizing single-port connection multi-channel stream multiplexing management based on TCP / IP; specifically, when reading the configuration information of the other end, the external end configuration information is read, the IP and a single port are set, the TCP / IP protocol stack is used to establish network communication, and the network connection is initialized; according to the end configuration information, the session mode is set, the server end sets the server mode, and the client end sets the client mode, and according to the maximum number of streams parameters and the memory initialization parameters, the stream management, memory management, and transmission management are initialized, and finally the initialization of session management is realized. The CST protocol management module can unpack the read network packets and also perform CST protocol encapsulation on the user input data. All the data after unpacking and encapsulation is structured data in the CST protocol format. When the multi-channel stream management module identifies the structured data in the CST protocol format, the stream management state machine identifies the flag value of the CST protocol header and determines the status of the stream based on the predefined flag value. The status includes: new, successful connection, completion and disconnection. According to the CST protocol ID value, the ID of the stream is confirmed, and hash mapping management is performed based on the ID. The actual structural data area of the stream is quickly found through the ID. According to the value of the CST protocol length, the actual user's application data or user data is read and written into the memory management module.The multi-channel stream management module identifies the CST protocol flag field and initializes the stream state according to the flag field definition; creates a new stream request, queries the stream management hash mapping table, takes the maximum ID, the new ID value is the maximum ID + 2, and sets the CST flag to 0x01, notifying the CST protocol management to process the stream creation request packet and set the stream state to new; obtains the ID field value, searches the stream management hash mapping table for the ID value, if it does not exist, it is successfully established, notifies the CST protocol management that the response flag field is 0x02, indicating that the stream is successfully established, if it exists, directly reads the application data, stores it in the memory management, and sets the stream connection success state; wherein, the CST flag value is 0x02, indicating that the stream connection is successful, and sets the stream connection success state; wherein, the CST The flag value is 0x04, which indicates that the stream is disconnected. The stream status is set to disconnected, and the resources of the hash management corresponding ID are released. The memory management module presets the maximum value of the memory that can be used to 16MB, and the initialization default value is set to 256KB. The server and client can negotiate the stream acceptance memory value according to the CST protocol type value 0x02, but it is not allowed to exceed half of the maximum value of the configured memory to ensure that multiple stream connection resources are available at the same time, and at the same time can store data after CST protocol unpacking or packaging. In this way, this embodiment can improve port utilization efficiency and reduce server resource usage without increasing port resources or repeatedly opening and closing ports, while realizing multiple data stream requests or initial launches at the application layer, thereby improving the application layer experience speed.
[0055] In one embodiment, before the step S1 of the session management module reading the peer configuration information, the step further includes:
[0056] S11. The CST definition module defines the following fields for the CST data transmission protocol:
[0057] S12, setting the protocol version;
[0058] S13, setting protocol description;
[0059] S14, setting the protocol identifier, and formulating definition information of the data flow state according to the protocol identifier;
[0060] S15, setting the protocol flow identifier, and confirming the ownership of the flow identifier according to the protocol flow identifier;
[0061] S16, set the data length identifier;
[0062] S17, protocol application data and user data.
[0063] As described in the above steps S11-S17, by setting the protocol version ver, you can define whether the data is supported according to the version, which occupies 1 Byte; set the protocol description type, and formulate the corresponding function according to the set description value, which occupies 1 Byte. Specifically, the preset value is 0x01 to identify data, indicating data transmission, 0x02 to identify window, indicating updating the transmission data window size, 0x03 to identify ping, indicating detecting the RTT value of the network between the server and the client, and 0x04 to identify goaway, indicating interrupting the connection session; set the protocol identifier flag, root According to the set identification value, the definition of the data flow status is formulated, which occupies 2 Bytes. Specifically, the preset value is 0x01 to identify SYN, indicating that a signal is sent to create a new flow; 0x02 to identify ACK, indicating that the response value of the new flow signal is received and the new flow connection is successful; 0x03 to identify FIN, indicating that a half-close signal is sent to the established flow, which can also carry user data; 0x04 to identify RST, indicating that the connected flow is closed; set the protocol flow identifier, that is, the protocol flow ID, and confirm the ownership of the identified flow according to the actual value of the ID. Set the service flow ID value to an odd number and the client flow ID to an even number, which occupies 4 bytes. Set the data length identifier lengh, the actual algorithm is: length = S12 + S13 + S14 + S15 + S16 + actual user data length, occupying 4 bytes; protocol application data and user data, the length is not limited; after the CST protocol management module parses the data, it reads the CST protocol header data to implement the structuring of the network data packet; and determines whether the ver field is supported to implement whether the network packet is valid; reads the type field value, determines the type value to identify the corresponding function, and performs corresponding function processing, among which 0x01 identifies the transmission data, 0x02 identifies the update protocol memory, and 0x 03 identifies the RTT of the detection network, 0x04 identifies the interrupt chain; read the flag field and determine the flag data value, where the flag data value is: 0x01: identifies the newly established stream; 0x02: identifies the receipt of the new stream request response ACK; 0x03: identifies the sending of a half-close signal to the established stream, which can also carry user data; 0x04 identifies RST, indicating the closing of the connected stream; S405 identifies the state of the stream according to the field value read in S404 and the corresponding identifier; S406 reads the ID field to identify the ID of the stream; S407 reads the length field to identify the application layer data length;
[0064] In one embodiment, the application data of the server and the client and the user data are packaged and unpacked according to the fields of the CST data transmission protocol.
[0065] In one embodiment, the session management module reads the peer configuration information, and performs session initialization S1 on the memory management module, the network transmission management module, the CST protocol management module, and the multi-channel flow management module according to the peer configuration information, including:
[0066] S101, the session management module establishes peer network communication based on the TCP / IP protocol stack, reads peer configuration parameters, and sets a session mode according to the peer configuration parameters, wherein the peer configuration parameters include a maximum number of streams parameter and a memory initialization parameter;
[0067] S102. Initialize a memory management module, a network transmission module, a CST protocol management module, and a multi-channel flow management module according to a maximum flow number parameter and a memory initialization parameter.
[0068] In one embodiment, the step S6 of marking the successful establishment of the flow if it does not exist includes:
[0069] S61, obtaining a protocol flow identifier of the CST protocol, and establishing a hash mapping table according to the protocol flow identifier;
[0070] S62, searching the hash mapping table for an actual structure data area of the flow according to the protocol flow identifier;
[0071] S63. Obtain the length value of the CST protocol, read the application data in the actual structure data area according to the length value, and store the user data in the memory management module.
[0072] In one embodiment, the memory management module can store a memory value of half of the maximum value. The memory management module presets the maximum value of the memory that can be used to be 16MB, and the initialization default value is 256KB. According to the CST protocol type value 0x02, the server and the client can negotiate the stream acceptance memory value, but it is not allowed to exceed half of the maximum value of the configured memory to ensure that multiple stream connection resources are available at the same time, and can store the data after the CST protocol is unpacked or packaged.
[0073] In one embodiment, the network transmission management module is used to simultaneously read data packets sent by the network and application data written into the user layer.
[0074] The present application also provides a multiplexing management device for connecting multiple streams with a single port, comprising:
[0075] The session management module is used to read the peer configuration information and perform session initialization on the memory management module, network transmission management module, CST protocol management module and multi-channel stream management module according to the peer configuration information;
[0076] The network transmission management module is used to start a loop to read and write data, and at least two threads or coroutines are started at the same time, where one thread or coroutine is responsible for receiving network packets, and the other thread or coroutine is responsible for reading the data input by the application layer and transmitting the data to the CST protocol management module;
[0077] The CST protocol management module is used to parse the data and obtain structured data in the CST protocol format;
[0078] The multi-channel stream management module is used to identify the structured data in the CST protocol format and initialize the stream status;
[0079] It is also used to determine whether the ID exists based on the identified CST protocol format structured data;
[0080] If it does not exist, the identification flow is established successfully;
[0081] If it exists, read the application data and store it in the memory management module.
[0082] like Figure 3 As shown, the present application also provides a computer device, which may be a server, and its internal structure may be as shown in Figure 3 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor designed by the computer is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store all data required for the process of the multiplexing management method of connecting multiple streams to a single port. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the multiplexing management method of connecting multiple streams to a single port is implemented.
[0083] Those skilled in the art will understand that Figure 3 The structure shown in is merely a block diagram of a portion of the structure related to the present application solution and does not constitute a limitation on the computer device to which the present application solution is applied.
[0084] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, any of the above-mentioned methods for multiplexing management of multiple streams connected to a single port is implemented.
[0085] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing related hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media provided in this application and used in the embodiments may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0086] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.
[0087] The above description is only a preferred embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for multiplexing management of multiple streams connected to a single port, characterized in that: include: The session management module reads the peer configuration information and performs session initialization on the memory management module, network transmission management module, CST protocol management module and multi-channel stream management module according to the peer configuration information; The network transmission management module starts a loop to read and write data, and starts at least two threads or coroutines at the same time, where one thread or coroutine is responsible for receiving network packets, and the other thread or coroutine is responsible for reading the data input by the application layer and transmitting the data to the CST protocol management module; The CST protocol management module parses the data and obtains structured data in the CST protocol format; The multi-channel stream management module identifies the structured data in the CST protocol format and initializes the stream status; Determine whether the ID exists based on the identified CST protocol format structured data; If it does not exist, the identification flow is established successfully; If it exists, read the application data and store the application data in the memory management module; Before the step of the session management module reading the peer configuration information, the step further includes: The CST definition module defines the following fields for the CST data transmission protocol: Set the protocol version; Set the protocol description; Set the protocol identifier and formulate the definition information of the data flow state according to the protocol identifier; Set the protocol flow identifier and confirm the ownership of the flow identifier according to the protocol flow identifier; Set the data length flag; Protocol application data and user data.
2. The method for multiplexing and managing multiple streams connected to a single port according to claim 1, characterized in that: The application data and the user data are both packaged and unpacked according to the fields of the CST data transmission protocol.
3. The method for multiplexing and managing multiple streams connected to a single port according to claim 1, characterized in that: The session management module reads the peer configuration information, and performs session initialization on the memory management module, the network transmission management module, the CST protocol management module, and the multi-channel flow management module according to the peer configuration information, including: The session management module establishes peer network communication based on the TCP / IP protocol stack, reads peer configuration parameters, and sets a session mode according to the peer configuration parameters, wherein the peer configuration parameters include a maximum number of streams parameter and a memory initialization parameter; Initialize the memory management module, network transmission module, CST protocol management module and multi-channel flow management module according to the maximum flow number parameter and memory initialization parameter.
4. The method for multiplexing and managing multiple streams connected to a single port according to claim 1, characterized in that: If the flow does not exist, the steps of successfully establishing the identification flow include: Obtain the protocol flow identifier of the CST protocol, and establish a hash mapping table according to the protocol flow identifier; Searching the actual structure data area of the flow in the hash mapping table according to the protocol flow identifier; Get the length value of the CST protocol, read the application data in the actual structure data area according to the length value, and store the user data in the memory management module.
5. The method for multiplexing and managing multiple streams connected to a single port according to claim 1, characterized in that: The memory value that the memory management module can store is half of the maximum value.
6. The method for multiplexing and managing multiple streams connected to a single port according to claim 1, characterized in that: The network transmission management module is used to simultaneously read data packets sent by the network and application data written into the user layer.
7. A multiplexing management device for connecting multiple streams with a single port, characterized in that: include: The session management module is used to read the peer configuration information and perform session initialization on the memory management module, network transmission management module, CST protocol management module and multi-channel stream management module according to the peer configuration information; The network transmission management module is used to start a loop to read and write data, and at least two threads or coroutines are started at the same time, where one thread or coroutine is responsible for receiving network packets, and the other thread or coroutine is responsible for reading the data input by the application layer and transmitting the data to the CST protocol management module; The CST protocol management module is used to parse the data and obtain structured data in the CST protocol format; The multi-channel stream management module is used to identify the structured data in the CST protocol format and initialize the stream status; It is also used to determine whether the stream connection is successful based on the identified fields of the CST protocol format structured data; If the stream connection is successful, read the application data and store it in the memory management module; If the stream connection fails, read the user data and store it in the memory management module; Before the step of the session management module reading the peer configuration information, the step further includes: The CST definition module is used to define the following fields for the CST data transmission protocol: Set the protocol version; Set the protocol description; Set the protocol identifier and formulate the definition information of the data flow state according to the protocol identifier; Set the protocol flow identifier and confirm the ownership of the flow identifier according to the protocol flow identifier; Set the data length flag; Protocol application data and user data.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Fudan-FDK250-based secure socket layer virtual private network (SSL VPN) accelerator
CN102377806A
Method and device for negotiating media multiplexing
CN104683312A