TCP proxy method and device and storage medium

By implementing a TCP proxy method on the proxy device, the problem of insufficient processing and storage capabilities of the proxy device is solved, the maintenance of the TCP proxy state machine is simplified, and the efficient TCP proxy function is realized.

CN119496810AActive Publication Date: 2025-02-21DATANG MOBILE COMM EQUIP CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202311048505.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-18
Publication Date
2025-02-21
Estimated Expiration
2043-08-18

AI Technical Summary

Technical Problem

The limited processing and storage capabilities of the proxy device cannot support its functional and performance overhead for TCP proxy.

Method used

By implementing a TCP proxy method on the proxy device, the receiving packets sent by the device and determining the target state according to the current state and message type, thereby switching the state and processing the TCP link. The method includes receiving a message, determining a target state and switching a state, and the specific steps include processing a synchronization message, confirming a message, closing a connection message, etc.

Benefits of technology

By simplifying the maintenance of TCP proxy state machine, the requirements for the processing and storage capabilities of the proxy device are reduced, so that limited proxy devices can effectively complete the TCP proxy function, improving performance and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119496810A_ABST
    Figure CN119496810A_ABST
Patent Text Reader

Abstract

The invention provides a TCP proxy method and device and a storage medium, and relates to the technical field of communication. In the method, a proxy device receives a first message sent by a first device, and the first device is a client device or a server device; determining a target state according to the first message and the current state of the proxy device, the target state being any one of the following states: a link establishment state, a data transmission state, a first link deletion state, a second link deletion state and a connectionless state; and switching from the current state to the target state. According to the invention, the proxy equipment switches on the CT segment and the TS segment to jointly maintain a set of simplified state machine, so that the maintenance complexity of the TCP proxy state machine is greatly reduced, and the requirement on the processing capability of the proxy equipment is further reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a TCP proxy method, device and storage medium. Background Art

[0002] The Transmission Control Protocol (TCP) proxy device divides the TCP link into two segments: the link between the proxy device and the server (referred to as the TS segment) and the link between the client and the proxy device (referred to as the CT segment). For the server, the proxy device needs to implement the client function, and for the client, the proxy device needs to implement the server function, which is equivalent to developing a complete TCP protocol stack, and has high requirements for the processing resources and storage resources of the proxy device.

[0003] When the processing power and storage capacity of the proxy device (such as a base station) are limited, the limited processing power and storage capacity cannot support the functions and performance overhead of the TCP proxy. Summary of the invention

[0004] The present application provides a TCP proxy method, device and storage medium, which solve the technical problem that the limited processing power and storage capacity of the proxy device cannot support the function and performance overhead of completing the TCP proxy.

[0005] In a first aspect, an embodiment of the present application provides a TCP proxy method, which is applied to a proxy device, and the method includes:

[0006] Receiving a first message sent by a first device, where the first device is a client device or a server device;

[0007] Determine a target state according to the first message and the current state of the proxy device, where the target state is any one of the following: a link establishment state, a data transmission state, a first link deletion state, a second link deletion state, and a connectionless state;

[0008] Switch from the current state to the target state.

[0009] In one implementation, determining a target state according to the first message and the current state of the proxy device includes:

[0010] If the first message is a synchronization message and the current state is the disconnected state, determining the target state to be the link establishment state; or,

[0011] If the first message is a synchronization confirmation message and the current state is the link establishment state, determining that the target state is the data transmission state; or,

[0012] If the first message is a normal connection closing message sent by the server device, and the current state is the data transmission state, determining that the target state is the first link deletion state; or,

[0013] If the first message is an abnormal connection closing message sent by the server device, and the current state is the data transmission state, determining that the target state is the second link deletion state; or,

[0014] If the first message is an abnormal connection closing message sent by the client device and the current state is the data transmission state, the target state is determined to be the disconnected state.

[0015] In one implementation, when the target state is the first link deletion state or the second link deletion state, the method further includes:

[0016] Sending data in the TCP proxy cache to the client device until the TCP proxy cache is cleared;

[0017] The TCP link is deleted and switched to the connectionless state.

[0018] In one embodiment, the method further comprises:

[0019] Send a second message to the server device, where the second message includes a first window length, and the first window length satisfies the following formula:

[0020] First window length = min (second window length, theoretical maximum window length)

[0021] Among them, the first window length indicates the maximum data volume of the first data packet, the first data packet is the data packet sent by the server device to the proxy device, the second window length indicates the theoretical maximum data volume of the second data packet, the second data packet is the data packet sent by the proxy device to the client device, and the theoretical proxy maximum window length indicates the theoretical maximum data volume of the first data packet.

[0022] In one embodiment, the method further comprises:

[0023] Sending a third message to the server device, wherein the third message includes a third window length, and the third window length indicates the data amount of the first data packet;

[0024] Wherein, the third window length satisfies the following formula:

[0025] The third window length = the fourth window length - the amount of proxy cache data - the amount of window reduction

[0026] The fourth window length indicates the data size of the second data packet, the proxy cache data size is the data size in the TCP proxy cache of the proxy device, and the shrinking window size is a constant.

[0027] In one implementation, the window reduction amount is the difference between the second window length and the first window length.

[0028] In one embodiment, the method further comprises:

[0029] Determine a timeout queue corresponding to each time slot in a frame period, wherein the timeout queue includes a plurality of timeout events;

[0030] Determine the scanning period;

[0031] The timeout events in the multiple timeout queues corresponding to the scanning period are processed.

[0032] In one implementation, determining a timeout queue corresponding to each time slot in a frame period includes:

[0033] For any timer, determine the first half frame number and the first time slot number corresponding to the start time of the timer;

[0034] Determine a second half frame number and a second time slot number according to the first half frame number, the first time slot number, and the timing duration of the timer;

[0035] Add the timeout event corresponding to the timer to the timeout queue corresponding to the second half-frame number and the second time slot number.

[0036] In a second aspect, an embodiment of the present application provides a TCP proxy device, which is applied to a proxy device. The device includes: a memory, a transceiver, and a processor.

[0037] The memory is used to store a computer program; the transceiver is used to send and receive data under the control of the processor; the processor is used to read the computer program in the memory and perform the following operations:

[0038] Receiving a first message sent by a first device, where the first device is a client device or a server device;

[0039] Determine a target state according to the first message and the current state of the proxy device, where the target state is any one of the following: a link establishment state, a data transmission state, a first link deletion state, a second link deletion state, and a connectionless state;

[0040] Switch from the current state to the target state.

[0041] In one implementation, the processor is specifically configured to perform the following operations:

[0042] If the first message is a synchronization message and the current state is the disconnected state, determining the target state to be the link establishment state; or,

[0043] If the first message is a synchronization confirmation message and the current state is the link establishment state, determining that the target state is the data transmission state; or,

[0044] If the first message is a normal connection closing message sent by the server device, and the current state is the data transmission state, determining that the target state is the first link deletion state; or,

[0045] If the first message is an abnormal connection closing message sent by the server device, and the current state is the data transmission state, determining that the target state is the second link deletion state; or,

[0046] If the first message is an abnormal connection closing message sent by the client device and the current state is the data transmission state, the target state is determined to be the disconnected state.

