A method and apparatus for detecting a TCP link

By running ifconfig status detection, ICMP packet detection, and heartbeat detection simultaneously on three processors, the timeliness and bandwidth consumption issues of TCP connection anomaly detection in existing technologies are resolved, enabling fast and accurate link switching and data transmission.

CN116599869BActive Publication Date: 2025-11-25BEIJING ZHONGCHUANG TELECOM TEST CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210120142.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-07
Publication Date
2025-11-25
Estimated Expiration
2042-02-07

AI Technical Summary

Technical Problem

Existing technologies cannot accurately identify and switch links in a very short time when detecting TCP connection anomalies, especially physical link anomalies, leading to network interruptions and data loss. Furthermore, frequent heartbeat detection consumes a large amount of network bandwidth.

Method used

The system employs three methods simultaneously, namely ifconfig status detection, ICMP packet detection, and heartbeat detection, running on three processors to detect anomalies at the data link layer, network routing, and transport layer, respectively, and switches to a backup link or re-establishes the primary link based on the anomaly type.

Benefits of technology

It improves the timeliness of judging hardware network interruptions, can quickly detect and switch links, ensure the continuity and reliability of data transmission, and reduce network bandwidth consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116599869B_ABST
    Figure CN116599869B_ABST
Patent Text Reader

Abstract

The application relates to a TCP link detection method and device, and belongs to the technical field of computer networks. The method solves the problem that the existing heartbeat detection method occupies a large amount of network bandwidth due to frequent sending of detection packets and cannot quickly judge physical link and program and process abnormalities. The TCP link detection method comprises the following steps: in the process of data transmission by using a main link, simultaneously running the following three network detection modes on three processors to judge whether the network is abnormal, the three network detection modes comprising an ifconfig state detection mode, an ICMP data packet detection mode and a heartbeat detection mode; when any one of the three network detection modes judges that the network is abnormal, returning network abnormality information to a corresponding processor in the three processors; and switching the main link to a backup link or re-establishing the main link and carrying out data transmission according to the network abnormality information received by the corresponding processor. The efficiency of judging hardware network interruption is greatly improved, and the hardware network interruption fault can be quickly judged.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer network technology, and in particular to a method and apparatus for detecting TCP connections. Background Technology

[0002] like Figure 1 As shown, the data gateway (GATEWAY) is used for high-volume, low-latency, and highly reliable data transmission in communication. Data transmission uses a 100GE network and a dual-link backup mode, meaning that the same data is transmitted only on one link. When LINK_A fails, it can notify LINK_B instantly (within 0.5 seconds) so that LINK_B can take over all data transmission.

[0003] The design serves two purposes: 1. For data cutover, i.e., link switching, ensuring no data loss through dual-link switching. 2. Dual-link primary / backup, ensuring data communication can continue via the other link even if either link fails.

[0004] The gateway switching performance requirements are as follows: 1. If the primary link fails, the backup link must start within 0.5 seconds. The communication traffic capacity must be 50Gbps (50Gbits / second). 2. Ensure no data loss and maintain the data communication sequence during the switching process.

[0005] Key Demand Analysis

[0006] 1. The transmission network is a 100G network, which is required to be able to carry a peak traffic of 50Gbps, and the traffic volume is large.

[0007] 2. Link switching must be completed within 0.5 seconds.

[0008] 3. This network disconnection includes data cutover, which means there is a physical network segmentation. This can lead to issues with software not being able to detect network interruptions in a timely manner during transmission. The link switching required by this GATEWAY includes physical link disconnection.

[0009] Based on the above three key requirements, it is necessary to determine network disconnection within a very short time and to detect network interruption in the event of physical hardware failure.

[0010] Program and process exceptions

[0011] If TCP (Transmission Control Protocol) link is abnormal while the program is normal, the TCP application program will be closed and the application will be informed that the abnormal TCP link is closed by the GATEWAY. This situation can be known through the return value or the exception code in a Socket call after the TCP link is abnormal. Therefore, it is easy to handle when developing the program, as follows:

