Single conduction transmission method based on UDP (User Datagram Protocol)
Patent Information
- Application Number
- CN202511665897.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-14
- Publication Date
- 2026-02-13
AI Technical Summary
Existing single-channel devices are inefficient and unreliable when transmitting large amounts of data, and cannot guarantee the accuracy and integrity of the data. In particular, under the UDP protocol, after the data packet is sent, it cannot be confirmed that the receiving end is ready and has been delivered, which poses a risk of data loss.
A gigabit Ethernet port and a unidirectional optical module are used to achieve single-channel transmission. A data segmentation and packet loss retransmission mechanism is introduced. The transmission of confirmation signals and exclusive CPU process control are achieved through GPIO to ensure the accuracy and integrity of data packet segmentation transmission.
It improves data transmission performance to 100Mbps, reduces packet loss rate, ensures data accuracy and integrity, and enhances the practicality of single-channel transmission devices.
Smart Images

Figure CN121530531A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communications, specifically a single-channel transmission method based on the UDP protocol. Background Technology
[0002] With the continuous advancement and widespread adoption of domestic production and information technology innovation projects, various industries have begun to widely apply domestically produced information technology innovation hosts and systems. In application areas with high confidentiality requirements, classified computers are not allowed to directly insert USB mass storage devices (USB flash drives) into the host for data transfer. Therefore, if data needs to be transferred from a USB mass storage device to a classified computer, it must be done securely and reliably through a single-channel platform. That is, only the USB mass storage device is allowed to transfer data to the computer, and data on the computer is not allowed to be transferred to the USB mass storage device through the single-channel platform. This can prevent classified computers from being infected with Trojan viruses that are easily carried by USB flash drives, and can also prevent classified data information on classified computers from being leaked through USB mass storage devices.
[0003] In some application scenarios, large amounts of data need to be transmitted. Existing single-channel optical devices have a performance of only 20MB / s. When dealing with hundreds of gigabytes or even terabytes of data, transmission becomes extremely time-consuming; for example, transmitting 1TB of data could take 15 hours, a wait that is unacceptable to users. Therefore, a high-performance single-channel optical device is needed to improve data transmission efficiency. Furthermore, the single-channel module ensures unidirectional data transmission through a unidirectional optical module. This physical isolation ensures data security. Due to the special nature of unidirectional transmission, high-performance single-channel modules can only transmit via the UDP protocol. However, due to the characteristics of UDP transmission, no connection needs to be established before sending data; it transmits directly using IP addresses and port identifiers. This stateless characteristic means that after a data packet is sent, there is no confirmation of the receiver's readiness, nor is delivery guaranteed. If the receiver's CPU processing power is insufficient, the data packet will be discarded directly. In other words, the UDP protocol is connectionless and unreliable, and cannot guarantee that data arrives in order, posing a risk of data loss. Summary of the Invention
[0004] To address the shortcomings of existing technologies, this invention provides a single-channel transmission method based on the UDP protocol. This method achieves single-channel transmission through a gigabit network port and a unidirectional optical module, thereby improving data transmission efficiency. Furthermore, it introduces a data segmentation and packet loss retransmission method, which does not affect data transmission performance while ensuring data accuracy and integrity.
[0005] To solve the aforementioned technical problem, the present invention adopts the following technical solution: a single-channel transmission method based on the UDP protocol, comprising the following steps: S01. Construct a single-channel transmission device. The single-channel transmission device includes a transmitter and a receiver. A data transmission channel and an acknowledgment signal transmission channel are provided between the transmitter and the receiver. The data transmission channel realizes unidirectional data transmission from the transmitter to the receiver based on a unidirectional optical module and a gigabit network port. The acknowledgment signal transmission channel realizes the acknowledgment mechanism for data packet block transmission between the transmitter and the receiver based on GPIO ports. S02. Data is transmitted between the sending end and the receiving end in data packet chunks. The capacity of the data packet is set, each data packet is numbered, and it is specified that the data packet with number 0 includes the data packet number, the CRC check code of the entire data block, the transmission block length and the valid data, while the data packets with numbers other than 0 include the data packet number and the valid data. S03, the PC sends a communication request command to the receiving end. The receiving end receives the communication request command and pulls the GPIO 0 level signal high. The sending end detects the level change of GPIO 0 and starts the data processing main thread MP1 and the UDP sending thread. The data processing main thread MP1 traverses the target folder of the USB storage device, reads data and writes it to the data buffer B0. The UDP sending thread reads a data block from the data buffer B0 and sends it to the receiving end. S04. After the sending end finishes sending a data block to the receiving end, it pulls GPIO1 high to notify the receiving end that the transmission is complete. At this time, the receiving end's receiving process detects the change in the level of GPIO1, confirms that the packet transmission is complete, performs integrity verification on the transmitted data block, and compares it with the CRC checksum stored in the data packet numbered 0. If they match, it means that the data block is complete, and it pulls GPIO2 high to notify the sending end. After the sending end detects the change in the level of GPIO2, it continues to send the next data block. If the data verification does not match, it pulls GPIO3 high. After the sending end detects the change in the level of GPIO3, it retransmits the data block and performs data block integrity verification. S05. The data processing process at the receiving end receives the UDP data sent by the sending end and transmits the data to the PC.
[0006] Furthermore, the data buffer B0 is a circular data buffer, which consists of multiple BLOCK data blocks. The BLOCK data block is the basic communication unit between the sending end and the receiving end.
[0007] Furthermore, after triggering the GPIO3 level, the sending end performs trigger frequency statistics. If the GPIO3 trigger frequency exceeds the set threshold, it indicates that the receiving end CPU is busy or network congestion has occurred. In this case, the sending end controls the UDP sending thread to perform speed reduction processing.
[0008] Furthermore, after slowing down the UDP sending thread, a timer is added. If the GPIO3 level is no longer triggered within the set time interval T, the slowdown process is lifted at the sending end.
[0009] Furthermore, there are four UDP sending threads P0, P1, P2, and P3, and the main thread MP1 and the UDP sending threads P0, P1, P2, and P3 share the data buffer B0.
[0010] Furthermore, the data processing process includes a UDP listening thread Px, a BULK response thread Py, and a data processing thread Pz in the shared data buffer B1. The UDP listening thread Px listens for UDP packets and receives data, storing it in the data buffer B1. The data processing thread Pz sorts the data in the data buffer B1, and the BULK response thread Py sends the data to the PC.
[0011] Furthermore, there are two data transmission channels between the sending end and the receiving end. UDP sending threads P0 and P1 send data to the receiving end through one data transmission channel, while UDP sending threads P2 and P3 send data to the receiving end through the other data transmission channel.
[0012] Furthermore, the two CPU cores of the isolated receiving end are used exclusively by the receiving process and the data processing process, that is, one process occupies one CPU core. The implementation method is as follows: the specified CPU is isolated for exclusive use by the server receiving process, the receiving process is bound to the isolated CPU through taskset, the startup script is configured, the taskset command is written into the script, and the binding is automatically completed after the system powers on.
[0013] Furthermore, the PC contains upper-layer application software. The receiving end runs service program B, and the sending end runs service program A. The upper-layer application software initiates a communication request command through the BULK transmission private protocol service program B. Service program B receives the communication request command and pulls the GPIO 0 level signal high. Service program A detects the level change of GPIO 0 and starts the data processing main thread MP1 and the UDP sending thread. The BULK response thread Py sends the data to the upper-layer application software in Bulk transmission mode.
[0014] Furthermore, the transmitting and receiving ends are implemented based on the RK3568 chip.
[0015] The beneficial effects of this invention are as follows: This invention achieves single-channel transmission through a gigabit network port and a unidirectional optical module, with an overall data transmission performance of up to 100 Mbps, which greatly improves data transmission performance and reduces the packet loss rate of UDP transmission. Furthermore, it introduces a method of data segmentation and packet loss retransmission, which does not affect data transmission performance and ensures the accuracy and integrity of the data, thus greatly improving the practicality of the single-channel transmission device. Attached Figure Description
[0016] Figure 1 This is a block diagram of a single-conductor transmission device. Figure 2 This is a flowchart of the data transmission process; Figure 3 This is a schematic diagram of data packet chunking during transmission. Detailed Implementation
[0017] The present invention will be further described below with reference to the accompanying drawings and specific embodiments.
[0018] Example 1 First, let's explain the English expression used in this invention: UDP: User Datagram Protocol, a network transport protocol.
[0019] GMAC: Gigabit network controller interface.
[0020] MTU: Maximum Transmission Unit.
[0021] GRUB: GRand Unified Bootloader, a multi-operating system boot manager, a complete program used to load and manage system boots.
[0022] This embodiment discloses a unidirectional transmission method based on the UDP protocol. The overall concept of this method is as follows: two RK3568 chips are used as the transmitter and receiver for data transmission. The transmitter and receiver are connected through a unidirectional optical module, and data can only be transmitted in one direction. The optical module is connected through the two GMAC gigabit Ethernet ports of the RK3568 chip, and data transmission is carried out through the UDP protocol, which greatly improves the reliability of UDP transmission.
[0023] This solution uses two RK3568 chips connected via two optical modules. Since optical modules can only transmit unidirectionally, this solution can only use optical modules connected through two GMAC gigabit Ethernet ports and transmit data unidirectionally via UDP packets. Due to the nature of UDP transmission, no connection needs to be established before sending data; it transmits directly using IP addresses and port identifiers. This stateless characteristic means that after a data packet is sent, there is no confirmation of the receiver's readiness, nor is delivery guaranteed. If the receiver's CPU processing power is insufficient, the data packet will be discarded directly. Without a checksum and retransmission mechanism, this solution is impractical. To address these issues, this solution's GPIO control method and process-exclusive CPU method significantly reduce the packet loss rate of UDP transmission. Furthermore, it introduces a data chunking and retransmission method, ensuring data accuracy and integrity without affecting data transmission performance.
[0024] Specifically, the implementation process of this method is as follows: S01. Construct a single-conductor transmission device, such as Figure 1 As shown, the single-channel transmission device includes a transmitter and a receiver. A data transmission channel and an acknowledgment signal transmission channel are provided between the transmitter and receiver. The data transmission channel consists of the GMAC gigabit Ethernet port of the RK3568 chip and a unidirectional optical module. Unidirectional data transmission from the transmitter to the receiver is realized based on the data transmission channel. The acknowledgment signal transmission channel is implemented through the GPIO port of the RK3568 chip. The acknowledgment signal transmission channel is used to realize the acknowledgment mechanism for data packet block transmission between the transmitter and receiver.
[0025] This embodiment has two data transmission channels and four confirmation signal transmission channels. The two data transmission channels are connected to two GMAC gigabit Ethernet ports GMAC0 and GMAC1 and two unidirectional optical modules. The four confirmation signal transmission channels are formed by connecting the GPIO0, GPIO1, GPIO2 and GPIO3 of two RK3568 chips.
[0026] In this embodiment, the sending end is mainly responsible for traversing the folders of the USB storage device and sending data to the receiving end via two gigabit Ethernet ports (two unidirectional optical modules) and the UDP network transmission protocol. The receiving end, after piecing together the data packets transmitted by the two gigabit Ethernet port sending end modules, sends the data to the PC via the BULK transmission protocol implemented by the USB Slave driver. The entire data transmission path is realized through a single-channel transmission device.
[0027] S02. Based on MTU limitations, the format of the data packets is defined. The MTU size is 1500, and the actual effective data length is 1472. Each data packet is numbered, using 4 bytes to store the number, supporting a number range of 0 to (2³²-1). The data packet numbered 0 contains the data packet number, the CRC checksum of the entire data block (4 bytes), the transport block length (4 bytes), and the effective data, with the following structure: Number 0 (4 bytes), CRC checksum (4 bytes), transport block length (4 bytes), valid data (1464 bytes).
[0028] Non-zero data packets only include the data sequence number and valid data, with the following structure: Number n (4 bytes), valid data (1468 bytes).
[0029] S03. The PC sends a communication request command to the receiving end. The receiving end receives the communication request command and pulls the GPIO 0 level signal high. The sending end detects the level change of GPIO 0 and starts the data processing main thread MP1 and the UDP sending thread. The data processing main thread MP1 traverses the target folder of the USB storage device, reads data and writes it to the data buffer B0. The UDP sending thread reads a data block from the data buffer B0 and sends it to the receiving end.
[0030] S04. After the sending end finishes sending a data block to the receiving end, it pulls GPIO1 high to notify the receiving end that the transmission is complete. At this time, the receiving end's receiving process detects the change in the level of GPIO1, confirms that the packet transmission is complete, performs integrity verification on the sent data block, and compares it with the CRC checksum stored in the data packet numbered 0. If they match, it means that the data block is complete, and it pulls GPIO2 high to notify the sending end. After detecting the level change, the sending end continues to send the next data block. If the data verification does not match, it pulls GPIO3 high. After detecting the level change of GPIO3, the sending end retransmits the data block and performs data block integrity verification.
[0031] S05. The data processing process at the receiving end receives UDP data from the sending end and transmits the data to the PC. The data processing process occupies one CPU core exclusively, which can respond to and process the data at the receiving end in real time, reducing the probability of network congestion and packet loss.
[0032] Using the above methods, in actual testing, the single-channel device platform adopted the UDP transmission protocol, and the packet loss rate was 0. Even under simulated packet loss conditions, data integrity could be guaranteed, greatly improving the practicality of the single-channel system.
[0033] like Figure 2As shown, the data transmission process of the single-channel platform is as follows: First, the PC starts the upper-layer application software. The application software initiates a communication request command to the service program B running on the receiving end through the BULK transmission private protocol. The service program on the receiving end receives the communication request command and pulls the GPIO 0 level signal high. The service program A on the sending end detects the level change of GPIO 0 and starts the data processing main thread MP1 and UDP sending threads P0, P1, P2, and P3. The main thread MP1 and UDP threads P0, P1, P2, and P3 share a circular data buffer B0. The data buffer B0 consists of multiple BLOCK data blocks, which serve as the most basic unit of communication between the sending and receiving ends. The main thread MP1 traverses the target folder of the USB storage device, reads data and writes it to the circular data buffer B0. UDP threads P0~P3 read data from the circular data buffer B and send it to the receiving end. The receiving end's UDP listening thread Px listens for UDP packets on port 5201 and stores the received data in data buffer B1. The receiving end's data processing thread Pz sorts and marks the data in the buffer, with 0 indicating unsorted and 1 indicating sorted. The BULK response thread Py sends the data to the upper-layer application software in Bulk transmission mode. Threads Px, Py, and Pz share data buffer B1.
[0034] The aforementioned UDP sending threads P0 and P1 send data to the receiving end through the data channel of GMAC0; UDP sending threads P2 and P3 send data to the receiving end through the data channel of GMAC1 (GMAC0 and GMAC1 are gigabit network ports used for communication between the sending and receiving ends in this scheme).
[0035] This embodiment transmits data packets in chunks and executes an acknowledgment mechanism. For example... Figure 3 As shown, the data packets are divided into blocks and transmitted in blocks. The circular data buffer B0 contains N (N is greater than 1) data blocks of the same size. The size of the data block can be set according to the total amount of data transmitted. For example, in this scheme, the size of a single data block BLOCK is 4MB and the value of N is 64.
[0036] The sending end transmits data to the receiving end. UDP sending threads P0, P1, P2, and P3 on the sending end share the same data block to ensure data synchronization. After the sending end finishes transmitting a data block (BLOCK), it pulls GPIO1 high to notify the receiving end (B) that transmission is complete. The receiving process on the receiving end detects the change in GPIO1, confirms the packet transmission is complete, and performs an integrity check on the data block. By comparing the CRC checksum stored in number 0, if they match, the data block is considered complete, and GPIO2 is pulled high to notify the sending end. Upon detecting the change in GPIO2, the sending end continues transmitting the next data block. If the data checksum does not match, GPIO3 is pulled high. Upon detecting the change in GPIO3, the sending end retransmits the data block and repeats the above process.
[0037] When GPIO3 is triggered, the sending end performs frequency statistics. If the frequency exceeds a threshold (e.g., 3 times per minute), it indicates that the receiving end's CPU is busy or network congestion is occurring. The sending end then controls UDP sending threads P0, P1, P2, and P3 to slow down the transmission. This slowdown involves adding a precise delay to the thread switching interval to prevent the sending end from transmitting data too quickly. Furthermore, a timer is added; if GPIO3 is not triggered again within a certain time interval T (e.g., T is 60 seconds), the sending end service process removes the slowdown, ensuring data transmission efficiency.
[0038] In this solution, the RK3568 chip is a quad-core processor. Therefore, two CPU cores can be isolated and reserved for the data processing process at the receiving end. This ensures that the process can respond to and process UDP packets from the receiving end in real time, reducing the probability of network congestion and packet loss.
[0039] The implementation process of the process exclusively using the CPU is as follows: Step 1: Isolate the designated CPU and reserve it exclusively for the receiving process and the data processing process: Add "isolcpus=2,3" to the configuration line of the GRUB configuration file, save the file, update GRUB, and then restart the receiver system. Step 2: Bind the receiving process to the isolated CPU mentioned above using taskset: `taskset -c process_names_2,3`; Step 3: Configure the startup script. Write the above commands into the script to ensure that the binding is completed automatically after the system is powered on.
[0040] In this embodiment, the data processing process includes a UDP listening thread Px, a BULK response thread Py, and a data processing thread Pz, and the threads are allocated to the corresponding CPUs according to requirements.
[0041] This invention significantly improves data transmission performance; the method of this invention greatly reduces the packet loss rate of UDP transmission, and introduces a method of data block packet loss retransmission, which does not affect data transmission performance, and ensures the accuracy and integrity of data, greatly improving the practicality of single-channel transmission devices.
[0042] The above description is merely the basic principle and preferred embodiment of the present invention. Improvements and substitutions made by those skilled in the art based on the present invention are within the scope of protection of the present invention.
Claims
1. A single-channel transmission method based on the UDP protocol, characterized in that: Includes the following steps: S01. Construct a single-channel transmission device. The single-channel transmission device includes a transmitter and a receiver. A data transmission channel and an acknowledgment signal transmission channel are provided between the transmitter and the receiver. The data transmission channel realizes unidirectional data transmission from the transmitter to the receiver based on a unidirectional optical module and a gigabit network port. The acknowledgment signal transmission channel realizes the acknowledgment mechanism for data packet block transmission between the transmitter and the receiver based on GPIO ports. S02. Data is transmitted between the sending end and the receiving end in data packet chunks. The capacity of the data packet is set, each data packet is numbered, and it is specified that the data packet with number 0 includes the data packet number, the CRC check code of the entire data block, the transmission block length and the valid data, while the data packets with numbers other than 0 include the data packet number and the valid data. S03, the PC sends a communication request command to the receiving end. The receiving end receives the communication request command and pulls the GPIO 0 level signal high. The sending end detects the level change of GPIO 0 and starts the data processing main thread MP1 and the UDP sending thread. The data processing main thread MP1 traverses the target folder of the USB storage device, reads data and writes it to the data buffer B0. The UDP sending thread reads a data block from the data buffer B0 and sends it to the receiving end. S04. After the sending end finishes sending a data block to the receiving end, it pulls GPIO1 high to notify the receiving end that the transmission is complete. The receiving end's receiving process detects the change in GPIO1 level, confirms the packet transmission is complete, and performs an integrity check on the sent data block by comparing it with the CRC checksum stored in data packet number 0. If they match, it indicates that the data block is complete, and it pulls GPIO2 high to notify the sending end. After detecting the change in GPIO2 level, the sending end continues to send the next data block. If the data check does not match, it pulls GPIO3 high. After detecting the change in GPIO3 level, the sending end retransmits the data block and performs a data block integrity check. S05. The data processing process at the receiving end receives the UDP data sent by the sending end and transmits the data to the PC.
2. The single-channel transmission method based on the UDP protocol according to claim 1, characterized in that: Data buffer B0 is a circular data buffer, which consists of multiple BLOCK data blocks. The BLOCK data block is the basic communication unit between the sending and receiving ends.
3. The single-channel transmission method based on the UDP protocol according to claim 1, characterized in that: After triggering the GPIO3 level, the sending end performs trigger frequency statistics. If the GPIO3 trigger frequency exceeds the set threshold, it indicates that the receiving end CPU is busy or network congestion has occurred. In this case, the sending end controls the UDP sending thread to reduce the speed.
4. The single-channel transmission method based on the UDP protocol according to claim 3, characterized in that: After slowing down the UDP sending thread, a timer is added. If the GPIO3 level is no longer triggered within the set time interval T, the slowdown process is lifted on the sending end.
5. The single-channel transmission method based on the UDP protocol according to claim 1, characterized in that: There are four UDP sending threads P0, P1, P2, and P3. The main thread MP1 and the UDP sending threads P0, P1, P2, and P3 share the data buffer B0.
6. The single-channel transmission method based on UDP protocol according to claim 1, characterized in that: The data processing process includes a UDP listening thread Px, a BULK response thread Py, and a data processing thread Pz in a shared data buffer B1. The UDP listening thread Px listens for UDP packets and receives data, storing it in the data buffer B1. The data processing thread Pz sorts the data in the data buffer B1, and the BULK response thread Py sends the data to the PC.
7. The single-channel transmission method based on the UDP protocol according to claim 5, characterized in that: There are two data transmission channels between the sending end and the receiving end. UDP sending threads P0 and P1 send data to the receiving end through one data transmission channel, while UDP sending threads P2 and P3 send data to the receiving end through the other data transmission channel.
8. The single-channel transmission method based on UDP protocol according to claim 1, characterized in that: The two CPU cores of the isolated receiver are used exclusively by the receiving process and the data processing process. The implementation method is as follows: the specified CPU is isolated and exclusively used by the server receiving process. The receiving process is bound to the isolated CPU through taskset. The startup script is configured and the taskset command is written into the script to ensure that the binding is completed automatically after the system powers on.
9. The single-channel transmission method based on UDP protocol according to claim 1, characterized in that: The PC contains upper-layer application software. The receiving end runs service program B, and the sending end runs service program A. The upper-layer application software initiates a communication request command through the BULK transmission private protocol service program B. Service program B receives the communication request command and pulls the GPIO 0 level signal high. Service program A detects the level change of GPIO 0 and starts the data processing main thread MP1 and the UDP sending thread. The BULK response thread Py sends the data to the upper-layer application software in Bulk transmission mode.
10. The single-channel transmission method based on the UDP protocol according to any one of claims 1-9, characterized in that: The transmitter and receiver are implemented based on the RK3568 chip.