[0047] In one implementation, when the target state is the first link deletion state or the second link deletion state, the processor is further configured to perform the following operations:

[0048] Sending data in the TCP proxy cache to the client device until the TCP proxy cache is cleared;

[0049] The TCP link is deleted and switched to the connectionless state.

[0050] In one implementation, the processor is further configured to perform the following operations:

[0051] Send a second message to the server device, where the second message includes a first window length, and the first window length satisfies the following formula:

[0052] First window length = min (second window length, theoretical maximum window length)

[0053] Among them, the first window length indicates the maximum data volume of the first data packet, the first data packet is the data packet sent by the server device to the proxy device, the second window length indicates the theoretical maximum data volume of the second data packet, the second data packet is the data packet sent by the proxy device to the client device, and the theoretical proxy maximum window length indicates the theoretical maximum data volume of the first data packet.

[0054] In one implementation, the processor is further configured to perform the following operations:

[0055] Sending a third message to the server device, wherein the third message includes a third window length, and the third window length indicates the data amount of the first data packet;

[0056] Wherein, the third window length satisfies the following formula:

[0057] The third window length = the fourth window length - the amount of proxy cache data - the amount of window reduction

[0058] The fourth window length indicates the data size of the second data packet, the proxy cache data size is the data size in the TCP proxy cache of the proxy device, and the shrinking window size is a constant.

[0059] In one implementation, the window reduction amount is the difference between the second window length and the first window length.

[0060] In one implementation, the processor is further configured to perform the following operations:

[0061] Determine a timeout queue corresponding to each time slot in a frame period, wherein the timeout queue includes a plurality of timeout events;

[0062] Determine the scanning period;

[0063] The timeout events in the multiple timeout queues corresponding to the scanning period are processed.

[0064] In one implementation, the processor is specifically configured to perform the following operations:

[0065] For any timer, determine the first half frame number and the first time slot number corresponding to the start time of the timer;

[0066] Determine a second half frame number and a second time slot number according to the first half frame number, the first time slot number, and the timing duration of the timer;

[0067] Add the timeout event corresponding to the timer to the timeout queue corresponding to the second half-frame number and the second time slot number.

[0068] In a third aspect, an embodiment of the present application provides a TCP proxy device, which is applied to a proxy device, and the device includes:

[0069] A receiving unit, configured to receive a first message sent by a first device, where the first device is a client device or a server device;

[0070] A first determining unit, configured to determine a target state according to the first message and a current state of the proxy device, wherein the target state is any one of the following: a link establishment state, a data transmission state, a first link deletion state, a second link deletion state, and a disconnected state;

[0071] A switching unit is used to switch from the current state to the target state.

[0072] Receiving a first message sent by a first device, where the first device is a client device or a server device;

[0073] Determine a target state according to the first message and the current state of the proxy device, where the target state is any one of the following: a link establishment state, a data transmission state, a first link deletion state, a second link deletion state, and a connectionless state;

[0074] Switch from the current state to the target state.

[0075] In one implementation, the first determining unit is specifically configured to:

[0076] If the first message is a synchronization message and the current state is the disconnected state, determining the target state to be the link establishment state; or,

[0077] If the first message is a synchronization confirmation message and the current state is the link establishment state, determining that the target state is the data transmission state; or,

[0078] If the first message is a normal connection closing message sent by the server device, and the current state is the data transmission state, determining that the target state is the first link deletion state; or,

[0079] If the first message is an abnormal connection closing message sent by the server device, and the current state is the data transmission state, determining that the target state is the second link deletion state; or,

[0080] If the first message is an abnormal connection closing message sent by the client device and the current state is the data transmission state, the target state is determined to be the disconnected state.

[0081] In one implementation, when the target state is the first link deletion state or the second link deletion state, the device further includes:

[0082] A first sending unit, configured to send data in the TCP proxy cache to the client device until the TCP proxy cache is cleared;

[0083] The deleting unit is used to delete the TCP link and switch to the connectionless state.

[0084] In one embodiment, the device further comprises:

[0085] The second sending unit is configured to send a second message to the server device, where the second message includes a first window length, and the first window length satisfies the following formula:

[0086] First window length = min (second window length, theoretical maximum window length)

[0087] Among them, the first window length indicates the maximum data volume of the first data packet, the first data packet is the data packet sent by the server device to the proxy device, the second window length indicates the theoretical maximum data volume of the second data packet, the second data packet is the data packet sent by the proxy device to the client device, and the theoretical proxy maximum window length indicates the theoretical maximum data volume of the first data packet.

[0088] In one embodiment, the device further comprises:

[0089] A third sending unit, configured to send a third message to the server device, wherein the third message includes a third window length, and the third window length indicates a data amount of the first data packet;

[0090] Wherein, the third window length satisfies the following formula:

[0091] The third window length = the fourth window length - the amount of proxy cache data - the amount of window reduction

[0092] The fourth window length indicates the data size of the second data packet, the proxy cache data size is the data size in the TCP proxy cache of the proxy device, and the shrinking window size is a constant.

[0093] In one implementation, the window reduction amount is the difference between the second window length and the first window length.

[0094] In one embodiment, the device further comprises:

[0095] A second determining unit, configured to determine a timeout queue corresponding to each time slot in a frame period, wherein the timeout queue includes a plurality of timeout events;

[0096] A third determining unit, configured to determine a scanning period;

[0097] The processing unit is used to process the timeout events in the multiple timeout queues corresponding to the scanning period.

[0098] In one implementation, the second determining unit is specifically configured to:

[0099] For any timer, determine the first half frame number and the first time slot number corresponding to the start time of the timer;

[0100] Determine a second half frame number and a second time slot number according to the first half frame number, the first time slot number, and the timing duration of the timer;

[0101] Add the timeout event corresponding to the timer to the timeout queue corresponding to the second half-frame number and the second time slot number.

[0102] In a fourth aspect, an embodiment of the present application provides a processor-readable storage medium, wherein the processor-readable storage medium stores a computer program, and the computer program is used to enable the processor to execute the method described in the first aspect.

[0103] The present application provides a TCP proxy method, apparatus and storage medium, in which the proxy device receives a first message sent by a first device, the first device being a client device or a server device; determines a target state according to the first message and the current state of the proxy device, the target state being any one of the following: link establishment state, data transmission state, first link deletion state, second link deletion state and no connection state; switches from the current state to the target state. The proxy device connects the CT segment and the TS segment, and jointly maintains a simplified state machine, which greatly reduces the maintenance complexity of the TCP proxy state machine, thereby reducing the processing capability requirements of the proxy device.

[0104] It should be understood that the contents described in the above summary of the invention are not intended to limit the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0105] In order to more clearly illustrate the technical solutions in the present application or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0106] Figure 1 A schematic diagram of an application scenario provided by an embodiment of the present application;

[0107] Figure 2 A schematic diagram of a process of establishing a TCP link in the related art;

[0108] Figure 3 A schematic diagram of a process of closing a TCP link in the related art;

[0109] Figure 4 A flowchart of a TCP proxy method provided in an embodiment of the present application;

