CN116614546A - Socket connection state-based monitoring method and device - Google Patents

Socket connection state-based monitoring method and device Download PDF

Info

Publication number
CN116614546A
CN116614546A CN202310587246.2A CN202310587246A CN116614546A CN 116614546 A CN116614546 A CN 116614546A CN 202310587246 A CN202310587246 A CN 202310587246A CN 116614546 A CN116614546 A CN 116614546A
Authority
CN
China
Prior art keywords
client
server
socket connection
socket
keep
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310587246.2A
Other languages
Chinese (zh)
Inventor
桂苏民
温卓然
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Topsec Technology Co Ltd
Beijing Topsec Network Security Technology Co Ltd
Beijing Topsec Software Co Ltd
Original Assignee
Beijing Topsec Technology Co Ltd
Beijing Topsec Network Security Technology Co Ltd
Beijing Topsec Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Topsec Technology Co Ltd, Beijing Topsec Network Security Technology Co Ltd, Beijing Topsec Software Co Ltd filed Critical Beijing Topsec Technology Co Ltd
Priority to CN202310587246.2A priority Critical patent/CN116614546A/en
Publication of CN116614546A publication Critical patent/CN116614546A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/143Termination or inactivation of sessions, e.g. event-controlled end of session
    • H04L67/145Termination or inactivation of sessions, e.g. event-controlled end of session avoiding end of session, e.g. keep-alive, heartbeats, resumption message or wake-up for inactive or interrupted session
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/161Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
    • H04L69/162Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Cardiology (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer And Data Communications (AREA)

Abstract

The embodiment of the application provides a monitoring method and a device based on Socket connection state, wherein the monitoring method comprises the following steps: after at least one client establishes socket connection with the server: receiving a keep-alive packet sent by each client of the at least one client; forwarding the keep-alive package to the server; and monitoring the total number of all socket connections established with the server in the transmission process of the data message between the at least one client and the server through the socket connection. The embodiment of the application designs a Socket connection state-based monitoring device and method aiming at a server-side Websocket monitoring mechanism, and the method can improve the safety and reliability of Socket connection.

Description

Socket connection state-based monitoring method and device
Technical Field
The application relates to the field of network communication, in particular to a Socket connection state-based monitoring method and device.
Background
In the increasingly-developed age of networks, it is indispensable to use Socket sockets for network programming, and how to efficiently ensure the security and reliability of Socket connection is primarily considered.
The Socket connection of the related technical scheme has the technical problems of low safety and poor service quality.
Disclosure of Invention
The embodiment of the application aims to provide a monitoring device and a monitoring device based on a Socket connection state, and aims to a server-side Websocket monitoring mechanism.
In a first aspect, an embodiment of the present application provides a Socket connection state-based monitoring method, where the monitoring method includes: after at least one client establishes socket connection with the server: receiving a keep-alive packet sent by each client of the at least one client; forwarding the keep-alive package to the server; and monitoring the total number of all socket connections established with the server in the transmission process of the data message between the at least one client and the server through the socket connection.
Compared with the related technical scheme, the embodiment of the application increases the keep-alive packets at the two ends of the Socket connection, improves the Socket connection reliability, and simultaneously uses the Websocket monitoring connection mechanism at the server end to effectively control the Socket connection quantity at the server end, limit the total number of Socket connections established by the client end and reduce the resource consumption of the server end.
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 of the at least one client; and confirming that the user information passes identity authentication.
Some embodiments of the application also need to perform identity verification on the client establishing Socket connection with the server, perform authority verification on the user information of the client requesting WebSocket connection, and improve the security of Socket connection.
In some embodiments, the user information comprises: a user name, a user password, a client IP address, and a client port number.
In some embodiments, the method further comprises: and if the total number is confirmed to exceed the set threshold, closing at least one of the socket connections.
Some embodiments of the present application automatically close at least one connection when the total number of socket connections established to the server is monitored to be greater than a set threshold, thereby improving the service quality of the server.
In some embodiments, the keep-alive packets are periodically generated and sent by the respective clients.
Some embodiments of the present application periodically generate keep-alive packets, monitor the connection status of the client and the server, so as to immediately cut off the socket connection that the disconnected client has established on the server.
In some embodiments, before the at least one client and the server perform the data packet transmission through the socket connection, the method further includes: and simulating TCP window updating operation when the server writes the file into the disk, and respectively sending a receiving speed packet to each client in the at least one client, wherein the receiving speed packet is used for notifying each client to adjust the sending speed.
In some embodiments of the present application, in the process of transmitting data by using Socket connection, in order to avoid abnormal disconnection of C1 or file content loss caused by read timeout, write error or TCP zero window problem due to mismatch of Socket read-write speed, it is necessary to first provide a speed parameter of receiving data packets by a server, that is, provide a receiving speed packet, for each client.
In some embodiments, the receiving the speed packet comprises: the total number of the current connection transmitting files, the number of the processed files, the buffer size of the receiving end and the receiving speed of the receiving end.
In some embodiments, the method further comprises: storing the data message to be processed caused by the server fault into a failure retry list; and reestablishing Socket connection, and scanning the failure retry list to recover the data message to be processed.
After downtime and restarting, the server of some embodiments of the present application can recover the established Socket connection, and continue to transmit the data which is not synchronized before, thereby increasing the user re-authentication fault-tolerant mechanism.
In a second aspect, some embodiments of the present application provide a Socket connection state-based listening device, where the listening device includes: a user keep-alive module configured to receive a keep-alive packet from a client and forward the keep-alive packet to a server; and 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 the socket connection with the server and the service.
In some embodiments, the user data transmission module is further configured to: simulating TCP window updating operation when the server writes the file into the disk, and respectively sending a receiving speed packet to each client establishing socket connection with the server, wherein the receiving speed packet is used for notifying each client to adjust the sending speed.
In some embodiments, the listening device further comprises: and the user identity verification module is configured to authenticate the identity of the client.
In some embodiments, the listening device further comprises: and the unsynchronized data recording module is configured to store a data message to be processed caused by the server fault, wherein the data message to be processed is used for completing data transmission after the connection socket is re-established with the server.
In a third aspect, some embodiments of the present application provide a data transmission system, the data transmission system comprising: the system comprises at least one client, at least one server and at least one server, wherein the client is configured to send a socket connection establishment request, send a keep-alive packet and send a data transmission message; a server configured to: establishing socket connection with a corresponding client in response to the received socket connection request; responding to all received keep-alive messages to confirm whether at least one socket connection needs to be cut off; completing the data message transmission with the corresponding client; the monitoring device based on Socket connection state is configured to: completing identity authentication of the at least one client; responding to the socket connection request from the client, carrying out identity authentication on the corresponding client and providing the corresponding socket connection request for the server after the identity authentication is passed; transmitting the keep-alive package to the server in response to the received keep-alive package; simulating TCP window updating operation when the server writes files into a disk, and respectively sending a receiving speed packet to each client in the at least one client, wherein the receiving speed packet is used for notifying each client to adjust the sending speed; and responding to the received data transmission message, and sending the data transmission message to a server connected with the corresponding socket.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and should not be considered as limiting the scope, and other related drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a system architecture diagram based on Socket connection according to an embodiment of the present application;
fig. 2 is one of flowcharts of a Socket connection state-based monitoring method according to an embodiment of the present application;
fig. 3 is a second flowchart of a Socket connection state-based monitoring method according to an embodiment of the present application;
fig. 4 is a block diagram of a monitoring device based on Socket connection status according to an embodiment of the present application;
fig. 5 is a schematic diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings in the embodiments of the present application.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only to distinguish the description, and are not to be construed as indicating or implying relative importance.
The inventors of the present application found in the study that the prior art has at least the following technical drawbacks: firstly, the related technology does not carry out authority verification on user information of a user requesting WebSocket connection, and cannot prevent illegal users from establishing the Socket connection by forging an IP address of a client; secondly, the related technology does not limit the total number of Socket connections established between the first service end of the external network and the second service end of the external network, and cannot guarantee the resource utilization rate and the service quality of the service end; thirdly, the related art does not have a fault-tolerant mechanism for recovering the established Socket connection after the server is down and restarted and continuously transmitting the data which are not synchronized before, so that the integrity and consistency of the data cannot be ensured.
At least to solve the above technical problems, in some embodiments of the present application, the server limits the total number of Socket connections established by the client, so as to prevent excessive Socket connections from occupying server resources. The server of some embodiments of the application performs authority verification on the user information of the client requesting the WebSocket connection, and prevents illegal users from establishing the Socket connection. The server of some embodiments of the present application can recover the established Socket connection after downtime and restarting, and continue to transmit the data which is not synchronized before, and increase the user re-authentication fault-tolerant mechanism. According to the method and the device, the problems of Read Time Out Read timeout, write Error and the like caused by Read-Write speed difference can be avoided when Socket Read-Write operation is performed between the client and the server.
Referring to fig. 1, fig. 1 is a Socket connection-based system according to some embodiments of the present application, unlike the related art, in which a Socket connection-based listening server (i.e. the listening server 120 of fig. 1) is added between a client (i.e. the first client 110 of fig. 1) and a server (i.e. the second server 130 of fig. 1) that need to establish a Socket connection, where the listening server 120 is used to monitor the state of the Socket connection.
It should be noted that, in some embodiments of the present application, the Socket connection state-based listening method is run on the listening server 120 in fig. 1.
The following exemplarily illustrates a Socket connection state-based listening method performed by the listening server 120.
As shown in fig. 2, an embodiment of the present application provides a Socket connection state-based monitoring method, where the monitoring method includes: after at least one client establishes socket connection with the server: s101, receiving keep-alive packets sent by each client in the at least one client; s102, forwarding the keep-alive package to the server; and S103, monitoring the total number of all socket connections established with the server in the transmission process of the data message between the at least one client and the server through the socket connection.
It is easy to understand that compared with the related technical scheme, the embodiment of the application increases the keep-alive packets at the two ends of the Socket connection, improves the reliability of the Socket connection, and simultaneously uses the WebSocket monitoring connection mechanism at the server end to effectively control the Socket connection quantity at the server end, limit the total number of Socket connections established by the client end and reduce the resource consumption of the server end.
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 the socket connection with the server, the method further includes: 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 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 further need to perform identity verification on a client that establishes a Socket connection with a server, perform authority verification on user information that requests WebSocket connection from the client, and improve security of Socket connection.
In order to further improve the service quality of the server, in some embodiments of the present application, the Socket connection state-based listening method further includes: and if the total number is confirmed to exceed the set threshold, closing at least one of the socket connections. For example, in some embodiments of the application, the keep-alive packets are periodically generated and sent by the respective clients.
It will be appreciated that some embodiments of the present application periodically generate keep-alive packets, monitor the connection status of a client to a server, and immediately disconnect the socket connection already established on the server by the disconnected client. Some embodiments of the present application automatically close at least one connection when the total number of socket connections established to the server is monitored to be greater than a set threshold, thereby improving the service quality of the server.
In order to avoid abnormal disconnection of a client or file content loss caused by read timeout, write error or TCP zero window problem due to mismatch of Socket read-write speeds, in some embodiments of the present application, before the at least one client and the server perform the data packet transmission through the Socket connection, the method further includes: and simulating TCP window updating operation when the server writes the file into the disk, and respectively sending a receiving speed packet to each client in the at least one client, wherein the receiving speed packet is used for notifying each client to adjust the sending speed. For example, in some embodiments of the application, the receiving the speed packet includes: the total number of the current connection transmitting files, the number of the processed files, the buffer size of the receiving end and the receiving speed of the receiving end. In some embodiments of the present application, in the process of transmitting data using a socket connection, it is necessary to first provide a speed parameter of receiving a data packet by a server to each client, that is, provide a receiving speed packet.
In order to achieve that the server can recover the established Socket connection after downtime and restarting and continue to transmit the data which is not synchronized before, in some embodiments of the present application, the method further includes: storing the data message to be processed caused by the server fault into a failure retry list; and reestablishing Socket connection, and scanning the failure retry list to recover the data message to be processed. That is, after downtime and restarting, the server of some embodiments of the present application can recover the established Socket connection and continue to transmit the data that was not synchronized before, thereby increasing the user re-authentication fault tolerance mechanism.
The following describes an example of a Socket connection state-based listening method according to some embodiments of the present application with reference to fig. 3.
As shown in fig. 3, a Socket connection state-based monitoring method provided by some embodiments of the present application includes:
1) And starting the device program, and registering the user.
And starting a Socket connection state monitoring device, waiting for the client to request the server to register the service, and submitting user registration data.
2) And starting the service and registering the user.
The server starts the registration service, verifies the user registration data submitted by the client, and returns registration success information after verification is successful.
3) And establishing connection and obtaining a socket channel.
After receiving the successful registration information, the client establishes Socket connection, and sends user information (including user name, user password, client IP, client Port, etc.) to the Socket connection state monitoring device to request Websocket connection.
4) And checking the user authority.
And the Socket connection state monitoring device performs authority verification on the user information sent by the client, if the verification fails, the user information is judged to be illegally connected, and the Socket connection channel of the current client is closed.
5) Websocket () establishes a Socket connection.
If the verification is successful, establishing WebSocket connection with the server, and acquiring a Socket connection channel.
6) Heartbeat starting detection module
The Socket connection state monitoring device starts a heartbeat detection module, and periodically checks whether the client sends a heartbeat packet every 10 seconds.
7) Socket user keep-alive
The client side periodically sends a user keep-alive packet to the Socket connection state monitoring device every 10 seconds.
8) And the keep-alive packets are received regularly, so that the user is ensured not to drop the line.
The server regularly receives the user keep-alive packet forwarded by the Socket connection state monitoring device every 10 seconds, and the delay of normally sending the heartbeat packet caused by network jitter is prevented; if the heartbeat packet is not received for 3 times (within 30 seconds), the client user is judged to be offline, the current Socket connection channel is closed, and the user state is set to be offline.
9) Socket data transmission
Socket data transmission is transmitted between a client and a server by means of data transmission and a data result checking module (or called a user data transmission module).
After the connection is established successfully, the client transmits data to the server through the Socket, and the server returns a data receiving result to the client through the Socket; in order to avoid the situation that Socket connection of a server end is infinitely increased, the Socket connection state monitoring device needs to check the number of currently established Socket connections of the client and user rights of the server in the processes of data transmission and result feedback, and if checking fails, a current Socket connection channel is closed.
A Socket connection state-based listening device according to some embodiments of the present application is described below with reference to fig. 4, where the device may be disposed on the listening server in fig. 1.
Referring to fig. 4, fig. 4 shows a Socket connection state-based monitoring device according to an embodiment of the present application, and it should be understood that the device corresponds to the method embodiment of fig. 2, and is capable of executing the steps involved in the method embodiment, and specific functions of the device may be referred to the above description, and detailed descriptions thereof are omitted herein for avoiding repetition. The device comprises at least one software functional module which can be stored in a memory in the form of software or firmware or solidified in the operating system of the device, and the monitoring device based on the Socket connection state comprises: user keep-alive module 121 and user data transmission module 122.
And the user keep-alive module is configured to receive the keep-alive packets from the client and forward the keep-alive packets to the server. That is, in some embodiments of the present application, the main function of the user keep-alive module is to implement a user keep-alive mechanism between the server side and the client side, so as to ensure that the Socket connection established by the current client side is not dropped (when the Socket connection is established, on-line user information needs to be carried, and illegal user information is not carried or carried, that is, illegal connection is determined), and prevent the WebSocket verification failure problem caused by normal disconnection or downtime and restarting of the client side or the server.
And 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 the 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 for data transmission between the current client and the server normally performs Read-Write operation, so as to avoid the problems of Read Time Out Read timeout and Write Error caused by Socket Read-Write speed difference (for example, when a large amount of files are transmitted, the file of the receiving end falls down slowly, resulting in a TCP Zero window event, the transmitting end needs to wait for the receiving end to update the sliding window before continuing to synchronize data, if the receiving end does not perform TCP Window Update updating window for a long Time, the transmitting end waits for closing the connection overtime); to solve this problem, in this scenario, some embodiments of the present application add a connection listening mechanism, and after sending a 64-byte listening packet, wait for a reply packet to arrive within a time period when the reply packet is not received, and close the current Socket connection; in addition, the server also checks whether the number of the Socket connections of the client terminal currently carrying out data synchronization exceeds the maximum supported concurrency number, and if so, returns error information and closes the Socket connection channel of the current client terminal. The user data transmission module also limits the concurrency number of the current client Socket connection and ensures the available state of the current client Socket connection; in order to prevent the problem that the current Socket is closed due to overtime when the data result is read and written, in the scene, some embodiments of the application add a heartbeat mechanism of the transmission result, wait for the arrival time of a reply packet after sending a 64-byte heartbeat packet and not receive the reply packet, and then close the current Socket connection.
It will be appreciated that in some embodiments of the application, the user data transmission module is further configured to: simulating TCP window updating operation when the server writes the file into the disk, and respectively sending a receiving speed packet to each client establishing socket connection with the server, wherein the receiving speed packet is used for notifying each client to adjust the sending speed.
In order to authenticate the identity of the user, in some embodiments of the present application, the listening device further comprises: and the user identity verification module is configured to authenticate the identity of the client. That is, the main function of the user authentication module is to verify the validity of the WebSocket connection of the client request server, and only the user registered in the server can establish the WebSocket connection, otherwise, the user authentication module is regarded as illegal connection, and the current client Socket connection channel is closed; in order to solve the problem that the Socket connection established by the current client is lost due to server downtime and restarting, a user authentication module is added with a user authentication sub-module, the data caused by server downtime and restarting is stored in a failure retry list, after the user authentication is successful, the client and the server are on line again, the Socket connection is re-established, the data which is not synchronized before the recovery is recorded by the scanning failure retry list, and a fault tolerance mechanism is added.
It will be appreciated that in some embodiments of the application, the listening device further comprises: and the unsynchronized data recording module is configured to store a data message to be processed caused by the server fault, wherein the data message to be processed is used for completing data transmission after the connection socket is re-established with the server.
It will be clear to those skilled in the art that, for convenience and brevity of description, reference may be made to the corresponding procedure in the foregoing method for the specific working procedure of the apparatus described above, and this will not be repeated here.
As shown in fig. 1, some embodiments of the present application provide a data transmission system including: at least one client (e.g., the first client 110 of fig. 1) configured to send a socket connection establishment request, send a keep-alive packet, and send a data transmission message; a server (i.e., server 130 of fig. 1) configured to: establishing socket connection with a corresponding client in response to the received socket connection request; responding to all received keep-alive messages to confirm whether at least one socket connection needs to be cut off; completing the data message transmission with the corresponding client; a Socket connection state-based listening device (provided on the listening server 120 of fig. 1) is configured to: completing identity authentication of the at least one client; responding to the socket connection request from the client, carrying out identity authentication on the corresponding client and providing the corresponding socket connection request for the server after the identity authentication is passed; transmitting the keep-alive package to the server in response to the received keep-alive package; simulating TCP window updating operation when the server writes files into a disk, and respectively sending a receiving speed packet to each client in the at least one client, wherein the receiving speed packet is used for notifying each client to adjust the sending speed; and responding to the received data transmission message, and sending the data transmission message to a server connected with the corresponding socket.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described method may refer to corresponding procedures in the above-described method, and will not be described in detail herein.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. The apparatus embodiments described above are merely illustrative, for example, of the flowcharts and block diagrams in the figures that illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form a single part, or each module may exist alone, or two or more modules may be integrated to form a single part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and variations will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application. It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures.
The foregoing is merely illustrative of the present application, and the present application is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.

