Search

CN-122002648-A - TCP connection release method, device, equipment and medium

CN122002648ACN 122002648 ACN122002648 ACN 122002648ACN-122002648-A

Abstract

The present disclosure relates to a method, an apparatus, a device, and a medium for releasing a TCP connection, where when a preset time period is reached, the number information of data packets transmitted by a target TCP connection within a preset time period is obtained, and when the number of data packets transmitted by the target TCP connection within the preset time period is zero, the target TCP connection is released. The TCP connection can be released without four handshakes, so that the release efficiency of the TCP connection is improved, and the system overhead is reduced. And whether the number of data packets transmitted by the target TCP connection in the preset time length is zero or not is judged, so that the invalid TCP connection without data can be accurately identified, and the false release is avoided.

Inventors

  • WANG JUNFENG
  • YUAN WEI
  • DI PENG

Assignees

  • 北京金山云网络技术有限公司

Dates

Publication Date
20260508
Application Date
20241108

Claims (10)

  1. 1. A method of releasing a TCP connection, the method comprising: Acquiring the quantity information of data packets transmitted by a target TCP connection in a preset time length in response to reaching a preset time period; And responding to the number of data packets transmitted by the target TCP connection within the preset time length to be zero, and releasing the target TCP connection.
  2. 2. The method according to claim 1, wherein the method further comprises: and responding to the data packets transmitted by the target TCP connection within the preset time length to be zero, and sending a notification message to opposite terminal equipment of the target TCP connection, wherein the notification message is used for notifying the opposite terminal equipment to release the target TCP connection.
  3. 3. The method of claim 1, wherein the step of determining the position of the substrate comprises, The time period is obtained through configuration of a system function interface; Or alternatively The time period is configured by a device-level process interface.
  4. 4. The method of claim 1, wherein the method further comprises, prior to obtaining the number of packets transmitted by the target TCP connection within the predetermined length of time in response to reaching the predetermined period of time: And establishing the target TCP connection based on the connection establishment request, and configuring a timer, wherein the timer is used for monitoring whether the time period is reached.
  5. 5. A release device for a TCP connection, comprising: The acquisition module is used for responding to the preset time period, and acquiring the quantity information of the data packets transmitted by the target TCP connection in the preset time length; And the execution module is used for responding to the zero number of the data packets transmitted by the target TCP connection within the preset time length and releasing the target TCP connection.
  6. 6. The apparatus as recited in claim 5, further comprising: And the notification module is used for responding to zero number of data packets transmitted by the target TCP connection within the preset time length, sending a notification message to opposite terminal equipment of the target TCP connection, and notifying the opposite terminal equipment of releasing the target TCP connection by the notification message.
  7. 7. The apparatus of claim 5, wherein the device comprises a plurality of sensors, The time period is obtained through configuration of a system function interface; Or alternatively The time period is configured by a device-level process interface.
  8. 8. The apparatus as recited in claim 5, further comprising: And the processing module is used for establishing the target TCP connection based on the connection establishment request and configuring a timer, and the timer is used for monitoring whether the time period is reached.
  9. 9. A computer device, comprising: A memory; processor, and A computer program; Wherein the computer program is stored in the memory and configured to be executed by the processor to implement the method of any of claims 1-4.
  10. 10.A computer readable storage medium having stored thereon a computer program, wherein the computer program when executed by a processor implements the method of any of claims 1-4.

Description

TCP connection release method, device, equipment and medium Technical Field The disclosure relates to the technical field of TCP connection management, and in particular, to a method, a device, equipment and a medium for releasing a TCP connection. Background The transmission control protocol (Transmission Control Protocol, TCP for short) is a connection-oriented, byte-stream based transport layer communication protocol. In existing content delivery network (Content Delivery Network, CDN) traffic, a large number of invalid TCP connections without data are created. And invalid TCP connection can be released only through four handshakes, so that the system overhead is increased. Disclosure of Invention In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a method, an apparatus, a device, and a medium for releasing a TCP connection. In a first aspect, an embodiment of the present disclosure provides a method for releasing a TCP connection, including: Acquiring the quantity information of data packets transmitted by a target TCP connection in a preset time length in response to reaching a preset time period; And responding to the number of data packets transmitted by the target TCP connection within the preset time length to be zero, and releasing the target TCP connection. In some embodiments, the method provided in the first aspect further comprises: and responding to the data packets transmitted by the target TCP connection within the preset time length to be zero, and sending a notification message to opposite terminal equipment of the target TCP connection, wherein the notification message is used for notifying the opposite terminal equipment to release the target TCP connection. In some embodiments, the time period is configured by a system function interface; Or alternatively The time period is configured by a device-level process interface. In some implementations, before the obtaining, in response to reaching the preset time period, the number information of the data packets transmitted by the target TCP connection in the preset time period, the method provided in the first aspect further includes: And establishing the target TCP connection based on the connection establishment request, and configuring a timer, wherein the timer is used for monitoring whether the time period is reached. In a second aspect, an embodiment of the present disclosure provides a release device for a TCP connection, including: The acquisition module is used for responding to the preset time period, and acquiring the quantity information of the data packets transmitted by the target TCP connection in the preset time length; And the execution module is used for responding to the zero number of the data packets transmitted by the target TCP connection within the preset time length and releasing the target TCP connection. In some embodiments, the apparatus provided in the second aspect may further include: And the notification module is used for responding to zero number of data packets transmitted by the target TCP connection within the preset time length, sending a notification message to opposite terminal equipment of the target TCP connection, and notifying the opposite terminal equipment of releasing the target TCP connection by the notification message. In some embodiments, the time period is configured by a system function interface; Or alternatively The time period is configured by a device-level process interface. In some embodiments, the apparatus provided in the second aspect may further include: And the processing module is used for establishing the target TCP connection based on the connection establishment request and configuring a timer, and the timer is used for monitoring whether the time period is reached. In a third aspect, embodiments of the present disclosure provide a computer device comprising: A memory; processor, and A computer program; Wherein the computer program is stored in the memory and configured to be executed by the processor to implement the method according to the first aspect. In a fourth aspect, embodiments of the present disclosure provide a computer-readable storage medium having stored thereon a computer program for execution by a processor to implement the method of the first aspect. According to the method, the device, the equipment and the medium for releasing the TCP connection, when the preset time period is reached, the quantity information of the data packets transmitted by the target TCP connection in the preset time length is obtained, and when the quantity of the data packets transmitted by the target TCP connection in the preset time length is zero, the target TCP connection is released. The TCP connection can be released without four handshakes, so that the release efficiency of the TCP connection is improved, and the system overhead is reduced. And whether the number of data packets transmitted