[0110] Figure 5A schematic diagram of a TCP link establishment process provided in an embodiment of the present application;

[0111] Figure 6 A schematic diagram of a TCP link closing process provided in an embodiment of the present application;

[0112] Figure 7 A schematic diagram of another process of closing a TCP link provided in an embodiment of the present application;

[0113] Figure 8 A schematic diagram of a state transition of a TCP proxy provided in an embodiment of the present application;

[0114] Fig. 9 A flowchart of another TCP proxy method provided in an embodiment of the present application;

[0115] Fig.10 A diagram showing the relationship between various window lengths when establishing a link provided in an embodiment of the present application;

[0116] Fig.11 A diagram showing the relationship between various window lengths during data transmission provided in an embodiment of the present application;

[0117] Fig.12 A flowchart of another TCP proxy method provided in an embodiment of the present application;

[0118] Fig.13 A schematic diagram of a timeout queue within a frame period provided in an embodiment of the present application;

[0119] Fig.14 A schematic diagram of the structure of a TCP proxy device provided in an embodiment of the present application;

[0120] Fig.15 A schematic diagram of the structure of another TCP proxy device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0121] In the embodiments of the present invention, the term "and / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent three situations: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.

[0122] In the embodiments of the present application, the term "plurality" refers to two or more than two, and other quantifiers are similar.

[0123] The descriptions such as "first" and "second" in the embodiments of the present application are only used for illustration and distinction of the described objects, and there is no order, nor does it indicate a special limitation on the number of objects in the embodiments of the present application, and cannot constitute any limitation on the embodiments of the present application. For example, the first data packet is a data packet sent by the server device to the proxy device, and the second data packet is a data packet sent by the proxy device to the client device. The descriptions such as "first" and "second" are only used to distinguish different data packets, and do not indicate the difference in size, priority or importance of the two data packets.

[0124] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0125] The embodiments of the present application provide a TCP proxy method and apparatus for simplifying TCP proxy so that proxy devices with limited processing power and storage capacity can also complete the functions and performance overhead of TCP proxy.

[0126] Among them, the method and the device are based on the same application concept. Since the method and the device solve the problem in a similar principle, the implementation of the device and the method can refer to each other, and the repeated parts will not be repeated.

[0127] The technical solution provided in the embodiment of the present application can be applicable to a variety of systems, especially 5G systems. For example, applicable systems may be global system of mobile communication (Global System of Mobile Communication, GSM) system, code division multiple access (Code Division Multiple Access, CDMA) system, wideband code division multiple access (Wideband Code Division Multiple Access, WCDMA) general packet radio service (General Packet Radio Service, GPRS) system, long term evolution (Long Term Evolution, LTE) system, LTE frequency division duplex (Frequency Division Duplex, FDD) system, LTE time division duplex (Time Division Duplex, TDD) system, advanced long term evolution (Long Term Evolution Advanced, LTE-A) system, universal mobile system (Universal Mobile Telecommunication System, UMTS), world-wide interoperability for Microwave Access (Worldwide Interoperability for Microwave Access, WiMAX) system, 5G new air interface (New Radio, NR) system, etc. These various systems include terminal equipment and network equipment. The system may also include a core network part, such as an evolved packet system (EPS), a 5G system (5GS), etc.

[0128] Combine the following Figure 1 The application scenario of this application is described. Figure 1 A schematic diagram of an application scenario provided in an embodiment of the present application.

[0129] like Figure 1 As shown, it includes a client device 101, a proxy device 102, and a server device 103. Among them, the client device 101 and the server device 103 can communicate with the proxy device 102 respectively. The server device 103 can send a downlink TCP data packet to the client device 101 through the proxy device 102. After the client device 101 receives the downlink TCP data packet, it can send an uplink TCP confirmation message (Acknowledgement, ACK) to the server device 103 through the proxy device 102.

[0130] The proxy device may be a base station, which may include multiple cells providing services to the terminal. Depending on the specific application scenario, the base station may also be called an access point, or may be a device in the access network that communicates with the wireless terminal device over the air interface through one or more sectors, or other names.

[0131] The proxy device divides the TCP link into two segments: TS segment and CT segment. For the server, the proxy device needs to implement the client function, and for the client, the proxy device needs to implement the server function, which is equivalent to developing a complete TCP protocol stack, and has high requirements on the processing resources and storage resources of the proxy device.

[0132] Next, the complexity of the existing TCP proxy is explained from three aspects: TCP proxy state machine mechanism, window length control mechanism and timer mechanism.

[0133] Figure 2 FIG. 1 is a flow chart of establishing a TCP link in the related technology. Figure 2 As shown, first, the client device in the disconnected state (CLOSED) actively requests communication and sends a connection request message to the server device. At this time, the synchronization sequence number (synchronize sequence number, SYN) = 1, selects its own initial sequence number (sequence number, seq) = x, and enters the synchronization sent state (SYN-SEND).

[0134] Then, the server device in the disconnected state is passively opened and enters the listening state (LISTEN). After receiving the request in the listening state, it sends a confirmation message to the client device, sets both the SYN and ACK bits to 1 in the confirmation message, and the confirmation number (ack) = x+1. At the same time, it selects its own initial sequence number seq = y and enters the synchronous received state (SYN-RECEIVED).

[0135] Finally, after the client device receives the confirmation message from the server device, it sends a confirmation message to the server device, with the ACK of the confirmation message set to 1, the confirmation number ack=y+1, and its own sequence number seq=x+1, entering the connection established state (ESTABLISHED); after the server device receives the confirmation message sent by the client device, it enters the connection established state.

[0136] After establishing a TCP connection, both parties complete data transmission and request to close the TCP connection. At this time, four handshakes are required to close the link. The link closing process can be initiated by the client device or the server device.

[0137] Figure 3FIG. 1 is a flow chart of a TCP link closing process in the related art. Figure 3 As shown in the figure, the client device actively initiates the closing of the connection as an example. First, the client device sends a closing connection message to the server device and stops sending data. In the closing connection message, FIN=1 and the sequence number seq=u, which is equal to the sequence number of the last byte of the previously transmitted data plus 1. At this time, the client device enters the closing connection sent state (FIN-WAIT-1) and waits for the confirmation of the server device.

[0138] Then, after receiving the connection closing message, the server device sends a confirmation message to confirm the connection closing. In this message, ACK=1, confirmation number ack=u+1, and its own sequence number seq=v. The sequence number is equal to the sequence number of the last byte of the data previously transmitted by the server device plus 1. The server device enters the connection closing received state (CLOSE-WAIT).

[0139] Next, after receiving the confirmation from the server, the client device enters the connection closing confirmed state (FIN-WAIT-2), waiting for the server to send a connection closing message. In the connection closing message sent by the server, FIN=1, and the confirmation number must repeat the confirmation number sent last time, that is, ack=u+1, and the sequence number seq=v. The server device enters the connection closing waiting confirmation state (LAST-ACK), waiting for the confirmation from the client.

