A method and device for monitoring based on a socket connection state

By introducing a listening server and keep-alive mechanism into the Socket connection, combined with authentication and TCP window updates, the security and quality of service issues of the Socket connection are resolved, and the reliability of the connection state and data recovery capability are achieved.

CN116614546BActive Publication Date: 2025-12-12BEIJING TOPSEC NETWORK SECURITY TECH +2
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310587246.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-23
Publication Date
2025-12-12
Estimated Expiration
2043-05-23

AI Technical Summary

Technical Problem

Existing technologies have low security and poor service quality for Socket connections, fail to effectively control the total number of Socket connections, and cannot restore established connections and continue data transmission after server crashes or restarts.

Method used

By introducing a listening server between the client and the server to monitor the socket connection status, using keep-alive packets and authentication mechanisms to limit the total number of connections, recovering unsynchronized data after server failure, and adjusting the data transmission speed using TCP window update operations.

Benefits of technology

It improves the security and reliability of Socket connections, reduces server resource consumption, enhances service quality, and restores data transmission after server failure, preventing read/write errors and connection loss.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116614546B_ABST
    Figure CN116614546B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a kind of based on Socket connection state's monitoring method and device, the monitoring method includes: after at least one client and server establish socket connection: receiving the keep-alive packet sent by each client in the at least one client;The keep-alive packet is forwarded to the server;In the data message transmission process of the at least one client and the server by the socket connection, the total number of all socket connections established with the server is monitored.The embodiment of the application is for server-side WebSocket monitoring mechanism, and a kind of based on Socket connection state's monitoring device and method are designed, and the method can improve the security and reliability of socket connection.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of network communication, in particular, the embodiments of the present application relate to a listening method and device based on Socket connection state. BACKGROUND

[0002] In the era of the development of network, network programming using Socket is indispensable, and how to efficiently guarantee the security and reliability of Socket connection is the primary consideration.

[0003] The Socket connection of the related technical solution has the technical problems of low security and poor service quality. SUMMARY

[0004] The embodiments of the present application aim to provide a listening method and device based on Socket connection state, and the embodiments of the present application are designed for the server-side WebSocket listening mechanism, and a listening device and method based on Socket connection state are designed, which can improve the security and reliability of socket connection.

[0005] In the first aspect, the embodiments of the present application provide a listening method based on Socket connection state, which comprises the following steps: after at least one client establishes a socket connection with a server: receiving a keep-alive packet sent by each client in the at least one client; forwarding the keep-alive packet to the server; monitoring the total number of all socket connections established with the server in the process of transmitting data packets between the at least one client and the server through the socket connection.

[0006] Compared with the related technical solution, the embodiments of the present application increase the keep-alive packet of both ends of the socket connection to improve the reliability of Socket connection, and use the server-side WebSocket listening connection mechanism to effectively control the number of server-side Socket connections, limit the total number of Socket connections established by the client, and reduce the resource consumption of the server.

[0007] In some embodiments, before the at least one client establishes a socket connection with the server, the method further comprises: receiving user information from each client in the at least one client; and confirming that the user information passes identity authentication.

[0008] Some embodiments of the present application also need to authenticate the client that establishes a socket connection with the server, and check the authority of the user information requested by the client to WebSocket connection, so as to improve the security of Socket connection.

[0009] In some embodiments, the user information comprises a user name, a user password, a client IP address and a client port number.

[0010] In some embodiments, the method further comprises closing at least one of the socket connections if the total number is confirmed to exceed a set threshold.

[0011] Some embodiments of the present application automatically close at least one connection when the total number of socket connections established by the server is monitored to be greater than a set threshold, thereby improving the service quality of the server.

[0012] In some embodiments, the keep-alive packet is periodically generated and sent by the corresponding client.

[0013] Some embodiments of the present application periodically generate keep-alive packets to monitor the connection status of the client and the server, so as to immediately cut off the socket connection established on the server by the disconnected client.

[0014] In some embodiments, before the at least one client transmits the data packet through the socket connection, the method further comprises simulating a TCP window update operation when the server writes a file to a disk, and sending a receiving speed packet to each of the at least one client, wherein the receiving speed packet is used to inform the each client to adjust the sending speed.