[0012] When the data is received, -1 is returned, and errno=EINTR.

[0013] When the program receives a signal, -1 is returned, and errno=EINTR.

[0014] This judgment is simple and timely, and can meet the requirement. However, the requirement focuses on the case of the physical link.

[0015] Abnormal physical link

[0016] If the optical fiber between LINK_A and LINK_B is pulled out, at this time, the GATEWAY_A and the GATEWAY_B cannot know the failure of the TCP connection of the link, and always consider that the connection is normal. Network hardware failure GATEWAY_A and GATEWAY_B cannot know the failure of the TCP connection, and always consider that the connection is normal.

[0017] The above two cases will become very bad when programming, because the TCP connection will always be considered valid, and all calls to the TCP Socket will be returned correctly, which is obviously wrong, and this error condition usually lasts for a long time.

[0018] Therefore, the prior art is to judge through the heartbeats between the TCP links. If the specified number of heartbeats are continuously sent without receiving the heartbeat response, it is considered that the network is interrupted.

[0019] Reference Figure 1 The prior art solution needs to monitor the heartbeats on both sides of the communication, that is, the GATEWAY_A and the GATEWAY_B send heartbeat information, as follows:

[0020] 1. The GATEWAY_A sends a detection packet to the GATEWAY_B every time interval.

[0021] 2. The GATEWAY_A starts a timeout timer when sending the packet.

[0022] 3. The GATEWAY_B receives the detection packet and should respond to a packet.

[0023] 4. If GATEWAY_A receives the response packet from the server, it means that the link is normal, and the timeout timer is deleted.

[0024] 5. If the timeout timer of GATEWAY_A expires and the response packet is still not received, it means that the link is abnormal.

[0025] Therefore, the prior art has the following problems: waiting for timeout, and a certain time delay is required to solve the problem. If the timeout is set to 0.5 seconds, the detection packet needs to be frequently sent, and a large amount of network bandwidth is occupied, and the demand still cannot be met. SUMMARY

[0026] In view of the above analysis, the embodiments of the present application aim to provide a TCP link detection method and device to solve the problem that the existing heartbeat detection method occupies a large amount of network bandwidth due to frequent sending of detection packets and cannot judge physical link and program and process abnormalities.

[0027] In one aspect, the embodiments of the present application provide a TCP link detection method, comprising: in the process of data transmission by using a main link, simultaneously running the following three network detection methods on three processors to judge whether the network is abnormal, wherein the three network detection methods include an ifconfig state detection method, an ICMP data packet detection method and a heartbeat detection method; when any one of the three network detection methods judges that the network is abnormal, returning network abnormality information to a corresponding processor of the three processors; and switching the main link to a backup link or re-establishing the main link according to the network abnormality information received by the corresponding processor, and performing data transmission by using the backup link or the re-established main link.

[0028] The beneficial effects of the above technical solution are as follows: the embodiments of the present application can detect program and process abnormalities by using the ifconfig state detection method, the ICMP data packet detection method and the heartbeat detection method, and can also detect physical link abnormalities, so that different measures can be taken for data transmission according to different network abnormalities. The effectiveness in judging hardware network interruption is greatly improved, and hardware network interruption failure can be quickly judged.

[0029] Further improvement based on the above method, when any of the three network detection methods judges that the network is abnormal, returning network abnormal information to the corresponding processor of the three processors includes: when the ifconfig state detection method judges that the data link layer is in a non-communication state of the optical port to judge that the network cable is pulled out or the network card is faulty, returning the data link layer in the non-communication state of the optical port to the first processor of the three processors; when the ICMP data packet detection method judges that the network routing is abnormal, returning the network routing abnormality to the second processor of the three processors; and when the heartbeat detection method judges that the transport layer is in a link disconnection state, returning the transport layer in the link disconnection state to the third processor of the three processors.