[0140] Finally, after receiving the server device's close connection message, the client device must send a confirmation. In the confirmation message segment, ACK = 1, confirmation number ack = v + 1, and its own sequence number seq = u + 1, and then enter the delayed connection closing state (TIME-WAIT). At this time, the TCP connection has not been released. The client device must wait for the time set by the timer for twice the maximum message life (Maximum Segment Lifetime, MSL) before entering the disconnected state. After receiving the confirmation from the client device, the server device enters the disconnected state.

[0141] During the TCP link establishment phase and the TCP connection closing phase, the proxy device needs to maintain a set of state machines like the client device and a set of state machines like the server device. Since each set of state machines includes many states, the states that the TCP proxy needs to maintain are too complex.

[0142] In terms of the window length control mechanism, the proxy device independently controls the window length in the CT segment and the TS segment. Since the TS segment is a wired network, the latency and packet loss rate are much better than the CT segment wireless network. Often, the number of messages confirmed by the TS segment proxy device far exceeds the CT segment demand, resulting in serious data traffic backlog in the proxy device and huge memory consumption.

[0143] In terms of the timer mechanism, the existing method is to use a timer driver to periodically scan all pending timed events, determine whether the timer has expired, and if so, process the relevant timed events. Its characteristics are that it requires a synchronous periodic trigger source to trigger the scan of all pending events, requires a multi-task execution environment, involves multi-task access, requires locking, and the business processing flow will be frequently interrupted. Task switching and cache misses will increase, which will seriously affect software performance.

[0144] Based on the problems in the prior art, the present application proposes the following technical concept: simplify the TCP proxy to reduce the requirements for the processing power and storage capacity of the proxy device, so that the proxy device with limited processing power and storage capacity can complete the functions and performance overhead of the TCP proxy.

[0145] The TCP proxy method provided by this application is introduced below in conjunction with specific embodiments.

[0146] Figure 4 A flowchart of a TCP proxy method provided in an embodiment of the present application. Figure 4 As shown, the method includes:

[0147] S401. Receive a first message sent by a first device.

[0148] The execution subject of the embodiment of the present application is a proxy device such as a base station, and can also be a TCP proxy device set in the proxy device. The TCP proxy device can be implemented by software or by a combination of software and hardware.

[0149] The first device may be a client device or a server device.

[0150] The first message may be a synchronization message, a synchronization confirmation message, a normal connection closing message and / or an abnormal connection closing message.

[0151] S402: Determine a target state according to the first message and the current state of the proxy device, where the target state is any one of the following: a link establishment state, a data transmission state, a first link deletion state, a second link deletion state, and a disconnected state.

[0152] During the TCP link establishment phase, the proxy device only needs to maintain the link establishment state and the data transmission state; during the TCP link closing phase, the proxy device only needs to maintain the first link deletion state and the second link deletion state.

[0153] In a possible implementation, if the first message is a synchronization message and the current state of the proxy device is a disconnected state, then the target state is determined to be a link establishment state.

[0154] In the link establishment state, the proxy device can establish a TCP link.

[0155] In a possible implementation manner, if the first message is a synchronization confirmation message and the current state of the proxy device is a link establishment state, then the target state is determined to be a data transmission state.

[0156] In the data transmission state, the proxy device can send and receive data with the client device and / or the server device.

[0157] In a possible implementation, if the first message is a normal connection closing message sent by the server device and the current state of the proxy device is a data transmission state, the target state is determined to be a first link deletion state.

[0158] In the first link deletion state, the proxy device can delete the TCP link.

[0159] In a possible implementation, if the first message is an abnormal connection closing message sent by the server device and the current state of the proxy device is a data transmission state, the target state is determined to be a second link deletion state.

[0160] In the second link deletion state, the proxy device can delete the TCP link.

[0161] In a possible implementation, if the first message is an abnormal connection closing message sent by the client device and the current state of the proxy device is a data transmission state, the target state is determined to be a disconnected state.

[0162] When receiving an abnormal connection closing message sent by the client device, the proxy device immediately clears the TCP proxy cache and deletes the TCP link, switching to a connectionless state.

[0163] S403: Switch from the current state to the target state.

[0164] In one possible implementation, when the proxy device switches to the target state, and the target state is the first link deletion state or the second link deletion state, the proxy device sends the data in the TCP proxy cache to the client device until the TCP proxy cache is cleared, and then deletes the TCP link and switches to the connectionless state.

[0165] exist Figure 4 In the embodiment shown, the proxy device receives a first message sent by a first device, the first device being a client device or a server device; determines a target state based on the first message and the current state of the proxy device, the target state being any one of the following: link establishment state, data transmission state, first link deletion state, second link deletion state, and no connection state; switches from the current state to the target state. In the embodiment of the present application, the proxy device connects the CT segment and the TS segment to jointly maintain a simplified state machine, which greatly reduces the maintenance complexity of the TCP proxy state machine, thereby reducing the processing capability requirements of the proxy device.

[0166] For ease of understanding, the switching of the proxy device state is explained below in conjunction with the TCP link establishment process and the TCP link closing process.

[0167] Figure 5 A schematic diagram of a TCP link establishment process provided in an embodiment of the present application. Figure 5 As shown, first, the client device in the disconnected state actively requests communication, sends a synchronization message (also called a connection request message) to the proxy device, and enters the synchronization sent state. After receiving the synchronization message sent by the client device, the proxy device in the disconnected state enters the link establishment state and sends a synchronization message to the server device.

[0168] Then, the server device in the disconnected state is passively opened and enters the listening state. After receiving the synchronization message in the listening state, it enters the synchronization received state and sends a synchronization confirmation message to the proxy device. After receiving the synchronization confirmation message sent by the server device, the proxy device enters the data transmission state and sends a synchronization confirmation message to the client device.

[0169] Finally, after the client device receives the synchronization confirmation message from the proxy device, it sends a confirmation message to the proxy device and enters the connection established state; after the proxy device receives the confirmation message sent by the client device, it sends a confirmation message to the server device. After receiving the confirmation message sent by the proxy device, the server device enters the connection established state.

[0170] After the TCP link is established, the proxy device performs data transmission with the client device and the server device respectively in the data transmission state.

[0171] It should be noted that Figure 5 Only a scenario in which the client device actively establishes a link is provided. The embodiments of the present application can also be used in a scenario in which the server device actively establishes a link, or even in a scenario in which the client device and the server device establish a link at the same time.

[0172] Figure 6 A schematic diagram of a TCP link closing process provided in an embodiment of the present application. Figure 6 As shown, first, the client device sends a normal connection close message to the proxy device and stops sending data. At this time, the client device enters the connection close sent state; after the proxy device receives the normal connection close message sent by the client device, it sends a normal connection close message to the server device.

[0173] Then, after receiving the normal connection close message sent by the proxy device, the server device sends a confirmation message to confirm the connection close and enters the connection close received state; after receiving the confirmation message sent by the server device, the proxy device sends a confirmation message to the client device; after receiving the confirmation message, the client device enters the connection close confirmed state and waits to receive the normal connection close message.

[0174] Next, the server device sends a normal connection close message and enters the waiting confirmation connection close state; after receiving the normal connection close message sent by the server device, the proxy device enters the first link deletion state, caches the normal connection close message, and sends the data in the TCP proxy cache to the client device until the TCP proxy cache is cleared, and then sends a normal connection close message to the client device.

