Network communication method, electronic device, storage medium and program product

By using multicast to send data packets and unicast acknowledge and retransmit messages in network communication, the problems of network delay and bandwidth consumption in one-to-many transmission scenarios in the prior art are solved, and the flexible expansion of the network system is realized. Load capacity increased.

CN119030809APending Publication Date: 2024-11-26HUBEI QIGUANG TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410327714.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-19
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

The existing reliable transmission algorithms lead to increased network latency and bandwidth consumption in one-to-many transmission scenarios, limiting the improvement of network load capacity.

Method used

The data packet is sent by multicast method, and the confirmation message and retransmit data packets are sent through unicast method, realizing a network communication method that does not significantly increase the data transmission amount when the number of receiving ends increases.

Benefits of technology

It saves network bandwidth resources and improves the flexible expansion capacity and load capacity of the network system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119030809A_ABST
    Figure CN119030809A_ABST
Patent Text Reader

Abstract

The invention provides a network communication method, electronic equipment, a storage medium and a program product. The network communication method is applied to a first network device, and comprises the following steps: establishing a unicast connection with a second network device; a data packet with a multicast address as a destination address is sent, the multicast address comprises a multicast network address and a multicast port, the data packet is used for bearing multicast data, and each piece of multicast data is packaged into at least one data packet; receiving an acknowledgement message (ACK) for the data packet from the second network device over the unicast connection; determining a retransmission data packet needing to be retransmitted in the data packet according to the received ACK; and transmitting the retransmitted data packet to the second network device over the unicast connection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure generally relates to the field of network communications, and more specifically to a network communication method, an electronic device, a storage medium, and a program product for optimizing a reliable transmission algorithm. Background Art

[0002] Reliable transmission algorithms in network communications can improve the integrity and accuracy of data transmission. Reliable transmission algorithms are mainly used in protocols such as TCP (Transmission Control Protocol) and RUDP (Reliable User Datagram Protocol). The current reliable transmission algorithm is generally a one-to-one model, that is, reliable transmission is guaranteed on the data channel between a sender and a receiver. For one-to-many (i.e., one sender and multiple receivers) transmission scenarios, such as live broadcast, real-time voice, etc., according to the current reliable transmission algorithm, it is necessary to implement separate reliable transmission data channels between the sender and each receiver, which will lead to greater network delays and bandwidth consumption, and is not conducive to improving network load capacity. Summary of the invention

[0003] The object of the present invention is to solve at least some of the above problems and to provide a network communication method, electronic device, storage medium and program product that can save network bandwidth resources and enable the network to have flexible expansion capabilities.

[0004] According to one aspect of the present disclosure, a network communication method is provided, which is applied to a first network device, and the method includes: establishing a unicast connection with a second network device; sending a data packet with a multicast address as a destination address, the multicast address including a multicast network address and a multicast port, the data packet being used to carry multicast data, and each multicast data being encapsulated into at least one data packet; receiving an acknowledgment message (ACK) for the data packet from the second network device via the unicast connection; determining a retransmitted data packet that needs to be retransmitted in the data packet based on the received ACK; and sending the retransmitted data packet to the second network device via the unicast connection.

[0005] According to another aspect of the present disclosure, a network communication method is provided, which is applied to a second network device, and the method includes: establishing a unicast connection with a first network device; receiving a data packet with a multicast address as a destination address, the multicast address including a multicast network address and a multicast port, the data packet being used to carry multicast data, each multicast data being encapsulated into at least one data packet; sending an acknowledgment message (ACK) for the data packet to the first network device via the unicast connection; and receiving a retransmitted data packet from the first network device via the unicast connection.

[0006] According to another aspect of the present disclosure, an electronic device is provided, comprising a processor and a memory, the memory being coupled to the processor and storing computer program instructions, which, when executed by the processor, cause the processor to perform a method according to any of the aforementioned aspects.

[0007] According to another aspect of the present disclosure, a computer-readable storage medium is provided, storing computer program instructions, which, when executed by one or more processors, cause the one or more processors to perform a method according to any of the aforementioned aspects.

[0008] According to another aspect of the present disclosure, a computer program product is provided, comprising computer executable instructions, which, when executed by one or more processors, cause the one or more processors to perform the method according to any of the aforementioned aspects.

[0009] The embodiment of the present disclosure provides a reliable transmission algorithm based on multicast transmission. Different from the traditional reliable transmission algorithm that completely adopts unicast transmission (i.e., establishes a "one-to-one" channel), the embodiment of the present disclosure sends data packets in a multicast manner, and also sends confirmation messages and retransmitted data packets in a unicast manner. In this way, even if the number of receiving terminals in the system increases, the amount of data transmission in the network will not increase too much. In this way, network bandwidth resources can be saved, and the network system can be flexibly expanded to improve load capacity.

[0010] It should be appreciated that the above advantages do not need to be all realized in one or some specific embodiments, but may be partially dispersed in different embodiments according to the present disclosure. The embodiments according to the present disclosure may have one or some of the above advantages, or may have other advantages alternatively or additionally.

[0011] Other features and advantages of the present invention will become more apparent from the following detailed description of exemplary embodiments of the present invention with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The accompanying drawings, which constitute a part of the specification, illustrate embodiments of the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0013] The present disclosure may be more clearly understood from the following detailed description with reference to the accompanying drawings, in which:

[0014] Figure 1 A schematic diagram of a network environment in which the method according to an embodiment of the present disclosure can be applied is shown;

[0015] Figure 2 A schematic flow chart of a network communication method applied to a first network device according to some embodiments of the present disclosure is shown;