[0015] In some embodiments of the present application, in order to avoid C1 abnormal disconnection or file content loss caused by read timeout, write error or TCP zero window problem due to mismatch between socket read and write speeds during data transmission using socket connection, a receiving speed packet needs to be provided to each client first, which provides the speed parameter of the server receiving data packet.

[0016] In some embodiments, the receiving speed packet comprises a total number of sent files of the current connection, a number of processed files, a size of a receiving end buffer and a receiving speed of the receiving end.

[0017] In some embodiments, the method further comprises storing the to-be-processed data packet caused by the server failure into a failure retry table, and re-establishing a socket connection to scan the failure retry table to recover the to-be-processed data packet.

[0018] Some embodiments of the present application enable the server to recover the established socket connection and continue to transmit the unsynchronized data before the server is down or restarted, and increase the user re-authentication fault tolerance mechanism.

[0019] In a second aspect, some embodiments of the present application provide a socket connection state-based monitoring device, which comprises: a user keep-alive module configured to receive keep-alive packets from clients and forward the keep-alive packets to a server; and a user data transmission module configured to monitor a total number of socket connections of the server during data transmission between each client establishing a socket connection with the server and the server.

[0020] In some embodiments, the user data transmission module is further configured to simulate a TCP window update operation when the server writes a file to a disk, and send a receiving speed packet to each client establishing a socket connection with the server, respectively, wherein the receiving speed packet is used to inform the each client to adjust a sending speed.

[0021] In some embodiments, the monitoring device further comprises a user identity verification module configured to authenticate a client identity.

[0022] In some embodiments, the monitoring device further comprises an unsynchronized data recording module configured to store pending data messages due to server failure, wherein the pending data messages are used to complete data transmission after reestablishing a socket connection with the server.

[0023] In a third aspect, some embodiments of the present application provide a data transmission system, which comprises: at least one client configured to send a socket connection establishment request, send keep-alive packets, and send data transmission messages; a server configured to: establish a socket connection with a corresponding client in response to a received socket connection request; confirm whether to cut off at least one socket connection in response to all received keep-alive packets; complete data message transmission with the corresponding client; and a socket connection state-based monitoring device configured to: complete identity authentication of the at least one client; authenticate the identity of a corresponding client and provide a corresponding socket connection request to the server after identity authentication is passed in response to the socket connection request from the client; send the keep-alive packets to the server in response to the received keep-alive packets; simulate a TCP window update operation when the server writes a file to a disk, and send a receiving speed packet to each client in the at least one client, respectively, wherein the receiving speed packet is used to inform the each client to adjust a sending speed; and send data transmission messages to the server of a corresponding socket connection in response to the received data transmission messages. BRIEF DESCRIPTION OF DRAWINGS

[0024] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments of the present application. It should be understood that the following drawings only show some of the embodiments of the present application, and therefore should not be regarded as a limitation to the scope, and for those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.

[0025] Figure 1 The system architecture diagram based on the Socket connection provided for the embodiments of the present application;

[0026] Figure 2 One of the flowcharts of the monitoring method based on the Socket connection state provided for the embodiments of the present application;

[0027] Figure 3 The flowchart two of the monitoring method based on the Socket connection state provided for the embodiments of the present application;

[0028] Figure 4 The component block diagram of the monitoring device based on the Socket connection state provided for the embodiments of the present application;

[0029] Figure 5 The schematic diagram of the electronic device provided for the embodiments of the present application. DETAILED DESCRIPTION

[0030] The technical solutions in the embodiments of the present application will be described below in combination with the drawings in the embodiments of the present application.

[0031] It should be noted that: similar labels and letters represent similar items in the following drawings, and therefore, once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings. Meanwhile, in the description of the present application, the terms "first", "second", etc. are only used for distinguishing description, and cannot be understood as indicating or implying relative importance.

[0032] The inventors of the present application found in the research that the prior art at least has the following technical defects: first, the related art does not perform permission verification on the user information of the user requesting the WebSocket connection, and cannot prevent the illegal user from establishing the Socket connection by forging the client IP address; second, the related art does not limit the total number of the Socket connections established between the first server in the external network and the second server in the external network, and cannot guarantee the resource utilization rate and the service quality of the server; third, the related art does not have the fault-tolerant mechanism for recovering the established Socket connection after the server is down and restarted, and continuing to transmit the data not synchronized before, and cannot guarantee the integrity and consistency of the data.

[0033] At least to solve the above technical problems, the server of some embodiments of the present application limits the total number of socket connections established by the client, preventing excessive socket connections from occupying server resources. The server of some embodiments of the present application performs authority verification on user information requested by the client to establish a WebSocket connection, preventing illegal users from establishing socket connections. The server of some embodiments of the present application can recover the established socket connection after a crash or restart and continue to transmit the unsynchronized data before, increasing the user re-authentication fault tolerance mechanism. The client and the server of some embodiments of the present application can avoid problems such as read timeout and write error caused by the difference between read and write speeds when performing socket read and write operations.

[0034] Please refer to Figure 1 , Figure 1 The socket connection-based system of some embodiments of the present application is different from related technologies in that some embodiments of the present application add a socket connection-based monitoring server (i.e., the monitoring server 120 of Figure 1 ) between the client (i.e., the first client 110 of Figure 1 ) and the server (i.e., the second server 130 of Figure 1 ) that needs to establish a socket connection, wherein the monitoring server 120 is used to monitor the state of the socket connection.

[0035] It should be noted that the socket connection state-based monitoring method of some embodiments of the present application runs on the monitoring server 120 of Figure 1 .

[0036] The socket connection state-based monitoring method executed by the monitoring server 120 is described below.

[0037] As shown in Figure 2 , the present application provides a socket connection state-based monitoring method, which comprises: after at least one client and a server establish a socket connection, S101, receiving a keep-alive packet sent by each client in the at least one client; S102, forwarding the keep-alive packet to the server; S103, monitoring the total number of all socket connections established with the server in the process of transmitting data packets between the at least one client and the server through the socket connection.

[0038] It is understandable that, compared with the related technical solutions, the embodiments of the present application increase the keep-alive packet at both ends of the socket connection to improve the reliability of the socket connection, and use the server-side WebSocket connection listening mechanism to effectively control the number of server-side socket connections, limit the total number of client-side socket connections, and reduce the resource consumption of the server.

[0039] It should be noted that, in order to improve the security of the socket connection, in some embodiments of the present application, before the at least one client establishes a socket connection with the server, the method further comprises: receiving user information from each of the at least one client; and confirming that the user information passes identity authentication. For example, in some embodiments of the present application, the user information includes: a user name, a user password, a client IP address, and a client port number. That is, some embodiments of the present application also need to authenticate the client that establishes a socket connection with the server, and check the authority of the user information requested by the client to establish a WebSocket connection, to improve the security of the socket connection.

[0040] In order to further improve the service quality of the server, in some embodiments of the present application, the socket connection state-based monitoring method further comprises: if it is confirmed that the total number exceeds a set threshold, closing at least one of the socket connections. For example, in some embodiments of the present application, the keep-alive packet is periodically generated and sent by the corresponding client.

[0041] It is understandable that, in some embodiments of the present application, the keep-alive packet is periodically generated, and the connection state of the client and the server is monitored, so as to immediately cut off the socket connection that has been established on the server by the disconnected client. When it is monitored that the total number of socket connections established by the server is greater than a set threshold, at least one connection will be automatically closed, thereby improving the service quality of the server.

[0042] To avoid the client abnormal disconnection or file content loss caused by read timeout, write error or TCP zero window problem due to the mismatch of Socket read and write speed, in some embodiments of the present application, before the at least one client and the server transmit the data packet through the socket connection, the method further comprises: simulating a TCP window update operation when the server writes a file to the disk, and sending a receiving speed packet to each of the at least one client, wherein the receiving speed packet is used to inform the each client to adjust the sending speed. For example, in some embodiments of the present application, the receiving speed packet comprises: the total number of files sent by the current connection, the number of processed files, the size of the receiving end buffer and the receiving speed of the receiving end. Some embodiments of the present application need to provide the speed parameters of the server receiving data packet to each client, i.e. provide the receiving speed packet, during the process of data transmission by socket connection.

[0043] To realize the resumption of the established Socket connection and the continuous transmission of the unsynchronized data before the server is restarted after a crash, in some embodiments of the present application, the method further comprises: storing the to-be-processed data packet caused by the server failure into a failure retry table; re-establishing the Socket connection and scanning the failure retry table to recover the to-be-processed data packet. That is, the server of some embodiments of the present application can resume the established Socket connection and continue to transmit the unsynchronized data before the server is restarted after a crash, and increase the user re-authentication fault tolerance mechanism.

[0044] The following will be described in conjunction with Figure 3 The Socket connection state monitoring method provided by some embodiments of the present application is exemplarily described.

[0045] As Figure 3 shown, the Socket connection state monitoring method provided by some embodiments of the present application comprises:

[0046] 1) The device program is started, and user registration is performed.

[0047] The Socket connection state monitoring device is started, and the client requests the server to register the service and submits the user registration data.

[0048] 2) The service is started, and user registration is performed.

[0049] The server starts the registration service, verifies the user registration data submitted by the client, and returns the registration success information after the verification is successful.

[0050] 3) The connection is established, and the socket channel is obtained.

[0051] After the client receives the registration success information, it establishes a Socket connection and sends user information (including username, user password, client IP, client Port, etc.) to the Socket connection state monitoring device to request a WebSocket connection.

[0052] 4) Check user permissions.

[0053] The Socket connection state monitoring device checks the user information sent by the client for permissions. If the check fails, it is determined to be an illegal connection, and the current client Socket connection channel is closed.

[0054] 5) WebSocket.accept() establishes a Socket connection.

[0055] If the check is successful, a WebSocket connection is established with the server, and the Socket connection channel is obtained.

[0056] 6) Start the heartbeat detection module

[0057] The Socket connection state monitoring device starts the heartbeat detection module and checks whether the client sends a heartbeat packet every 10 seconds.

[0058] 7) Socket user keep-alive

[0059] The client sends a user keep-alive packet to the Socket connection state monitoring device every 10 seconds.

[0060] 8) Regularly receive keep-alive packets to ensure that users do not drop offline.

[0061] The server receives the user keep-alive packet forwarded by the Socket connection state monitoring device every 10 seconds to prevent delays in sending heartbeat packets due to network jitter. If no heartbeat packet is received for 3 consecutive times (within 30 seconds), it is determined that the client user has dropped offline, and the current Socket connection channel is closed. The user status is set to offline.

[0062] 9) Socket data transmission

[0063] Socket data transmission is transmitted between the client and the server through the data transmission and data result verification module (also known as the user data transmission module).

[0064] After the connection is successfully established, the client transmits data to the server through the Socket, and the server returns the data receiving result to the client through the Socket; in order to avoid the situation that the Socket connection of the server side is unlimitedly increased, the Socket connection state monitoring device needs to check the number of the client Socket connections currently established by the server and the user authority in the process of data transmission and result returning, and if the check fails, the current Socket connection channel is closed.

[0065] The following Figure 4 The application provides a Socket connection state monitoring device, and the device can be set on the monitoring server. Figure 1 The application provides a Socket connection state monitoring device, and the device can be set on the monitoring server.

[0066] Please refer to Figure 4 , Figure 4 The application provides a Socket connection state monitoring device, and the device can be set on the monitoring server. Figure 2 The application provides a Socket connection state monitoring device, and the device can be set on the monitoring server.

[0067] The user keep-alive module is configured to receive a keep-alive packet from a client and forward the keep-alive packet to a server. That is, in some embodiments of the application, the main function of the user keep-alive module is to realize a user keep-alive mechanism between the server side and the client side, to ensure that the Socket connection currently established by the client does not drop (the Socket connection needs to carry online user information when being established, and if no user information or illegal user information is carried, it is determined as illegal connection), and to prevent the WebSocket verification failure problem caused by the normal offline or downtime or restart of the client or the server.

[0068] The user data transmission module is configured to monitor the total number of socket connections of the server in the process of data transmission between each client establishing a socket connection with the server and the service. That is, the main function of the user data transmission module is to check whether the socket connection between the current client and the server for data transmission is normally read and written, so as to avoid the problems of read timeout and write error caused by the difference in socket read and write speed (for example, when a large amount of data is transmitted, the file landing speed of the receiving end is relatively slow, which leads to TCP Zero window event, and the sending end needs to wait for the receiving end to update the sliding window before continuing to synchronize data. If the receiving end does not update the TCP window for a long time, the sending end will wait for timeout and close the connection). In order to solve this problem, some embodiments of the present application add a connection monitoring mechanism in this scenario. If no reply packet is received within the waiting time after sending a 64-byte monitoring packet, the current socket connection is closed. In addition, the server also needs to check whether the number of client socket connections currently performing data synchronization exceeds the maximum supported concurrency number. If it exceeds, an error message is returned and the current client socket connection channel is closed. The user data transmission module also limits the number of concurrent connections of the current client socket and guarantees its available state. In order to prevent the problem of closing the current socket connection due to reading and writing data results, some embodiments of the present application add a transmission result heartbeat mechanism in this scenario. If no reply packet is received within the waiting time after sending a 64-byte heartbeat packet, the current socket connection is closed.

[0069] It is not difficult to understand that in some embodiments of the present application, the user data transmission module is also configured to simulate a TCP window update operation when the server writes a file to the disk, and send a receiving speed packet to each client establishing a socket connection with the server, respectively, wherein the receiving speed packet is used to notify each client to adjust the sending speed.

[0070] In order to authenticate the user identity, in some embodiments of the present application, the monitoring device further comprises a user identity verification module configured to authenticate the client identity. That is, the main function of the user authentication module is to verify the legality of the client requesting the server WebSocket connection, only the user registered by the server can establish the WebSocket connection, otherwise it is considered as illegal connection, and the current client socket connection channel is closed; in order to solve the problem that the server downtime, restart causes the current client established socket connection to lose transmission data, the user authentication module increases the user re-authentication submodule, the data caused by server downtime, restart and failed to store into the retry table, after the user re-authentication is successful, the client and the server are online again, and the socket connection is re-established, the scanning failure retry table record recovers the unsynchronized data before, increases the fault tolerance mechanism.

[0071] It is not difficult to understand that, in some embodiments of the present application, the monitoring device further comprises an unsynchronized data record module configured to store the to-be-processed data message caused by the server failure, wherein the to-be-processed data message is used to complete the data transmission after the socket connection with the server is re-established.

[0072] It is not difficult to understand that, in some embodiments of the present application, the monitoring device further comprises an unsynchronized data record module configured to store the to-be-processed data message caused by the server failure, wherein the to-be-processed data message is used to complete the data transmission after the socket connection with the server is re-established.

[0073] As shown in Figure 1 some embodiments of the present application provide a data transmission system, the data transmission system comprises: at least one client (for example, the first client 110 of Figure 1 , configured to send socket connection establishment request, send keep-alive packet, and send data transmission message; server (i.e. Figure 1the server 130) configured to: establish a socket connection with the corresponding client in response to the received socket connection request; determine whether to cut off at least one socket connection in response to the received keep-alive packet; complete data packet transmission with the corresponding client; and a monitoring device based on the socket connection state (provided on the monitoring server 120 of route 1) configured to: complete identity authentication of the at least one client; perform identity authentication on the corresponding client in response to the socket connection request from the client and provide a corresponding socket connection request to the server after the identity authentication is passed; send the keep-alive packet to the server in response to the received keep-alive packet; simulate a TCP window update operation when the server writes a file to a disk, and send a receiving speed packet to each client in the at least one client, respectively, wherein the receiving speed packet is used to inform the each client to adjust the sending speed; and send the data transmission packet to the server corresponding to the socket connection in response to the received data transmission packet.

[0074] Those skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working process of the above-described method can refer to the corresponding process in the foregoing method, which will not be described in detail here.

[0075] In several embodiments provided in the present application, it should be understood that the disclosed apparatus and method can also be implemented in other ways. The apparatus embodiments described above are only schematic, for example, the flowcharts and block diagrams in the drawings show the possible implementation architectures, functions and operations of the apparatus, method and computer program product according to the embodiments of the present application. In this regard, each block in the flowcharts or block diagrams can represent a module, a program segment or a part of code, which contains one or more executable instructions for implementing the specified logical functions. It should also be noted that, in some alternative implementations, the functions noted in the blocks can occur in different orders from those described in the drawings. For example, two consecutive blocks can actually be executed substantially in parallel, and sometimes they can be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and the combination of blocks in the block diagrams and / or flowcharts, can be implemented by a dedicated hardware-based system for executing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.

[0076] In addition, each functional module in the embodiments of the present application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0077] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the parts of the prior art that make contributions or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.

[0078] The above merely provides an example of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application can have various modifications and changes. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application. It should be noted that similar reference numbers and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.

[0079] The above merely provides an example of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application can have various modifications and changes. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application. It should be noted that similar reference numbers and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.