[0175] Finally, after receiving the normal connection close message, the client device sends a confirmation message to confirm the connection close, and then enters the delayed connection close state. After 2MSL, it enters the connectionless state; after receiving the confirmation message, the proxy device sends a confirmation message to the server device, deletes the TCP link, and enters the connectionless state; after receiving the confirmation message, the server device enters the connectionless state.

[0176] Figure 7 Another flow chart of closing a TCP link provided in an embodiment of the present application. Figure 7 As shown, the server device sends an abnormal connection close message to the proxy device and enters the disconnected state. After receiving the abnormal connection close message sent by the server device, the proxy device enters the second link deletion state, caches the abnormal connection close message, stops confirming subsequent data from the server device, and continues to send data in the TCP proxy cache to the client device until the TCP proxy cache is cleared, and then sends an abnormal connection close message to the client device, deletes the TCP link, and enters the disconnected state. The client device enters the disconnected state after receiving the abnormal connection close message.

[0177] When the client device initiates an abnormal close, the client device sends an abnormal close connection message to the proxy device, and enters the disconnected state. After receiving the abnormal close connection message sent by the client device, the proxy device immediately clears the TCP proxy cache and sends an abnormal close connection message to the server device, and enters the disconnected state. After receiving the abnormal close connection message, the server device enters the disconnected state.

[0178] In the embodiment of the present application, the proxy device connects the CT segment and the TS segment to jointly maintain a simplified state machine. The state transition of the proxy device is as follows: Figure 8 As shown, only a few state transitions are involved, which reduces the processing capability requirements of the proxy device.

[0179] Based on any of the above embodiments, Fig. 9 Detailed description of the simplification of window length in the TCP proxy simplification process.

[0180] Fig. 9 A flowchart of another TCP proxy method provided in an embodiment of the present application. Fig. 9 , the method comprising:

[0181] S901. Send a second message to a server device, where the second message includes a first window length.

[0182] The second message may be a synchronization message.

[0183] The first window length may indicate a maximum data amount of the first data packet.

[0184] The first data packet is a data packet sent by the server device to the proxy device.

[0185] That is, the first window length indicates the maximum amount of data packets that the proxy device can receive.

[0186] First window length = min (second window length, theoretical maximum window length)

[0187] The second window length may indicate a theoretical maximum data size of the second data packet.

[0188] The second data packet is a data packet sent by the proxy device to the client device.

[0189] That is, the second window length indicates the theoretical maximum amount of data packets that the client device can receive.

[0190] The theoretical proxy maximum window length may indicate a theoretical maximum data volume of the first data packet.

[0191] The theoretical maximum TCP proxy window length can be calculated based on the wired side round trip time (RTT) and the service rate.

[0192] For example, when RTT=10 ms and service rate=2 Gbps, it can be calculated that the theoretical maximum TCP proxy window length=2.5 MB.

[0193] S902. Send a third message to the server device, where the third message includes a third window length.

[0194] The third message may be a confirmation message.

[0195] The third window length may indicate the data volume of the first data packet.

[0196] That is, the third window length indicates the amount of data packets that the proxy device can still receive.

[0197] The third window length satisfies the following formula:

[0198] Third window length = fourth window length - proxy cache data volume - window reduction amount formula (1)

[0199] Among them, the fourth window length indicates the data size of the second data packet, that is, the fourth window length indicates the data size of the data packet that the client device can still receive; the proxy cache data volume is the data volume in the TCP proxy cache of the proxy device, and the shrink window amount is a constant.

[0200] The third window length is ensured to be smaller than the fourth window length by reducing the window amount, so as to prevent the proxy device cache from being over-occupied.

[0201] When establishing a link, the proxy cache data volume is 0, the client device's confirmed transmission sequence number (TSN) = the proxy device's confirmed TSN, and the relationship between the various window lengths is as follows: Fig.10 As shown, that is:

[0202] First window length = second window length = fourth window length = third window length - window reduction amount

[0203] During data transmission, the amount of data cached by the client is greater than 0, and the amount of data cached by the proxy is greater than 0. At this time, the confirmation TSN of the client device is different from the confirmation TSN of the proxy device. The relationship between each window length and the confirmation TSN is as follows: Fig.11 As shown, that is:

[0204] Client cache data volume = client device confirmation TSN - client device submission TSN

[0205] Proxy cache data volume = Proxy device confirmation TSN - Client device confirmation TSN

[0206] The client device's confirmed TSN + the fourth window length = the proxy device's confirmed TSN + the third window length + the window reduction amount

[0207] The above formula can be deduced:

[0208] Third window length = fourth window length - proxy cache data volume - window reduction amount formula (1)

[0209] In a possible implementation, the window reduction amount=the second window length-the first window length.

[0210] The third window length is related to the fourth window length, the amount of proxy cache data and the amount of window reduction. When any of the three factors changes, the third window length needs to be updated, that is, the proxy device sends a confirmation message to the server device announcing the updated third window length.

[0211] Exemplarily, after receiving the confirmation message reported by the client device, the proxy device extracts the fourth window length in the confirmation message, substitutes the fourth window length into formula (1), calculates the third window length, generates a confirmation message and sends it to the server device to update the third window length.

[0212] In another example, when the proxy device receives the confirmation message reported by the client device, it updates the proxy cache data volume according to the TSN of the confirmed downlink data in the confirmation message, substitutes the proxy cache data volume into formula (1), calculates the third window length, generates a confirmation message and sends it to the server device to update the third window length.

[0213] In another example, when the proxy device receives a data message sent by the server device, if its TSN indicates that it is a sequential message (not out of order or retransmitted), the proxy cache data volume is updated, the proxy cache data volume is substituted into formula (1), the third window length is calculated, and a confirmation message is generated and sent to the server device to update the third window length.

[0214] As another example, if the window reduction amount is dynamically adjusted according to the amount of proxy cache data, the window reduction amount can be substituted into formula (1) to calculate the third window length, and a confirmation message is generated and sent to the server device to update the third window length.

[0215] Determining the third window length in the above manner has the following effects:

[0216] 1) End-to-end consistency is ensured as much as possible. Even if the proxy is stopped in the middle, the business continuity can be guaranteed without interruption, and the window consistency can be guaranteed;

[0217] 2) When the air interface is unobstructed, the client device has insufficient capacity or high speed (the air interface speed is not a bottleneck), the second window length fed back by the client device is small, which can reduce the amount of proxy cache data and reduce the cache pressure of the proxy device;

[0218] 3) In a constant low-rate scenario, the client device has a low cache size. Even if the third window grows, the actual rate is low, so the TCP proxy cache pressure on the proxy device is also small.

[0219] 4) In extreme air interface conditions (e.g., sudden deterioration of the air interface during high-speed downloading, requiring joint air interface judgment), it is necessary to timely perceive and update (reduce) the third window length in time through confirmation messages to avoid excessive pressure on the TCP proxy cache;

[0220] 5) Avoid the problem that the "supply" of TS segments is far greater than the "demand" of CT segments due to independent maintenance window lengths for CT segments, which in turn leads to serious memory consumption of proxy devices.