Claims (13)

1. The monitoring method based on the Socket connection state is characterized by comprising the following steps:
after at least one client establishes socket connection with the server:
receiving a keep-alive packet sent by each client of the at least one client;
forwarding the keep-alive package to the server;
and monitoring the total number of all socket connections established with the server in the transmission process of the data message between the at least one client and the server through the socket connection.
2. The monitoring method of claim 1, wherein prior to the at least one client establishing 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.
3. The monitoring method of claim 2, wherein the user information comprises: a user name, a user password, a client IP address, and a client port number.
4. The listening method of claim 1, wherein the method further comprises: and if the total number is confirmed to exceed the set threshold, closing at least one of the socket connections.
5. The listening method of claim 1 wherein the keep-alive packets are periodically generated and sent by respective clients.
6. The listening method of claim 1, wherein before the at least one client and the server transmit the data message through the socket connection, the method further comprises:
and simulating TCP window updating operation when the server writes the file into the disk, and respectively sending a receiving speed packet to each client in the at least one client, wherein the receiving speed packet is used for notifying each client to adjust the sending speed.
7. The listening method of claim 6 wherein said receiving a speed packet comprises: the total number of the current connection transmitting files, the number of the processed files, the buffer size of the receiving end and the receiving speed of the receiving end.
8. The listening method of claim 1, wherein the method further comprises:
storing the data message to be processed caused by the server fault into a failure retry list;
and reestablishing Socket connection, and scanning the failure retry list to recover the data message to be processed.
9. A Socket connection state-based monitoring device, wherein the monitoring device comprises:
a user keep-alive module configured to receive a keep-alive packet from a client and forward the keep-alive packet to a server;
and 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 the socket connection with the server and the service.
10. The listening device of claim 9 wherein the user data transmission module is further configured to: simulating TCP window updating operation when the server writes the file into the disk, and respectively sending a receiving speed packet to each client establishing socket connection with the server, wherein the receiving speed packet is used for notifying each client to adjust the sending speed.
11. The listening device of claim 9 wherein the listening device further comprises:
and the user identity verification module is configured to authenticate the identity of the client.
12. The listening device of claim 9 wherein the listening device further comprises:
and the unsynchronized data recording module is configured to store a data message to be processed caused by the server fault, wherein the data message to be processed is used for completing data transmission after the connection socket is re-established with the server.
13. A data transmission system, the data transmission system comprising:
the system comprises at least one client, at least one server and at least one server, wherein the client is configured to send a socket connection establishment request, send a keep-alive packet and send a data transmission message;
a server configured to:
establishing socket connection with a corresponding client in response to the received socket connection request;
responding to all received keep-alive messages to confirm whether at least one socket connection needs to be cut off;
completing the data message transmission with the corresponding client;
the monitoring device based on Socket connection state is configured to:
completing identity authentication of the at least one client;
responding to the socket connection request from the client, carrying out identity authentication on the corresponding client and providing the corresponding socket connection request for the server after the identity authentication is passed;
transmitting the keep-alive package to the server in response to the received keep-alive package;
simulating TCP window updating operation when the server writes files into a disk, and respectively sending a receiving speed packet to each client in the at least one client, wherein the receiving speed packet is used for notifying each client to adjust the sending speed;
and responding to the received data transmission message, and sending the data transmission message to a server connected with the corresponding socket.
CN202310587246.2A 2023-05-23 2023-05-23 Socket connection state-based monitoring method and device Pending CN116614546A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310587246.2A CN116614546A (en) 2023-05-23 2023-05-23 Socket connection state-based monitoring method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310587246.2A CN116614546A (en) 2023-05-23 2023-05-23 Socket connection state-based monitoring method and device