[0016] Figure 3 A signal interaction diagram of a network communication method according to some embodiments of the present disclosure is shown;

[0017] Figure 4 A schematic diagram showing multicast data being encapsulated into data packets according to some embodiments of the present disclosure is shown;

[0018] Figure 5 A signal interaction diagram of a network communication method according to some embodiments of the present disclosure is shown;

[0019] Figure 6 A schematic flow chart showing a network communication method applied to a second network device according to some embodiments of the present disclosure; and

[0020] Figure 7 An exemplary electronic device that can be used to implement the method according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0021] Various exemplary embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings. It should be noted that unless otherwise specifically stated, the relative arrangement of components and steps, numerical expressions and numerical values ​​set forth in these embodiments do not limit the scope of the present disclosure.

[0022] The following description of at least one exemplary embodiment is in fact merely illustrative and is in no way intended to limit the present disclosure and its application or use. That is, the structures and methods herein are shown in an exemplary manner to illustrate different embodiments of the structures and methods in the present disclosure. However, those skilled in the art will appreciate that they merely illustrate exemplary ways of the present disclosure that can be implemented, rather than exhaustive ways. In addition, the drawings need not be drawn to scale, and some features may be enlarged to illustrate the details of specific components.

[0023] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered as part of the specification.

[0024] The embodiment of the present disclosure provides a reliable transmission algorithm based on multicast transmission. Different from the traditional reliable transmission algorithm that completely adopts unicast transmission (i.e., establishes a "one-to-one" channel), the embodiment of the present disclosure sends data packets in a multicast manner, and also sends confirmation messages and retransmitted data packets in a unicast manner. In this way, even if the number of receiving ends in the system increases, the amount of data transmission in the system will not increase too much. In this way, the network system can be flexibly expanded to improve the load capacity.

[0025] Figure 1A schematic diagram of a network environment to which the method according to an embodiment of the present disclosure can be applied is shown. Network device A 102 and network device B 104 can be various electronic devices with network communication functions, including but not limited to portable terminals (e.g., mobile phones, tablet computers, personal digital assistants (PDAs)), computers (e.g., laptop computers, desktop computers), smart home devices (e.g., smart speakers, smart TVs, smart fans), wearable devices (e.g., smart watches, smart headphones, augmented reality (AR) glasses, virtual reality (VR) glasses, mixed reality (MR) glasses, Bluetooth glasses, smart bracelets), vehicle-mounted electronic devices (e.g., electronic control units (ECUs), transmission control units (TCUs), vehicle-mounted entertainment information terminals), etc. Network device A 102 and network device B 104 can form a peer-to-peer architecture or a server-client architecture.

[0026] Network device A 102 and network device B 104 may establish a unicast connection. Through the unicast connection, network device A 102 transmits data packets to network device B 104 one-to-one according to the network address and port of network device B 104; conversely, network device B 104 may also transmit data packets to network device A 102 one-to-one according to the network address and port of network device A. In the process of establishing a unicast connection, at least one of network device A and network device B needs to know the network address and port of the other party and send its own network address and port to the other party.

[0027] In the present disclosure, unless otherwise specified, a network address (including the "local network address" and "multicast network address" mentioned below) may be an IP (Internet Protocol) address or a MAC (Media Access Control) address, which is used to identify a device or a set of devices (e.g., a multicast group). An IP address includes a network number and a host number. In the present disclosure, unless otherwise specified, a port (including the "local port" and "multicast port" mentioned below) is used to identify an application or a communication process. Different applications or communication processes use different ports. The port address may be set randomly or preset to a designated port. For example, when establishing a unicast connection, network device A, which is the sender of subsequent multicast data, may set its port randomly, while network device B, which is the receiver of subsequent multicast data, may set its port to a predetermined multicast port.

[0028] In addition to unicast connection, network device A 102 can perform multicast transmission to network device B 104. In the case of multicast transmission, network device A 102 sets the destination address of the data packet of the multicast data to be sent to the multicast address. The multicast address includes a multicast network address and a multicast port. In some embodiments, the multicast network address can be a pre-agreed class of IP or MAC address. In some embodiments, the multicast network address can be calculated by the network device based on its own local network address. For example, in the case where network device A and network device B are located in the same local area network, the multicast network address can include a broadcast network address. The broadcast network address can be calculated by network device A based on its own local network address (e.g., IP address) and the subnet mask of the local area network. The multicast port can also be pre-set.

[0029] In some embodiments, to receive the data packet sent by network device A 102 to the multicast address, network device B 104 may join the multicast group 108 identified by the multicast address (or only the multicast network address in the multicast address) in advance. For example, in Linux, socket option parameters such as IP_ADD_MEMBERSHIP or IP_DROP_MEMBERSHIP may be used to join or exit the multicast group. The number of network devices as members in the multicast group may be one or more. In some embodiments, network device A and network device B are located in the same local area network. Further, the local area network may be a physical local area network, that is, all network devices in the local area network are in the same network segment. In this case, there is no need to convert the network segment, and there is an easy implementation of multicast transmission. The local area network may be based on various wired or wireless communication technologies, wherein the wireless communication technologies include but are not limited to Wi-Fi, Bluetooth, ZigBee, Z-Wave, IPv6 over Low power Wireless Personal Area Network (6LoWPAN), etc. In a further embodiment, network device A and network device B are in a local area network in a short-distance scenario. In an embodiment of the present disclosure, two or more network devices in a local area network in a short-distance scenario refer to two or more network devices that are directly connected or meshed with each other through wireless communication technology. For example, the so-called direct connection means that two devices are connected together to communicate directly. For example, the so-called mesh connection means a many-to-many meshed Internet network, and devices that are not directly connected can realize data relay transmission via devices in between.

[0030] In the case where network device A and network device B are located in the same local area network, the multicast network address can be calculated by the network device based on its own local network address. At this time, in some embodiments, the multicast network address can be a broadcast network address. In the case where there is a subnet in the local area network, the broadcast network address can be calculated by network device A based on its own local network address (such as IP address) and the subnet mask of the local area network. Specifically, the local network address of network device A and the subnet mask of the local area network can be operated bitwise and obtained to obtain the network number of the local area network, and then all other bits in the local network address except the network number are set to 1 to obtain the broadcast network address corresponding to the subnet. When sending a data packet with the broadcast network address as the destination address, all network devices in the subnet can receive the data packet. At this time, to receive the data packet sent by network device A 102 to the broadcast network address, network device B 104 does not need to join the multicast group 108 in advance, but only needs to be located in the local area network (or local area network subnet) corresponding to the broadcast network address.

[0031] Regardless of whether the multicast group is joined in advance or the broadcast network address is adopted, in order to receive the multicast data sent from the network device A 102 to the multicast address, the network device B 104 also binds its local port to the predetermined multicast port. "Binding to the multicast port" means that the network device B 104 will receive and send data packets from the multicast port. For example, this function can be implemented through the bind() function in Linux. Therefore, when the network device B 104 receives multicast data sent to the multicast group but the port is not the multicast port, it will be discarded. Alternatively, when the network device B 104 receives multicast data whose destination address is the broadcast network address corresponding to the network, but the port is not the multicast port, it will also be discarded. It can be seen that even if the broadcast network address is adopted, the transmission method in the present disclosure is different from the conventional broadcast transmission, because the broadcast network address is combined with the multicast port, thereby controlling that only the network device bound to the specific multicast port can receive the transmitted data packet, thereby achieving the effect of multicast transmission.

[0032] In some embodiments, there may be more than one network device serving as a multicast data receiver. Figure 1 As shown, network device A 102 may want to send multicast data to network device B 104 and network device C 106 at the same time. Network device C 106 may also be various electronic devices with network communication functions. Network device C 106 may form a peer-to-peer node network like network device A 102 and network device B 104, or may serve as a client of network device A 102 (serving as a server) like network device B 108. In some embodiments, as shown in FIG. Figure 1As shown, network device C 106 may also join the multicast group 108 identified by the multicast address (or only the multicast network address in the multicast address) in advance, so as to receive the data packet sent by network device A 102 with the multicast address as the destination address. In other embodiments, for example, when network device A 102, network device B 104 and network device C 106 are all located in the same local area network (or a subnet of the local area network), network device A 102 may use the broadcast network address (calculated as described above) corresponding to the local area network (or the subnet of the local area network) as the multicast network address to transmit multicast data. By adopting any of the above methods, through multicast transmission, the same data packet can be sent to network device B and network device C at the same time, without having to send them separately once as in the traditional unicast transmission method.

[0033] Similar to network device B, network device C can also be controlled by a multicast port to determine whether it can receive multicast data. In order to receive multicast data sent from network device A 102 to a multicast address, network device C 106 also binds its local port to a predetermined multicast port.

[0034] In some embodiments, network device C 106 may also establish a unicast connection with network device A 102. The specific process of establishing the unicast connection may be the same as the process of establishing the unicast connection between network device B 104 and network device A 102, and will not be described in detail here.

[0035] It is important to recognize that, although Figure 1 Network device C 106 and a unicast connection between network device C 106 and network device A 102 are shown, but are provided only as an example and may be omitted in some embodiments.

[0036] In some embodiments, network device A, network device B, and network device C are in the same local area network. On the one hand, there is no need to switch network segments in the same local area network, which is conducive to the implementation of multicast transmission; on the other hand, the communication quality differences between network devices in the same local area network will not be too large, which is conducive to the balance of communication between the sender and the receivers. In a further embodiment, network device C can be directly connected or meshed with network device A and / or network device B in a short-distance scenario.

[0037] It should also be recognized that according to the embodiments of the present disclosure, the network device as the multicast data sender and the network device as the multicast data receiver are not fixed, but their roles can be switched, especially when multiple network devices are located in the same local area network. In this case, the multicast data receiver does not need to join the multicast group in advance, and any network device can calculate the same broadcast network address based on its own local network address. It only needs the parties to predetermine the multicast port, so any network device can easily switch from a multicast data receiver to a multicast data sender.

[0038] Figure 2 FIG. 2 is a schematic flow chart of a network communication method 200 applied to a first network device according to some embodiments of the present disclosure. The first network device is a sender of multicast data, for example, Figure 1 The network device A 102 in FIG. Figure 3 A signal interaction diagram of a network communication method according to some embodiments of the present disclosure is shown. Figure 2 and Figure 3 Method 200 is introduced.

[0039] In step 202, the first network device establishes a unicast connection with the second network device. The second network device is a receiver of multicast data, for example, Figure 1 The network device B 104 in FIG.

[0040] Figure 3 Steps S311 to S314 show an exemplary process of establishing a unicast connection (step S31) between a first network device and a second network device in a request-response manner. In step S311, the first network device monitors its local network address and local port to detect whether there are any request messages from other network devices. The local network address and local port of the first network device are addressing addresses for the first network device to establish unicast connections with other network devices on the network. The local network address can be an IP address or a MAC address. The local network address and local port can be continuously or periodically monitored at the first network device. In some embodiments, the local network address and local port of the first network device are different from the multicast network address and multicast port introduced in step 204 below.

[0041] In step S312, the second network device sends a subscription request to the first network device. The subscription request indicates that the second network device wishes to receive multicast data from the first network device. The subscription request includes the network address and port of the second network device. For example, the network address and port of the second network device may be included in the source address field of the header of the data packet of the subscription request. Like the local network address and local port of the first network device, the network address and port of the second network device are also the addressing addresses for the second network device to establish a unicast connection with other network devices on the network. The local network address of the second network device may also be an IP address or a MAC address. The second network device may know the local network address and local port of the first network device in advance, thereby sending the subscription request with the local network address and local port of the first network device as the destination address.

[0042] In some embodiments, the network address and port of the second network device included in the subscription request are the local network address and local port of the second network device. The local network address of the second network device is different from the local network address of the first network device and also different from the multicast network address.

[0043] In some embodiments, the local port of the second network device is different from the multicast port. In other embodiments, the port included in the subscription request sent by the second network device is the multicast port introduced in step 204 below. The multicast port is a predetermined port known to the first network device and the second network device. Before sending the subscription request in step S312, the second network device binds its local port to the multicast port, and then in step S312, the second network device includes the bound multicast port in the subscription request. By binding its local port to the multicast port, the second network device can send / receive unicast data and multicast data through the same port, which is beneficial to the management of the port by the application / communication process. The benefit of completing the port binding first and then sending the subscription request is that the first network device, as the sender of the multicast data, can know that the second network device wants to receive the multicast data and is ready to receive it after receiving the subscription request, so that the accuracy of the next multicast data announced when sending the response message in step S314 is higher.

[0044] In step S313, the first network device stores the network address and port of the second network device received from the subscription request. As will be described later, storing the network address and port of the second network device is beneficial for subsequently sending data packets that need to be retransmitted to the second network device via a unicast connection. Storing may include saving the network address and port in a temporary variable, or storing them in a temporary, semi-permanent or permanent storage medium.

[0045] In step S314, the first network device sends a response message to the second network device based on the network address and port of the second network device. The first network device can use the network address and port of the second network device as the destination address of the response message. So far, based on the request-response mechanism, the first network device has learned the network address and port of the second network device and established a unicast connection with the second network device.

[0046] In the exemplary process shown in steps S311-S314, the second network device knows the network address and port of the first network device in advance and sends a subscription request to it. It should be recognized that the way to establish a unicast connection in step S31 is not limited to this, but other ways can be adopted. In an exemplary alternative, the first network device may know the network address and port of the second network device in advance and send a probe request to it. For example, the second network device monitors its own network address and port, the first network device sends a probe request to the second network device, asking whether it wants to receive multicast data, and the second network device stores the network address and port of the first network device and sends a reply message to it. In this way, a unicast connection can also be established. In another exemplary alternative, the first network device may send a probe request in a broadcast manner to ask whether any network device wants to receive multicast data. The probe request includes the network address and port of the first network device. The second network device replies to the probe request with a reply message, and informs the first network device of its own network address and port through a reply message. In this way, the two network devices can also know each other's network address and port, and thus establish a unicast connection.

[0047] In some embodiments, during or after the process of establishing a unicast connection, the first network device as the multicast sender sends an identifier of the next multicast data to be sent after the unicast connection between the two is established to the second network device. The identifier may be the sequence number of the next multicast data. The identifier may also be the sequence number of the data packet used to carry the next multicast data. For example, assuming that the next multicast data will be carried by data packets No. 100-102, the first network device may inform the second network device that the sequence number of the data packet used to carry the next multicast data is 100-102. Further, in order to save data volume, the identifier may also be the sequence number of the starting data packet used to carry the next multicast data. For example, the first network device may only inform the second network device of the sequence number of the starting data packet of the next multicast data, i.e., 100. This is because, after receiving and processing the next multicast data, the second network device may learn the end of a multicast data through the multicast data end marker in the multicast data. The purpose of the first network device sending the identifier of the next multicast data to the second network device is that the first network device can continue to multicast the multicast data, and the second network device can establish a unicast connection with the first network device at any time. It is possible that when the second network device establishes a unicast connection with the first network device, the current multicast data is in the process of being sent, and the second network device cannot receive the part of the current multicast data that has been multicasted before. For some special types of multicast data (such as time series data such as real-time video streams), the remaining part of the current multicast data will not be available. If the identifier of the next multicast data can be received, the second network device can start receiving directly from the next multicast data. In this way, the second network device can flexibly access the network to receive data at any time. In some examples, the identifier of the next multicast data can be used as part of the response message.

[0048] In some embodiments, before step S313 or S314, the first network device may first determine whether the port in the second network device in the received subscription request is a multicast port. In response to determining that the port is a multicast port, the first network device executes step S313 or step S314. This is because, by determining that the port is a multicast port, the first network device may assume that the second network device wishes to receive multicast data and is ready to receive it. In addition, the first network device may also distinguish the subscription request from unicast connection requests from other network devices (e.g., network devices that only wish to establish a unicast connection and do not receive multicast data) by whether the multicast port is included, without requiring the subscription request to adopt a special message format.

[0049] In step 204, the first network device sends a data packet with a multicast address as the destination address. The data packet is used to carry multicast data, and each multicast data is encapsulated into at least one data packet. The multicast address may include a multicast network address and a multicast port. Figure 1 When the second network device binds its port to the multicast port, in step S32, the second network device receives a data packet carrying multicast data sent from the first network device.

[0050] In some embodiments, before sending data packets of multicast data, the first network device may first determine whether there is at least one established unicast connection. Another network device establishing a unicast connection with the first network device means that the other network device wishes to subscribe to the multicast data of the first network device. Therefore, in some cases, the first network device starts sending data packets of multicast data only when it is determined that there is at least one established unicast connection. Otherwise, in the absence of any unicast connection, the first network device does not need to start sending multicast data, which can avoid unnecessary data transmission in the network.

[0051] Combine the following Figure 4 The following describes how multicast data is encapsulated into data packets. Data packets 1 to 5 are five data packets sent in chronological order. Each data packet includes a header 402 and a payload 404. A multicast data is divided into one or more parts according to the transmission protocol, and is placed in the payload field of one or more data packets accordingly. For example, multicast data 1 is divided into three parts 406-1, 406-2, and 406-3. Multicast data 2 is divided into two parts, which are placed in data packet 4 and data packet 5 respectively. In some embodiments, in order to mark the end of a multicast data, a multicast data end marker 408 may also be included in the data packet.

[0052] According to some embodiments of the present disclosure, the multicast data may be a data stream in the same time series, such as a real-time data stream in scenarios such as live broadcast and screen projection collaboration.

[0053] For each data packet of the received multicast data, the second network device can determine whether the data packet belongs to the next multicast data or a later subsequent multicast data according to the identifier of the next multicast data to be sent after the first network device and the second network device establish a unicast connection as described above. If it is determined to belong, the data packet can be received and stored in the receiving buffer. In some embodiments, the second network device can determine whether the sequence number of the data packet is greater than or equal to the sequence number of the starting data packet of the next multicast data received by the identifier. For example, the first network device can inform the second network device that the sequence number of the starting data packet of the next multicast data to be sent is 0001, then after receiving the data packet with a sequence number greater than or equal to 0001, the second network device determines that it belongs to the next multicast data, receives it, and stores it in the receiving buffer. Next, the second network device processes the one or more data packets in response to determining that the one or more data packets in the receiving buffer have formed complete multicast data. It can be determined whether the complete multicast data has been received based on some special tags carried in the data packet. For example, when the second network device receives data packet 0003, it parses its payload field and finds the multicast data end marker 408, and has received all the data packets from the start data packet (data packet 0001) to the data packet including the multicast data end marker (data packet 0003), and determines that complete multicast data, i.e., multicast data 01, has been formed in the receiving buffer. Therefore, multicast data 01 can be processed. On the contrary, if it is determined that it does not belong to the next multicast data or later subsequent multicast data, the data packet can be discarded. For example, if the first network device informs the second network device that the sequence number of the start data packet of the next multicast data to be sent is 0004, then the second network device will discard it when it receives data packets 0001-0003.

[0054] In step 206 , the first network device receives an acknowledgment message (ACK) for the data packet sent in step 204 from the second network device through the unicast connection established in step 202 . Figure 3 This process is also shown in step S34. The unicast connection established in step 202 means that the destination address of the ACK is the local network address and local port of the first network device known when the unicast connection is established in step 202. This enables the ACK to be accurately routed to the first network device and received and processed by the first network device.

[0055] The second network device can confirm the reception of the data packet according to various mechanisms. For example, ACK can be replied to each received data packet, or ACK can be replied to a batch of data packets. The ACK can include the sequence number of each received data packet, or the sequence number of the last data packet received in sequence. The ACK can also include an identifier of the multicast data carried in the data packet. Regardless of the method, the purpose of the ACK is to let the first network device know which data packets have been successfully received by the second network device.

[0056] As mentioned above, in some embodiments, when the first network device establishes a unicast connection with the second network device, it may send to the second network device an identifier of the next multicast data to be sent after the unicast connection is established between the two. Accordingly, on the second network device side, before sending the ACK, the second network device may process and analyze each data packet received in the multicast manner in step S32, and determine based on the identifier whether the data packet belongs to the next multicast data to be received by the second network device after the unicast connection is established with the first network device or a later subsequent multicast data, and only send the ACK if it is determined to belong. Figure 3 This process is shown in step S33 of FIG.

[0057] In step 208, the first network device determines, according to the received ACK, retransmission data packets that need to be retransmitted among the sent data packets. Figure 3 This process is also shown in step S35. The first network device can determine that the ACK comes from the second network device based on the source address of the ACK. For each data packet sent by the first network device, the first network device can confirm whether the data packet belongs to the next multicast data or a later subsequent multicast data based on the identifier of the next multicast data to be sent after the first network device establishes a connection with the second network device. If it does not belong, the first network device does not expect to receive an ACK corresponding to the data packet from the second network device. If it does, the first network device also determines whether the corresponding ACK for the data packet has been successfully received from the second network device based on the received ACK. In the case of sending a single ACK for a batch of data packets, the single ACK should also be regarded as an ACK for each data packet in the batch of data packets. If it is determined that the corresponding ACK for the data packet has not been successfully received from the second network device, the data packet is determined as a retransmitted data packet that needs to be retransmitted. The retransmitted data packet is a data packet that the first network device has sent in a multicast manner but has not successfully received a corresponding ACK. The reason may be that the second network device did not receive the data packet, or the second network device received and replied a corresponding ACK, but the ACK was not successfully received by the first network device.

[0058] In step 210 , the first network device sends the retransmission data packet determined in step 208 to the second network device via the unicast connection established in step 202 . Figure 3 This process is also shown in step S36. The unicast connection established in step 202 means that the destination address of these retransmitted data packets is set to the network address and port of the second network device known when the unicast connection is established in step 202. This enables these data packets to be retransmitted to be accurately routed to the second network device.

[0059] In the subsequent steps, the second network device may confirm the reception of the retransmitted data packet and send an ACK. The first network device may determine the retransmitted data packet that needs to be retransmitted again. If the data packet is still not successfully received after retransmission once, the first network device may retransmit again until the data packet is successfully received and the first network device receives the corresponding ACK; or the first network device may give up retransmission after a predetermined number of retransmissions or after a predetermined timeout period, and identify the data packet as a data packet with timeout packet loss.

[0060] So far, the communication process between the first network device and the second network device has been described. It can be seen that the network communication method according to the embodiment of the present disclosure sends data packets in a multicast manner, and sends confirmation messages of data packets and retransmitted data packets in a unicast manner, which saves network bandwidth resources on the basis of realizing a reliable transmission mechanism, and the network system can be flexibly expanded to improve load capacity.

[0061] Combine the following Figure 5 The following describes the communication between the parties when there is another network device in the network that also receives the multicast data of the first network device. Figure 5 and Figure 2-Figure 3 The differences are shown in the figure, and the same steps and processes are omitted.

[0062] The network topology environment between the first network device, the second network device, and the third network device may be as follows: Figure 1 As shown. In step S51 and step S52, the first network device establishes a first unicast connection and a second unicast connection with the second network device and the third network device respectively. For the specific process of establishing the connection, please refer to the introduction of step 202 and step S31 above. Similar to the establishment of the first unicast connection between the first network device and the second network device, when the second unicast connection is established between the first network device and the third network device, both parties also learn each other's network address and port through the request-response mechanism.

[0063] In step S53, the first network device sends a data packet with the multicast address as the destination address. Similar to the previous description of the second network device: in some embodiments, the third network device can also join the multicast group identified by the multicast address in advance, and bind its own port to the multicast port, so that it can receive multicast data; in other embodiments, the third network device and the first network device and the second network device are located in the same local area network, the first network device sends data packets in the form of a broadcast network address combined with a multicast port, and the third network device binds its own port to the multicast port, so that it can also receive multicast data. In this way, a piece of multicast data only needs to be sent once, and it can be received by both the second network device and the third network device. As a result, the amount of data transmitted in the network is reduced, and multicast transmission can make full use of available bandwidth resources, optimize transmission efficiency, and also improve the load capacity of the network.

[0064] The second network device and the third network device may start to receive multicast data one after another, or may establish unicast connections with the first network device one after another, and are not limited to Figure 5 Since the second network device and the third network device establish unicast connections with the first network device at different times, the next multicast data to be received by each of them may also be different, and therefore, the identifiers of the corresponding next multicast data may also be different.

[0065] In step S54 and step S55, the second network device and the third network device reply corresponding ACKs, namely, the first ACK and the second ACK, for the data packets received. The first ACK and the second ACK are sent to the first network device via the first unicast connection and the second unicast connection, respectively. For the specific process, please refer to the introduction of steps 206, S33 and S34 above.

[0066] In step S56, the first network device determines the first retransmission data packet that needs to be retransmitted to the second network device and the second retransmission data packet that needs to be retransmitted to the third network device based on the first ACK and the second ACK, respectively. For example, the first network device can locally maintain a list of the first ACK and a list of the second ACK, respectively, and then determine the first retransmission data packet and the second retransmission data packet based on the list of the first ACK, respectively. The process of determining the retransmission data packet based on the ACK can refer to the introduction of steps 208 and S35.

[0067] In step S57, the first network device sends the first retransmission data packet determined in step S56 to the second network device via the first unicast connection; in step S58, the first network device sends the second retransmission data packet determined in step S56 to the third network device via the second unicast connection.

[0068] In some embodiments, when multicast data is sent, the multicast sending speed can be determined / adjusted according to the transmission quality between the sender and multiple receivers. For example, in step S59, the first network device can determine the multicast sending speed according to the first transmission quality data between the first network device and the second network device and the second transmission quality data between the first network device and the third network device, and send the data packet for carrying the multicast data according to the determined multicast sending speed. The first transmission quality data may include various indicators that can reflect the transmission quality between the first network device and the second network device. For example, the first transmission quality data may include one or more of the first ACK, the first retransmission data packet, or the data packet that eventually timed out and lost packets between the first network device and the second network device received by the first network device. The second transmission quality data may include various indicators that can reflect the transmission quality between the first network device and the third network device. For example, the second transmission quality data may include one or more of the second ACK, the second retransmission data packet, or the data packet that eventually timed out and lost packets between the first network device and the third network device received by the first network device.

[0069] Although step S59 is shown as a step independent of step S53 in the figure, in some embodiments, the process of determining the multicast transmission speed and transmitting according to the multicast transmission speed in step S59 can also be a part of step S53. However, when the first network device and the second and third network devices perform multicast transmission for the first time, there is no previous transmission quality data, so a preset initial multicast transmission speed can be used, and then adjusted according to the actual transmission quality data.

[0070] In some embodiments, the multicast transmission speed can be set / adjusted according to the first transmission quality data and the second transmission quality data, whichever has a worse transmission quality, thereby avoiding the corresponding network device with the worse transmission quality from needing to retransmit a large number of data packets. In other embodiments, the multicast transmission speed can be set / adjusted according to the average level of the corresponding transmission quality data of multiple network devices as multicast data receivers.

[0071] Figure 6 FIG. 6 is a schematic flow chart of a network communication method 600 applied to a second network device according to some embodiments of the present disclosure. The second network device is any receiver of multicast data, for example, Figure 1 Network device B 104, network device C 106, or Figure 5 The second network device or the third network device in the above text has been combined Figure 3The signal interaction between the first network device and the second network device is introduced. Here, some operations performed by the second network device as the receiving party are mainly described. For other details, please refer to Figure 2-Figure 5 Description.

[0072] In step 602 , the second network device establishes a unicast connection with the first network device.

[0073] In step 604, the second network device receives a data packet with a multicast address as a destination address, the multicast address includes a multicast network address and a multicast port, the data packet is used to carry multicast data, and each multicast data is encapsulated into at least one data packet.

[0074] In some embodiments, in order to receive a data packet with a multicast address as a destination address, the second network device pre-joins a multicast group identified by the multicast address and binds its local port to the multicast port.

[0075] In some embodiments, in order to receive a data packet with a multicast address as a destination address, the second network device binds its local port to the multicast port without having to join the multicast group in advance.

[0076] In step 606 , the second network device sends an ACK for the data packet received in step 604 to the first network device through the unicast connection established in step 602 .

[0077] In step 608 , the second network device receives the retransmitted data packet from the first network device through the unicast connection established in step 602 .

[0078] Figure 7 An exemplary electronic device that can be used to implement the method according to an embodiment of the present disclosure is shown. The electronic device 700 can be used to implement Figure 1 The network device A, network device B or network device C in the figure or the first, second or third network device in other figures. Figure 7 As shown, the electronic device 700 may include one or more processors 702. The one or more processors 702 may be any type of processor, and may include but is not limited to one or more general-purpose processors or special-purpose processors (such as special-purpose processing chips). The processor 702 may execute instructions to implement the various methods (including methods 200 and 300), steps, and processes described above according to the embodiments of the present disclosure.

[0079] The electronic device 700 may also include or be connected to a non-transitory storage device 704, which may be any non-transitory storage device that can implement data storage, and may include but is not limited to a disk drive, an optical storage device, a solid-state memory, a floppy disk, a flexible disk, a hard disk, a tape or any other magnetic medium, a compressed disk or any other optical medium, a cache memory and / or any other storage chip or module, and / or any other medium from which a computer can read data, instructions and / or code. The non-transitory storage device 704 may store various dynamic and static instructions and / or data for the processor 702 to read and / or execute.

[0080] The processor 702 and / or the storage device 704 may be connected or communicated with the bus 706 via one or more interfaces. The bus 706 may include, but is not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MCA) bus, an Enhanced ISA (EISA) bus, a Video Electronics Standards Association (VESA) local bus, a PCI bus or a PCI-e bus, etc.

[0081] I / O device 708 may be any external device capable of interacting with electronic device 700. Examples of I / O device 708 may include, but are not limited to, a keyboard, a touch pad, a mouse, a joystick or other pointing device, a microphone, a speaker, a display, or a printer.

[0082] The electronic device 700 may also include a network interface 710. The network interface 710 may be any type of device or system capable of enabling communication with an external device and / or a network, and may include but is not limited to a modem, a network card, an infrared communication device, a wireless communication device and / or a chipset (such as a Bluetooth device, a WiFi device, a WiMax device, a cellular communication facility, etc.).

[0083] I / O devices 708 and / or network interface 710 may also be communicatively coupled with processor 702 and / or storage device 704 via bus 706 .

[0084] The present disclosure may be implemented as any combination of an apparatus, a system, an integrated circuit, and a computer program on a non-transitory computer-readable medium or a computer program product. One or more processors may be implemented as an integrated circuit (IC), an application specific integrated circuit (ASIC), or a large-scale integrated circuit (LSI), a system LSI, a super LSI, or a super LSI component that performs some or all of the functions described in the present disclosure.

[0085] The present disclosure includes the use of software, applications, computer programs, or algorithms. The software, applications, computer programs, or algorithms may be stored on a non-transitory computer-readable medium or computer program product to enable a computer such as one or more processors to perform the above steps and the steps described in the accompanying drawings. For example, one or more memories store the software or algorithm in executable instructions, and one or more processors may associate a set of instructions to execute the software or algorithm to provide various functions according to the embodiments described in the present disclosure.

[0086] Software and computer programs (which may also be referred to as programs, software applications, applications, components or code) include machine instructions for a programmable processor and may be implemented in a high-level procedural language, an object-oriented programming language, a functional programming language, a logic programming language, or an assembly language or a machine language. The term "computer-readable medium" refers to any computer program product, apparatus or device for providing machine instructions or data to a programmable data processor, such as magnetic disks, optical disks, solid-state storage devices, memories and programmable logic devices (PLDs), including computer-readable media that receive machine instructions as computer-readable signals.

[0087] For example, computer readable media may include dynamic random access memory (DRAM), random access memory (RAM), read-only memory (ROM), electrically erasable read-only memory (EEPROM), compact disk read-only memory (CD-ROM) or other optical disk storage devices, magnetic disk storage devices or other magnetic storage devices, or any other medium that can be used to carry or store the desired computer readable program code in the form of instructions or data structures and can be accessed by a general or special purpose computer or a general or special purpose processor. As used herein, disk or disc includes compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), floppy disk and Blu-ray disc, where disks usually reproduce data magnetically, while discs reproduce data optically by laser. Combinations of the above are also included in the scope of computer readable media.

[0088] The subject matter of the present disclosure is provided as an example of devices, systems, methods and programs for performing the features described in the present disclosure. However, in addition to the above-mentioned features, other features or variations may also be expected. It is expected that the implementation of the components and functions of the present disclosure may be completed with any emerging technology that may replace any of the above-mentioned implementation technologies.