[0221] On the basis of any of the above embodiments, in order to improve software efficiency, for packet data convergence protocol (PDCP) and TCP proxy such message sending and receiving software, a vector packet processor (VPP)-like large loop framework is implemented. The embodiment of the present application combines the frame number and time slot number mechanism of the wireless software to design the following timeout scheme that matches the large loop software architecture, such as Fig.12 shown.

[0222] Fig.12 A flowchart of another TCP proxy method provided in an embodiment of the present application. Fig.12 , the method comprising:

[0223] S1201. Determine a timeout queue corresponding to each time slot in a frame period, where the timeout queue includes multiple timeout events.

[0224] For example, one frame period corresponds to 2048 half frames (5 ms), that is, to 20480 time slot numbers. Therefore, there are 20480 timeout queues in one frame period. Fig.13 shown.

[0225] Each timeout queue can be a doubly linked list, and any specified node can be quickly deleted or inserted.

[0226] A timeout event may refer to an event that should be executed after a timer times out.

[0227] In a possible implementation, the timeout queue corresponding to each time slot in a frame period may be determined in the following manner:

[0228] For any timer, determine the first half-frame number and the first time slot number corresponding to the start time of the timer; determine the second half-frame number and the second time slot number based on the first half-frame number, the first time slot number and the timing duration of the timer; add the timeout event corresponding to the timer to the timeout queue corresponding to the second half-frame number and the second time slot number.

[0229] Each half-frame number includes 10 time slot numbers, wherein the second time slot number is the time slot number within the second half-frame number.

[0230] Exemplarily, if the second half frame number is 0 and the second time slot number is 1, the timeout event corresponding to the timer is added to the timeout queue corresponding to the second time slot number under the second half frame number.

[0231] S1202: Determine a scanning period.

[0232] The scanning period may be a period between scanning times of two scanning events.

[0233] If the scanning time of the first scanning event is a, and the scanning time of the second scanning event is a+x, then the scanning period is [a, a+x].

[0234] Exemplarily, if the current moment corresponds to a scanning event, the period between the current moment and the last scanning moment is determined as the scanning period.

[0235] The duration x corresponding to the scanning period can be determined according to actual conditions. For example, x can be 2 ms.

[0236] The durations corresponding to the two scanning periods may be the same or different.

[0237] The timer timeout judgment logic may be called based on the PDCP large cycle period, and the scanning event may be determined according to the timer timeout judgment logic.

[0238] S1203: Process the timeout events in the multiple timeout queues corresponding to the scanning period.

[0239] The multiple timeout queues corresponding to the scanning period may refer to the timeout queues corresponding to the multiple time slot numbers corresponding to the scanning period.

[0240] Exemplarily, if the current moment corresponds to a scanning event, the half-frame number and time slot number corresponding to the current moment are obtained, compared with the half-frame number and time slot number corresponding to the previous scanning moment, and multiple interval time slot numbers corresponding to the scanning period are determined, and all timeout events in the timeout queue corresponding to the multiple interval time slot numbers are processed.

[0241] Each timer corresponds to a timeout timer control block, and the timeout event can be processed according to the control block information of each timeout timer. Each control block information includes at least one of the following:

[0242] 1) Timer start time;

[0243] 2) Timing duration;

[0244] 3) The processing function that needs to be called after timeout;

[0245] 4) All parameters required by the function.

[0246] The following are examples of processing different timers:

[0247] 1) CT segment data timeout retransmission timer: by counting the air interface RTT (after smoothing), if no message is received for more than 2 RTT, it triggers the timeout retransmission of the corresponding data.

[0248] 2) TCP proxy link keep-alive timer: When no data is received for a specified period of time in the TS segment, the timeout triggers the idle TCP proxy to be closed and the TCP proxy link to be deleted.

[0249] 3) Zero window length detection timer: When receiving a report from the client device that the second window length is 0, the timeout detection mechanism is started to prevent the client device from not updating the second window length for a long time or the update message is lost.

[0250] 4) TS segment confirmation delay confirmation timer: In order to improve confirmation efficiency and reduce the number of confirmation messages, a confirmation is sent after N messages are received continuously. However, it may result in not receiving N messages for a long time and being unable to confirm the last few messages. It is necessary to start the timer after receiving the first message. In addition, the TS segment confirmation delay confirmation timer can be reused in the RTT smoothing stage.

[0251] 5) TCP proxy delay close timer: After the proxy device receives the TCP proxy close message from the specified user, it starts a TCP proxy delay close timer based on the client device. After the timer expires, all TCP proxy links under the client device are set to TCP proxy close. Before the proxy delay close times out, each TCP thread performs the RTT smoothing strategy.

[0252] The timer mechanism under the large loop framework set by the frame number system based on the wireless software only scans and processes timeout events, without scanning all pending events, saving software overhead; and based on the large loop framework, business data will not be interrupted frequently, there is no task switching overhead, the cache hit rate is significantly improved, and there is no lock mechanism, avoiding the system overhead of locks.

[0253] Fig.14 A schematic diagram of the structure of a TCP proxy device provided in an embodiment of the present application. Fig.14 As shown, the device includes: a memory 1410 , a transceiver 1420 and a processor 1430 .

[0254] Memory 1410, used for storing computer programs;

[0255] A transceiver 1420, configured to transmit and receive data under the control of the processor;

[0256] The processor 1430 is configured to read the computer program in the memory and perform the following operations:

[0257] Receiving a first message sent by a first device, where the first device is a client device or a server device;

[0258] Determine a target state according to the first message and the current state of the proxy device, where the target state is any one of the following: a link establishment state, a data transmission state, a first link deletion state, a second link deletion state, and a connectionless state;

[0259] Switch from the current state to the target state.

[0260] In one implementation, the processor 1430 is specifically configured to perform the following operations:

[0261] If the first message is a synchronization message and the current state is a disconnected state, then the target state is determined to be a link establishment state; or,

[0262] If the first message is a synchronization confirmation message and the current state is a link establishment state, then the target state is determined to be a data transmission state; or,

[0263] If the first message is a normal connection closing message sent by the server device, and the current state is a data transmission state, then the target state is determined to be a first link deletion state; or,

[0264] If the first message is an abnormal connection closing message sent by the server device, and the current state is a data transmission state, then the target state is determined to be a second link deletion state; or,

[0265] If the first message is an abnormal connection closing message sent by the client device and the current state is a data transmission state, the target state is determined to be a disconnected state.

[0266] In one implementation, when the target state is the first link deletion state or the second link deletion state, the processor 1330 is further configured to perform the following operations:

[0267] Send the data in the TCP proxy cache to the client device until the TCP proxy cache is cleared;

[0268] Delete the TCP link and switch to the connectionless state.

[0269] In one implementation, the processor 1330 is further configured to perform the following operations:

[0270] A second message is sent to the server device, where the second message includes the first window length, and the first window length satisfies the following formula:

[0271] First window length = min (second window length, theoretical maximum window length)

[0272] Among them, the first window length indicates the maximum data volume of the first data packet, the first data packet is a data packet sent by the server device to the proxy device, the second window length indicates the theoretical maximum data volume of the second data packet, the second data packet is a data packet sent by the proxy device to the client device, and the theoretical proxy maximum window length indicates the theoretical maximum data volume of the first data packet.