[0030] Further improvement based on the above method, according to the network abnormal information received by the corresponding processor, switching the main link to the standby link or re-establishing the main link, and using the standby link or the re-established main link for data transmission further includes: according to the data link layer in the non-communication state of the optical port received by the first processor, directly switching the main link to the standby link, and transmitting data through the standby link; according to the network routing abnormality received by the second processor, detecting the standby link again and the secondary detection result is network normal, the main link is switched to the standby link, and data transmission is performed through the standby link; and according to the transport layer in the link disconnection state received by the third processor, re-establishing the main link, and using the re-established main link for data transmission.

[0031] Further improvement based on the above method, the ifconfig state detection method further includes: sending an ifconfig command to a linux operating system; querying the status information of the network card connection in the system state according to the ifconfig command; and reading the status information of the network card connection in the system state and judging whether the network is normal according to the status information of the network card connection.

[0032] Further improvement based on the above method, judging whether the network is normal according to the status information of the network card connection further includes: when the status information of the network card connection includes a string MULTICAST and a string RUNNING, the status of the network card connection is normal, otherwise the network is abnormal.

[0033] Based on the further improvement of the above method, the ICMP packet detection method further comprises: generating an ICMP packet and providing the ICMP packet to a server side; sending the ICMP packet directly to a receiving server through UDP; when the receiving server supports a standard Ping command, returning feedback information according to an ICMP message in the ICMP packet to the server side immediately; and obtaining and analyzing the feedback information, and judging whether the network is normal according to the analyzed feedback information, wherein judging whether the network is normal according to the analyzed feedback information further comprises: when the analyzed feedback information is correct reply information, the network is normal, otherwise the network is abnormal.

[0034] Based on the further improvement of the above method, the heartbeat detection method further comprises: sending heartbeat information at a predetermined time interval; starting a timeout timer, and recording a timestamp of sending the heartbeat as a starting point of a timeout waiting time; and when a reply is received within a timeout time range, judging that the network is normal, otherwise the network is abnormal.

[0035] In another aspect, the embodiment of the present application provides a TCP link detection device, comprising: a network detection module, configured to run simultaneously three network detection modules on three processors to judge whether a network is abnormal in the case of data transmission through a main link, wherein the network detection module comprises an ifconfig state detection module, an ICMP packet detection module and a heartbeat detection module; a network abnormality confirmation module, configured to return network abnormality information to a corresponding processor in the three processors when any one of the three network detection methods judges that the network is abnormal; and a network transmission module, configured to switch the main link to a backup link or reestablish the main link according to the network abnormality information received by the corresponding processor, and to perform data transmission through the backup link or the reestablished main link.

[0036] Based on the further improvement of the above device, the network abnormality confirmation module comprises a first judgment module, a second judgment module and a third judgment module, wherein the first judgment module is configured to return a non-communication state of a data link layer in an optical port to a first processor in the three processors when the ifconfig state detection method judges that the data link layer is in the non-communication state of the optical port to judge that a network cable or a network card is faulty; the second judgment module is configured to return network routing abnormality to a second processor in the three processors when the ICMP packet detection method judges that the network routing is abnormal; and the third judgment module is configured to return a link disconnection state of a transport layer to a third processor in the three processors when the heartbeat detection method judges that the transport layer is in the link disconnection state.

[0037] Based on the further improvement of the above device, the network transmission module is used for: according to the first processor receiving the data link layer in the optical port non-communication state, the main link is directly switched to the standby link, and the data transmission is carried out through the standby link; according to the second processor receiving network routing exception, the standby link is detected again and the secondary detection result is network normal, the main link is switched to the standby link, and the data transmission is carried out through the standby link; and according to the third processor receiving the transmission layer in the link disconnection state, the main link is re-established, and the data transmission is carried out by using the re-established main link.

[0038] Compared with the prior art, the present application can realize at least one of the following beneficial effects:

