WO2015074279A1 - Network encoding and transmission method based on udp protocol - Google Patents

Network encoding and transmission method based on udp protocol Download PDF

Info

Publication number
WO2015074279A1
WO2015074279A1 PCT/CN2013/087789 CN2013087789W WO2015074279A1 WO 2015074279 A1 WO2015074279 A1 WO 2015074279A1 CN 2013087789 W CN2013087789 W CN 2013087789W WO 2015074279 A1 WO2015074279 A1 WO 2015074279A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
data packet
transmission
network coding
layer
Prior art date
Application number
PCT/CN2013/087789
Other languages
French (fr)
Chinese (zh)
Inventor
李挥
谭学磊
秦立都
于超琪
潘凯
Original Assignee
北京大学深圳研究生院
深圳赛思鹏科技发展有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京大学深圳研究生院, 深圳赛思鹏科技发展有限公司 filed Critical 北京大学深圳研究生院
Priority to CN201380081163.0A priority Critical patent/CN107852398A/en
Priority to PCT/CN2013/087789 priority patent/WO2015074279A1/en
Publication of WO2015074279A1 publication Critical patent/WO2015074279A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/164Adaptation or special uses of UDP protocol

Definitions

  • the present invention relates to the field of network coding and transmission, and more particularly to a network coding and transmission method based on the UDP protocol.
  • TCP/NC network coding theory
  • TCP protocol method based on network coding theory (TCP/NC), that is, adding a network coding layer (NC layer) between the TCP layer and the IP layer, requires some modifications to the existing TCP protocol.
  • TCP/NC network coding theory
  • the NC layer at the transmitting end receives the data packets from the TCP layer and stores them in an encoding buffer representing the encoding window, encodes the buffered original data packets, and then repackages the encoded data packets and transmits them;
  • the layer is responsible for receiving the encoded data packet from the network and buffering, then returning an ACK message to the transmitting end, decoding the received encoded data packet, and finally transmitting the decoded original data packet to the TCP layer.
  • the sender generates and transmits a random linear combination of data packets in the coding window, and the linear combination coefficients are transmitted through the packet header.
  • R is the redundancy coefficient, which is the reciprocal of the successful reception probability, which may not be an integer, so it will be rounded up during the operation
  • Go out the network throughput and link utilization can be improved by setting a fixed optimal redundancy coefficient R (the optimal redundancy coefficient R is equal to the reciprocal of the successful reception rate). rate.
  • R of the redundancy coefficient is not easy to determine. If R is too small, it will not be enough to cover the loss of the data packet.
  • the TCP/NC protocol cannot adapt to the changing environment of the network environment, especially the wireless network environment that is greatly affected by external interference.
  • the technical problem to be solved by the present invention is to provide an easy implementation, a small delay at the receiving end, and a change in the network environment, which is difficult to implement in the prior art, has a large delay at the receiving end, and cannot adapt to changes in the network environment.
  • the technical solution adopted by the present invention to solve the technical problem is: Constructing a network coding and transmission method based on the UDP protocol, comprising the following steps:
  • the data or file is entered by the application layer of the transmitting end into the network coding layer of the transmitting end, buffered and coded by the network coding layer of the transmitting end, and formed a numbered data packet according to the set manner, through the transmitting end transmission layer, Sending to the receiving end by means of transmission with reliable transmission;
  • the network coding layer of the receiving end receives the encoded data through the transmission layer of the receiving end, identifies the number of the received data packet, returns a different response signal to the transmitting end according to the received number, and decodes the data to obtain the data. Or file, and transferred to the application layer at the receiving end.
  • the method further includes the following steps:
  • the transmitting end decides to retransmit or not retransmit the data block according to different types of response signals sent by the receiving end.
  • step B) further includes the following steps:
  • step B) further includes the following steps:
  • the data or file to be transmitted by the transmitting end is divided into data packets of a first set length according to the inflow order thereof, and when the remaining file or data length is less than the first set length, the data is filled in.
  • Data zero to maintain the packet length, so that each packet after division has the same length; set the number of packets blks ize to form a data block, the data packet is the smallest unit of transmission; the data contained in the data block
  • the number of packets is adjusted according to the information returned by the receiving end during transmission.
  • step B) further includes the following steps:
  • the transmitting end controls the sending speed of the data packet by the number of tokens allowed to be allowed in a unit time, and each token allows one data packet to be sent; the number of tokens that appear in the unit time is transmitted according to the data packet. Time adjustment.
  • the number of tokens allowed to be transmitted in a unit time is adjusted according to a transmission time of the data packet at the transmitting end and the receiving end, and the receiving end is notified; the longer the data packet is transmitted, the unit The fewer tokens allowed to be sent during the time.
  • the number of data packets included in the data block is adjusted according to the transmission time of each data packet, and the number of data packets included in the data block is inversely proportional to the transmission time of the data packet between the transmitting end and the receiving end. .
  • step C) further includes the following steps:
  • the receiving end detects the data packet number that has been received, and if the number is consecutive, sends an acknowledgement response signal to the transmitting end; if the number is not continuous, sends an extended acknowledgement response signal to the transmitting end, the extended acknowledgement signal
  • the last consecutive data packet number received by the receiving end is carried in the middle.
  • step C) further includes the following steps:
  • step C3) for each received data packet, insert its coding coefficient and payload into the above-mentioned coding coefficient matrix and the corresponding payload structure respectively, and use Gaussian elimination method to judge whether it is independent of the previous data packet, and if so, Perform step C4); otherwise, perform step C5);
  • the transmitting end transmits the data packet in a slow start mode; the slow start mode includes The number of tokens allowed to be transmitted in the unit time is set to a default value, and the number of tokens is incremented by one after each successful transmission of a data packet, until the token number reaches a set threshold, and is changed to a normal transmission state.
  • the UDP protocol-based network coding and transmission method embodying the present invention has the following beneficial effects: Since the network coding layer is disposed between the application layer and the transport layer, the network coding layer is connected to the transport layer through the UDP protocol stack of the transport layer and The data is transmitted, and the modification difficulty and workload of the UDP protocol are much smaller than the modification of the TCP/IP protocol. At the same time, an acknowledgment signal is used between the receiving end and the transmitting end, and a reliable UDP transmission form is used to ensure reliable transmission of data; The number of data packets transmitted per unit time and the number of data packets included in each data block can be adjusted in real time according to the transmission time of the data packet to adapt to changes in the network environment. Therefore, it is easier to implement, the receiver has less delay, and adapts to changes in the network environment.
  • FIG. 1 is a schematic diagram of a network coding layer setting in an embodiment of a network coding and transmission method based on a UDP protocol according to the present invention
  • Figure 2 is a flow chart showing a case of data transmission in the embodiment
  • 3 is a flow chart of transmitting data and congestion control at the transmitting end in the embodiment.
  • Figure 4 is a flow chart of the receiving end decoding in the embodiment
  • Figure 5 is a diagram of six state transitions for reliable transmission of the network coding layer. detailed description
  • the method includes the following steps:
  • Step S11 constructs a network coding layer to be respectively connected to the application layer and the transport layer:
  • the mechanism is capable of obtaining the encoded data after encoding. Transmission to the receiving end for decoding; therefore, both the transmitting end and the receiving end need to set a network coding layer, and when the network coding layer is used as a receiving end, the data is compiled.
  • the code obtains the encoded data; and when it is the receiving end, decodes the received encoded data.
  • the structure of the transmitting end and the receiving end is the same. When a terminal initiates a connection, it is a transmitting end.
  • a network coding layer is constructed between the transport layer and the application layer of the terminal; the network coding layer is respectively connected to the transport layer and the application layer, and in the connection with the transport layer, the network coding layer uses (or passes) the transmission.
  • the layer's UDP protocol establishes a connection with the transport layer.
  • Step S12 forms a network code, which is parallelized into a numbered data packet, and is sent by the transmitting end to the receiving end:
  • one terminal needs to transmit the data or file to another terminal, and then the terminal initiates the connection and sends the data.
  • the other terminal responds to the connection it initiated as the receiving end.
  • the transmitting end transmits the file to be transmitted from the application layer to the network coding layer, and encodes the encoded data to obtain the encoded data; the obtained encoded data sequentially enters the transmission layer of the transmitting end; and processes it in the transmission layer of the transmitting end to obtain With numbered packets, multiple such packets form a block of data that is sent to the network through the transport layer.
  • the transport layer transmits data in units of packets, but the network coding layer decodes the encoded data in units of data blocks.
  • the setting of the transmission parameters, the transmission of the data packet, and the reception of the acknowledgment signal (sent by the receiving end after receiving the data packet) are included, and the details will be described later.
  • Step S1 3 The receiving end receives the data packet, obtains its number, and sends a different response signal to the transmitting end according to the numbering condition: After the data reaches the receiving end through the network link, the receiving end receives the data packet, and obtains the data packet in the transport layer. The number of these data packets, according to the relationship between the previously obtained number and the currently obtained number, sends a different acknowledgment signal to the sender, for example, if the obtained packet number is continuous, indicating that there is no packet loss. Appears, sends an acknowledgment signal to the sender; if the number of the packet is not continuous, indicating that there is a packet in the middle, the extension acknowledgment signal is sent to the sender.
  • the extended acknowledgement signal carries the number of the last received continuous data packet and the currently received data packet number, so that the sender can determine which data packets are retransmitted.
  • Step S14 The transmitting end determines whether to retransmit or not retransmit the related data packet according to different response signals: In this step, the transmitting end determines whether to retransmit or not according to the received different type of response signals sent by the receiving end. Send a data packet, and if it needs to be resent, also determine which data needs to be resent. Package.
  • step S12 further includes multiple steps, as follows:
  • Step S21 The transmitting end sends the data packet with the transmission parameter to the receiving end, and the receiving end returns an acknowledgment signal and sets it according to the setting:
  • the receiving end that needs to arrive due to the data is usually indefinite, in order to ensure the transmission
  • the sender needs to notify the receiving end of the transmission parameters before sending the data, that is, when the connection is established, so that the receiving end can set according to these parameters, thereby realizing the connection transmission data.
  • the transmitting end when the transmitting end establishes a connection with the receiving end, the transmitting end sends a data packet carrying the set transmission parameter to notify the receiving end, and the receiving end returns the acknowledgement information after receiving the data packet and according to the transmission.
  • the parameter sets the receiver.
  • Step S22 setting or adjusting the data block size according to the specification:
  • the data or file to be transmitted by the transmitting end is divided into the data packet of the first set length according to the inflow order thereof, when the remaining file or data length is smaller than the first setting
  • the length is fixed (that is, when an integer number of data packets are obtained according to the first set length, and some data remains undivided, but the length of the data is less than the first set length)
  • the data zero is filled in to keep the data packet length
  • a fixed number of data packets constitutes a data block, and the data packet is the smallest unit of transmission
  • the number of data packets included in the data block is adjusted according to the information returned by the receiving end during transmission.
  • the sender divides the stream or file into multiple blocks, including the number of b lks i ze packets, each of which is assumed to be a fixed length. If the remaining files or streams are not enough to form a complete package, pad it with zeros to ensure that all packets have the same length.
  • a block does not need to be full, that is, one block may be less than b lks i ze packets; however, the i-th block must be full before the i+1th block is initialized.
  • the block size is adjusted according to the feedback from the receiver.
  • the receiver is responsible for decoding the received data and constructing an ACK to the sender. When the receiver receives a packet, it needs to check if the current block is decodable (ack_currb lk) and the number of degrees of freedom (ack-currdof) of the current block received.
  • the receiver side For each block b lkno , the receiver side initializes a coding coefficient matrix C blkn of b lks i ze b lks i ze . And a corresponding payload structure P blkn . . Whenever a packet is received from b lkno, the coding coefficients and payload are inserted into C blkn respectively. And P blkn . . The Gaussian elimination method is then used to determine whether the received data is linear regardless of whether the previously received packet is linear. If yes, the receiver sets ack-currdof ack.currdof + 1.
  • ack_currdof is equal to b lks i ze
  • the receiver acknowledges that it has received sufficient degrees of freedom for the ack_currb lk block and updates ack_currb lk Ack.currblk + 1 (requires resetting ack_currdof to reflect the need for new ack_currblk degrees of freedom).
  • the receiver transmits an ACK (received by the corresponding packet) but does not update ack_currdof and ack_currblk. Once enough linearly unrelated blksizef packets (degrees of freedom) are received, the receiver can decode all the packets in the block.
  • Step S23 The sender processes the encoded data according to the set format to obtain the numbered data packet and the data block:
  • the number of data packets in the data block is adjusted, and in the case that the network environment is not good, the data block is reduced.
  • the number of packets in the packet helps to successfully decode. Therefore, when the network environment is good, the number of data packets in the data block is large; otherwise, the number is small. That is, in this step, the number of data packets included in the data block is adjusted according to the transmission time of each data packet, and the data packet includes the number of data packets and the data packet between the transmitting end and the receiving end.
  • the transmission time is inversely proportional.
  • Step S24 sets or adjusts the number of tokens according to the regulations:
  • the number of tokens is set or adjusted, which is also changed according to the network environment, and the sender controls the data packet by the number of tokens allowed to be allowed in a unit time.
  • the sending speed each token is allowed to send a data packet; the number of tokens appearing per unit time is adjusted according to the time of packet transmission.
  • the number of tokens allowed to be sent in a unit time is adjusted according to a transmission time of the data packet at the transmitting end and the receiving end, and the receiving end is notified; the longer the data packet is transmitted, the transmission is allowed in a unit time. The less the number of tokens.
  • Fig. 3 only gives an example.
  • the steps in Figure 3 are arranged according to certain conditions.
  • the data transmitting end may not be arranged in the order shown in FIG. 3. It is possible that the two steps in FIG. 3 are performed simultaneously or the order of the two steps in FIG. 3 is reversed. Or for some reason not doing one of the steps and so on. These situations are all possible in this embodiment.
  • the steps in Figure 3 are implemented to send data smoothly and reliably, and different steps can be taken depending on the actual situation.
  • step S13 after the data packet is received by the receiving end, it is processed in the transmission layer of the receiving end to obtain the data packet number thereof, and is judged if the number is connected. And sending an acknowledgement response signal to the sending end; if the number is not continuous, sending an extended acknowledgement response signal to the sending end, where the extended acknowledgement signal carries the last consecutive data packet number received by the receiving end .
  • Step S31 Receive a new data block, initialize the coding matrix and the payload:
  • the initialization size is b Iks i zeXb Iks i ze
  • Step S32 The newly received data packet is linearly related to the data packet received before the data block. If yes, go to step S34, otherwise, go to step S35; for each received data packet, insert its coding coefficient and payload respectively.
  • the Gaussian elimination method is used to judge whether it is independent of whether the previous data packet is linear.
  • Step S33 Sending an acknowledgment signal, updating the block degree of freedom: Since the linearity is irrelevant, indicating that the data packet is received normally, the receiving end returns an acknowledgment signal, updates the current block degree of freedom, increments it by 1, and executes step S35.
  • Step S34 sends an acknowledgment signal, and does not update the block degree of freedom: In this step, the acknowledgment signal is transmitted, but the block degree of freedom is not updated, and the next packet is received, and the process returns to step S32.
  • Step S35 The degree of freedom is equal to the block length. No: It is judged whether the updated current block degree of freedom is equal to the current set length in the data block, and if so, it is judged that the data block can be decoded; otherwise, the process returns to step S32.
  • Step S36 The data block is received and can be decoded: In this step, all the data packets in one received data block are decoded. At the same time, it is ready to receive the next data block.
  • the transmitting end transmits the data packet in the slow start mode;
  • the slow start mode includes setting the number of tokens allowed to be transmitted in the unit time to a default value, and adding the number of tokens after successfully transmitting one data packet, until the number of tokens reaches a set threshold, and then changing Normal transmission status.
  • a virtual connection is also established between the network coding peers of the sender and the receiver, similar to TCP, and a three-way handshake is also performed.
  • a three-way handshake is also performed.
  • both parties initiate a connection at the same time, respond and send a SYN.
  • a SYN packet is sent when the connection is established.
  • the configuration BPDUs of both ends are carried in the segment.
  • closing a connection uses a 4-way handshake similar to TCP, but in a persistent connection application, the connection is closed only when an exception occurs. After an abnormality occurs on one end, the other end detects the abnormality through the reliable detection mechanism and reports it to the upper-layer user to release the local connection resources.
  • Retransmission timer In the network coding layer, after each coded message is sent, if the retransmission timer is not set at this time , then set the timer. So when the peer receives the message, it will send a response to On the sending end, the sending end cancels the timer after receiving the response. If there is a message sent but not answered after receiving the response, the timer is restarted. The duration of the timer timeout is negotiated by both ends, but both ends must be the same value.
  • Retransmission counter The retransmission counter records the number of times the message is retransmitted until the number of retransmissions reaches the threshold. When the number of retransmissions exceeds the threshold, the connection is considered to have been disconnected. In this case, the connection error should be handled.
  • EACK There are two types of response messages for encoded messages.
  • EACK There are two types of response messages for encoded messages.
  • EACK and ACK. Consideration must be given to the loss of the intermediate sequence number message after a group of messages has been sent.
  • this scenario provides an EACK message type.
  • the receiver receives an unordered message
  • the receiving end sends an EACK response to the sender, notifying that some of the other party's messages may be lost or corrupted during the flight.
  • the sender receives the EACK type message
  • the EACK message carries the most recently received sequence message number and the received out-of-order message number.
  • the message sequence number that needs to be retransmitted is calculated according to the information carried in the message. Resend these messages. Similar to TCP to reduce network load and increase utilization. It also uses response delay techniques.
  • the receiver maintains a counter to count the number of received but unacknowledged packets.
  • the threshold is configurable
  • An EACK is sent if the message does not respond.
  • the cumulative acknowledgment timer expires, a separate ACK or EACK is sent regardless of whether the accumulated counter has reached the threshold. The timer restarts when a separate response is sent.
  • Keep-alive mechanism When transmitting information using the network coding layer protocol, there may be a case where there is no data circulation on one connection for a period of time. That is to say, neither link has applied data to the other party. At this point, a keep-alive mechanism is needed to keep abreast of the link situation so that it can be detected in time if one party crashes.
  • the keepalive timer When one end of the connection finds that there is no message transmission on the local end, the keepalive timer is set on the local end. If there is data transmission before the keep-alive timer expires, the keep-alive timer is canceled and the re-send timer is set. If the keep-alive timer expires and no application data needs to be sent, a keep-alive message is sent to the peer.
  • the keep-alive mechanism enables the network coding layer to provide long connection services.
  • Redundant connection mechanism If a connection fails, the upper application receives the signal and starts the state transition timer. The upper application can transfer the connection status information through the API, initiate another connection and inherit the previously failed connection. This avoids message loss or duplication. If the state transition timer has not expired yet, the disconnected connection resource is released.
  • a message of type SYN is used to initiate a connection between two hosts.
  • the SYN message also contains the configuration negotiation information required by both parties. For example, various timer durations, version numbers, connection IDs, message sequence spaces, cumulative acknowledgement thresholds, and so on. Messages of type SYN cannot carry user data.
  • the ACK is used to acknowledge the received in-sequence message to the sender.
  • EACK that is, extended ACK
  • the sender when the sender receives the EACK, it indicates that a message is lost in the transmission, and the receiving end receives the out-of-order message.
  • the EACK always contains a sequence message sequence number and one or more out-of-order message sequence numbers that were last received last. After receiving the EACK, the sender will retransmit the last sequence message to the message before the out-of-order message (excluding the two sequence numbers) according to the contents of the EACK.
  • the network coding layer uses tokens to control the transmission rate of the sender instead of the congestion window cwnd; therefore, tokens play an important role in the network coding layer as if cwnd is TCP-like.
  • a token allows the sender of the network coding layer to send a packet (coded or unencoded). When the sender transmits a packet, tokens can be used. The number of Tokens is controlled based on the modified AIMD multiplication compensation:
  • RTT RTT max when the packet loss occurs (link queue is full).
  • throughput 1
  • RTT In the lossy link (except for the loss of queue overflow), RTT is used to adapt ⁇ to each loss.
  • RTT> RTTmin, ⁇ ⁇ 1, ie the tokens are reduced when there is a packet loss, because the link queue is full, and the sum of the throughput before the loss is ⁇ n B.
  • the parameters of the sender are defined as follows:
  • the update of the network parameters of the sender is that the sender adjusts its coding and congestion control according to some sender parameters. If the sender does not receive the sender's transmission within a certain period of time
  • the parameter is reset to the default value.
  • the parameters are updated according to the ACK.
  • t ime las tack Is the current time current time; If the smallest undecoded block (number) is greater than the current sender's block number, you need to send the smallest undecoded block to the receiver, so the current send block number is updated to ack_currblk; in fact, currdof is always ack_currdof and The larger the currdof, the greater the freedom to perform various operations on the packet.
  • the network coding can operate the data bits in the data packet, such as "bitwise XOR", etc., which can effectively allow the target node to accept multiple information without increasing the number of data packets it can receive, that is, without increasing the overall network. Capacity, and bitwise to get more freedom.
  • sequence number 1 when the confirmed ack.seqno is greater than seqno.una (unconfirmed), it indicates that there is a packet loss (because the confirmation is in order, from small to large, the small is always confirmed earlier than the large number)
  • the average loss rate is shown in Algorithm 1, and its seqno.una is updated to ack.seqno.
  • the token is incremented by 1, indicating that the network coding layer sender increases the number of packets allowed to be sent at one time.
  • the token tokes is increased to the slow start threshold ss_threshold, the slow start is used and the congestion avoidance algorithm is used instead. .
  • the number of tokens is controlled according to the modified AIMD. That is, use the above method and apply tokens to implement congestion control.
  • the controller For the receiving end, it is mainly based on the degree of freedom in ack_currblk whether the controller can be decoded. If the received block is linearly correlated, it means that the received block is not used as the decoded coefficient matrix. Once there are enough linearly independent blocks, each block can be represented by these linearly independent blocks, so it can be decoded.
  • the receiver side For each block (blkno), the receiver side initializes a coding coefficient matrix C blkn of blks ize blksize . And a corresponding payload structure P blkn . . Whenever a packet is received from blkno, the encoding coefficients and payload are inserted into C blkn respectively. And P blkn . . The Gaussian elimination method is then used to determine whether the received data is linear regardless of whether the previously received packet is linear. If yes, the receiver sets Ack-currdof ack.currdof + 1.
  • ack_currdof is equal to blksize
  • the receiver acknowledges that it has received enough ack_currblk blocks and updates ack_currblk ack.currblk + 1 (requires resetting ack.currdof to reflect the new ack.currblk degrees of freedom).
  • the receiver transmits an ACK (received by the corresponding packet) but does not update ack_currdof and ack_currblk. Once enough linearly unrelated blksizef packets (degrees of freedom) are received, the receiver can decode all the packets in the block.
  • index entry is smaller than the size of the block, indicating that there is a linearly related packet in the block, it returns FALSE. It is necessary to iteratively update the parameters so that the linear correlation coding coefficient is 0. Once updated, it needs to be normalized once.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Communication Control (AREA)