[0273] In one implementation, the processor 1430 is further configured to perform the following operations:

[0274] Sending a third message to the server device, where the third message includes a third window length, and the third window length indicates the data amount of the first data packet;

[0275] Among them, the third window length satisfies the following formula:

[0276] The third window length = the fourth window length - the amount of proxy cache data - the amount of window reduction

[0277] The fourth window length indicates the data volume of the second data packet, the proxy cache data volume is the data volume in the TCP proxy cache of the proxy device, and the window reduction amount is a constant.

[0278] In one implementation, the window reduction amount is the difference between the second window length and the first window length.

[0279] In one implementation, the processor 1430 is further configured to perform the following operations:

[0280] Determine a timeout queue corresponding to each time slot in a frame period, the timeout queue including multiple timeout events;

[0281] Determine the scanning period;

[0282] The timeout events in the multiple timeout queues corresponding to the scanning period are processed.

[0283] In one implementation, the processor 1430 is specifically configured to perform the following operations:

[0284] For any timer, determine the first half frame number and the first time slot number corresponding to the start time of the timer;

[0285] Determine the second half frame number and the second time slot number according to the first half frame number, the first time slot number and the timing duration of the timer;

[0286] The timeout event corresponding to the timer is added to the timeout queue corresponding to the second half frame number and the second time slot number.

[0287] Among them, Fig.14In the embodiment, the bus architecture may include any number of interconnected buses and bridges, specifically one or more processors represented by processor 1430 and various circuits of memory represented by memory 1410 are linked together. The bus architecture may also link together various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. The bus interface provides an interface. The transceiver 1420 may be a plurality of components, namely, a transmitter and a receiver, providing a unit for communicating with various other devices on a transmission medium, which transmission medium may include a wireless channel, a wired channel, an optical cable, and other transmission media. The processor 1430 is responsible for managing the bus architecture and general processing, and the memory 1410 may store data used by the processor 1430 when performing operations.

[0288] The processor 1430 may be a central processing unit (CPU), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or a complex programmable logic device (CPLD). The processor may also adopt a multi-core architecture.

[0289] It should be noted here that the above-mentioned device provided in the present application can implement all the method steps in the above-mentioned method embodiment and can achieve the same technical effect. The parts and beneficial effects of this embodiment that are the same as the method embodiment will not be described in detail here.

[0290] Fig.15 A schematic diagram of the structure of another TCP proxy device provided in an embodiment of the present application. Fig.15 As shown, the device is applied to a proxy device, and the device includes:

[0291] The receiving unit 1510 is configured to receive a first message sent by a first device, where the first device is a client device or a server device;

[0292] The first determining unit 1520 is configured to determine a target state according to the first message and the current state of the proxy device, where the target state is any one of the following: a link establishment state, a data transmission state, a first link deletion state, a second link deletion state, and a disconnected state;

[0293] The switching unit 1530 is used to switch from the current state to the target state.

[0294] In one implementation, the first determining unit 1520 is specifically configured to:

[0295] If the first message is a synchronization message and the current state is a disconnected state, then the target state is determined to be a link establishment state; or,

[0296] If the first message is a synchronization confirmation message and the current state is a link establishment state, then the target state is determined to be a data transmission state; or,

[0297] If the first message is a normal connection closing message sent by the server device, and the current state is a data transmission state, then the target state is determined to be a first link deletion state; or,

[0298] If the first message is an abnormal connection closing message sent by the server device, and the current state is a data transmission state, then the target state is determined to be a second link deletion state; or,

[0299] If the first message is an abnormal connection closing message sent by the client device and the current state is a data transmission state, the target state is determined to be a disconnected state.

[0300] In one implementation, when the target state is the first link deletion state or the second link deletion state, the device further includes:

[0301] A first sending unit, configured to send data in a TCP proxy cache to a client device until the TCP proxy cache is cleared;

[0302] The deletion unit is used to delete the TCP link and switch to a connectionless state.

[0303] In one embodiment, the device further includes a second sending unit, and the second sending unit is configured to:

[0304] A second message is sent to the server device, where the second message includes the first window length, and the first window length satisfies the following formula:

[0305] First window length = min (second window length, theoretical maximum window length)

[0306] Among them, the first window length indicates the maximum data volume of the first data packet, the first data packet is a data packet sent by the server device to the proxy device, the second window length indicates the theoretical maximum data volume of the second data packet, the second data packet is a data packet sent by the proxy device to the client device, and the theoretical proxy maximum window length indicates the theoretical maximum data volume of the first data packet.

[0307] In one embodiment, the device further includes a third sending unit, and the third sending unit is configured to:

[0308] Sending a third message to the server device, where the third message includes a third window length, and the third window length indicates the data amount of the first data packet;

[0309] Among them, the third window length satisfies the following formula:

[0310] The third window length = the fourth window length - the amount of proxy cache data - the amount of window reduction

[0311] The fourth window length indicates the data volume of the second data packet, the proxy cache data volume is the data volume in the TCP proxy cache of the proxy device, and the window reduction amount is a constant.

[0312] In one implementation, the window reduction amount is the difference between the second window length and the first window length.

[0313] In one embodiment, the device further comprises:

[0314] A second determining unit is used to determine a timeout queue corresponding to each time slot in a frame period, where the timeout queue includes multiple timeout events;

[0315] A third determining unit, configured to determine a scanning period;

[0316] The processing unit is used to process timeout events in multiple timeout queues corresponding to the scanning period.

[0317] In one implementation, the second determining unit is further configured to:

[0318] For any timer, determine the first half frame number and the first time slot number corresponding to the start time of the timer;

[0319] Determine the second half frame number and the second time slot number according to the first half frame number, the first time slot number and the timing duration of the timer;

[0320] The timeout event corresponding to the timer is added to the timeout queue corresponding to the second half frame number and the second time slot number.

[0321] It should be noted that the division of units in the embodiments of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional unit in each embodiment of the present application may be integrated into a processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0322] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a processor-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program codes.

[0323] It should be noted here that the above-mentioned device provided in the present application can implement all the method steps implemented in the above-mentioned method embodiment, and can achieve the same technical effect. The parts and beneficial effects of this embodiment that are the same as the method embodiment will not be described in detail here.

[0324] An embodiment of the present application further provides a processor-readable storage medium, wherein the processor-readable storage medium stores a computer program, and the computer program is used to enable a processor to execute the method described in any one of the above method embodiments.

[0325] The processor-readable storage medium can be any available medium or data storage device that can be accessed by a computer, including but not limited to magnetic storage (such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc.), optical storage (such as CD, DVD, BD, HVD, etc.), and semiconductor storage (such as ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH), solid-state drive (SSD)), etc.

[0326] An embodiment of the present application also provides a computer program product, including a computer program, which implements the method described in any one of the above method embodiments when the computer program is executed by a processor.

[0327] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) that contain computer-usable program code.

