Data receiving, transmitting and sharing method based on UDP (User Datagram Protocol)
By dividing communication modes in the UDP protocol and using message receipts, packet loss and retransmission mechanisms and other means, the problems of out-of-order and packet loss in the UDP protocol when transmitting large files are solved, and the communication stability and efficiency of the drone group are improved. It realizes efficient information transmission of many-to-many communication.
Patent Information
- Application Number
- CN202411190176.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2024-12-24
AI Technical Summary
When transmitting large files, the existing UDP protocol is prone to out-of-order and packet loss due to congestion in file transmission channels, occasional circuit breakers and other factors, resulting in low data transmission stability, making it difficult to meet the efficient communication needs of drone groups during mission execution. .
Using the UDP protocol data transmission, reception and sharing method, by dividing text messages and file messages, three communication modes (point-to-point, broadcast, and sharing mode), and through message receipt, packet loss and retransmission mechanism, packet sorting and grouping packets, etc. , improve the stability and efficiency of transmission.
On the basis of retaining the efficient transmission of the UDP protocol, the stability of transmission is increased, and the orderly and simple method of many-to-many communication between nodes is realized, making the information transmission more efficient and the connection is tighter when performing tasks.
Smart Images

Figure CN119182499A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of UDP communication, and in particular relates to a data sending and receiving sharing method based on the UDP protocol. Background Art
[0002] In the era of big data, data is a resource, and it often contains a lot of information from all aspects. If individual data is only saved separately, an island phenomenon will occur, and the potential value of the data cannot be fully utilized, causing inconvenience and loss to the system.
[0003] With the development of science and technology, drones are playing an increasingly important role in the military and civilian fields. With their small size, flexibility and high mobility, drone swarms can quickly establish information transmission channels in situations such as natural disasters and unexpected accidents. As the core of drone swarm technology, communication technology largely determines the upper limit of drone swarm applications. A good, stable and efficient data communication environment can provide a solid foundation for drone mission execution.
[0004] TCP and UDP are the two mainstream communication protocols, each with its own advantages and disadvantages. TCP is connection-oriented, provides reliable services, and only supports point-to-point communication; UDP is connectionless, supports one-to-one, one-to-many, and many-to-many interactive communication, and has relatively high data transmission efficiency. However, in actual applications, especially when transmitting large files such as video and audio, it is very easy to cause disorder and packet loss due to factors such as file transmission channel congestion and occasional disconnection, which reduces the stability of data transmission. Summary of the invention
[0005] The present invention relates to a data transmission and reception sharing method based on the UDP protocol, so as to ensure stable and efficient communication between UAVs and between UAVs and the ground, and better realize the tasks of UAV groups detecting information, transmitting data and assisting rescue.
[0006] In order to achieve the above object, the technical solution adopted by the present invention is:
[0007] A data transmission and reception sharing method based on UDP protocol comprises the following steps:
[0008] Step 1, data messages are divided into two categories: text messages and file messages, and communication modes are divided into three communication modes: point-to-point mode, broadcast mode and sharing mode, and two threads are established respectively; among which, file messages include images, audio and video;
[0009] Step 2, define the format of text message and file message, the text message format includes message header, receiver port field, flag X, file type, file name and file location, the file message packet format includes message header, receiver port number, flag W, packet sequence number, total number of packets and data packet flag Y; wherein, the message header includes sender ID, receiver ID, sender IP and receiver IP; flag X is used to define the transmission mode, flag X is 1, it is shared mode, flag X is 0, it is point-to-point mode, flag X is 2, it is broadcast mode; flag W is used to define the transmission mode, flag W is 1, it is shared mode, flag W is 0, it is point-to-point mode, flag W is 2, it is broadcast mode; data packet flag Y is 1, it is the last data packet, data packet flag Y is 0, it is not the last data packet;
[0010] Step 3: When transmitting messages between drones, the transmission mode is determined. In point-to-point mode, when transmitting text messages, the receiving drone will send a message receipt to the sending drone after receiving the text message. If the sending drone does not receive the message receipt, the text message will be retransmitted. When transmitting file messages, the receiving drone will determine whether the data packet is lost based on the actual number of received packets and the total number of packets. If lost, a packet loss flag will be sent through the loop, and the sending drone will retransmit the file message.
[0011] In broadcast mode, the sending drone broadcasts text messages and file messages, and all drones in the local area network receive and store the messages;
[0012] In sharing mode, the text message is first converted into a file message, and then the sending drone unpacks the file message and transmits it to the ground end. The ground end sorts and packages it, stores it, updates the resource list, and updates the resource list for other drones. When a drone retrieves the required file in the resource list, it sends a file request command to the ground end. The ground end unpacks the corresponding file message and then transmits it to the drone that sent the file request command.
[0013] Furthermore, the specific process of step 3 is as follows:
[0014] In point-to-point mode:
[0015] When transmitting text messages, the sending drone calls the sending data receiving and sending sharing service software to send the text message to be sent in the form of a data packet. The receiving drone receives the data packet through the receiving data receiving and sending sharing service software and feeds back the message receipt through the loop to inform the sending drone that the text message transmission is successful. If the sending drone does not receive the message receipt within the set time, it is judged that the message transmission fails and the text message is retransmitted.
[0016] When file messages are transmitted, the sending drone sends the file type, file name and file location of the target file to the sending data transceiver sharing service software. The sending data transceiver sharing service software finds the corresponding file message, unpacks it and sends the unpacked data packet to the receiving data transceiver sharing service software. After receiving the data packet, the receiving data transceiver sharing service software determines whether the data packet is lost based on the actual number of received packets and the total number of packets. If lost, a packet loss flag is sent through the loop, and the sending drone retransmits the file message. If not lost, the receiving data transceiver sharing service software reorders the data packets according to the packet sequence number, assembles them into the target file in the receiving drone and stores them in the corresponding position.
[0017] In broadcast mode:
[0018] When the text message is transmitted, the sending drone broadcasts the text message through the sending data transceiver sharing service software, and all drone data transceiver sharing service software in the local area network receive and store the text message;
[0019] When the file message is transmitted, the sending drone passes the file message to the sending data transceiver sharing service software for unpacking, and then broadcasts the data packet. The data transceiver sharing service software of all drones in the local area network receives the data packet, and then reassembles the data packet in the corresponding drone and stores it in the corresponding location;
[0020] In shared mode:
[0021] The text message is converted into document data and classified as a file message; the sending end drone transmits the file information to be stored to the sending end data transceiver sharing service software, including the file type, file name and file location; the sending end data transceiver sharing service software unpacks the corresponding file message and sends it to the ground end through the ground end data transceiver sharing service software; the ground end sorts and groups the data packets, stores the grouped file messages in a specific location, updates the resource list of the ground end, and regularly updates the resource list to surrounding drones;
[0022] When a drone retrieves the required file from the resource list, it transmits the file request command to the ground-end data transceiver sharing service software through its own data transceiver sharing service software. After the ground-end data transceiver sharing service software receives the file request command, it unpacks the corresponding file message according to the file type, file name and file location of the target file in the command, and then transmits it to the drone that sent the file request command, and reassembles it into the target file in the corresponding drone.
[0023] Compared with the prior art, the present invention has the following beneficial effects:
[0024] (1) The present invention improves the unreliable UDP protocol through mechanisms such as message receipt and packet loss retransmission, thereby increasing the stability of transmission while retaining its efficient transmission.
[0025] (2) The present invention proposes a concept and implementation scheme of a sharing mode, which realizes many-to-many communication between nodes in an orderly and simple manner, thereby maximizing the utilization of data information.
[0026] (3) The present invention organically forms a system by combining the point-to-point mode, broadcast mode and sharing mode, so that the drone group can be more closely connected when performing tasks and information transmission can be more efficient. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 It is a schematic diagram of message transmission in the improved point-to-point mode of the UDP protocol according to an embodiment of the present invention.
[0028] Figure 2 This is the text transmission message structure of an embodiment of the present invention.
[0029] Figure 3 This is the file transfer message structure of an embodiment of the present invention.
[0030] Figure 4 It is a schematic diagram of the transmission mode of an embodiment of the present invention.
[0031] Figure 5 It is a schematic diagram of a point-to-point mode according to an embodiment of the present invention.
[0032] Figure 6 It is a schematic diagram of the broadcast mode of an embodiment of the present invention.
[0033] Figure 7 It is a schematic diagram of the sharing mode of an embodiment of the present invention. DETAILED DESCRIPTION
[0034] The present invention relates to a data transmission and reception sharing method based on the UDP protocol, which is used to meet the stability, efficiency and diversity of communication when a drone group performs a task. While improving the UDP protocol, the communication process is divided into three modes: point-to-point mode, broadcast mode and sharing mode for implementation. The schematic diagrams of the three transmission modes are shown in FIG. Figure 4 As shown, when conventional communication means fail, the drone group can quickly establish efficient and stable communication, allowing operators to obtain relevant information at the fastest speed and in the widest range. As a resource library, the ground station can directly establish contact with all drones, play a role in human-machine information interaction and overall coordination. The specific implementation method is further described in detail below with reference to the accompanying drawings.
[0035] Step 1: Divide data messages into two categories: text messages and file messages (images, audio, and video, etc.), divide the communication mode into three communication modes: point-to-point mode, broadcast mode, and sharing mode. Based on the characteristics of UDP transmission being efficient but less stable, the UDP protocol is improved by referring to the TCP protocol, and UDP transmission is divided into two threads: text transmission and file transmission, to avoid affecting the efficiency of information transmission due to congestion. The design description of the two threads is shown in Figure 1 shown.
[0036] Step 2, define the format of text messages and file messages, such as Figure 2 As shown, the text message format includes a message header (sender ID, receiver ID, sender IP and receiver IP), a receiver port field, a flag X, a file type, a file name and a file location; Figure 3 As shown, the file message packet format includes a message header (sender ID, receiver ID, sender IP and receiver IP), receiver port number, flag W, packet sequence number, total number of packets and data packet flag Y;
[0037] For each text message to be sent, the sender ID, receiver ID, sender IP and receiver IP are first defined. The data type is Char*, and the byte size is 10, 10, 20 and 20 respectively. They represent the starting point and end point of the message, ensuring that the source and destination of the message are clear and unambiguous. The receiver port field follows, the data type is Int, the byte size is 4, it is the unique number of a specific communication channel, and only drones with the same port number have the right to receive the message. The transmission mode is defined by the flag bit X, the data type is Int, the byte size is 1, if the flag bit is 1, it is a shared mode, indicating that this text message is a data request instruction, used to obtain specified data from the ground terminal, if it is 0, it is a point-to-point mode, indicating that this message is the data itself, if the flag bit X is 2, it is a broadcast mode. Finally, three fields, file type, file name, and file location, are defined. The data type is Char*, and the byte sizes are 4, 20, and 30, respectively. When the message is in sharing mode, that is, the flag bit X is 1, this field will help the drone accurately locate the location of the data required by the ground end. After that, the ground end will send the specified data to the drone.
[0038] For each file message to be sent, the first 60 bits of the message header are the sender ID, receiver ID, sender IP, and receiver IP, respectively. The data type is Char*, and the byte size is 10, 10, 20, and 20, respectively. The receiver port number data type is Int, and the byte size is 4. It is the unique number of a specific communication channel. Only drones with the same port number have the right to receive the message. The flag bit W is used to define the transmission mode. If the flag bit W is 1, it is a shared mode, if the flag bit W is 0, it is a point-to-point mode, and if the flag bit X is 2, it is a broadcast mode. The subsequent field is the packet sequence number, the data type is Int, and the byte size is 5. It defines the order of the data packets after the file is unpacked. The receiving end can use the packet sequence number to determine whether the data packets are out of order, and rearrange the data packets when out of order occurs, so that the file can be reassembled according to the original data packet order of the file, solving the problem of UDP transmission out of order. The total number of packets data type is Int, and the byte size is 5. It stores the total number of data packets after the file is unpacked. Data packet flag Y, data type is Int, byte size is 1. If the data packet flag is 1, it means that the data packet is the last data packet, and the actual number of packets received by the receiving end is obtained; if the data packet flag is 0, it means that this packet is not the last data packet. The total number of packets and data packet flag Y can be used to determine whether the file transfer process is lost. If the actual number of packets is equal to the total number of packets, there is no packet loss; if the actual number of packets is less than the total number of packets, there is packet loss.
[0039] Step 3: When transmitting messages between drones, determine the transmission mode;
[0040] like Figure 1 and Figure 5 As shown, in point-to-point mode:
[0041] When transmitting a text message, the sending drone A calls the sending end data transmission and reception sharing service software A, and sends the text message to be sent in the form of a data packet. The receiving drone B receives the data packet through the receiving end data transmission and reception sharing service software B, and feeds back the message receipt "WORD RECEIVED" through the loop to inform the sending drone A that the text message transmission is successful. If the sending drone A does not receive the message receipt within the set time, it is judged that the message transmission fails and the text message is retransmitted.
[0042] When the file message is transmitted, the sending end drone A sends the file type, file name and file location of the target file to the sending end data transceiver sharing service software A. The sending end data transceiver sharing service software A finds the corresponding file message for unpacking and sends the unpacked data packet to the receiving end data transceiver sharing service software B. After receiving the data packet, the receiving end data transceiver sharing service software B determines whether the data packet is lost according to the actual number of received packets and the total number of packets. If lost, the packet loss flag "BAGS LOST" is sent through the loop, and the sending end drone A retransmits the file message. If not lost, the receiving end data transceiver sharing service software B reorders the data packets according to the packet sequence number, and assembles them into the target file in the receiving end drone B and stores them in the corresponding position;
[0043] like Figure 6 As shown, in broadcast mode:
[0044] When the text message is transmitted, the sending drone A broadcasts the text message through the sending data transceiver sharing service software A, and all drone data transceiver sharing service software (D, C, D...) in the local area network receive and store the text message;
[0045] When the file message is transmitted, the sending drone A passes the file message to the sending data transceiver sharing service software A for unpacking, and then broadcasts the data packet. All drone data transceiver sharing service software (D, C, D...) in the local area network receive the data packet, and then reassemble the data packet in the corresponding drone and store it in the corresponding location;
[0046] like Figure 7 As shown, in sharing mode:
[0047] The text message is converted into document data and classified as a file message; the sending end UAV A transmits the file information to be stored to the sending end data transceiver sharing service software A, including the file type, file name and file location; the sending end data transceiver sharing service software A unpacks the corresponding file message and sends it to the ground end through the ground end data transceiver sharing service software; the ground end sorts and groups the data packets, stores the grouped file messages in a specific location, updates the resource list of the ground end, and regularly updates the resource list to the surrounding UAVs;
[0048] When a drone B retrieves the required file from the resource list, it transmits the file request command to the ground-end data transceiver sharing service software through its own data transceiver sharing service software B. After the ground-end data transceiver sharing service software receives the file request command, it unpacks the corresponding file message according to the file type, file name and file location of the target file in the command, and then transmits it to the drone B that sent the file request command, and reassembles it into the target file in the corresponding drone.
[0049] The three transmission modes complement and cooperate with each other, and together provide a solid foundation for stable, efficient and scientific communication of drone swarms.
Claims
1. A data transmission and reception sharing method based on UDP protocol, characterized in that: The following steps are involved: Step 1, data messages are divided into two categories: text messages and file messages, and communication modes are divided into three communication modes: point-to-point mode, broadcast mode and sharing mode, and two threads are established respectively; among which, file messages include images, audio and video; Step 2, define the format of text message and file message, the text message format includes message header, receiver port field, flag X, file type, file name and file location, the file message packet format includes message header, receiver port number, flag W, packet sequence number, total number of packets and data packet flag Y; wherein, the message header includes sender ID, receiver ID, sender IP and receiver IP; flag X is used to define the transmission mode, flag X is 1, it is shared mode, flag X is 0, it is point-to-point mode, flag X is 2, it is broadcast mode; flag W is used to define the transmission mode, flag W is 1, it is shared mode, flag W is 0, it is point-to-point mode, flag W is 2, it is broadcast mode; data packet flag Y is 1, it is the last data packet, data packet flag Y is 0, it is not the last data packet; Step 3: When transmitting messages between drones, the transmission mode is determined. In point-to-point mode, when transmitting text messages, the receiving drone will send a message receipt to the sending drone after receiving the text message. If the sending drone does not receive the message receipt, the text message will be retransmitted. When transmitting file messages, the receiving drone will determine whether the data packet is lost based on the actual number of received packets and the total number of packets. If lost, a packet loss flag will be sent through the loop, and the sending drone will retransmit the file message. In broadcast mode, the sending drone broadcasts text messages and file messages, and all drones in the local area network receive and store the messages; In sharing mode, the text message is first converted into a file message, and then the sending drone unpacks the file message and transmits it to the ground end. The ground end sorts and packages it, stores it, updates the resource list, and updates the resource list for other drones. When a drone retrieves the required file in the resource list, it sends a file request command to the ground end. The ground end unpacks the corresponding file message and then transmits it to the drone that sent the file request command.
2. A data transmission and reception sharing method based on UDP protocol according to claim 1, characterized in that: The specific process of step 3 is as follows: In point-to-point mode: When transmitting text messages, the sending drone calls the sending data receiving and sending sharing service software to send the text message to be sent in the form of a data packet. The receiving drone receives the data packet through the receiving data receiving and sending sharing service software and feeds back the message receipt through the loop to inform the sending drone that the text message transmission is successful. If the sending drone does not receive the message receipt within the set time, it is judged that the message transmission fails and the text message is retransmitted. When file messages are transmitted, the sending drone sends the file type, file name and file location of the target file to the sending data transceiver sharing service software. The sending data transceiver sharing service software finds the corresponding file message, unpacks it and sends the unpacked data packet to the receiving data transceiver sharing service software. After receiving the data packet, the receiving data transceiver sharing service software determines whether the data packet is lost based on the actual number of received packets and the total number of packets. If lost, a packet loss flag is sent through the loop, and the sending drone retransmits the file message. If not lost, the receiving data transceiver sharing service software reorders the data packets according to the packet sequence number, assembles them into the target file in the receiving drone and stores them in the corresponding position. In broadcast mode: When the text message is transmitted, the sending drone broadcasts the text message through the sending data transceiver sharing service software, and all drone data transceiver sharing service software in the local area network receive and store the text message; When the file message is transmitted, the sending drone passes the file message to the sending data transceiver sharing service software for unpacking, and then broadcasts the data packet. The data transceiver sharing service software of all drones in the local area network receives the data packet, and then reassembles the data packet in the corresponding drone and stores it in the corresponding location; In shared mode: The text message is converted into document data and classified as a file message; the sending end drone transmits the file information to be stored to the sending end data transceiver sharing service software, including the file type, file name and file location; the sending end data transceiver sharing service software unpacks the corresponding file message and sends it to the ground end through the ground end data transceiver sharing service software; the ground end sorts and groups the data packets, stores the grouped file messages in a specific location, updates the resource list of the ground end, and regularly updates the resource list to surrounding drones; When a drone retrieves the required file from the resource list, it transmits the file request command to the ground-end data transceiver sharing service software through its own data transceiver sharing service software. After the ground-end data transceiver sharing service software receives the file request command, it unpacks the corresponding file message according to the file type, file name and file location of the target file in the command, and then transmits it to the drone that sent the file request command, and reassembles it into the target file in the corresponding drone.