Abstract

The present invention relates to a network encoding and transmission method based on the UDP protocol, comprising the following steps: establishing a network encoding layer that is connected to a transmission layer by using the UDP protocol, wherein data or a file enters from an application layer of a transmit end to a network encoding layer of the transmit end, and is processed in the network encoding layer of the transmit end to form network code, a data packet with a number is generated in a set manner by using the network code, and the data packet is sent to a receive end by the transmission layer of the transmit end; a network encoding layer of the receive end receiving the encoded data packet by a transmission layer of the receive end, identifying the number of the received data packet, returning a different response signal to the transmit end according to the received number, decoding the data packet to obtain data or a file, and transmitting the data or the file to an application layer of the receive end. The network encoding and transmission method based on the UDP protocol has the following beneficial effects: it is easy to implement the method, a receive end has a short delay, and the method adapts to the change in network environment.

Description

一种基于 UDP协议的网络编码及传输方法  Network coding and transmission method based on UDP protocol
技术领域 Technical field
本发明涉及网络编码传输领域, 更具体地说, 涉及一种基于 UDP协议的 网络编码及传输方法。  The present invention relates to the field of network coding and transmission, and more particularly to a network coding and transmission method based on the UDP protocol.
背景技术 Background technique
目前, 网络编码在传输层的研究主要基于 TCP协议, 如基于网络编码理 论的 TCP协议( TCP/NC )。 在现有技术中, 为了结合 TCP和网络编码的优点, 提出了一个新的协议称为 TCP/NC。 TCP/NC的数据包使用随机线性网络编码来 编码单个数据流, 修改了 TCP的确认(ACK)方案,以便它应答确认自由度(收到 的新编码数据包的数量)而取代单个数据包。 TCP/NC利用随机线性编码技术 来掩盖 TCP数据包的丟失, 有效提高吞吐量。 但是对于越来越广泛使用的无 线网络, 应用 TCP 协议效果并不好, 这是由于传统的传输层协议会把包丟 失看成是网络拥塞,从而会减小拥塞窗口,导致网络吞吐量下降。 目前, 基于 网络编码理论的 TCP协议的方法(TCP/NC) , 即在 TCP层与 IP层之间增加网络编 码层(NC层) , 需要对现有的 TCP协议进行一些修改。 发送端的 NC层从 TCP 层收到数据包并将它们保存在一个代表编码窗口的编码緩存中, 对緩存的原 始数据包进行编码, 然后重新封装编码后的数据包并发送; 其接收端网络编 码层负责从网络中接收到编码后的数据包并緩存, 然后向发送端返回 ACK消 息,对接收到的编码数据包进行解码,最后将解码后的原始数据包传递给 TCP 层。 发送方在编码窗口中生成并发送数据包的随机线性组合, 线性组合系数 通过包头来传输。  At present, the research of network coding in the transport layer is mainly based on the TCP protocol, such as the TCP protocol based on network coding theory (TCP/NC). In the prior art, in order to combine the advantages of TCP and network coding, a new protocol called TCP/NC is proposed. The TCP/NC packet uses a random linear network coding to encode a single data stream, modifying the TCP acknowledgment (ACK) scheme so that it responds to the acknowledgment of freedom (the number of new encoded packets received) instead of a single packet. TCP/NC uses random linear coding techniques to mask the loss of TCP packets and improve throughput. However, for the increasingly widely used wireless networks, the application of the TCP protocol is not good. This is because the traditional transport layer protocol will treat packet loss as network congestion, which will reduce the congestion window and lead to a decrease in network throughput. At present, the TCP protocol method based on network coding theory (TCP/NC), that is, adding a network coding layer (NC layer) between the TCP layer and the IP layer, requires some modifications to the existing TCP protocol. The NC layer at the transmitting end receives the data packets from the TCP layer and stores them in an encoding buffer representing the encoding window, encodes the buffered original data packets, and then repackages the encoded data packets and transmits them; The layer is responsible for receiving the encoded data packet from the network and buffering, then returning an ACK message to the transmitting end, decoding the received encoded data packet, and finally transmitting the decoded original data packet to the TCP layer. The sender generates and transmits a random linear combination of data packets in the coding window, and the linear combination coefficients are transmitted through the packet header.
在这种情况下,对于编码窗口中的数据包,将进行 R次随机线性组合( R 是冗余系数, 为成功接收概率的倒数, 其可能不是整数, 故在运算时将向 上取整)发送出去。 当网络情况较为稳定, 丟包率变化不大的情况下, 可以 通过设置固定最优的冗余系数 R (最优冗余系数 R等于成功接收率的倒数) 来提高网络吞吐量和链路利用率。 但在网络情况不明, 丟包率经常变化的 环境下,冗余系数的 R不易确定,如果 R太小,将不足以掩盖数据包的丟失, 因此, 会出现大量的超时从而导致吞吐量低下; 反之, 发送速率会受到编码 自身速率的限制,也会降低吞吐量,而且发送太多的线性组合也会阻塞网络。 因此, 在现有技术中, 除了对 TCP协议修改较大、 难于实现外, 其使用编码 窗口进行编码也可能带来接收端的较大的延迟, 同时固定冗余系数值的In this case, for the data packets in the coding window, R random linear combinations will be performed (R is the redundancy coefficient, which is the reciprocal of the successful reception probability, which may not be an integer, so it will be rounded up during the operation) Go out. When the network condition is relatively stable and the packet loss rate does not change much, the network throughput and link utilization can be improved by setting a fixed optimal redundancy coefficient R (the optimal redundancy coefficient R is equal to the reciprocal of the successful reception rate). rate. However, in an environment where the network situation is unknown and the packet loss rate changes frequently, the R of the redundancy coefficient is not easy to determine. If R is too small, it will not be enough to cover the loss of the data packet. Therefore, a large number of timeouts may occur, resulting in low throughput; Conversely, the transmission rate is limited by the rate of the encoding itself, which also reduces throughput, and sending too many linear combinations can also block the network. Therefore, in the prior art, in addition to the modification of the TCP protocol is large and difficult to implement, its encoding using the coding window may also bring a large delay at the receiving end, and at the same time fix the value of the redundant coefficient.
TCP/NC协议不能 ^艮好地适应网络环境不断变化的情况,特别是受外界干扰影 响较大的无线网络环境。 The TCP/NC protocol cannot adapt to the changing environment of the network environment, especially the wireless network environment that is greatly affected by external interference.
发明内容 Summary of the invention
本发明要解决的技术问题在于, 针对现有技术的上述较难实现、 接收端 延迟较大、 不能适应网络环境变化的缺陷, 提供一种较易实现、 接收端延迟 较小、 适应网络环境变化的基于 UDP协议的网络编码及传输方法。  The technical problem to be solved by the present invention is to provide an easy implementation, a small delay at the receiving end, and a change in the network environment, which is difficult to implement in the prior art, has a large delay at the receiving end, and cannot adapt to changes in the network environment. Network coding and transmission method based on UDP protocol.
本发明解决其技术问题所采用的技术方案是: 构造一种基于 UDP协议的 网络编码及传输方法, 包括如下步骤:  The technical solution adopted by the present invention to solve the technical problem is: Constructing a network coding and transmission method based on the UDP protocol, comprising the following steps:
A )在传输层和应用层之间构建网络编码层; 所述网络编码层分别 与其相应的传输层和应用层连接, 所述网络编码使用所述传输层的 UDP协议 与所述传输层建立连接;  A) constructing a network coding layer between the transport layer and the application layer; the network coding layer is respectively connected to its corresponding transport layer and application layer, and the network coding establishes a connection with the transport layer by using the UDP protocol of the transport layer ;
B )数据或文件由发送端的应用层进入发送端的网络编码层, 在发 送端的网络编码层緩存并进行网络编码, 将其按照设定的方式形成带有编号 的数据包, 通过发送端传输层, 采取可靠传输的传输方式发送到接收端;  B) The data or file is entered by the application layer of the transmitting end into the network coding layer of the transmitting end, buffered and coded by the network coding layer of the transmitting end, and formed a numbered data packet according to the set manner, through the transmitting end transmission layer, Sending to the receiving end by means of transmission with reliable transmission;
C )接收端的网络编码层通过接收端的传输层接收到所述编码数据, 识别接收到的数据包的编号, 依据接收的编号返回不同的应答信号给所述发 送端, 同时对其进行解码得到数据或文件, 并传输到接收端的应用层。  C) The network coding layer of the receiving end receives the encoded data through the transmission layer of the receiving end, identifies the number of the received data packet, returns a different response signal to the transmitting end according to the received number, and decodes the data to obtain the data. Or file, and transferred to the application layer at the receiving end.
更进一步地, 还包括如下步骤:  Further, the method further includes the following steps:
D )所述发送端依据接收到所述接收端发来的不同类型的应答信号, 决定重发或不重发数据块。  D) The transmitting end decides to retransmit or not retransmit the data block according to different types of response signals sent by the receiving end.
更进一步地, 所述步骤 B ) 中进一步包括如下步骤:  Further, the step B) further includes the following steps:
B1 )所述发送端与接收端建立连接时, 发送携带有设定传输参数的 数据包通知所述接收端, 所述接收端在接收到所述数据包后返回确认信息并 按照所述传输参数设定该接收端。  B1) when the transmitting end establishes a connection with the receiving end, sending a data packet carrying the set transmission parameter to notify the receiving end, and the receiving end returns the acknowledgement information after receiving the data packet and according to the transmission parameter Set the receiver.
更进一步地, 所述步骤 B ) 中进一步包括如下步骤:  Further, the step B) further includes the following steps:
B2 )所述发送端将要传输的数据或文件按其流入顺序划分为第一设 定长度的数据包, 当余下留下的文件或数据长度小于第一设定长度时, 填入 数据零以保持数据包长度, 使划分后的每个数据包具有相同的长度; 设定个 数为 blks ize的数据包构成一个数据块, 数据包是传输的最小单位; 数据块 所包含的数据包个数在传输过程中依据接收端返回的信息调节。 B2) the data or file to be transmitted by the transmitting end is divided into data packets of a first set length according to the inflow order thereof, and when the remaining file or data length is less than the first set length, the data is filled in. Data zero to maintain the packet length, so that each packet after division has the same length; set the number of packets blks ize to form a data block, the data packet is the smallest unit of transmission; the data contained in the data block The number of packets is adjusted according to the information returned by the receiving end during transmission.
更进一步地, 所述步骤 B ) 中进一步包括如下步骤:  Further, the step B) further includes the following steps:
B3 )所述发送端通过单位时间内允许出现的令牌个数控制所述数据 包的发送速度, 每个令牌允许发送一个数据包; 所述单位时间内出现的令牌 数量依据数据包传输的时间调节。  B3) The transmitting end controls the sending speed of the data packet by the number of tokens allowed to be allowed in a unit time, and each token allows one data packet to be sent; the number of tokens that appear in the unit time is transmitted according to the data packet. Time adjustment.
更进一步地, 所述单位时间内允许发送的令牌数量根据一个数据包在所 述发送端和所述接收端的传输时间调节并通知所述接收端; 所述数据包传输 的时间越长, 单位时间内允许发送的令牌数量越少。  Further, the number of tokens allowed to be transmitted in a unit time is adjusted according to a transmission time of the data packet at the transmitting end and the receiving end, and the receiving end is notified; the longer the data packet is transmitted, the unit The fewer tokens allowed to be sent during the time.
更进一步地, 所述数据块包括的数据包数量依据每个数据包的传输时间 调节, 所述数据块包括的数据包数量与数据包在所述发送端和接收端之间的 传输时间成反比。  Further, the number of data packets included in the data block is adjusted according to the transmission time of each data packet, and the number of data packets included in the data block is inversely proportional to the transmission time of the data packet between the transmitting end and the receiving end. .
更进一步地, 所述步骤 C ) 中进一步包括如下步骤:  Further, the step C) further includes the following steps:
C1 )所述接收端检测已经接收到的数据包编号, 如果编号连续, 发 送确认应答信号到所述发送端; 如果编号不连续, 发送扩展确认应答信号到 所述发送端, 所述扩展确认信号中携带有所述接收端接收到的最后一个连续 的数据包编号。  C1) the receiving end detects the data packet number that has been received, and if the number is consecutive, sends an acknowledgement response signal to the transmitting end; if the number is not continuous, sends an extended acknowledgement response signal to the transmitting end, the extended acknowledgement signal The last consecutive data packet number received by the receiving end is carried in the middle.
更进一步地, 所述步骤 C ) 中进一步包括如下步骤:  Further, the step C) further includes the following steps:
C2 )在接收到新的数据块时, 初始化尺寸为 blks ize*blks ize的编 码系数矩阵和相应的有效载荷结构, 其中, blks ize是当前设定的数据块的 长度;  C2) upon receiving a new data block, initializing a coding coefficient matrix of size blks ize*blks ize and a corresponding payload structure, where blks ize is the length of the currently set data block;
C3 )对于每个接收到的数据包, 将其编码系数和有效载荷分别插入 上述编码系数矩阵和相应的有效载荷结构中, 使用高斯消元法判断其与之前 的数据包是否线性无关, 如是, 执行步骤 C4 ); 否则, 执行步骤 C5 );  C3) for each received data packet, insert its coding coefficient and payload into the above-mentioned coding coefficient matrix and the corresponding payload structure respectively, and use Gaussian elimination method to judge whether it is independent of the previous data packet, and if so, Perform step C4); otherwise, perform step C5);
C4 )返回确认信号, 更新当前块自由度, 使其加 1 , 并判断更新后 的当前块自由度是否等于数据块中的当前设定长度, 如是, 判断该数据块可 以解码; 否则, 等待接收下一数据包;  C4) returning an acknowledgment signal, updating the current block degree of freedom, adding 1 to it, and determining whether the updated current block degree of freedom is equal to the current set length in the data block, and if so, determining that the data block can be decoded; otherwise, waiting for reception Next packet;
C5 )发送确认信号,但不更新块自由度,并等待接收下一数据包。 更进一步地, 如果发送端发送一个数据包且未收到确认信号的时间大于 最后一个数据包的传输时间加上重传超时周期, 发送端采用慢启动模式传输 数据包; 所述慢启动模式包括设置所述单位时间允许传输的令牌数为缺省值 , 每次成功传输一个数据包后所述令牌数加一, 直到所述令牌数达到设定门限 后, 改为正常传输状态。 C5) Sends an acknowledgment signal, but does not update the block degrees of freedom and waits to receive the next packet. Further, if the sending end sends a data packet and the acknowledgment signal is not received for longer than the transmission time of the last data packet plus the retransmission timeout period, the transmitting end transmits the data packet in a slow start mode; the slow start mode includes The number of tokens allowed to be transmitted in the unit time is set to a default value, and the number of tokens is incremented by one after each successful transmission of a data packet, until the token number reaches a set threshold, and is changed to a normal transmission state.
实施本发明的基于 UDP协议的网络编码及传输方法,具有以下有益效果: 由于将网络编码层设置在应用层和传输层之间, 该网络编码层通过传输层的 UDP协议栈与传输层连接并传输数据, 而 UDP协议的修改难度和工作量均大 大小于对 TCP/ IP协议的修改, 同时,在接收端和发送端之间使用确认信号, 采用可靠的 UDP传输形式保证数据的可靠传输; 而且可以实时地根据数据包 的传输时间, 调节单位时间内传输的数据包数量以及每个数据块中包括数据 包的数量, 以适应网络环境的变化。 所以, 其较易实现、 接收端延迟较小、 适应网络环境变化。  The UDP protocol-based network coding and transmission method embodying the present invention has the following beneficial effects: Since the network coding layer is disposed between the application layer and the transport layer, the network coding layer is connected to the transport layer through the UDP protocol stack of the transport layer and The data is transmitted, and the modification difficulty and workload of the UDP protocol are much smaller than the modification of the TCP/IP protocol. At the same time, an acknowledgment signal is used between the receiving end and the transmitting end, and a reliable UDP transmission form is used to ensure reliable transmission of data; The number of data packets transmitted per unit time and the number of data packets included in each data block can be adjusted in real time according to the transmission time of the data packet to adapt to changes in the network environment. Therefore, it is easier to implement, the receiver has less delay, and adapts to changes in the network environment.
附图说明 DRAWINGS
图 1是本发明基于 UDP协议的网络编码及传输方法实施例中网络编码层 设置的示意图;  1 is a schematic diagram of a network coding layer setting in an embodiment of a network coding and transmission method based on a UDP protocol according to the present invention;
图 2是所述实施例中的数据传输时一种情况下的流程图;  Figure 2 is a flow chart showing a case of data transmission in the embodiment;
图 3是所述实施例中发送端发送数据及拥塞控制的的流程图。  3 is a flow chart of transmitting data and congestion control at the transmitting end in the embodiment.
图 4 是所述实施例中接受端解码的流程图;  Figure 4 is a flow chart of the receiving end decoding in the embodiment;
图 5 是网络编码层可靠传输的六种状态转换图。 具体实施方式  Figure 5 is a diagram of six state transitions for reliable transmission of the network coding layer. detailed description
下面将结合附图对本发明实施例作进一步说明。  The embodiments of the present invention will be further described below in conjunction with the accompanying drawings.
如图 1和图 2所示, 在本发明的基于 UDP协议的网络编码及传输方法实 施例中, 该方法包括如下步骤:  As shown in FIG. 1 and FIG. 2, in the embodiment of the UDP protocol-based network coding and transmission method of the present invention, the method includes the following steps:
步骤 S11 构建网络编码层,使其分别与应用层和传输层连接: 在本步骤 中, 为了实现编码及数据传输, 需要构建一个编码的机构, 并且该机构在编 码后要能够将得到的编码数据传输到接收端进行解码; 所以, 在发送端和接 收端均需要设置网络编码层, 该网络编码层在作为接收端时, 对数据进行编 码, 得到编码数据; 而在作为接收端时, 对接收到的编码数据进行解码。 在 本实施例中, 发送端和接收端的结构是相同的, 一个终端, 其发起连接时, 就是发送端,其在别的终端要求下与对方连接时,就是接收端。在本步骤中, 在终端的传输层和应用层之间构建网络编码层; 该网络编码层分别与传输层 和应用层连接, 在与传输层的连接中, 网络编码层使用 (或者通过)传输层 的 UDP协议与该传输层建立连接。 上述网络编码层的位置及数据传输示意图 请参见图 1 , 在图 1 中, 实线箭头表示数据传输路径, 而虚线的箭头表示应 答信号 (ACK ) 的传输路径。 Step S11 constructs a network coding layer to be respectively connected to the application layer and the transport layer: In this step, in order to implement coding and data transmission, it is necessary to construct an encoding mechanism, and the mechanism is capable of obtaining the encoded data after encoding. Transmission to the receiving end for decoding; therefore, both the transmitting end and the receiving end need to set a network coding layer, and when the network coding layer is used as a receiving end, the data is compiled. The code obtains the encoded data; and when it is the receiving end, decodes the received encoded data. In this embodiment, the structure of the transmitting end and the receiving end is the same. When a terminal initiates a connection, it is a transmitting end. When it is connected to the other party under the request of another terminal, it is the receiving end. In this step, a network coding layer is constructed between the transport layer and the application layer of the terminal; the network coding layer is respectively connected to the transport layer and the application layer, and in the connection with the transport layer, the network coding layer uses (or passes) the transmission. The layer's UDP protocol establishes a connection with the transport layer. For the location and data transmission diagram of the above network coding layer, please refer to FIG. 1. In FIG. 1, the solid arrow indicates the data transmission path, and the dotted arrow indicates the transmission path of the response signal (ACK).
步骤 S12 形成网络编码, 并行成带有编号的数据包, 由发送端发送到接 收端: 在本步骤中, 一个终端需要将数据或文件传输到另一个终端, 于是, 该终端发起连接, 作为发送端; 而另一个终端响应其发起的连接, 作为接收 端。该发送端将需要传输的文件由应用层传输到网络编码层,对其进行编码, 得到编码数据; 这些得到的编码数据依次进入发送端的传输层; 在发送端的 传输层中对其进行处理, 得到带有编号的数据包, 多个这样的数据包构成一 个数据块, 通过传输层发送到网络上。 在上述数据发送时, 传输层以数据包 为单位发送数据, 但是, 网络编码层是以数据块为单位对编码数据进行解码 的。 在上述传输过程中, 包括了传输参数的设置、 数据包的发送以及确认信 号 (接收端收到数据包后发送的) 的接收等等, 具体情况稍后详述。  Step S12 forms a network code, which is parallelized into a numbered data packet, and is sent by the transmitting end to the receiving end: In this step, one terminal needs to transmit the data or file to another terminal, and then the terminal initiates the connection and sends the data. The other terminal responds to the connection it initiated as the receiving end. The transmitting end transmits the file to be transmitted from the application layer to the network coding layer, and encodes the encoded data to obtain the encoded data; the obtained encoded data sequentially enters the transmission layer of the transmitting end; and processes it in the transmission layer of the transmitting end to obtain With numbered packets, multiple such packets form a block of data that is sent to the network through the transport layer. At the time of the above data transmission, the transport layer transmits data in units of packets, but the network coding layer decodes the encoded data in units of data blocks. In the above transmission process, the setting of the transmission parameters, the transmission of the data packet, and the reception of the acknowledgment signal (sent by the receiving end after receiving the data packet) are included, and the details will be described later.
步骤 S1 3 接收端接收数据包,取得其编号, 并依据编号情况发送不同的 应答信号到发送端: 当数据通过网络链路到达接收端后, 接收端接收上述数 据包, 并在传输层中取得这些数据包的编号, 依据之前取得的编号和当前取 得的编号之间的关系, 发送不同的确认信号到发送端, 例如, 如果得到的数 据包编号都是连续的, 表明其中没有丟包的情况出现, 发送确认信号到发送 端; 如果数据包的编号不是连续的, 表明中间有数据包没有接收到, 发送扩 展确认信号到发送端。 其中, 上述扩展确认信号携带有最后收到的连续的数 据包的编号和当前收到的数据包编号, 便于发送端判断重发哪些数据包。  Step S1 3: The receiving end receives the data packet, obtains its number, and sends a different response signal to the transmitting end according to the numbering condition: After the data reaches the receiving end through the network link, the receiving end receives the data packet, and obtains the data packet in the transport layer. The number of these data packets, according to the relationship between the previously obtained number and the currently obtained number, sends a different acknowledgment signal to the sender, for example, if the obtained packet number is continuous, indicating that there is no packet loss. Appears, sends an acknowledgment signal to the sender; if the number of the packet is not continuous, indicating that there is a packet in the middle, the extension acknowledgment signal is sent to the sender. The extended acknowledgement signal carries the number of the last received continuous data packet and the currently received data packet number, so that the sender can determine which data packets are retransmitted.
步骤 S14 发送端依据不同的应答信号决定重发或不重发相关的数据包: 在本步骤中, 发送端依据接收到的、 接收端发来的不同类型的应答信号, 决 定重发或不重发数据包, 在需要重发的情况下, 还要判断需要重发哪些数据 包。 Step S14: The transmitting end determines whether to retransmit or not retransmit the related data packet according to different response signals: In this step, the transmitting end determines whether to retransmit or not according to the received different type of response signals sent by the receiving end. Send a data packet, and if it needs to be resent, also determine which data needs to be resent. Package.
在本实施例中, 具体来讲, 步骤 S12中还包括了多个步骤, 如下:  In this embodiment, specifically, step S12 further includes multiple steps, as follows:
步骤 S21发送端发送带有传输参数的数据包到接收端, 接收端收到 后返回确认信号并按其设置: 在网络传输中, 由于数据所需要到达的接收端 通常是不定的, 为了保证传输, 需要发送端在发送数据之前, 也就是建立连 接时通知接收端其传输参数, 便于接收端按照这些参数进行设置, 从而实现 连接传输数据。 在本步骤中, 发送端在建立与接收端的连接时, 发送携带有 设定传输参数的数据包通知所述接收端, 而接收端在接收到所述数据包后返 回确认信息并按照所述传输参数设定该接收端。  Step S21: The transmitting end sends the data packet with the transmission parameter to the receiving end, and the receiving end returns an acknowledgment signal and sets it according to the setting: In the network transmission, the receiving end that needs to arrive due to the data is usually indefinite, in order to ensure the transmission The sender needs to notify the receiving end of the transmission parameters before sending the data, that is, when the connection is established, so that the receiving end can set according to these parameters, thereby realizing the connection transmission data. In this step, when the transmitting end establishes a connection with the receiving end, the transmitting end sends a data packet carrying the set transmission parameter to notify the receiving end, and the receiving end returns the acknowledgement information after receiving the data packet and according to the transmission. The parameter sets the receiver.
步骤 S22设置或按规定调数据块大小: 在本步骤中, 发送端将要传输的 数据或文件按其流入顺序划分为第一设定长度的数据包, 当余下的文件或数 据长度小于第一设定长度时(即当按照第一设定长度划分得到整数个数据包, 还剩余一些数据尚未划分, 但这些数据的长度小于第一设定长度), 填入数 据零以保持数据包长度; 设定个数的数据包构成一个数据块, 数据包是传输 的最小单位; 数据块所包含的数据包个数在传输过程中依据接收端返回的信 息调节。 即发送方把流或文件分割成多块, 包含 b lks i ze 包的数量,每个数 据包假定是固定的长度。 如果分割完余下的文件或流不足以形成一个完整的 包,用零来填充,以确保所有的数据包具有相同的长度。 一个块不需要全满, 即一个块可能少于 b lks i ze个数据包;然而,在第 i+1个块初始化前第 i块必 须全满。 在初始数据包传送后, 块大小要根据接收端的反馈来调整。 接收方 则负责解码收到的数据并构建 ACK给发送端。 当接收端收到一个包,它需要 检查当前块是否可解码(ack_currb lk)和所收到的当前块的自由度数 (ack-currdof) 。  Step S22: setting or adjusting the data block size according to the specification: In this step, the data or file to be transmitted by the transmitting end is divided into the data packet of the first set length according to the inflow order thereof, when the remaining file or data length is smaller than the first setting When the length is fixed (that is, when an integer number of data packets are obtained according to the first set length, and some data remains undivided, but the length of the data is less than the first set length), the data zero is filled in to keep the data packet length; A fixed number of data packets constitutes a data block, and the data packet is the smallest unit of transmission; the number of data packets included in the data block is adjusted according to the information returned by the receiving end during transmission. That is, the sender divides the stream or file into multiple blocks, including the number of b lks i ze packets, each of which is assumed to be a fixed length. If the remaining files or streams are not enough to form a complete package, pad it with zeros to ensure that all packets have the same length. A block does not need to be full, that is, one block may be less than b lks i ze packets; however, the i-th block must be full before the i+1th block is initialized. After the initial packet transmission, the block size is adjusted according to the feedback from the receiver. The receiver is responsible for decoding the received data and constructing an ACK to the sender. When the receiver receives a packet, it needs to check if the current block is decodable (ack_currb lk) and the number of degrees of freedom (ack-currdof) of the current block received.
对于每个块 b lkno,接收机端初始化一个 b lks i ze b lks i ze的编码系数 矩阵 Cblkn。 和一个相应的有效荷载结构 Pblkn。。 每当从 b lkno收到一个数据包, 编码系数和有效荷载分别插入到 Cblkn。和 Pblkn。。然后使用高斯消元法来判断接 收到的数据与之前收到的数据包是否线性无关。 如果是,接收方设置 ack-currdof ack.currdof + 1。 如果 ack_currdof 等于 b lks i ze,那么接收 方确认已收到 ack_currb lk 块足够的自 由度并更新 ack_currb lk ack.currblk + 1 (需要重置 ack_currdof 来反映新 ack_currblk自由度的需 求)。 如果接收到的数据包与之前收到的数据包线性相关, 接收端传输 ACK (相应的包收到的)但不更新 ack_currdof 和 ack_currblk。一旦收到足够 的线性无关的 blks izef 包(自由度), 接收端就可以解码块中所有的包。 For each block b lkno , the receiver side initializes a coding coefficient matrix C blkn of b lks i ze b lks i ze . And a corresponding payload structure P blkn . . Whenever a packet is received from b lkno, the coding coefficients and payload are inserted into C blkn respectively. And P blkn . . The Gaussian elimination method is then used to determine whether the received data is linear regardless of whether the previously received packet is linear. If yes, the receiver sets ack-currdof ack.currdof + 1. If ack_currdof is equal to b lks i ze, the receiver acknowledges that it has received sufficient degrees of freedom for the ack_currb lk block and updates ack_currb lk Ack.currblk + 1 (requires resetting ack_currdof to reflect the need for new ack_currblk degrees of freedom). If the received packet is linearly related to the previously received packet, the receiver transmits an ACK (received by the corresponding packet) but does not update ack_currdof and ack_currblk. Once enough linearly unrelated blksizef packets (degrees of freedom) are received, the receiver can decode all the packets in the block.
步骤 S23发送端按设定格式处理编码数据, 得到带有编号的数据包 和数据块: 在本步骤中, 调节数据块中数据包的数量, 在网络环境不好的情 况下,减小数据块中数据包的数量,有助于成功解码。 因此, 网络环境好时, 其数据块中的数据包数量较多;反之,则数量较少。也就是说,在本步骤中, 数据块的所包括的数据包数量依据每个数据包的传输时间调节, 所述数据块 包括的数据包数量与数据包在所述发送端和接收端之间的传输时间成反比。  Step S23: The sender processes the encoded data according to the set format to obtain the numbered data packet and the data block: In this step, the number of data packets in the data block is adjusted, and in the case that the network environment is not good, the data block is reduced. The number of packets in the packet helps to successfully decode. Therefore, when the network environment is good, the number of data packets in the data block is large; otherwise, the number is small. That is, in this step, the number of data packets included in the data block is adjusted according to the transmission time of each data packet, and the data packet includes the number of data packets and the data packet between the transmitting end and the receiving end. The transmission time is inversely proportional.
步骤 S24设置或按规定调节令牌数量: 在本步骤中, 设置或调节令 牌数量, 同样是依据网络环境而变化的, 发送端通过单位时间内允许出现的 令牌个数控制所述数据包的发送速度, 每个令牌允许发送一个数据包; 单位 时间内出现的令牌数量依据数据包传输的时间调节。 所述单位时间内允许发 送的令牌数量根据一个数据包在所述发送端和所述接收端的传输时间调节 并通知所述接收端; 所述数据包传输的时间越长, 单位时间内允许发送的令 牌数量越少。  Step S24 sets or adjusts the number of tokens according to the regulations: In this step, the number of tokens is set or adjusted, which is also changed according to the network environment, and the sender controls the data packet by the number of tokens allowed to be allowed in a unit time. The sending speed, each token is allowed to send a data packet; the number of tokens appearing per unit time is adjusted according to the time of packet transmission. The number of tokens allowed to be sent in a unit time is adjusted according to a transmission time of the data packet at the transmitting end and the receiving end, and the receiving end is notified; the longer the data packet is transmitted, the transmission is allowed in a unit time. The less the number of tokens.
在本实施例中, 图 3只是给出了一个例子。 为了便于说明情况, 图 3 中的步骤是按照一定情况排列的。 但是, 在实际情况或应用中, 在数据发送 端可能并不是按照图 3中的顺序排列的, 有可能图 3中的两个步骤是同时进 行的或者图 3中的两个步骤的顺序是相反的或者由于某种原因不进行其中一 个步骤等等。 这些情况在本实施例中都是可能出现的。 总之, 图 3中的步骤 是为了顺利地、 可靠地发送数据而实行的, 可以依据实际的情况采取不同的 步骤。 例如, 就同一对发送端和接收端而言, 在开始时, 必然有参数的设置 步骤; 但是, 传输一段时间后, 需要调节数据块中包括数据包的个数, 此时 就不必将上述步骤全部执行一遍, 仅仅需要按照上述描述直接调节其个数 (即直接执行步骤 S23 ) 即可。  In the present embodiment, Fig. 3 only gives an example. For the sake of illustration, the steps in Figure 3 are arranged according to certain conditions. However, in actual situations or applications, the data transmitting end may not be arranged in the order shown in FIG. 3. It is possible that the two steps in FIG. 3 are performed simultaneously or the order of the two steps in FIG. 3 is reversed. Or for some reason not doing one of the steps and so on. These situations are all possible in this embodiment. In summary, the steps in Figure 3 are implemented to send data smoothly and reliably, and different steps can be taken depending on the actual situation. For example, in the case of the same pair of transmitting end and receiving end, there must be a parameter setting step at the beginning; however, after a period of transmission, it is necessary to adjust the number of data packets included in the data block, and the above steps are not necessary. All of them are executed once, and it is only necessary to directly adjust the number according to the above description (ie, directly execute step S23).
如上所述, 在上述步骤 S13中当数据包在被接收端接收后, 在接收端的 传输层中对其进行处理, 得到其数据包编号, 并对其进行判断, 如果编号连 续, 发送确认应答信号到所述发送端; 如果编号不连续, 发送扩展确认应答 信号到所述发送端, 所述扩展确认信号中携带有所述接收端接收到的最后一 个连续的数据包编号。 As described above, in the above step S13, after the data packet is received by the receiving end, it is processed in the transmission layer of the receiving end to obtain the data packet number thereof, and is judged if the number is connected. And sending an acknowledgement response signal to the sending end; if the number is not continuous, sending an extended acknowledgement response signal to the sending end, where the extended acknowledgement signal carries the last consecutive data packet number received by the receiving end .
此外, 接收端的网络编码层还需要对接收到的数据包进行解码。 其首先 需要判断这些数据包是否能够解码。 判断过程请参见图 4 , 包括如下步骤: 步骤 S31 接收新的数据块, 初始化编码矩阵和有效载荷: 在本步骤 中, 在接收到新的数据块时, 初始化尺寸为 b Iks i zeXb Iks i ze的编码系数矩 阵和相应的有效载荷结构, 其中, blks ize是当前设定数据块的长度。  In addition, the network coding layer of the receiving end also needs to decode the received data packet. It first needs to determine if these packets can be decoded. Refer to FIG. 4 for the judgment process, including the following steps: Step S31: Receive a new data block, initialize the coding matrix and the payload: In this step, when a new data block is received, the initialization size is b Iks i zeXb Iks i ze The coding coefficient matrix and the corresponding payload structure, where blks ize is the length of the currently set data block.
步骤 S32 新接收的数据包与本数据块之前接收的数据包线性相关否, 如是, 执行步骤 S34 , 否则, 执行步骤 S35 ; 对于每个接收到的数据包, 将 其编码系数和有效载荷分别插入上述编码系数矩阵和相应的有效载荷结构 中, 使用高斯消元法判断其与之前的数据包是否线性无关。  Step S32: The newly received data packet is linearly related to the data packet received before the data block. If yes, go to step S34, otherwise, go to step S35; for each received data packet, insert its coding coefficient and payload respectively. In the above coding coefficient matrix and the corresponding payload structure, the Gaussian elimination method is used to judge whether it is independent of whether the previous data packet is linear.
步骤 S33 发送确认信号, 更新块自由度: 由于线性无关, 表明该数 据包接收正常, 接收端返回确认信号, 更新当前块自由度, 使其加 1 , 并执 行步骤 S35。  Step S33: Sending an acknowledgment signal, updating the block degree of freedom: Since the linearity is irrelevant, indicating that the data packet is received normally, the receiving end returns an acknowledgment signal, updates the current block degree of freedom, increments it by 1, and executes step S35.
步骤 S34 发送确认信号, 不更新块自由度: 在本步骤中, 发送确认 信号, 但不更新块自由度, 并等待接收下一数据包, 返回步骤 S32。  Step S34 sends an acknowledgment signal, and does not update the block degree of freedom: In this step, the acknowledgment signal is transmitted, but the block degree of freedom is not updated, and the next packet is received, and the process returns to step S32.
步骤 S35 自由度与块长度相等否: 判断更新后的当前块自由度是否 等于数据块中的当前设定长度, 如是, 判断该数据块可以解码; 否则, 返回 步骤 S32。  Step S35: The degree of freedom is equal to the block length. No: It is judged whether the updated current block degree of freedom is equal to the current set length in the data block, and if so, it is judged that the data block can be decoded; otherwise, the process returns to step S32.
步骤 S36 本数据块接收完成, 可以解码: 在本步骤中, 对已接收到 的一个数据块中的所有数据包进行解码。 同时准备接收下一个数据块。  Step S36 The data block is received and can be decoded: In this step, all the data packets in one received data block are decoded. At the same time, it is ready to receive the next data block.
此外, 在本实施例中, 如果发送端发送一个数据包且未收到确认信号 的时间大于最后一个数据包的传输时间加上重传超时周期, 发送端采用慢启 动模式传输数据包; 所述慢启动模式包括设置所述单位时间允许传输的令牌 数为缺省值, 每次成功传输一个数据包后所述令牌数加一, 直到所述令牌数 达到设定门限后, 改为正常传输状态。  In addition, in this embodiment, if the sending end sends a data packet and the time when the acknowledgment signal is not received is greater than the transmission time of the last data packet plus the retransmission timeout period, the transmitting end transmits the data packet in the slow start mode; The slow start mode includes setting the number of tokens allowed to be transmitted in the unit time to a default value, and adding the number of tokens after successfully transmitting one data packet, until the number of tokens reaches a set threshold, and then changing Normal transmission status.
总之,在本实施例中,由于网络编码层是工作在本来不可靠的 UDP传 输层上面的, 所以必须考虑报文丟失的情况出现。 请参见图 5 , 为了在 UDP 上实现其高效、可靠传输功能的介绍,其网络编码层协议需要考虑六种状态, :¾口下: In summary, in the present embodiment, since the network coding layer operates on the originally unreliable UDP transport layer, it is necessary to consider the case where the message is lost. See Figure 5 for UDP To introduce its efficient and reliable transmission function, its network coding layer protocol needs to consider six states: 3⁄4 port:
CLOSE (断开): 当没有连接时处于该状态; LI STEN (侦听): 当被动连 接时进入 LI STEN状态,在该状态下等待主动建立连接请求; SYN-SENT ( SYN 发送): 当发起一个主动建立连接的 SYN后进入 SYN-SENT状态。 此时生成 一个连接状态记录, 确定本连接的初始序列号, 并发送一个 SYN 到远端, 等待对端 SYN及 ACK 确认; SYN-RECVD ( SYN接收): 此状态可以从 LI STEN 状态和 SYN-SENT状态转换而来。 当处于 LI STEN状态时, 只要收到一个远 端的 SYN 文段便转换到 SYN-RECVD状态。 并且产生一个初始序列号作为 本端报文序列的起始号, 并发送一个 SYN和 ACK确认到对端, 然后等待对 端回应; OPEN (连接): 表示建立连接成功双方协商好配置数据如初始序列 号, 最大报文段尺寸最大发送窗口等等, 然后双方可以通过该虚拟连接进行 数据交互; CLOSE- WAIT。 CLOSE- WAIT状态可以从 OPEN 状态收到 c l ose (断 开) 请求转换到 CLOSE 状态也可以是收到 RST报文。 这两种情况下进入 CLOSE-WAIT (等待断开)状态等到一段时间, 关闭连接。  CLOSE: This state is in the absence of a connection; LI STEN: Enters the LI STEN state when passively connected, in which it waits for an active connection request; SYN-SENT: When initiated After a SYN that actively establishes a connection, it enters the SYN-SENT state. At this point, a connection status record is generated, the initial sequence number of the connection is determined, and a SYN is sent to the far end, waiting for the opposite SYN and ACK to be acknowledged; SYN-RECVD (SYN receiving): This state can be from the LI STEN state and SYN- The SENT state is converted. When in the LI STEN state, it transitions to the SYN-RECVD state as soon as it receives a far-end SYN segment. And generate an initial sequence number as the starting number of the local message sequence, and send a SYN and ACK to the opposite end, and then wait for the opposite end to respond; OPEN (connection): indicates that the establishment of the connection is successful, both parties negotiate good configuration data as initial Serial number, maximum segment size, maximum send window, etc., then both parties can interact with each other through the virtual connection; CLOSE-WAIT. The CLOSE-WAIT state can be received from the OPEN state c l ose (open) request to switch to CLOSE state or receive RST message. In both cases, enter the CLOSE-WAIT state and wait for a while to close the connection.
当处于 SYN-SENT状态时, 收到远端的 SYN但是并没有伴随的 ACK 时, 就从 SYN-SNET 状态转入到 SYN-RECVD 状态。 这种情况是由于两方同时主 动发起建立连接的请求。 此时以同样的序列号再次发送 SYN, 并且对对方的 SYN 进行确认, 表示接收建立连接请求。  When in the SYN-SENT state, when the remote SYN is received but there is no accompanying ACK, it is transferred from the SYN-SNET state to the SYN-RECVD state. This situation is due to the fact that both parties actively initiate a request to establish a connection. At this time, the SYN is sent again with the same serial number, and the SYN of the other party is confirmed, indicating that the connection establishment request is received.
在本实施例中, 发送方和接收方的网络编码对等层之间也会建立起虚连 接, 类似于 TCP , 也进行三次握手。 根据实际情况, 在双方如果同时发起建 立连接时, 进行回应并发送 SYN。 建立连接时发送 SYN 类型报文段, 所有 的两端的配置消息都携带在报文段中。 一般情况下关闭连接采用与 TCP 类 似的 4 次握手, 但是在永久连接应用中只有出现异常时才关闭连接。 在一 端出现异常后, 另外一端通过可靠检测机制端检测到异常后上报给上层用户, 释放本端连接资源。  In this embodiment, a virtual connection is also established between the network coding peers of the sender and the receiver, similar to TCP, and a three-way handshake is also performed. According to the actual situation, if both parties initiate a connection at the same time, respond and send a SYN. A SYN packet is sent when the connection is established. The configuration BPDUs of both ends are carried in the segment. In general, closing a connection uses a 4-way handshake similar to TCP, but in a persistent connection application, the connection is closed only when an exception occurs. After an abnormality occurs on one end, the other end detects the abnormality through the reliable detection mechanism and reports it to the upper-layer user to release the local connection resources.
在本实施例中, 还借助于如下部件或机制, 实现了高效、 可靠的传输: 重传定时器: 在网络编码层中, 当每一个编码消息发送后, 如果此时重 传定时器未设置, 则设置该定时器。 这样当对端收到该消息后会发送响应给 发送端, 发送端收到响应后取消定时器, 如果收到应答后, 还有发送但未 应答的报文, 则重启该定时器。 定时器超时的时长是由两端协商的, 但是两 端必须是同一值。 In this embodiment, efficient and reliable transmission is also achieved by means of the following components or mechanisms: Retransmission timer: In the network coding layer, after each coded message is sent, if the retransmission timer is not set at this time , then set the timer. So when the peer receives the message, it will send a response to On the sending end, the sending end cancels the timer after receiving the response. If there is a message sent but not answered after receiving the response, the timer is restarted. The duration of the timer timeout is negotiated by both ends, but both ends must be the same value.
重传计数器: 重传计数器记录报文重发的次数, 直到重传次数达到门限 值。 当重发次数超过了门限则认为连接已经断开, 此时, 应转入连接错误处 理。  Retransmission counter: The retransmission counter records the number of times the message is retransmitted until the number of retransmissions reaches the threshold. When the number of retransmissions exceeds the threshold, the connection is considered to have been disconnected. In this case, the connection error should be handled.
应答机制: 编码消息有两种类型的应答消息。 EACK 和 ACK。 必须考虑 当一组消息发送后, 中间序号消息丟失的情况。 为此, 此方案提供了 EACK 消 息类型。 当接收方收到的并不是按序的消息时,接收端会向发送端发送 EACK 响应, 通告对方某些消息可能在传播途中丟失或损坏。 当发送端收到 EACK 类型消息后, EACK 消息中携带着最近最后收到的一个按序消息号和收到的 乱序消息号, 根据消息中所带的信息计算出需要重发的消息序号然后重发这 些消息。 与 TCP 类似为了减少网络负载, 提高利用率。 它也采用了应答延 迟技术。 在接收端维护了一个计数器统计收到但未应答的报文数, 当收到的 报文超过了门限值(门限值是可以配置)则发送一个单独的 ACK, 如果此时 有乱序报文未响应则发送一个 EACK。 此外, 还有一个累计超时定时器用以 控制等待的时间。 当累计确认定时器超时, 无论累计计数器是否达到门限值 都要发送单独的 ACK 或者 EACK。 当单独的应答发送后, 该定时器重启。  Response mechanism: There are two types of response messages for encoded messages. EACK and ACK. Consideration must be given to the loss of the intermediate sequence number message after a group of messages has been sent. To this end, this scenario provides an EACK message type. When the receiver receives an unordered message, the receiving end sends an EACK response to the sender, notifying that some of the other party's messages may be lost or corrupted during the flight. When the sender receives the EACK type message, the EACK message carries the most recently received sequence message number and the received out-of-order message number. The message sequence number that needs to be retransmitted is calculated according to the information carried in the message. Resend these messages. Similar to TCP to reduce network load and increase utilization. It also uses response delay techniques. The receiver maintains a counter to count the number of received but unacknowledged packets. When the received packet exceeds the threshold (the threshold is configurable), a separate ACK is sent. An EACK is sent if the message does not respond. In addition, there is a cumulative timeout timer to control the waiting time. When the cumulative acknowledgment timer expires, a separate ACK or EACK is sent regardless of whether the accumulated counter has reached the threshold. The timer restarts when a separate response is sent.
保活机制: 在利用网络编码层协议传输信息时, 可能存在一段时间内一 个连接上并未有数据流通的情况。 即是说链路双方都没有应用数据向对方发 送。 此时需要提供保活机制来及时了解链路情况, 以便在一方崩溃的情况下 及时检测出来。 当连接上的一端发现本端无消息发送时, 便在本端设定保活 定时器。 如果在保活定时器超时之前有数据发送, 则取消保活定时器, 设置 重发定时器。 如果保活定时器超时并未有应用数据需要发送则发送保活消息 到对端。 保活机制使得网络编码层能够提供长连接服务。  Keep-alive mechanism: When transmitting information using the network coding layer protocol, there may be a case where there is no data circulation on one connection for a period of time. That is to say, neither link has applied data to the other party. At this point, a keep-alive mechanism is needed to keep abreast of the link situation so that it can be detected in time if one party crashes. When one end of the connection finds that there is no message transmission on the local end, the keepalive timer is set on the local end. If there is data transmission before the keep-alive timer expires, the keep-alive timer is canceled and the re-send timer is set. If the keep-alive timer expires and no application data needs to be sent, a keep-alive message is sent to the peer. The keep-alive mechanism enables the network coding layer to provide long connection services.
冗余连接机制: 如果一条连接失败了, 上层应用会收到信号并且启动状 态转换定时器。 上层应用可以通过 API 将连接状态信息转移, 发起另外一 条连接并继承之前失败的连接。 这样避免消息丟失或重复。 如果状态转换定 时器超时仍然未进行状态转换, 则释放掉断开的连接资源。 在本实施例中, SYN 类型的消息用于发起两个主机间的连接。 SYN 消 息中还包含了双方需要的配置协商信息。 比如各类定时器时长、 版本号、 该 连接 ID、 消息序列空间、 累计确认门限等等。 SYN 类型的消息不能携带用 户数据。 ACK则用于向发送端应答收到的按序(in-sequence)的消息。 EACK , 即扩展 ACK , 发送端收到 EACK 时, 说明有消息在传输中丟失, 接收端收到 了乱序消息。 EACK 中总包含了最近最后收到的一个按序消息序号和一个或 多个乱序消息序号。 发送端收到 EACK 后, 会更据 EACK中内容, 重传最后 一个按序消息之后到乱序消息之前的消息 (不包括这两个序号的消息) 。 如上所述, 在实施例中, Redundant connection mechanism: If a connection fails, the upper application receives the signal and starts the state transition timer. The upper application can transfer the connection status information through the API, initiate another connection and inherit the previously failed connection. This avoids message loss or duplication. If the state transition timer has not expired yet, the disconnected connection resource is released. In this embodiment, a message of type SYN is used to initiate a connection between two hosts. The SYN message also contains the configuration negotiation information required by both parties. For example, various timer durations, version numbers, connection IDs, message sequence spaces, cumulative acknowledgement thresholds, and so on. Messages of type SYN cannot carry user data. The ACK is used to acknowledge the received in-sequence message to the sender. EACK, that is, extended ACK, when the sender receives the EACK, it indicates that a message is lost in the transmission, and the receiving end receives the out-of-order message. The EACK always contains a sequence message sequence number and one or more out-of-order message sequence numbers that were last received last. After receiving the EACK, the sender will retransmit the last sequence message to the message before the out-of-order message (excluding the two sequence numbers) according to the contents of the EACK. As described above, in the embodiment,
在本实施例中, 网络编码层使用令牌(tokens ) 来控制发送端的传输速 率而不是拥塞窗口 cwnd;因此, tokens对于网络编码层起着重要作用就像 cwnd对于 TCP—样。 一个 token允许网络编码层发送端发送一个数据包(编 码或未编码的)。 当发送端传送包时,可使用 tokens。 Tokens的数量是根据 修改后的 AIMD乘法补偿来控制:  In this embodiment, the network coding layer uses tokens to control the transmission rate of the sender instead of the congestion window cwnd; therefore, tokens play an important role in the network coding layer as if cwnd is TCP-like. A token allows the sender of the network coding layer to send a packet (coded or unencoded). When the sender transmits a packet, tokens can be used. The number of Tokens is controlled based on the modified AIMD multiplication compensation:
o _ RTT匪  o _ RTT匪
RTT  RTT
当丟包发生时 RTT = RTTmax (链接队列已满)。 在这种情况下,当一个链接被提 供用一个带宽延迟积的緩存,那么 RTTmax= 2 RTTmin , β = 0. 5 , 即与标准的 TCP 相同。 一般地,当发生队列溢出时, 流吞吐量之和必须等于链接的容量 toke = B ^ 其中 n是流的数量。 根据算法 3补偿后,队列清空, 吞吐 =1 RTT 量总和成为 °=i Pi R to T k T mS = B 。 即上述选择中其 β降低了 tokens数量, 以便 链接队列清空, 维持吞吐量。 在有损耗的链接(除了队列溢出的损耗),使用 RTT使 β适应每一个损耗。 当一个网络路径利用率低时, RTT = RTTmin (因此, β = 1和 β * token=tokens) 。 因此, tokens不减少丟包, 尽管存在数据包丟失 tokens也能够增大。 一旦 链接开始经历排队延迟, 则 RTT> RTTmin , β < 1,即有丟包时 tokens减少, 因为链接队列是满的,损失之前吞吐量总和是∑n = B。 tokens减少后 , 当队列清空时, 吞吐量总和最低是 5; ^^ = β (所有流补偿 tokens) , 也就是说, 可以调整 β来保持全吞吐量。 RTT = RTT max when the packet loss occurs (link queue is full). In this case, when a link is provided with a buffer with a bandwidth delay product, then RTT max = 2 RTT min , β = 0.5, which is the same as standard TCP. In general, when a queue overflow occurs, the sum of the stream throughputs must equal the capacity of the link toke = B ^ where n is the number of streams. After compensation according to Algorithm 3, the queue is cleared, throughput = 1 The sum of the RTT quantities becomes ° = i Pi R to T k T mS = B . That is, in the above selection, β reduces the number of tokens, so that the link queue is emptied and the throughput is maintained. In the lossy link (except for the loss of queue overflow), RTT is used to adapt β to each loss. When a network path utilization is low, RTT = RTT min (hence, β = 1 and β * token=tokens). Therefore, tokens do not reduce packet loss, although tokens can be increased in the presence of packet loss. Once The link begins to experience a queuing delay, then RTT> RTTmin, β < 1, ie the tokens are reduced when there is a packet loss, because the link queue is full, and the sum of the throughput before the loss is ∑ n = B. After the tokens are reduced, when the queue is emptied, the sum of the throughputs is at least 5; ^^ = β (all stream compensation tokens), that is, β can be adjusted to maintain full throughput.
在本实施例中, 发送方的参数定义如下表:  In this embodiment, the parameters of the sender are defined as follows:
Figure imgf000014_0001
在本实施例中发送端网络参数的更新是发送方根据一些发送方参数来 调控其编码和拥塞控制等动作。 若一定时间内发送端没有收到接收端发送的
Figure imgf000014_0001
In this embodiment, the update of the network parameters of the sender is that the sender adjusts its coding and congestion control according to some sender parameters. If the sender does not receive the sender's transmission within a certain period of time
ACK, 参数被重置为默认值。 收到 ACK后, 根据 ACK更新参数。 t ime— las tack 就是当前时间 current time; 如果最小的未解码块(编号) 大于当前发送方 的块编号, 就需要发送最小的未解码块给接收端, 所以当前发送方块编号更 新为 ack_currblk ;其实 currdof 总是 ack_currdof 和 currdof 大的那个, 越大的自由度可对数据包进行各种操作。 如网络编码可以将数据包中的数 据位进行操作, 如 "按位异或" 等可以有效地允许目标节点接受多个信息 而不必增加它所能接收数据包的数量, 即不必增加网络的整体容量, 而按位 来获得更大的自由度。 ACK, the parameter is reset to the default value. After receiving the ACK, the parameters are updated according to the ACK. t ime — las tack Is the current time current time; If the smallest undecoded block (number) is greater than the current sender's block number, you need to send the smallest undecoded block to the receiver, so the current send block number is updated to ack_currblk; in fact, currdof is always ack_currdof and The larger the currdof, the greater the freedom to perform various operations on the packet. For example, the network coding can operate the data bits in the data packet, such as "bitwise XOR", etc., which can effectively allow the target node to accept multiple information without increasing the number of data packets it can receive, that is, without increasing the overall network. Capacity, and bitwise to get more freedom.
对于序歹l号, 当已确认的 ack.seqno 大于 seqno.una (未确认的) , 说明有包丟失(因为确认按序进行, 由小到大,小的总是比大的号先确认), 平均丟失率如算法一所示, 其 seqno.una 更新为 ack.seqno 力口 1。  For sequence number 1, when the confirmed ack.seqno is greater than seqno.una (unconfirmed), it indicates that there is a packet loss (because the confirmation is in order, from small to large, the small is always confirmed earlier than the large number) The average loss rate is shown in Algorithm 1, and its seqno.una is updated to ack.seqno.
发送端控制其网络阻塞的方法是可以是慢开始 (启动 slow-start )和 拥塞避免; 慢开始起初设置 拥塞窗口 cwnd=l, 使得发送端在开始只发送一 个报文段, 然后再逐渐增大 cwnd, 这比按照大的 cwnd —下子把许多报文段 突然注入到网络中' |·曼得多。  The method for the sender to control its network congestion can be slow start (start slow-start) and congestion avoidance; slow start initially set the congestion window cwnd=l, so that the sender only sends one segment at the beginning, and then gradually increases Cwnd, this is much more than a large cwnd - the next sub-injection of many segments into the network.
开始时, 若 current time > time_lastack + RTO , 时间轴上收到 ACK 的时间加上重传超时周期 若小于现在的时间, 那么说明即使包丟失等发生, 也不能收到重传应答确认消息。 所以启动慢开始模式。  Initially, if current time > time_lastack + RTO , the time when the ACK is received on the time axis plus the retransmission timeout period is less than the current time, it means that the retransmission acknowledgement message cannot be received even if the packet is lost or the like. So start the slow start mode.
当收到 ACK, 在慢开始下, 令牌加 1, 表明网络编码层发送端一次允许 发送的数据包增加; 当令牌 tokes增加到慢开始门限 ss_threshold , 停止 使用慢开始而改用拥塞避免算法。而 tokens的数量根据修改后的 AIMD 来控 制。 也就是说, 使用上述方法并应用 tokens 来实现拥塞控制。  When an ACK is received, at the slow start, the token is incremented by 1, indicating that the network coding layer sender increases the number of packets allowed to be sent at one time. When the token tokes is increased to the slow start threshold ss_threshold, the slow start is used and the congestion avoidance algorithm is used instead. . The number of tokens is controlled according to the modified AIMD. That is, use the above method and apply tokens to implement congestion control.
对于接收端而言,主要是根据 ack_currblk 中的自由度来控制器是否可 解码。 若收到的块线性相关, 说明接收到重复的块, 不能作为解码的系数矩 阵, 一旦有足够的线性无关的块, 其每个块都可由这些线性无关的块表示, 故可以解码。  For the receiving end, it is mainly based on the degree of freedom in ack_currblk whether the controller can be decoded. If the received block is linearly correlated, it means that the received block is not used as the decoded coefficient matrix. Once there are enough linearly independent blocks, each block can be represented by these linearly independent blocks, so it can be decoded.
对于每个块 (blkno),接收机端初始化一个 blks ize blksize的编码系 数矩阵 Cblkn。 和一个相应的有效荷载结构 Pblkn。。 每当从 blkno收到一个数据 包,编码系数和有效荷载插入分别到 Cblkn。和 Pblkn。。 然后使用高斯消元法来判 断接收到的数据与之前收到的数据包是否线性无关。 如果是,接收方设置 ack-currdof ack.currdof + 1。 如果 ack_currdof 等于 blks ize,那么接收 方 确认已收到 ack_currblk 块足够的自由并更新 ack_currblk ack.currblk + 1 (需要重置 ack.currdof 来反映新 ack.currblk自由度 的需求)。 如果接收到的数据包与之前收到的数据包线性相关, 接收端传输 ACK (相应的包收到的)但不更新 ack_currdof 和 ack_currblk。一旦收到足够 的线性无关的 blks izef 包(自由度), 接收端就可以解码块中所有的包。 For each block (blkno), the receiver side initializes a coding coefficient matrix C blkn of blks ize blksize . And a corresponding payload structure P blkn . . Whenever a packet is received from blkno, the encoding coefficients and payload are inserted into C blkn respectively. And P blkn . . The Gaussian elimination method is then used to determine whether the received data is linear regardless of whether the previously received packet is linear. If yes, the receiver sets Ack-currdof ack.currdof + 1. If ack_currdof is equal to blksize, then the receiver acknowledges that it has received enough ack_currblk blocks and updates ack_currblk ack.currblk + 1 (requires resetting ack.currdof to reflect the new ack.currblk degrees of freedom). If the received packet is linearly related to the previously received packet, the receiver transmits an ACK (received by the corresponding packet) but does not update ack_currdof and ack_currblk. Once enough linearly unrelated blksizef packets (degrees of freedom) are received, the receiver can decode all the packets in the block.
若块 blkno的 Cblkn。[ index, :] 为空, 即块中数据包皆线性无关, 无需 迭代, 返回 TRUE。 把块 blkno归一化后的编码系数和荷载构成 Cblkn。 和 PblknIf the block blkno is C blkn . [ index, :] is empty, that is, the data packets in the block are linear and independent, no iteration is required, and TRUE is returned. The coding coefficient and the load normalized by the block blkno constitute C blkn . And P blkn .
如果索引项小于块的大小, 表明块中有线性相关的数据包, 所以返回 FALSE。 需迭代更新参数, 使线性相关的编码系数为 0 , 更新一次就需要 归 一化一次。  If the index entry is smaller than the size of the block, indicating that there is a linearly related packet in the block, it returns FALSE. It is necessary to iteratively update the parameters so that the linear correlation coding coefficient is 0. Once updated, it needs to be normalized once.
但并不能因此而理解为对本发明专利范围的限制。 应当指出的是, 对于本领 域的普通技术人员来说, 在不脱离本发明构思的前提下, 还可以做出若干变 形和改进, 这些都属于本发明的保护范围。 因此, 本发明专利的保护范围应 以所附权利要求为准。 However, it is not to be construed as limiting the scope of the invention. It should be noted that a number of variations and modifications may be made by those skilled in the art without departing from the spirit and scope of the invention. Therefore, the scope of the invention should be determined by the appended claims.