[0328] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer executable instructions. These computer executable instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0329] These processor executable instructions may also be stored in a processor readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the processor readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0330] These processor-executable instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0331] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A Transmission Control Protocol TCP proxy method, characterized in that: Applied to a proxy device, the method comprises: Receiving a first message sent by a first device, where the first device is a client device or a server device; Determine a target state according to the first message and the current state of the proxy device, where the target state is any one of the following: a link establishment state, a data transmission state, a first link deletion state, a second link deletion state, and a connectionless state; Switch from the current state to the target state.

2. The method according to claim 1, characterized in that: Determining a target state according to the first message and the current state of the proxy device includes: If the first message is a synchronization message and the current state is the disconnected state, determining the target state to be the link establishment state; or, If the first message is a synchronization confirmation message and the current state is the link establishment state, determining that the target state is the data transmission state; or, If the first message is a normal connection closing message sent by the server device, and the current state is the data transmission state, determining that the target state is the first link deletion state; or, If the first message is an abnormal connection closing message sent by the server device, and the current state is the data transmission state, determining that the target state is the second link deletion state; or, If the first message is an abnormal connection closing message sent by the client device and the current state is the data transmission state, the target state is determined to be the disconnected state.

3. The method according to claim 2, characterized in that When the target state is the first link deletion state or the second link deletion state, the method further includes: Sending data in the TCP proxy cache to the client device until the TCP proxy cache is cleared; The TCP link is deleted and switched to the connectionless state.

4. The method according to claim 1, characterized in that: The method further comprises: Send a second message to the server device, where the second message includes a first window length, and the first window length satisfies the following formula: First window length = min (second window length, theoretical maximum window length) Among them, the first window length indicates the maximum data volume of the first data packet, the first data packet is the data packet sent by the server device to the proxy device, the second window length indicates the theoretical maximum data volume of the second data packet, the second data packet is the data packet sent by the proxy device to the client device, and the theoretical proxy maximum window length indicates the theoretical maximum data volume of the first data packet.

5. The method according to claim 4, characterized in that The method further comprises: Sending a third message to the server device, wherein the third message includes a third window length, and the third window length indicates the data amount of the first data packet; Wherein, the third window length satisfies the following formula: The third window length = the fourth window length - the amount of proxy cache data - the amount of window reduction The fourth window length indicates the data size of the second data packet, the proxy cache data size is the data size in the TCP proxy cache of the proxy device, and the shrinking window size is a constant.

6. The method according to claim 5, characterized in that The window reduction amount is the difference between the second window length and the first window length.

7. The method according to claim 1, characterized in that The method further comprises: Determine a timeout queue corresponding to each time slot in a frame period, wherein the timeout queue includes a plurality of timeout events; Determine the scanning period; The timeout events in the multiple timeout queues corresponding to the scanning period are processed.

8. The method according to claim 7, characterized in that Determine the timeout queue corresponding to each time slot in a frame period, including: For any timer, determine the first half frame number and the first time slot number corresponding to the start time of the timer; Determine a second half frame number and a second time slot number according to the first half frame number, the first time slot number, and the timing duration of the timer; Add the timeout event corresponding to the timer to the timeout queue corresponding to the second half-frame number and the second time slot number.

9. A Transmission Control Protocol TCP proxy device, characterized in that: Applied to a proxy device, the device comprises: a memory, a transceiver and a processor, The memory is used to store a computer program; the transceiver is used to send and receive data under the control of the processor; the processor is used to read the computer program in the memory and perform the following operations: Receiving a first message sent by a first device, where the first device is a client device or a server device; Determine a target state according to the first message and the current state of the proxy device, where the target state is any one of the following: a link establishment state, a data transmission state, a first link deletion state, a second link deletion state, and a connectionless state; Switch from the current state to the target state.

10. The device according to claim 9, characterized in that The processor is specifically configured to perform the following operations: If the first message is a synchronization message and the current state is the disconnected state, determining the target state to be the link establishment state; or, If the first message is a synchronization confirmation message and the current state is the link establishment state, determining that the target state is the data transmission state; or, If the first message is a normal connection closing message sent by the server device, and the current state is the data transmission state, determining that the target state is the first link deletion state; or, If the first message is an abnormal connection closing message sent by the server device, and the current state is the data transmission state, determining that the target state is the second link deletion state; or, If the first message is an abnormal connection closing message sent by the client device and the current state is the data transmission state, the target state is determined to be the disconnected state.

11. The device according to claim 10, characterized in that When the target state is the first link deletion state or the second link deletion state, the processor is further configured to perform the following operations: Sending data in the TCP proxy cache to the client device until the TCP proxy cache is cleared; The TCP link is deleted and switched to the connectionless state.

12. The device according to claim 9, characterized in that The processor is further configured to perform the following operations: Send a second message to the server device, where the second message includes a first window length, and the first window length satisfies the following formula: First window length = min (second window length, theoretical maximum window length) Among them, the first window length indicates the maximum data volume of the first data packet, the first data packet is the data packet sent by the server device to the proxy device, the second window length indicates the theoretical maximum data volume of the second data packet, the second data packet is the data packet sent by the proxy device to the client device, and the theoretical proxy maximum window length indicates the theoretical maximum data volume of the first data packet.

13. The device according to claim 12, characterized in that The processor is further configured to perform the following operations: Sending a third message to the server device, wherein the third message includes a third window length, and the third window length indicates the data amount of the first data packet; Wherein, the third window length satisfies the following formula: The third window length = the fourth window length - the amount of proxy cache data - the amount of window reduction The fourth window length indicates the data size of the second data packet, the proxy cache data size is the data size in the TCP proxy cache of the proxy device, and the shrinking window size is a constant.

14. The device according to claim 13, characterized in that The window reduction amount is the difference between the second window length and the first window length.

15. The device according to claim 9, characterized in that The processor is further configured to perform the following operations: Determine a timeout queue corresponding to each time slot in a frame period, wherein the timeout queue includes a plurality of timeout events; Determine the scanning period; The timeout events in the multiple timeout queues corresponding to the scanning period are processed.

16. The device according to claim 15, characterized in that The processor is specifically configured to perform the following operations: For any timer, determine the first half frame number and the first time slot number corresponding to the start time of the timer; Determine a second half frame number and a second time slot number according to the first half frame number, the first time slot number, and the timing duration of the timer; Add the timeout event corresponding to the timer to the timeout queue corresponding to the second half-frame number and the second time slot number.

17. A Transmission Control Protocol TCP proxy device, characterized in that: Applied to a proxy device, the device comprises: A receiving unit, configured to receive a first message sent by a first device, where the first device is a client device or a server device; a determining unit, configured to determine a target state according to the first message and the current state of the proxy device, wherein the target state is any one of the following: a link establishment state, a data transmission state, a first link deletion state, a second link deletion state, and a connectionless state; A switching unit is used to switch from the current state to the target state.

18. A processor-readable storage medium, characterized in that: The processor-readable storage medium stores a computer program, and the computer program is used to enable the processor to execute the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • A TCP proxy providing application layer modifications

    CA2392097A1

  • Method and device for processing TCP connection

    CN101547210A

  • Transmission data processing method and device

    CN114301996A

  • One-way proxy system

    US20060248582A1

  • Network Connection Hand-Off and Hand-Back

    US20140095592A1