[0089] In addition, the above description provides examples without limiting the scope, applicability or configuration set forth in the claims. Without departing from the spirit and scope of the present disclosure, the functions and arrangements of the elements discussed may be changed. Various embodiments may appropriately omit, replace or add various processes or components. For example, features described with respect to certain embodiments may be combined in other embodiments.

[0090] Similarly, although operations are depicted in a particular order in the drawings, this should not be understood as requiring that such operations be performed in the particular order shown or in a sequential order, or that all illustrated operations be performed to achieve the desired results. In some cases, the order of operations may be changed, or multiple operations may be processed in parallel.

Claims

1. A network communication method, applied to a first network device, characterized in that: The method comprises: establishing a unicast connection with a second network device; Sending a data packet with a multicast address as a destination address, the multicast address includes a multicast network address and a multicast port, the data packet is used to carry multicast data, and each multicast data is encapsulated into at least one data packet; receiving an acknowledgement message (ACK) for the data packet from the second network device via the unicast connection; Determining, according to the received ACK, a retransmitted data packet that needs to be retransmitted among the data packets; and The retransmission data packet is sent to the second network device via the unicast connection.

2. The method according to claim 1, wherein: The unicast connection is a first unicast connection, the ACK is a first ACK, the retransmitted data packet is a first retransmitted data packet, and the method further includes: Establishing a second unicast connection with a third network device, wherein the first network device, the second network device and the third network device are located in the same local area network; receiving a second ACK for the data packet from the third network device via the second unicast connection; Determine a second retransmission data packet that needs to be retransmitted in the data packets according to the received second ACK; and The second retransmission data packet is sent to the third network device through the second unicast connection.

3. The method according to claim 2, wherein: Sending a data packet with a multicast address as the destination address includes: determining a multicast transmission speed according to first transmission quality data between the first network device and the second network device and second transmission quality data between the first network device and the third network device; and The data packets are sent according to a multicast sending speed.

4. The method according to claim 1, wherein: The first network device and the second network device are located in the same local area network, and the multicast network address is calculated according to the local network address of the first network device and the subnet mask of the local area network.

5. The method according to claim 1, wherein: The establishing a unicast connection with the second network device includes: An identifier is sent to the second network device, where the identifier is a sequence number of a starting data packet for carrying next multicast data to be sent by the first network device after establishing a unicast connection with the second network device.

6. The method according to claim 5, wherein determining the retransmitted data packets that need to be retransmitted in the data packets according to the received ACK comprises: For each data packet sent with a multicast address as the destination address: In response to determining, based on the identifier, that the data packet belongs to the next multicast data to be sent after the first network device establishes a unicast connection with the second network device or a later subsequent multicast data, and in response to determining, based on the received ACK, that a corresponding ACK for the data packet is not successfully received from the second network device, the data packet is determined to be the retransmission data packet.

7. The method according to claim 1, wherein: The establishing a unicast connection with the second network device includes: monitoring the local network address and local port of the first network device; receiving a subscription request from the second network device, the subscription request including a network address and a port of the second network device; storing the network address and port of the second network device; and A reply message is sent to the second network device based on the network address and port of the second network device. The method according to claim 7 , wherein the port of the second network device is the multicast port.

9. A network communication method, applied to a second network device, characterized in that: The method comprises: establishing a unicast connection with the first network device; receiving a data packet with a multicast address as a destination address, the multicast address including a multicast network address and a multicast port, the data packet being used to carry multicast data, each of the multicast data being encapsulated into at least one data packet; sending an acknowledgement message (ACK) for the data packet to the first network device through the unicast connection; and A retransmitted data packet is received from the first network device via the unicast connection.

10. The method according to claim 9, wherein: The establishing a unicast connection with the first network device includes: An identifier is received from the first network device, where the identifier is a sequence number of a starting data packet for carrying next multicast data to be received by the second network device after establishing a unicast connection with the first network device.

11. The method according to claim 10, wherein sending an ACK for the data packet to the first network device through the unicast connection comprises: For each data packet received with a multicast address as the destination address: In response to determining, based on the identifier, that the data packet belongs to the next multicast data or later subsequent multicast data to be received after the second network device establishes a unicast connection with the first network device, an ACK for the data packet is sent to the first network device via the unicast connection.

12. The method according to claim 10, further comprising: For each data packet received with a multicast address as the destination address: In response to determining, based on the identifier, that the data packet belongs to the next multicast data or later subsequent multicast data to be received by the second network device after establishing a unicast connection with the first network device, storing the data packet in a receiving buffer; as well as In response to determining that the one or more data packets in the receiving buffer have formed complete multicast data, the one or more data packets are processed.

13. The method according to claim 10, further comprising: For each of the received data packets with the multicast address as the destination address: In response to determining, based on the identifier, that the data packet does not belong to the next multicast data or later subsequent multicast data to be received after the second network device establishes a unicast connection with the first network device, the data packet is discarded.

14. The method according to claim 9, wherein: The establishing a unicast connection with the first network device includes: Sending a subscription request to the first network device, the subscription request including a network address and a port of the second network device; A reply message is received from the first network device via the network address and port of the second network device.

15. The method according to claim 14, wherein: The establishing of a unicast connection with the first network device further includes: Before sending the subscription request to the first network device, the port of the second network device is bound as the multicast port.

16. An electronic device, characterized in that: The electronic device comprises: Processor; and A memory, coupled to the processor and storing computer program instructions, which, when executed by the processor, cause the processor to perform the method according to any one of claims 1 to 15.

17. A computer program product comprising computer executable instructions which, when executed by one or more processors, cause the one or more processors to perform the method according to any one of claims 1-15.