Claims

权利要求书 claims
1、一种基于 UDP协议的网络编码及传输方法,其特征在于,包括如下步骤: 1. A network coding and transmission method based on UDP protocol, which is characterized by including the following steps:
A )在传输层和应用层之间构建网络编码层; 所述网络编码层分别 与所述传输层和所述应用层连接, 所述网络编码使用所述传输层的 UPD协 议与所述传输层建立连接; A) Construct a network coding layer between the transport layer and the application layer; the network coding layer is connected to the transport layer and the application layer respectively, and the network coding uses the UPD protocol of the transport layer to communicate with the transport layer establish connection;
B )数据或文件由发送端的应用层进入发送端的网络编码层, 在发 送端的网络编码层緩存并进行网络编码, 将其按照设定的方式形成带有编号 的数据包, 通过发送端传输层发送到接收端; B) Data or files enter the network coding layer of the sending end from the application layer of the sending end, cache and perform network coding on the sending end of the network coding layer, form them into numbered data packets according to the set method, and send them through the transmission layer of the sending end. to the receiving end;
C )接收端的网络编码层通过接收端的传输层接收到所述编码数据, 识别接收到的数据包的编号, 依据接收的编号返回不同的应答信号到所述发 送端, 同时对其进行解码得到数据或文件, 并传输到接收端的应用层。 C) The network coding layer of the receiving end receives the encoded data through the transmission layer of the receiving end, identifies the number of the received data packet, returns different response signals to the sending end according to the received number, and simultaneously decodes it to obtain the data. or file, and transmitted to the application layer of the receiving end.
2、 根据权利要求 1所述的基于 UDP协议进行网络编码传输的方法, 其 特征在于, 还包括如下步骤: 2. The method for network coding transmission based on UDP protocol according to claim 1, characterized in that it further includes the following steps:
D )所述发送端依据接收到的所述接收端发来的不同类型的应答信号 , 决定重发或不重发数据块。 D) The sending end decides to resend or not resend the data block based on the different types of response signals received from the receiving end.
3、 根据权利要求 2所述的基于 UDP协议的网络编码及传输方法, 其特 征在于, 所述步骤 B ) 中进一步包括如下步骤: 3. The network coding and transmission method based on UDP protocol according to claim 2, characterized in that step B) further includes the following steps:
B1 )所述发送端与接收端建立连接时, 发送携带有设定传输参数的 数据包通知所述接收端, 所述接收端在接收到所述数据包后返回确认信息并 按照所述传输参数设定该接收端。 B1) When the sending end and the receiving end establish a connection, send a data packet carrying set transmission parameters to notify the receiving end. After receiving the data packet, the receiving end returns confirmation information and follows the transmission parameters. Set this receiver.
4、 根据权利要求 3所述的基于 UDP协议的网络编码及传输方法, 其特 征在于, 所述步骤 B ) 中进一步包括如下步骤: 4. The network coding and transmission method based on UDP protocol according to claim 3, characterized in that step B) further includes the following steps:
B2 )所述发送端将要传输的数据或文件按其流入顺序划分为第一设 定长度的数据包, 当余下留下的文件或数据长度小于第一设定长度时, 填入 数据零以保持数据包长度, 使划分后的每个数据包具有相同的长度; 设定个 数为 blksize的数据包构成一个数据块,数据包是传输的最小单位;数据块所 包含的数据包个数在传输过程中依据接收端返回的信息调节。 B2) The sending end divides the data or files to be transmitted into data packets of the first set length in the order in which they flow in. When the length of the remaining files or data is less than the first set length, data zeros are filled in to maintain The length of the data packet makes each divided data packet have the same length; the number of data packets set to blksize constitutes a data block, and the data packet is the smallest unit of transmission; the number of data packets contained in the data block is transmitted The process is adjusted based on the information returned by the receiving end.
5、 根据权利要求 4所述的基于 UDP协议的网络编码及传输方法, 其特 征在于, 所述步骤 B ) 中进一步包括如下步骤: 5. The network coding and transmission method based on UDP protocol according to claim 4, wherein Characteristically, step B) further includes the following steps:
B3 )所述发送端通过单位时间内允许出现的令牌个数控制所述数据 包的发送速度, 每个令牌允许发送一个数据包; 所述单位时间内出现的令牌 数量依据数据包传输的时间调节。 B3) The sending end controls the sending speed of the data packet through the number of tokens allowed to appear per unit time, and each token is allowed to send one data packet; the number of tokens appearing per unit time is based on the data packet transmission time adjustment.
6、 根据权利要求 5所述的基于 UDP协议的网络编码及传输方法, 其特 征在于, 所述单位时间内允许发送的令牌数量根据一个数据包在所述发送端 和所述接收端的传输时间调节并通知所述接收端; 所述数据包传输的时间越 长, 单位时间内允许发送的令牌数量越少。 6. The network coding and transmission method based on UDP protocol according to claim 5, characterized in that the number of tokens allowed to be sent per unit time is based on the transmission time of one data packet between the sending end and the receiving end. Adjust and notify the receiving end; the longer the data packet transmission time is, the smaller the number of tokens allowed to be sent per unit time.
7、 根据权利要求 6所述的基于 UDP协议的网络编码及传输方法, 其特 征在于, 所述数据块包括的数据包数量依据每个数据包的传输时间调节, 所 述数据块包括的数据包数量与数据包在所述发送端和接收端之间的传输时 间成反比。 7. The network coding and transmission method based on UDP protocol according to claim 6, characterized in that, the number of data packets included in the data block is adjusted according to the transmission time of each data packet, and the number of data packets included in the data block is adjusted The number is inversely proportional to the transmission time of the data packet between the sender and the receiver.
8、 根据权利要求 7所述的基于 UDP协议的网络编码及传输方法, 其特 征在于, 所述步骤 C ) 中进一步包括如下步骤: 8. The network coding and transmission method based on UDP protocol according to claim 7, characterized in that step C) further includes the following steps:
C1 )所述接收端检测已经接收到的数据包编号, 如果编号连续, 发 送确认应答信号到所述发送端; 如果编号不连续, 发送扩展确认应答信号到 所述发送端, 所述扩展确认信号中携带有所述接收端接收到的最后一个连续 的数据包编号。 C1) The receiving end detects the received data packet number, and if the numbers are continuous, sends a confirmation response signal to the sending end; if the numbers are discontinuous, sends an extended confirmation response signal to the sending end, the extended confirmation signal carries the last consecutive data packet number received by the receiving end.
9、 根据权利要求 8所述的基于 UDP协议的网络编码及传输方法, 其特 征在于, 所述步骤 C ) 中进一步包括如下步骤: 9. The network coding and transmission method based on UDP protocol according to claim 8, characterized in that step C) further includes the following steps:
C2 )在接收到新的数据块时, 初始化尺寸为 blksize*blksize的编码 系数矩阵和相应的有效载荷结构,其中, blksize是当前设定的数据块的长度; C2) When receiving a new data block, initialize the coding coefficient matrix and the corresponding payload structure with a size of blksize*blksize, where blksize is the length of the currently set data block;
C3 )对于每个接收到的数据包, 将其编码系数和有效载荷分别插入 上述编码系数矩阵和相应的有效载荷结构中, 使用高斯消元法判断其与之前 的数据包是否线性无关, 如是, 执行步骤 C4 ); 否则, 执行步骤 C5 ); C3) For each received data packet, insert its coding coefficient and payload into the above-mentioned coding coefficient matrix and corresponding payload structure respectively, and use the Gaussian elimination method to determine whether it is linearly independent of the previous data packet. If so, Go to step C4); Otherwise, go to step C5);
C4 )返回确认信号, 更新当前块自由度, 使其加 1 , 并判断更新 后的当前块自由度是否等于数据块中的当前设定长度, 如是, 判断该数据块 可以解码; 否则, 等待接收下一数据包; C4) Returns a confirmation signal, updates the current block degree of freedom, increments it by 1, and determines whether the updated current block degree of freedom is equal to the current set length in the data block. If so, determines that the data block can be decoded; otherwise, wait for reception next packet;
C5 )发送确认信号,但不更新块自由度,并等待接收下一数据包。 C5) sends an acknowledgment signal but does not update the block degrees of freedom and waits to receive the next data packet.
10、 根据权利要求 9所述的基于 UDP协议的网络编码及传输方法, 其 特征在于, 如果发送端发送一个数据包且未收到确认信号的时间大于最后一 个数据包的传输时间加上重传超时周期, 则发送端采用慢启动模式传输数据 包; 所述慢启动模式包括设置所述单位时间允许传输的令牌数为缺省值, 每 次成功传输一个数据包后所述令牌数加一, 直到所述令牌数达到设定门限后, 改为正常传输状态。 10. The network coding and transmission method based on UDP protocol according to claim 9, characterized in that if the sending end sends a data packet and does not receive the confirmation signal for a time greater than the transmission time of the last data packet plus retransmission timeout period, the sending end uses the slow start mode to transmit the data packet; the slow start mode includes setting the number of tokens allowed to be transmitted per unit time to a default value, and the number of tokens is increased by each time a data packet is successfully transmitted. 1. Until the number of tokens reaches the set threshold, it changes to the normal transmission state.
PCT/CN2013/087789 2013-11-25 2013-11-25 Network encoding and transmission method based on udp protocol WO2015074279A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201380081163.0A CN107852398A (en) 2013-11-25 2013-11-25 A kind of network code and transmission method based on udp protocol
PCT/CN2013/087789 WO2015074279A1 (en) 2013-11-25 2013-11-25 Network encoding and transmission method based on udp protocol

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2013/087789 WO2015074279A1 (en) 2013-11-25 2013-11-25 Network encoding and transmission method based on udp protocol

Publications (1)

Publication Number Publication Date
WO2015074279A1 true WO2015074279A1 (en) 2015-05-28

Family

ID=53178846

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/087789 WO2015074279A1 (en) 2013-11-25 2013-11-25 Network encoding and transmission method based on udp protocol

Country Status (2)

Country Link
CN (1) CN107852398A (en)
WO (1) WO2015074279A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20210336725A1 (en) * 2020-04-27 2021-10-28 Qualcomm Incorporated Network coding termination and procedures using feedback

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112422962A (en) * 2020-10-30 2021-02-26 西安万像电子科技有限公司 Method and device for controlling video coding layer
CN115134047A (en) * 2021-03-29 2022-09-30 维沃移动通信有限公司 Transmission method, device, equipment and readable storage medium
CN113347151B (en) * 2021-04-28 2023-04-28 厦门海迈科技股份有限公司 Data interaction method based on socket shared memory
CN115499108A (en) * 2022-09-27 2022-12-20 西安羚控电子科技有限公司 Closed-loop network communication method and system based on UDP protocol

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101841479A (en) * 2010-04-28 2010-09-22 四川大学 High bit-error long time-delay network self-adaptive transmission method based on network coding
CN102291226A (en) * 2011-09-02 2011-12-21 北京大学深圳研究生院 Self-adaptive network transmission control method and system based on TCP (Transmission Control Protocol) protocol
CN102904689A (en) * 2012-10-15 2013-01-30 哈尔滨工业大学深圳研究生院 Improved method for transmission control protocol based on network coding
CN103152359A (en) * 2013-03-25 2013-06-12 重庆大学 Method for improving end-to-end wireless transmission control protocol (TCP) linear network coding

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8130776B1 (en) * 2009-08-28 2012-03-06 Massachusetts Institute Of Technology Method and apparatus providing network coding based flow control
CN103200192B (en) * 2013-03-28 2016-02-17 中国科学院声学研究所 Network code layer is to the decoding method of packet

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101841479A (en) * 2010-04-28 2010-09-22 四川大学 High bit-error long time-delay network self-adaptive transmission method based on network coding
CN102291226A (en) * 2011-09-02 2011-12-21 北京大学深圳研究生院 Self-adaptive network transmission control method and system based on TCP (Transmission Control Protocol) protocol
CN102904689A (en) * 2012-10-15 2013-01-30 哈尔滨工业大学深圳研究生院 Improved method for transmission control protocol based on network coding
CN103152359A (en) * 2013-03-25 2013-06-12 重庆大学 Method for improving end-to-end wireless transmission control protocol (TCP) linear network coding

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20210336725A1 (en) * 2020-04-27 2021-10-28 Qualcomm Incorporated Network coding termination and procedures using feedback
US11588587B2 (en) * 2020-04-27 2023-02-21 Qualcomm Incorporated Network coding termination and procedures using feedback

Also Published As

Publication number Publication date
CN107852398A (en) 2018-03-27

Similar Documents

Publication Publication Date Title
US11641387B2 (en) Timely delivery of real-time media problem when TCP must be used
KR100785293B1 (en) System and Method for TCP Congestion Control Using Multiple TCP ACKs
KR100533686B1 (en) Method for transmitting data in mobile ad hoc network and network apparatus using the same
KR101130479B1 (en) Response for spurious timeout
JP5020076B2 (en) High performance TCP suitable for low frequency ACK system
US9577791B2 (en) Notification by network element of packet drops
KR102061772B1 (en) Data transmission method and apparatus
US20070086335A1 (en) Congestion management over lossy network connections
JP2007534194A (en) Improved TCP performance when reordering packets
WO2014092779A1 (en) Notification by network element of packet drops
WO2012174763A1 (en) Tcp-based adaptive network control transmission method and system
CN107634823B (en) Data transmission method of transmission control protocol based on network coding
WO2015074279A1 (en) Network encoding and transmission method based on udp protocol
WO2006027695A1 (en) Signaling a state of a transmission link via a transport control protocol
US10645012B2 (en) System and method for reducing bandwidth usage of a network
WO2014194806A1 (en) Link processing method and mobile terminal in multiplexing control protocol
WO2014194797A2 (en) Transmission control protocol(tcp)connection control parameter in-band signaling
CN113169977A (en) Network equipment and method for delivering data packets
US7623546B1 (en) Latency improvement for file transfers over network connections
US20220368765A1 (en) Universal Transport Framework For Heterogeneous Data Streams
Coonjah et al. An investigation of the TCP meltdown problem and proposing raptor codes as a novel to decrease TCP retransmissions in VPN systems
US11811877B2 (en) Universal transport framework for heterogeneous data streams
KR20050013777A (en) Method for controlling congestion of TCP for reducing the number of retransmission timeout
Coonjah et al. An Investigation of the TCP Meltdown Problem and Proposing Raptor Codes as a Novel to Decrease TCP
CN111193577A (en) Network system communication method and communication device using transmission timeout

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 13897944

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 13897944

Country of ref document: EP

Kind code of ref document: A1