[0039] 1. The three detection methods of ifconfig state detection method, ICMP data packet detection method and heartbeat detection method can detect program and process exceptions, and can also detect physical link exceptions, so that different measures can be taken for data transmission according to different network exception types (including data link layer exception, network routing exception and transmission layer exception);

[0040] 2. The judgment of hardware network interruption is greatly improved in timeliness, which can ensure that the hardware network interruption fault can be quickly judged;

[0041] 3. The application can judge the network disconnection in a very short time, and can monitor the network interruption in the case of physical hardware exception;

[0042] 4. The ifconfig state detection method, the ICMP data packet detection method and the heartbeat detection method run on three different CPUs respectively, and run on three complementary time sequences, any one can feedback when finding that the network has a problem, which can greatly improve the timeliness.

[0043] In the present application, each of the above technical solutions can be combined with each other to realize more preferred combination schemes. Other features and advantages of the present application will be described in the subsequent specification, and some advantages will become apparent from the specification, or will be understood by implementing the present application. The purpose and other advantages of the present application can be realized and obtained from the contents specifically pointed out in the specification and the drawings. BRIEF DESCRIPTION OF DRAWINGS

[0044] The accompanying drawings are included to provide a further understanding of the embodiments, and are not considered as limitations on the present application, and the same reference numerals represent the same components throughout the drawings.

[0045] Figure 1 The network structure diagram of the existing data gateway is shown in the following figure:

[0046] Figure 2 a flow chart of the method for detecting TCP link disconnection according to an embodiment of the present application;

[0047] Figure 3 a specific flow chart of the method for detecting TCP link disconnection according to an embodiment of the present application;

[0048] Figure 4 a block diagram of the device for detecting TCP link disconnection according to an embodiment of the present application. DETAILED DESCRIPTION

[0049] The preferred embodiments of the present application will be described in detail with reference to the drawings, in which:

[0050] One specific embodiment of the present application, with reference to Figure 2 discloses a method for detecting TCP link, comprising: in step S202, running the following three network detection methods simultaneously on three processors to determine whether the network is abnormal during data transmission using the main link, wherein the three network detection methods include ifconfig state detection method, ICMP data packet detection method and heartbeat detection method; in step S204, when any of the three network detection methods determines that the network is abnormal, returning the network abnormal information to the corresponding processor of the three processors; and in step S206, switching the main link to the backup link or re-establishing the main link according to the network abnormal information received by the corresponding processor, and using the backup link or the re-established main link for data transmission.

[0051] Compared with the prior art, in the method for detecting TCP link provided by the embodiment, the ifconfig state detection method, the ICMP data packet detection method and the heartbeat detection method can detect program and process abnormalities, and can also detect physical link abnormalities, so that different measures can be taken for data transmission according to different network abnormalities. The effectiveness in determining hardware network interruption is greatly improved, and hardware network interruption failure can be quickly determined.

[0052] Hereinafter, with reference to Figure 2 , each step in the method for detecting TCP link according to an embodiment of the present application is described in detail.

[0053] With reference to Figure 2In step S202, during the data transmission process using the main link, the following three network detection methods are simultaneously run on the three processors to determine whether the network is abnormal, wherein the three network detection methods include an ifconfig state detection method, an ICMP data packet detection method, and a heartbeat detection method. Hereinafter, the three detection methods are described in detail.

[0054] Specifically, the ifconfig state detection method further includes: sending an ifconfig command to the linux operating system; querying the network card connection state information in the system state according to the ifconfig command; and reading the network card connection state information in the system state and determining whether the network is normal according to the network card connection state information. Determining whether the network is normal according to the network card connection state information further includes: when the network card connection state information includes the string MULTICAST and the string RUNNING, the network card connection state is normal, otherwise the network is abnormal.

[0055] Specifically, the ICMP data packet detection method further includes: generating an ICMP data packet and providing the ICMP (Internet Control Message Protocol) data packet to the server side, wherein the ICMP data packet includes an IP header, an ICMP header, and an ICMP message; sending the ICMP data packet directly to the receiving server through the user datagram protocol UDP (User Datagram Protocol); when the receiving server supports the standard Ping command, immediately returning feedback information to the server side according to the ICMP message in the ICMP data packet; and obtaining and parsing the feedback information, and determining whether the network is normal according to the parsed feedback information. Determining whether the network is normal according to the parsed feedback information further includes: when the parsed feedback information is correct reply information, the network is normal, otherwise the network is abnormal.

[0056] Specifically, the heartbeat detection method further includes: sending heartbeat information at a predetermined time interval; starting a timeout timer and recording the timestamp of sending the heartbeat as the starting point of the timeout waiting time; and when a reply is received within the timeout time range, determining that the network is normal, otherwise the network is abnormal.

[0057] In step S204, when any one of the three network detection methods judges that the network is abnormal, the network abnormality information is returned to the corresponding processor of the three processors. Specifically, when any one of the three network detection methods judges that the network is abnormal, the network abnormality information is returned to the corresponding processor of the three processors includes: when the ifconfig state detection method judges that the data link layer is in the non-communication state of the optical port to judge that the network cable is pulled out or the network card is faulty, the data link layer in the non-communication state of the optical port is returned to the first processor of the three processors; when the ICMP data packet detection method judges that the network routing is abnormal, the network routing abnormality is returned to the second processor of the three processors; and when the heartbeat detection method judges that the transmission layer is in the link disconnection state, the transmission layer in the link disconnection state is returned to the third processor of the three processors.

[0058] In step S206, the main link is switched to the standby link or the main link is re-established according to the network abnormality information received by the corresponding processor, and data transmission is performed using the standby link or the re-established main link. Specifically, the main link is switched to the standby link or the main link is re-established according to the network abnormality information received by the corresponding processor, and data transmission is performed using the standby link or the re-established main link further includes: according to the data link layer in the non-communication state of the optical port received by the first processor, the main link is directly switched to the standby link, and data transmission is performed through the standby link; according to the network routing abnormality received by the second processor, the standby link is detected again and the secondary detection result is that the network is normal, the main link is switched to the standby link, and data transmission is performed through the standby link; and according to the transmission layer in the link disconnection state received by the third processor, the main link is re-established, and data transmission is performed using the re-established main link.

[0059] Another embodiment of the present application, with reference to Figure 4 , discloses a TCP link detection device, comprising: a network detection module 402, a network abnormality confirmation module 404 and a network transmission module 406.

[0060] The network detection module 402 is used to simultaneously run the following three network detection modules on the three processors to judge whether the network is abnormal when data transmission is performed using the main link. The network detection module 402 includes an ifconfig state detection module, an ICMP data packet detection module and a heartbeat detection module.

[0061] The network exception confirmation module 404 is configured to return the network exception information to the corresponding processor of the three processors when any of the three network detection manners judges that the network is abnormal. The network exception confirmation module 404 comprises a first judging module, a second judging module and a third judging module. The first judging module is configured to return the non-communication state of the data link layer at the optical port to the first processor of the three processors when the ifconfig state detection manner judges that the data link layer is in the non-communication state at the optical port to judge that the network cable is pulled out or the network card is faulty. The second judging module is configured to return the network routing exception to the second processor of the three processors when the ICMP data packet detection manner judges that the network routing is abnormal. The third judging module is configured to return the link disconnection state of the transport layer to the third processor of the three processors when the heartbeat detection manner judges that the transport layer is in the link disconnection state.

[0062] The network transmission module 406 is configured to switch the main link to the standby link or re-establish the main link according to the network exception information received by the corresponding processor, and perform data transmission by using the standby link or the re-established main link. Specifically, the network transmission module 406 is configured to switch the main link to the standby link directly and perform data transmission by using the standby link according to the non-communication state of the data link layer at the optical port received by the first processor. The main link is switched to the standby link and data transmission is performed by using the standby link when the standby link is detected again and the secondary detection result is that the network is normal according to the network routing exception received by the second processor. The main link is re-established and data transmission is performed by using the re-established main link according to the link disconnection state of the transport layer received by the third processor.

[0063] Hereinafter, the specific flow chart of the method for detecting the TCP link disconnection according to the embodiment of the present application is described in the form of specific examples. Figure 3

[0064] ​The application combines three network outage judgment methods to detect network status, solve the timeliness problem, and each of the three methods has its own scene in quickly detecting network anomalies. Ifconfig can quickly judge the connectivity state of the optical port at the data link layer to determine whether the network cable is plugged or the network card is faulty, etc. ICMP detection method can quickly judge whether the network routing is normal at the network layer. Heartbeat detection can judge the link state at the transport layer and can compensate for each other. The method can ensure the selection of quick data link switching and recovery when sending massive data in different scenarios. For example, when the network cable is plugged, ifconfig can detect it and directly switch data to the backup link for transmission. When the network is adjusted, ICMP detection can detect it and detect the backup link network. After successful detection, the data is switched to the backup link. When the transport layer link has a problem, the system will first perform a re-link operation to restore data transmission. The three methods include the following:

[0065] 1. Read ifconfig state

[0066] The ifconfig tool can not only be used to simply obtain network interface configuration information, but also can modify these configurations. The network card information configured by the ifconfig command does not exist after the network card is restarted and the machine is restarted. The Linux ifconfig command is used to display or set network devices. Ifconfig is a command used to display or configure network devices (network interface cards) in Linux. The English full name is network interfaces configuring.

[0067] By reading the state, the current network state can be obtained.

[0068] In step 1, the ifconfig command is sent to the Linux operating system, and the string in the returned text is read. GATEWAY_A queries the state of the system through the ifconfig command provided by the operating system, and obtains the state information of the network card connection. The returned text includes network card connection state, buffer information, and received and sent packet information.

[0069] In step 2, the string (i.e., the network card connection state) is parsed to determine whether the normal running information exists in the string. If it exists, it is considered that the network is normal, otherwise it can be determined that the network has a problem, as follows:

[0070]

[0071]

[0072] Reading ifconfig configuration information is the fastest and most efficient method among the three combinations.

[0073] Program interpretation:

[0074] (1) through the linux command ifconfig to capture the status of the specified network card, if the state of the eth0 network card is captured, the command is ifconfig | grep eth0

[0075] (2) the information returned by the command is judged.

[0076] If the command returns information containing "MULTICAST" and "RUNNING", it means that the network is normal, otherwise, it means that the network is not normal.

[0077] 2, send ICMP command detection

[0078] ICMP is a sub-protocol of TCP / IP protocol cluster, which is used to transmit control messages between IP host and router. Control message refers to network connectivity, host reachability, route availability and other network messages. ICMP is (Internet Control Message Protocol) Internet Control Message Protocol. It is a sub-protocol of TCP / IP protocol family, which is used to transmit control messages between IP host and router. Control message refers to network connectivity, host reachability, route availability and other network messages. These control messages do not transmit user data, but play an important role in user data transmission.

[0079] This method is the existing method, which is a general method to judge network connectivity.

[0080] The processing steps are as follows:

[0081] (1) combine ICMP (Internet Control Message Protocol) data packets and pack data.

[0082] (2) send ICMP to the server side through udp, and directly send to the receiving server. As long as the server supports standard ping command, it can receive the command and give feedback.

[0083] (3) receive ICMP data feedback information, and judge after unpacking. If the correct reply information is received, it is considered that the network is normal, otherwise, it can be judged that the network has problems. If no reply is received after timeout, it also proves that the network has problems.

[0084] (4) ICMP sends command to the opposite network card through udp. The opposite network card will give an answer immediately after receiving the command, and the network status is confirmed through the one-question-one-answer format.

[0085] ICMP(Internet Control Message Protocol, Internet control message protocol) features include: UDP(User Datagram Protocol, User Datagram Protocol) protocol, connectionless state, high communication efficiency, fast. Simple structure is mature, accurate and reliable feedback.

[0086] 3. Heartbeat judgment

[0087] The traditional network hardware interrupt judgment method is low in efficiency, but can be supplemented by other implementation methods.

[0088] Heartbeat message step:

[0089] 1. Send heartbeat information regularly, and the heartbeat information is part of the communication protocol of the client and the server. Heartbeat information is generally sent once every 20 seconds to send heartbeat messages.

[0090] 2. Set timeout, record the sending timestamp after sending the heartbeat message as the starting time of the timeout waiting, and wait for the reply.

[0091] 3. If a reply is received within the timeout time range, it can be judged that the network is normal, and if no reply is received after the timeout time, it can be considered that the network is abnormal.

[0092] (1) Solve the detection efficiency problem by combining three kinds of ways

[0093] Three ways are combined, and the three ways are as follows:

[0094] (1) By reading the ifconfig state, capturing information in the command return state to judge the network running state.

[0095] (2) By sending ICMP packets, determine the network state according to the returned data.

[0096] (3) Determine by heartbeat timeout.

[0097] The above three ways run at the same time, and as long as one of them judges that the network has been interrupted, it is considered that the network has been interrupted.

[0098] Usually, the combination of the three ways will be processed in three different threads of the program, running on three different CPUs, and running on three complementary time sequences. Any one that finds a problem with the network will feed back, which will greatly improve the timeliness.

[0099] Through our test effect, the average feedback time will be accelerated by 30% to 50%, or even more.

[0100] The application uses three ways of reading ifconfig configuration file, ICMP protocol and heartbeat to judge the hardware network disconnection, which is the key point. Therefore, compared with the prior art, the embodiment of the application greatly improves the timeliness in judging the hardware network disconnection, and can ensure that the hardware network disconnection fault is rapidly judged.

[0101] Those skilled in the art can understand that all or part of the processes of the above-mentioned embodiments can be completed by a computer program instructing relevant hardware, and the program can be stored in a computer readable storage medium. The computer readable storage medium is a disk, an optical disk, a read-only memory or a random access memory, etc.

[0102] The above is only a preferred specific embodiment of the application, but the protection scope of the application is not limited to this. Any person skilled in the art can easily think of changes or replacements within the technical range disclosed by the application, which should be covered within the protection scope of the application.

Claims

1. A method of detecting TCP link, characterized by, Comprise: In the process of data transmission by using the main link, the ifconfig state detection method, the ICMP data packet detection method and the heartbeat detection method are combined, and the above three network detection methods are run on the three processors with three complementary related time sequences to determine whether the network is abnormal; When any of the three network detection methods determines that the network is abnormal, network abnormal information is returned to the corresponding processor of the three processors, wherein when any of the three network detection methods determines that the network is abnormal, network abnormal information is returned to the corresponding processor of the three processors, including: when the ifconfig state detection method determines that the data link layer is in a non-communication state of the optical port to determine that the network cable or the network card is faulty, the data link layer in the non-communication state of the optical port is returned to the first processor of the three processors; when the ICMP data packet detection method determines that the network routing is abnormal, the network routing is returned to the second processor of the three processors; and when the heartbeat detection method determines that the transmission layer is in a link disconnection state, the transmission layer in the link disconnection state is returned to the third processor of the three processors; and According to the network abnormal information received by the corresponding processor, the main link is switched to the backup link or the main link is re-established, and data transmission is performed by using the backup link or the re-established main link.

2. The method of claim 1, wherein, According to the network abnormal information received by the corresponding processor, the main link is switched to the backup link or the main link is re-established, and data transmission is performed by using the backup link or the re-established main link further comprises: According to the data link layer in the non-communication state of the optical port received by the first processor, the main link is directly switched to the backup link, and data transmission is performed through the backup link; According to the network routing abnormality received by the second processor, the backup link is detected again and the secondary detection result is network normal, the main link is switched to the backup link, and data transmission is performed through the backup link; and According to the transmission layer in the link disconnection state received by the third processor, the main link is re-established, and data transmission is performed by using the re-established main link.

3. The method of claim 1, wherein, The ifconfig state detection method further comprises: Send an ifconfig command to a linux operating system; Query the status information of the network card connection in the system state according to the ifconfig command; and Read the status information of the network card connection in the system state and determine whether the network is normal according to the status information of the network card connection.

4. The method of claim 3, wherein, Determine whether the network is normal according to the status information of the network card connection further comprises: when the status information of the network card connection includes a string MULTICAST and a string RUNNING, the status of the network card connection is normal, otherwise the network is abnormal.

5. The method of claim 1, wherein, The ICMP data packet detection method further comprises: Generate an ICMP data packet and provide the ICMP data packet to a server end; sending the ICMP packet directly to a receiving server through UDP; when the receiving server supports a standard Ping command, returning feedback information according to an ICMP message in the ICMP packet to the server side immediately; and acquiring and analyzing the feedback information, and judging whether the network is normal according to the analyzed feedback information, wherein judging whether the network is normal according to the analyzed feedback information further comprises: when the analyzed feedback information is correct reply information, the network is normal, otherwise the network is abnormal.

6. The method of claim 1, wherein, The heartbeat detection mode further comprises: sending heartbeat information at a predetermined time interval; starting a timeout timer, and recording a timestamp of sending the heartbeat information as a time starting point of timeout waiting; and when a reply is received within a timeout time range, judging that the network is normal, otherwise judging that the network is abnormal.

7. An apparatus for detecting a TCP connection, characterized by comprises: a network detection module, configured to, in a case of utilizing a main link to transmit data, combine an ifconfig state detection mode, an ICMP packet detection mode and a heartbeat detection mode, and run the above three network detection modes on three processors at three complementary time sequences to judge whether the network is abnormal, wherein the network detection module comprises an ifconfig state detection module, an ICMP packet detection module and a heartbeat detection module; a network abnormality confirmation module, configured to, when any one of the three network detection modes judges that the network is abnormal, return network abnormality information to a corresponding processor of the three processors, wherein the network abnormality confirmation module comprises a first judgment module, a second judgment module and a third judgment module, the first judgment module is configured to, when the ifconfig state detection mode judges that a data link layer is in a non-communication state of an optical port to judge that a network cable or a network card is faulty, return the data link layer in the non-communication state of the optical port to a first processor of the three processors, the second judgment module is configured to, when the ICMP packet detection mode judges that a network routing is abnormal, return the network routing abnormality to a second processor of the three processors, and the third judgment module is configured to, when the heartbeat detection mode judges that a transmission layer is in a link disconnection state, return the transmission layer in the link disconnection state to a third processor of the three processors; and a network transmission module, configured to switch the main link to a backup link or re-establish the main link according to the network abnormality information received by the corresponding processor, and utilize the backup link or the re-established main link to transmit data.

8. The apparatus for detecting TCP link according to claim 7, wherein, The network transmission module is configured to: switch the main link to the backup link directly according to the data link layer in the non-communication state of the optical port received by the first processor, and transmit data through the backup link; when the second processor receives network routing abnormality, detect the backup link again, and when a secondary detection result is that the network is normal, switch the main link to the backup link, and transmit data through the backup link; and ​ According to the third processor receives the transmission layer is in link disconnected state, reestablishes the main link, and uses the reestablished main link to carry out data transmission.

Citation Information

Patent Citations

  • Methods and apparatus for monitoring link integrity for signaling traffic over a path traversing hybrid ATM / Ethernet infrastructure in support of packet voice service provisioning

    US20060268729A1