[0080] It should be noted that, in this document, the terms such as first and second are used merely to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the processes, methods, articles or devices including a series of elements not only include those elements, but also include other elements not explicitly listed or inherent to such processes, methods, articles or devices. Without more limitations, the element defined by the statement "including a" does not exclude the presence of another identical element in the process, method, article or device including the element.

Claims

1. A Socket connection state-based monitoring method, characterized in that, The application is applied to a monitoring server, and the monitoring method comprises the following steps: After at least one client establishes a socket connection with a server, the method comprises the following steps: Receiving a keep-alive packet sent by each client in the at least one client; Forwarding the keep-alive packet to the server; Monitoring the total number of all socket connections established with the server during the transmission of data packets between the at least one client and the server through the socket connection, and closing at least one of the socket connections if it is confirmed that the total number exceeds a set threshold; Before the at least one client and the server transmit the data packets through the socket connection, the method further comprises the following steps: Simulating a TCP window update operation when the server writes a file to a disk, and sending a receiving speed packet to each client in the at least one client, wherein the receiving speed packet is used to inform each client to adjust the sending speed.

2. The monitoring method of claim 1, wherein, Before the at least one client establishes a socket connection with the server, the method further comprises the following steps: Receiving user information from each client in the at least one client; Confirming that the user information passes identity authentication.

3. The monitoring method of claim 2, wherein, The user information comprises a username, a user password, a client IP address, and a client port number.

4. The monitoring method of claim 1, wherein, The keep-alive packet is periodically generated and sent by the corresponding client.

5. The method of claim 1, wherein, The receiving speed packet comprises a total number of connected files, a number of processed files, a receiving end buffer size, and a receiving end receiving speed.

6. The method of claim 1, wherein, The method further comprises the following steps: Storing data packets to be processed caused by server failure in a failure retry table; Reestablishing a socket connection and scanning the failure retry table to recover the data packets to be processed.

7. A monitoring apparatus based on a Socket connection state, characterized by comprising: The application is applied to a monitoring server. The monitoring device comprises the following modules: A user keep-alive module configured to receive a keep-alive packet sent by each client in the at least one client after the at least one client establishes a socket connection with a server, and forward the keep-alive packet to the server; A user data transmission module configured to monitor the total number of all socket connections established with the server during the transmission of data between the at least one client and the server through the socket connection, and close at least one of the socket connections if it is confirmed that the total number exceeds a set threshold; The user data transmission module is further configured to simulate a TCP window update operation when the server writes a file to a disk before the at least one client and the server transmit the data packets through the socket connection, and send a receiving speed packet to each client in the at least one client, wherein the receiving speed packet is used to inform each client to adjust the sending speed.

8. The monitoring device of claim 7, wherein, The monitoring device further comprises the following modules: A user identity verification module configured to authenticate the identity of the client.

9. The monitoring device of claim 7, wherein, The monitoring device further comprises the following modules: An unsynchronized data recording module configured to store data messages to be processed due to the server failure, wherein the data messages to be processed are used to complete data transmission after reestablishing a socket connection with the server.

10. A data transmission system, characterized by The data transmission system comprises: At least one client configured to send a socket connection establishment request, send a keep-alive packet, and send a data message; A server configured to: establish a socket connection with a corresponding client in response to a received socket connection request; confirm whether to cut off at least one socket connection in response to all received keep-alive packets; complete data message transmission with the corresponding client; A monitoring server, the monitoring server comprising a monitoring device based on a socket connection state, the monitoring device being configured to: complete identity authentication of the at least one client; in response to the socket connection request from the client, perform identity authentication on the corresponding client and provide a corresponding socket connection request to the server after the identity authentication is passed; after the at least one client establishes a socket connection with the server, send the keep-alive packet to the server in response to the received keep-alive packet; during the transmission of the data message by the at least one client and the server through the socket connection, monitor the total number of all socket connections established with the server, and if it is confirmed that the total number exceeds a set threshold, close at least one of the socket connections; before the at least one client and the server transmit the data message through the socket connection, simulate a TCP window update operation when the server writes a file to a disk, and send a receiving speed packet to each of the at least one client, wherein the receiving speed packet is used to inform the each client to adjust the sending speed; in response to the received data message, send to the server of the corresponding socket connection.

Citation Information

Patent Citations

  • Data forwarding method, API gateway and message service system

    CN112202872A