Remote communication method based on transmission control protocol and related device
By determining the target socket based on communication events in the automotive diagnostic system and detecting the reception and existence of data frames, efficient data transmission is achieved, timeout problems caused by packet loss and retransmission in remote diagnosis are solved, and improved Diagnostic success rate.
Patent Information
- Application Number
- CN202411357271.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2044-09-27
AI Technical Summary
In remote diagnosis of automobiles, data transmission between diagnostic equipment and vehicles is caused by the distance and the unreliability of network communication, resulting in packet loss and retransmission, causing data frame timeout, affecting the diagnosis success rate.
By determining and calling the target socket based on the transmission port processor of the automotive diagnostic system, the target socket is called to detect the receiving of the data frame and the presence of the second data frame. Send to achieve efficient transmission of data frames.
Without increasing the number of transmissions and slightly increasing the amount of data, the probability of data frame timeout caused by packet loss and retransmission is reduced, and the data transmission efficiency and reliability of the automotive diagnostic system are improved.
Smart Images

Figure CN119363846A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of automobile diagnosis, and in particular to a remote communication method based on a transmission control protocol and a related device. Background Art
[0002] Remote car diagnosis requires remote data transmission between the diagnostic device and the vehicle through two port devices connected to the diagnostic device and the vehicle respectively. In actual applications, the diagnostic device and the vehicle are far apart, even in different cities or countries. The data frames that need to be transmitted for car diagnosis are small packets with high transmission frequency. During network communication, if wireless networks such as WiFi or 4G are used, the probability of packet loss and retransmission will be very high; if a wired network connection is used, packet loss will also occur. Even if TCP communication with high reliability is used on the basis of wired or wireless connection, packet loss is inevitable. According to TCP's own packet loss and retransmission algorithm, the packet loss and retransmission message will often take more than 200 milliseconds to be sent to the other party again. However, vehicle diagnosis has very high requirements for delay. A delay of 100 or 200 milliseconds usually leads to timeout and diagnosis failure. Summary of the invention
[0003] The embodiments of the present application provide a remote communication method and related devices based on the transmission control protocol, which can reduce the probability of data frame timeout due to packet loss and retransmission without significantly increasing the number of transmissions and the amount of data sent.
[0004] In a first aspect, an embodiment of the present application provides a remote communication method based on a transmission control protocol, which is applied to a processor of a transmission port of an automobile diagnostic system, wherein the automobile diagnostic system further includes a bus connected to the transmission port, and the method includes:
[0005] Determine and call the target socket according to the previous communication event, and the target socket is used for sending and receiving data frames of the current communication event;
[0006] Detecting a reception condition of a first data frame and an existence condition of a second data frame of a target socket according to a detection strategy, wherein the reception condition includes successful reception, the first data frame is a data frame transmitted from a bus, the second data frame is data sent in a previous communication event in a data buffer, the existence condition includes existence, and the detection strategy is a preset strategy;
[0007] Data is sent through the target socket based on the reception status and the existence status, wherein, when it is detected that the reception status is successful and the existence status of the second data frame is existence, the first data frame and the second data frame are packaged respectively to obtain a first data packet and a second data packet, and the first data packet and the second data packet are sent through the target socket.
[0008] In a possible embodiment, the target socket includes the first socket or the second socket, and determining and calling the target socket according to the previous communication event includes:
[0009] If it is detected that the first socket is used for data transmission and reception in the previous communication event, the target socket is determined to be the second socket, and the second socket is called;
[0010] If it is detected that the second socket is used for data transmission and reception in the previous communication event, the target socket is determined to be the first socket, and the first socket is called.
[0011] In a possible embodiment, the existence condition also includes non-existence, and detecting the reception condition of the first data frame of the target socket and the existence condition of the second data frame according to the detection strategy includes:
[0012] Detecting the reception of the first data frame of the target socket;
[0013] Acquire time information of the second data frame, where the time information represents the time length from the moment when the second data frame is acquired to the current moment;
[0014] The time information is compared with the timeout threshold. If the time information does not meet the timeout threshold, the existence of the second data frame is determined to be non-existent; if the time information meets the timeout threshold, the existence of the second data frame is determined to be present.
[0015] In a possible embodiment, the reception condition of the first data frame further includes a reception timeout, and sending data through the target socket based on the reception condition and the existence condition further includes:
[0016] When it is detected that the receiving condition is a receiving timeout and the existence condition of the second data frame is existence, the second data frame is packaged to obtain a second data packet, and the second data packet is sent through the target socket;
[0017] When it is detected that the receiving condition is a receiving timeout and the existence condition of the second data frame is non-existence, the step of detecting the receiving condition of the first data frame of the target socket and the existence condition of the second data frame according to the detection strategy is repeated.
[0018] In a possible embodiment, sending data based on the reception situation and the existence situation further includes:
[0019] When it is detected that the receiving condition is successful and the existence condition is non-existent, the first data frame is packaged to obtain a first data packet, and the first data packet is sent through the target socket.
[0020] In a possible embodiment, after the step of sending the first data packet and the second data packet through the target socket, the method further includes: deleting the second data frame; and looping the step of determining and calling the target socket according to the previous communication event.
[0021] In a possible embodiment, the automobile diagnostic system also includes a target vehicle and a diagnostic device, the transmission port includes a first transmission port connected to the target vehicle and a second transmission port connected to the diagnostic device, and the bus includes a first bus for connecting the target vehicle and the first transmission port, and a second bus for connecting the diagnostic device and the second transmission port.
[0022] In a second aspect, an embodiment of the present application provides a remote communication device based on a transmission control protocol, which is applied to a processor of a transmission port of an automobile diagnostic system, wherein the transmission port is bound to a first socket and a second socket, and the automobile diagnostic system further includes a bus, which is connected to the transmission port, and the method includes:
[0023] A determination module, used to determine and call a target socket according to a previous communication event, the target socket being used for sending and receiving data frames of the current communication event;
[0024] a detection module, used for detecting a reception condition of a first data frame of a target socket and an existence condition of a second data frame according to a detection strategy, wherein the reception condition includes successful reception, the first data frame is a data frame transmitted from a bus, the second data frame is data sent in a previous communication event in a data buffer, the existence condition includes existence, and the detection strategy is a preset strategy;
[0025] A sending module is used to send data through a target socket based on a reception status and an existence status, wherein when it is detected that the reception status is successful and the existence status of the second data frame is existence, the first data frame and the second data frame are packaged to obtain a first data packet and a second data packet respectively, and the first data packet and the second data packet are sent through the target socket.
[0026] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the program includes instructions for executing some or all of the steps described in the first aspect of the embodiment of the present application.
[0027] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. The computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes some or all of the steps described in the first aspect.
[0028] In a fifth aspect, an embodiment of the present application provides a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute some or all of the steps described in the first aspect of the embodiment of the present application. The computer program product may be a software installation package.
[0029] By implementing the embodiment of the present application, a target socket is determined and called according to the previous communication event, and the target socket is used for sending and receiving data frames of the current communication event; the reception status of the first data frame of the target socket and the existence status of the second data frame are detected according to the detection strategy, the reception status includes successful reception, the first data frame is a data frame transmitted from the bus, the second data frame is the data sent in the previous communication event in the data buffer, the existence status includes existence, and the detection strategy is a preset strategy; data is sent through the target socket based on the reception status and the existence status, wherein, when it is detected that the reception status is successful reception and the existence status of the second data frame is existence , respectively packing the first data frame and the second data frame to obtain the first data packet and the second data packet, and sending the first data packet and the second data packet through the target socket. Compared with the existing mechanism in which the data frame sending end sends the same data frame to the data receiving end through two data transmission channels at the same time, the present application selects, determines and calls the target socket as the sending endpoint, and determines the specific data to be sent according to the existence of the first data frame of the current communication event and the second data frame of the historical communication event, thereby shortening the time required for data retransmission without increasing the number of transmissions and slightly increasing the amount of data, which is beneficial to reducing the probability of communication timeout caused by packet loss. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the background technology, the drawings required for use in the embodiments of the present invention or the background technology will be described below.
[0031] Figure 1 is a system architecture diagram of an automobile diagnostic system provided by an embodiment of the present application;
[0032] Figure 2 It is a flow chart of a remote communication method based on a transmission control protocol provided in an embodiment of the present application;
[0033] Figure 3 It is a schematic diagram of the interaction of transmission ports in a remote communication method based on a transmission control protocol provided in an embodiment of the present application;
[0034] Figure 4 It is a flow chart of another remote communication method based on the transmission control protocol provided in an embodiment of the present application;
[0035] Figure 5 It is a structural diagram of a remote communication device based on a transmission control protocol proposed in an embodiment of the present application;
[0036] Figure 6 It is a structural schematic diagram of an electronic device proposed in an embodiment of the present application. DETAILED DESCRIPTION
[0037] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0038] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or electronic device that includes a series of steps or units is not limited to the listed steps or units, but in an optional example also includes steps or units that are not listed, or in an optional example also includes other steps or units inherent to these processes, methods, products, or electronic devices.
[0039] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0040] The socket mentioned in this article is a socket, which is an abstraction in computer network programming. It provides an interface for communication on the network.
[0041] See also Figure 1 , Figure 1 is a system architecture diagram of an automobile diagnostic system provided by an embodiment of the present application, such as Figure 1 As shown, the automobile diagnostic system 100 includes: a target vehicle 110 , a diagnostic device 120 , a first transmission port 130 and a second transmission port 140 .
[0042] The automobile diagnostic system 100 includes a transmission port, which includes a first transmission port 130 and a second transmission port 140. The first transmission port 130 is connected to the target vehicle 110 through a CAN bus, and the second transmission port 140 is connected to the diagnostic device 120 through a CAN bus, that is, data can be transmitted between the target vehicle 110 and the first transmission port 130, and data can be transmitted between the diagnostic device 120 and the second transmission port 140. The first transmission port 130 and the second transmission port 140 can send and receive data through a network.
[0043] The first transmission port 130 and the second transmission port 140 may be an electronic device with a processor, and the first transmission port 130 is used to receive data frames from the network or from the target vehicle 110 and send data to the network or the target vehicle 110; the second transmission port 140 is used to receive data frames from the network or from the diagnostic device 120 and send data to the network or the diagnostic device 120. The first transmission port 130 and the second transmission port 140 can perform data type conversion, for example, bus data transmitted by the target vehicle 110 or the diagnostic device 120 through the bus can be converted into transparent transmission data of the network, and transparent transmission data transmitted from the network can also be converted into bus data that can be transmitted through the bus.
[0044] The diagnostic device 120 reads the information of the target vehicle 110 through the first transmission port 130 and the second transmission port 140, exchanges data based on the communication protocol, and realizes the detection of the state of the target vehicle 110 and the diagnosis of the fault, wherein the above-mentioned communication protocol can be the transmission control protocol (TCP).
[0045] The first transmission port 130 and the second transmission port 140 may be connected wirelessly or by wire, which is not limited here.
[0046] See also Figure 2 , Figure 2 is a flow chart of a remote communication method based on a transmission control protocol provided in an embodiment of the present application. The method is applied to a processor of a transmission port of an automobile diagnostic system. The automobile diagnostic system also includes a bus connected to the transmission port, such as Figure 2 As shown, the method comprises the following steps:
[0047] S210, determining and calling a target socket according to the previous communication event, the target socket being used for sending and receiving data frames of the current communication event.
[0048] Among them, the previous communication event refers to the event of sending the previous data frame that needs to be transmitted. Each time data is sent, a socket is called for sending. A socket is a concept at the function level and is a communication endpoint that provides the interface and functions required for communication. The target socket can be selected according to a predetermined rule. For example, it can be the socket of the current communication event determined by the socket used in the previous communication event. The target socket is used for sending and receiving data frames of the current communication event. The sending of data frames can be to send the packaged data frames, and the receiving can also be to receive a data packet.
[0049] In a possible embodiment, the target socket includes a first socket or a second socket, and determining and calling the target socket according to the previous communication event includes: if it is detected that the previous communication event uses the first socket for data transmission and reception, the target socket is determined to be the second socket, and the second socket is called; if it is detected that the previous communication event uses the second socket for data transmission and reception, the target socket is determined to be the first socket, and the first socket is called.
[0050] Among them, multiple sockets can be constructed in the processor, such as a first socket, a second socket, etc. Each socket can be called, and the socket called in the current communication event is used as the target socket. The rule for determining the target socket can determine the socket used for the current communication according to the socket used in the previous communication event. Specifically, if the previous communication event used the first socket, the target socket selects the second socket as the socket of the current communication event. If the previous communication event used the second socket, the target socket selects the first socket as the socket of the current communication event.
[0051] It can be seen that in this embodiment, the socket of the current communication event can be selected by the socket of the previous communication event, which can improve the concurrent processing capability and improve the data transmission efficiency.
[0052] S220, detecting the reception status of the first data frame and the existence status of the second data frame of the target socket according to the detection strategy, the reception status includes successful reception, the first data frame is a data frame transmitted from the bus, the second data frame is the data sent in the previous communication event in the data buffer, the existence status includes existence, and the detection strategy is a preset strategy.
[0053] Among them, the transmission port also has a data buffer or data storage area for temporarily storing received data frames. The processor can check whether the data buffer of the transmission port has received the data frame transmitted by the bus. The processor can also check whether the data frame sent in the previous communication event exists in the data buffer.
[0054] The processor continuously detects whether the data buffer area receives the first data frame and whether the second data frame exists, and obtains the reception status of the first data frame and the existence status of the second data frame. The detection strategy can be a judgment condition for determining whether the second data frame exists or not, and specifically, it can be determined whether the second data frame exists based on the length of time the second data frame exists. The reception status of the first data frame can include successful reception and can also include reception timeout, and the existence status of the second data frame can include existence and can also include non-existence.
[0055] Wherein, the reception success indicates that the first data frame is received within the timeout threshold, and the reception timeout indicates that the first data frame is not received within the timeout threshold; the existence of the existence situation indicates that the second data frame that meets the detection strategy is detected, and the non-existence situation indicates that the second data frame that meets the detection strategy is not detected. The above-mentioned timeout threshold can be a preset time length, which is used to limit the time length of waiting for the first data frame to be received from the bus.
[0056] In a possible embodiment, the existence condition also includes non-existence, and detecting the reception condition of the first data frame of the target socket and the existence condition of the second data frame according to the detection strategy includes:
[0057] 21. Detect the reception of the first data frame of the target socket;
[0058] 22. Obtain time information of the second data frame, where the time information represents the time length from the moment the second data frame is obtained to the current moment;
[0059] 23. Compare the time information with the timeout threshold. If the time information does not meet the timeout threshold, determine that the second data frame does not exist; if the time information meets the timeout threshold, determine that the second data frame does exist.
[0060] The reception situation can also be determined based on a timeout threshold. If it is detected that the target socket receives the first data frame within the timeout threshold, the reception situation of the first data frame is a successful reception. If it is detected that the target socket does not receive the first data frame within the timeout threshold, the reception situation of the first data frame is a reception timeout. The time information of the second data frame is obtained. The time information can be obtained based on the timestamp in the second data frame. Specifically, a time length can be obtained by subtracting the timestamp from the current time. The time length is the time information. Then, the time information of the second data frame is compared with a preset timeout threshold. If the time information does not meet the timeout threshold, the existence of the second data frame is determined to be non-existent. If the time information meets the timeout threshold, the existence of the second data frame is determined to be present.
[0061] If the second data frame is not detected, it also indicates that the existence of the second data frame is non-existent.
[0062] It can be seen that in this embodiment, the existence of the second data frame is judged by the time information of the second data frame, and the reception status of the first data frame is obtained, so that the first data frame and / or the second data frame can be sent in time subsequently, which is conducive to reducing data timeouts.
[0063] S230, sending data through the target socket based on the reception status and the existence status, wherein, when it is detected that the reception status is successful and the existence status of the second data frame is existence, the first data frame and the second data frame are packaged to obtain a first data packet and a second data packet respectively, and the first data packet and the second data packet are sent through the target socket.
[0064] The receiving conditions include successful receiving and receiving timeout, and the existence conditions include existence and non-existence. Combining the two conditions in pairs can obtain multiple decision conditions, and the specific data content to be sent is decided based on the receiving conditions and the existence conditions.
[0065] Among them, if it is detected that the reception status is successful and the existence status of the second data frame is also detected, the first data frame and the second data frame are respectively packaged to obtain the first data packet and the second data packet, and the first data packet and the second data packet are sent through the called target socket. If sent to the network, they can be converted into transparent data that can be transmitted by the network and transmitted through the network.
[0066] In a possible embodiment, the reception status of the first data frame also includes a reception timeout, and sending data through the target socket based on the reception status and the existence status also includes: when it is detected that the reception status is a reception timeout and the existence status of the second data frame is existence, the second data frame is packaged to obtain a second data packet, and the second data packet is sent through the target socket; when it is detected that the reception status is a reception timeout and the existence status of the second data frame is non-existence, repeating the steps of detecting the reception status of the first data frame of the target socket and the existence status of the second data frame according to the detection strategy.
[0067] If it is detected that the reception status of the first data frame is reception timeout and the existence status of the second data frame is existence, the second data frame is packaged into a second data packet and the second data packet is sent through the target socket. If it is detected that the reception status of the first data frame is reception timeout and the existence status of the second data frame is non-existence, it means that there is no data that can be sent in the data buffer at this time, then continue to wait for the bus data to transmit the first data frame and repeat the above steps of the reception status of the first data frame of the target socket and the existence status of the second data frame. Alternatively, the data transmission can be directly terminated.
[0068] Among them, sending data based on the reception status and the existence status also includes: when it is detected that the reception status is successful and the existence status is non-existent, packaging the first data frame to obtain a first data packet, and sending the first data packet through the target socket.
[0069] If it is detected that the reception status of the first data frame is successful, but the existence status of the second data frame is non-existent, only the first data frame is packaged to obtain a first data packet, and then the first data packet is sent through the target socket.
[0070] It can be seen that in this embodiment, multiple decisions are made by judging the reception status of the first data frame and the existence status of the second data frame, and different data are sent under different combinations of situations, so that the existing data is sent to the maximum extent, and there is no need to send retransmitted data separately. This achieves the goal of shortening the time required for data retransmission without increasing the number of transmissions and slightly increasing the amount of data, which is beneficial to reducing the probability of communication timeout caused by packet loss.
[0071] In a possible embodiment, after the step of sending the first data packet and the second data packet through the target socket, the method further includes: deleting the second data frame; and looping the step of determining and calling the target socket according to the previous communication event.
[0072] Among them, after sending the first data packet or sending the first data packet and the second data packet or sending the second data packet, it is equivalent to the end of the current communication event and preparing to enter the next communication event, then the second data frame of the previous communication event is deleted, and the next communication event is entered. The cycle mechanical energy determines and calls the target socket according to the previous communication event. At this time, the first data frame becomes the data frame of the previous communication event relative to the next communication event, and the target socket of the next communication event is determined according to the socket of the current communication event.
[0073] For example, if the first socket and the second socket are set, and the previous communication event sent data through the first socket, then the current communication event determines that the second socket is the target socket. If the current communication event ends, that is, data is sent through the target socket, then the flow will be transferred to the next communication event, the second data frame of the previous communication event will be deleted, and the first data frame received in the current communication event will be used as the second data frame of the previous communication event in the next communication event, and the target socket is determined to be the first socket, and wait for the reception of the new first data frame transmitted from the bus.
[0074] It can be seen that in this embodiment, the data sent last time is used as the second data frame of the next communication event, and the socket is switched to send data. This can make the data sent through the target socket next time include the second data frame sent last time, and there is no need to send retransmitted data separately. This achieves the goal of shortening the time required for data retransmission without increasing the number of transmissions and slightly increasing the amount of data, which is beneficial to reducing the probability of communication timeout caused by packet loss.
[0075] In a possible embodiment, the automobile diagnostic system also includes a target vehicle and a diagnostic device, the transmission port includes a first transmission port connected to the target vehicle and a second transmission port connected to the diagnostic device, and the bus includes a first bus for connecting the target vehicle and the first transmission port, and a second bus for connecting the diagnostic device and the second transmission port.
[0076] The automobile diagnostic system includes two ends, a target vehicle and a diagnostic device. The target vehicle is connected to a first transmission port through a bus, and the diagnostic device is connected to a second transmission port through a bus. The first transmission port and the second transmission port can receive and send data. For example, data can be transparently transmitted between the first transmission port and the second transmission port through a network. The first transmission port and the second transmission port can both execute the contents described in any of the above embodiments.
[0077] It should be noted that if the automobile diagnostic system further includes other transmission ports, the contents described in any of the above embodiments may also be executed, and the specific number of transmission ports is not limited herein.
[0078] It can be seen that in the automobile diagnostic system, each port can be set with at least two sockets to transmit data alternately, and each port can execute the contents described in the above embodiment, thereby shortening the time required for data retransmission without increasing the number of transmissions and slightly increasing the amount of data, which is beneficial to reducing the probability of communication timeout caused by packet loss.
[0079] For example, referring to Table 1, if the target vehicle sends ten frames of data numbered 1, 2, 3, 4, 5, 6, 7, 8, 9, and 10 to the first transmission port through the bus, and the interval between sending each frame of data is 10 milliseconds. The first transmission port has set the first socket and the second socket, and first determines that the first socket is the target socket, and sets the timeout threshold to 20 milliseconds. According to Table 1, it can be seen that: it is detected that 1 is received, and at this time, there is no sent data frame in the data buffer, then the target socket, that is, the first socket, packs 1 and sends it; the target socket is switched to the second socket, and the second socket receives 2 after 10 milliseconds, which does not exceed 20 milliseconds. It is detected whether there is a sent data frame. At this time, there is 1 in the data buffer, and it is determined according to the time information that the existence time of 1 at this time does not exceed 20 milliseconds, then 1 and 2 are packed separately and sent through the target socket, that is, the second socket; this cycle is repeated until the last frame of data is also sent (9 and 10 are sent together), and the target socket is switched to the first socket. The first socket still does not receive the data frame after 20 milliseconds, and it is detected whether there is a sent data frame. At this time, there is 10 in the data buffer, and it is determined according to the time information that the existence time of 10 at this time does not exceed 20 milliseconds, then 10 is packed and sent through the target socket, that is, the first socket.
[0080]
[0081] Table 1
[0082] It should be noted that the time length of the above timeout threshold can be set according to the actual situation, which can be 20 milliseconds, 15 milliseconds, or other time lengths, and the specific market is not limited here. Even if the timeout threshold will lead to wider restrictions and increased timeout probability, in the automotive diagnosis scenario, data transmission is small and dense. As long as the data is frequent, there is a high probability that timeouts caused by retransmission will not occur.
[0083] It should be noted that during vehicle diagnosis, if the bus is a CAN bus, the data length of the data frame transmitted by the CAN bus plus the frame number, timestamp, ID and other data will usually not exceed 30 bytes. Even for CANFD messages, the data length of a frame of data generally does not exceed 64 bytes. In this case, each data transmission carries the data sent last, and the increased data length is also limited, so it will not lead to a situation where the data volume is too large. Therefore, it will almost never cause a higher delay due to the increase in data volume than without the data sent last time.
[0084] In one possible embodiment, see Figure 3 , Figure 3 is a schematic diagram of the interaction of transmission ports in a remote communication method based on a transmission control protocol provided in an embodiment of the present application, such as Figure 3As shown, the processor of the first port can call the target socket, and the processor of the second port can call the target socket. The selection of the target socket is based on Figure 2 The method described in the embodiment is selected, the first transmission port establishes a TCP connection with the server, and the second transmission port establishes a TCP connection with the server, thereby achieving the effect of sending and receiving data between the first transmission port and the second transmission port through the target socket and the TCP connection. The above-mentioned servers can be the same or different servers, and are not specifically limited here.
[0085] Optionally, a direct TCP connection may be established between the second transmission port and the first transmission port, without establishing a TCP connection with the server to achieve the effect of connecting the first transmission port and the second transmission port. The specific situation depends on the actual situation and is not limited here.
[0086] It can be seen that in this embodiment, compared with the existing mechanism in which the data frame sending end sends the same data frame to the data receiving end through two data transmission channels at the same time, this embodiment selects to determine and call the target socket as the sending endpoint, thereby achieving the situation where the number of transmissions is not increased and the amount of data is slightly increased. The time required for data retransmission is shortened, which is beneficial to reducing the probability of communication timeout caused by packet loss.
[0087] In one possible embodiment, see Figure 4 , Figure 4 FIG. 1 is a flow chart of another remote communication method based on the transmission control protocol provided in an embodiment of the present application. Figure 4 As shown, the remote communication method based on the transmission control protocol includes:
[0088] S410, determining and calling a target socket according to a previous communication event.
[0089] S420, detecting whether the reception status of the first data frame of the target socket is successful reception or reception timeout.
[0090] S430: Detect whether the second data frame exists or does not exist.
[0091] Among them, if the reception status of the first data frame is successful reception, and the existence status of the second data frame is existence, execute step S441; if the reception status of the first data frame is successful reception, and the existence status of the second data frame is non-existence, execute step S442; if the reception status of the first data frame is reception timeout, and the existence status of the second data frame is existence, execute step S443; if the reception status of the first data frame is reception timeout, and the existence status of the second data frame is non-existence, execute step S420.
[0092] S441, respectively packing the first data frame and the second data frame to obtain a first data packet and a second data packet, and sending the first data packet and the second data packet through a target socket.
[0093] S442, pack the first data frame to obtain a first data packet, and send the first data packet through the target socket.
[0094] S443, pack the second data frame to obtain a second data packet, and send the second data packet through the target socket.
[0095] S450, delete the second data frame.
[0096] After the second data frame is deleted, step S410 and subsequent steps are executed cyclically.
[0097] It should be noted that the specific instructions for the above steps are already in Figure 2 The examples are described in detail in the embodiment, and will not be described in detail in this embodiment. Please refer to Figure 2 Embodiment Content.
[0098] It can be seen that in this embodiment, the target socket is determined and called according to the previous communication event, and the target socket is used for sending and receiving data frames of the current communication event; the reception status of the first data frame and the existence status of the second data frame of the target socket are detected according to the detection strategy, the reception status includes successful reception, the first data frame is a data frame transmitted from the bus, the second data frame is the data sent in the previous communication event in the data buffer, the existence status includes existence, and the detection strategy is a preset strategy; data is sent through the target socket based on the reception status and the existence status, wherein, when it is detected that the reception status is successful reception and the existence status of the second data frame is existence, The first data frame and the second data frame are packaged respectively to obtain the first data packet and the second data packet, and the first data packet and the second data packet are sent through the target socket. Compared with the existing mechanism that the data frame sending end sends the same data frame to the data receiving end through two data transmission channels at the same time, the present application selects and determines and calls the target socket as the sending endpoint, and determines the specific data to be sent according to the existence of the first data frame of the current communication event and the second data frame of the historical communication event, thereby shortening the time required for data retransmission without increasing the number of transmissions and slightly increasing the amount of data, which is beneficial to reducing the probability of communication timeout caused by packet loss.
[0099] See also Figure 5 , Figure 51 is a schematic diagram of the structure of a remote communication device based on a transmission control protocol proposed in an embodiment of the present application. The device is applied to a processor of a transmission port of an automobile diagnostic system, the transmission port is bound to a first socket and a second socket, and the automobile diagnostic system also includes a bus, and the bus is connected to the transmission port. The remote communication device 500 based on the transmission control protocol includes: a determination module 510, a detection module 520 and a sending module 530, wherein:
[0100] The determination module 510 is used to determine and call the target socket according to the previous communication event, and the target socket is used for sending and receiving data frames of the current communication event;
[0101] The detection module 520 is used to detect the reception status of the first data frame of the target socket and the existence status of the second data frame according to the detection strategy, the reception status includes successful reception, the first data frame is a data frame transmitted from the bus, the second data frame is the data sent in the previous communication event in the data buffer, the existence status includes existence, and the detection strategy is a preset strategy;
[0102] The sending module 530 is used to send data through the target socket based on the reception status and the existence status, wherein, when it is detected that the reception status is successful and the existence status of the second data frame is existence, the first data frame and the second data frame are packaged respectively to obtain the first data packet and the second data packet, and the first data packet and the second data packet are sent through the target socket.
[0103] In a possible implementation, the determination module 510 is specifically configured to:
[0104] If it is detected that the first socket is used for data transmission and reception in the previous communication event, the target socket is determined to be the second socket, and the second socket is called;
[0105] If it is detected that the second socket is used for data transmission and reception in the previous communication event, the target socket is determined to be the first socket, and the first socket is called.
[0106] In a possible implementation, the detection module 520 is specifically configured to detect the reception of the first data frame of the target socket and the existence of the second data frame according to the detection strategy:
[0107] Detecting the reception of the first data frame of the target socket;
[0108] Acquire time information of the second data frame, where the time information represents the time length from the moment when the second data frame is acquired to the current moment;
[0109] The time information is compared with the timeout threshold. If the time information does not meet the timeout threshold, the existence of the second data frame is determined to be non-existent; if the time information meets the timeout threshold, the existence of the second data frame is determined to be present.
[0110] In a possible implementation, the sending module 530 is further configured to send data through the target socket based on the reception status and the existence status:
[0111] When it is detected that the receiving condition is a receiving timeout and the existence condition of the second data frame is existence, the second data frame is packaged to obtain a second data packet, and the second data packet is sent through the target socket;
[0112] When it is detected that the receiving condition is a receiving timeout and the existence condition of the second data frame is non-existence, the step of detecting the receiving condition of the first data frame of the target socket and the existence condition of the second data frame according to the detection strategy is repeated.
[0113] In a possible implementation, the sending module 530 is further configured to send data through the target socket based on the reception status and the existence status:
[0114] When it is detected that the receiving condition is successful and the existence condition is non-existent, the first data frame is packaged to obtain a first data packet, and the first data packet is sent through the target socket.
[0115] In a possible implementation, the sending module 530 is further configured to delete the second data frame in terms of sending data through the target socket based on the reception status and the existence status.
[0116] It is worth noting that the specific functional implementation of the remote communication device 500 based on the transmission control protocol can be found in the above Figure 2 The description of the remote communication method based on the transmission control protocol shown, for example, determines that module 510 is used to implement the relevant content of executing S210. Each unit or module in the remote communication device 500 based on the transmission control protocol can be separately or completely combined into one or more other units or modules to constitute, or one (some) of the units or modules can also be divided into multiple smaller units or modules in function to constitute, which can achieve the same operation without affecting the realization of the technical effect of the embodiment of the present invention. The above-mentioned units or modules are divided based on logical functions. In practical applications, the function of one unit (or module) is implemented by multiple units (or modules), or the function of multiple units (or modules) is implemented by one unit (or module).
[0117] It can be seen that the remote communication device based on the transmission control protocol described in the embodiment of the present application determines and calls the target socket according to the previous communication event, and the target socket is used for sending and receiving data frames of the current communication event; detects the reception status of the first data frame of the target socket and the existence status of the second data frame according to the detection strategy, the reception status includes successful reception, the first data frame is a data frame transmitted from the bus, and the second data frame is the data sent in the previous communication event in the data buffer, the existence status includes existence, and the detection strategy is a preset strategy; based on the reception status and the existence status, data is sent through the target socket, wherein, when it is detected that the reception status is successful and the second data frame is present, According to the existence of the data frame, the first data frame and the second data frame are packaged respectively to obtain the first data packet and the second data packet, and the first data packet and the second data packet are sent through the target socket. Compared with the existing mechanism that the data frame sending end sends the same data frame to the data receiving end through two data transmission channels at the same time, the present application selects and determines and calls the target socket as the sending endpoint, and determines the specific data to be sent according to the existence of the first data frame of the current communication event and the second data frame of the historical communication event, thereby shortening the time required for data retransmission without increasing the number of transmissions and slightly increasing the amount of data, which is beneficial to reducing the probability of communication timeout caused by packet loss.
[0118] See also Figure 6 , Figure 6 It is a structural diagram of an electronic device proposed in an embodiment of the present application. As shown in the figure, the electronic device 600 includes a processor 610, a memory 620, a communication interface 630 and one or more programs 621. The one or more programs 621 are stored in the memory 620 and are configured to be executed by the processor 610.
[0119] The processor 610, the memory 620, and the communication interface 630 are connected to each other and perform communication work with each other;
[0120] The memory 620 may be a volatile memory such as a dynamic random access memory DRAM, or a non-volatile memory such as a mechanical hard disk. The memory 620 is used to store a set of executable program codes, and the processor 610 is used to call one or more programs 621 stored in the memory 620, and can execute the above-mentioned Figure 2 Part or all of the steps of any transmission control protocol-based remote communication method recorded in the embodiments.
[0121] Among them, the electronic device 600 may include smart phones (such as Android phones, iOS phones, Windows Phone phones, etc.), tablet computers, PDAs, driving recorders, vehicle-mounted electronic devices, servers, laptops, mobile Internet electronic devices (MID, Mobile Internet Devices) or wearable electronic devices (such as smart watches, Bluetooth headsets), etc. The above are only examples and not exhaustive, including but not limited to the above electronic devices.
[0122] An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute part or all of the steps of any method described in the above method embodiments, and the above computer includes an electronic device.
[0123] The embodiment of the present application also provides a computer program product, the computer program product includes a non-transitory computer-readable storage medium storing a computer program, the computer program is operable to cause a computer to execute some or all of the steps of any method described in the method embodiment. The computer program product may be a software installation package, and the computer includes an electronic device.
[0124] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0125] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0126] In the several embodiments provided in the present application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the above-mentioned units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.
[0127] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0128] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0129] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory, including a number of instructions to enable a computer electronic device (which can be a personal computer, electronic device or network electronic device, etc.) to perform all or part of the steps of the above-mentioned methods of each embodiment of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0130] A person skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable memory, and the memory can include: a flash drive, a read-only memory (English: Read-Only Memory, abbreviated as: ROM), a random access memory (English: Random Access Memory, abbreviated as: RAM), a magnetic disk or an optical disk, etc.
[0131] The embodiments of the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A remote communication method based on transmission control protocol, characterized in that: A processor applied to a transmission port of an automobile diagnostic system, wherein the automobile diagnostic system further comprises a bus connected to the transmission port, and the method comprises: Determine and call a target socket according to a previous communication event, wherein the target socket is used for sending and receiving data frames of the current communication event; Detecting the reception status of the first data frame and the existence status of the second data frame of the target socket according to the detection strategy, wherein the reception status includes successful reception, the first data frame is a data frame transmitted from the bus, the second data frame is the data sent in the previous communication event in the data buffer, the existence status includes existence, and the detection strategy is a preset strategy; Data is sent through the target socket based on the reception status and the existence status, wherein, when it is detected that the reception status is the successful reception and the existence status of the second data frame is the existence, the first data frame and the second data frame are packaged to obtain a first data packet and a second data packet respectively, and the first data packet and the second data packet are sent through the target socket.
2. The method according to claim 1, characterized in that The target socket includes a first socket or a second socket, and the determining and calling the target socket according to the previous communication event includes: If it is detected that the previous communication event uses the first socket to send and receive data, the target socket is determined to be the second socket, and the second socket is called; If it is detected that the previous communication event uses the second socket to send and receive data, the target socket is determined to be the first socket, and the first socket is called.
3. The method according to claim 1, characterized in that The existence condition also includes non-existence, and the detecting, according to the detection strategy, the reception condition of the first data frame of the target socket and the existence condition of the second data frame includes: Detecting a reception status of a first data frame of the target socket; Acquire time information of the second data frame, where the time information represents the time length from the moment when the second data frame is acquired to the current moment; Compare the time information and the timeout threshold. If the time information does not meet the timeout threshold, determine that the existence of the second data frame is non-existent; if the time information meets the timeout threshold, determine that the existence of the second data frame is present.
4. The method according to claim 3, characterized in that The reception condition of the first data frame further includes a reception timeout, and the sending of data through the target socket based on the reception condition and the existence condition further includes: When it is detected that the receiving condition is the receiving timeout and the existence condition of the second data frame is the existence, the second data frame is packaged to obtain the second data packet, and the second data packet is sent through the target socket; When it is detected that the reception condition is the reception timeout and the existence condition of the second data frame is the non-existence, the step of detecting the reception condition of the first data frame of the target socket and the existence condition of the second data frame according to the detection strategy is repeated.
5. The method according to claim 3, characterized in that: The sending of data based on the receiving situation and the existence situation further includes: When it is detected that the receiving condition is successful reception and the existence condition is non-existence, the first data frame is packaged to obtain the first data packet, and the first data packet is sent through the target socket.
6. The method according to claim 2, characterized in that After the step of sending the first data packet and the second data packet through the target socket, the method further includes: deleting the second data frame; and looping the step of determining and calling the target socket according to the previous communication event.
7. The method according to any one of claims 1 to 6, characterized in that: The automobile diagnostic system also includes a target vehicle and a diagnostic device, the transmission port includes a first transmission port connected to the target vehicle and a second transmission port connected to the diagnostic device, the bus includes a first bus for connecting the target vehicle and the first transmission port, and a second bus for connecting the diagnostic device and the second transmission port.
8. A remote communication device based on a transmission control protocol, characterized in that: A processor applied to a transmission port of an automobile diagnostic system, wherein the transmission port is bound to a first socket and a second socket, the automobile diagnostic system further comprises a bus, the bus is connected to the transmission port, and the method comprises: A determination module, used to determine and call a target socket according to a previous communication event, wherein the target socket is used for sending and receiving data frames of a current communication event; A detection module, used for detecting the reception status of the first data frame and the existence status of the second data frame of the target socket according to a detection strategy, wherein the reception status includes successful reception, the first data frame is a data frame transmitted from a bus, the second data frame is data sent in the previous communication event in a data buffer, the existence status includes existence, and the detection strategy is a preset strategy; A sending module is used to send data through the target socket based on the reception status and the existence status, wherein, when it is detected that the reception status is the reception success and the existence status of the second data frame is the existence, the first data frame and the second data frame are packaged to obtain a first data packet and a second data packet respectively, and the first data packet and the second data packet are sent through the target socket.
9. A computer-readable storage medium, characterized in that: A remote communication program based on a transmission control protocol is stored, including execution instructions. When a processor of an electronic device executes the execution instructions, the processor executes the method according to any one of claims 1 to 7.
10. An electronic device, characterized in that: It comprises a processor and a memory storing execution instructions, wherein the memory stores one or more programs; when the processor executes the execution instructions stored in the memory, the processor executes the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Data transmission method and device, computer readable medium and electronic equipment
CN112953850A
Multi-thread data transmission method and device
CN114237937A
Data transmission method and device
CN117909098A
Method of restoring communication state of process
US20070260920A1
Ordered Event Notification
US20150277997A1