Publications (1)

Publication Number Publication Date
CN116614546A true CN116614546A (en) 2023-08-18

Family

ID=87684989

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310587246.2A Pending CN116614546A (en) 2023-05-23 2023-05-23 Socket connection state-based monitoring method and device

Country Status (1)

Country Link
CN (1) CN116614546A (en)

Similar Documents

Publication Publication Date Title
US9438566B2 (en) Method and system for negotiation based on IKE messages
EP2119184B1 (en) Virtualization and high availability of network connections
KR102167613B1 (en) Message push method and device
US20100011435A1 (en) Method and System for Providing Guaranteed File Transfer in Corporate Environment Behind Firewall
CN109286593B (en) Method and device for transmission reconnection, computer equipment and storage medium
US7089311B2 (en) Methods, systems and computer program products for resuming SNA application-client communications after loss of an IP network connection
CN110032478B (en) Method, device and system for real-time synchronization of data of main and standby centers and storage medium
EP2109980A2 (en) Method and system for providing peer liveness for high speed environments
CN108259618B (en) Synchronous data interaction processing method and device
US20140068103A1 (en) Stateful failover management in a network traffic manager
US7254739B2 (en) Error recovery in a client/server application using two independent sockets for communication
CN101465862A (en) Method and device for processing switch of authentication business, network appliance and communication system
KR20140132063A (en) Apparatus and Method for CAN Comnunication
CN111327650A (en) Data transmission method, device, equipment and storage medium
CN103516587A (en) Instant communication client terminal disconnection reconnection method and device
CN111083049B (en) User table item recovery method and device, electronic equipment and storage medium
WO2008103196A1 (en) Hanging request system and method for client/server communication
US10680930B2 (en) Method and apparatus for communication in virtual network
CN111064813B (en) Method and device for synchronizing processing messages during block chain consensus processing
CN110442479A (en) A kind of method and system for the data thermal backup for avoiding data out-of-order or losing
CN113141257A (en) Revocation list updating method and storage medium
CN116614546A (en) Socket connection state-based monitoring method and device
KR20180099143A (en) Apparatus and method for recovering tcp-session
CN108270613B (en) Message sending method and network equipment
CN110890989A (en) Channel connection method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination