At time slot t:
Received coded data packet in time slot t;
If     then
 Extend each received encoding vector to its corresponding global encoding vector with length tN by adding zeros, i.e., ;
 Suppose that the matrix is composed by the global encoding vectors of the received TN coded packets as its rows and the matrix is composed by corresponding coded packets as its rows;
 Decode and recover the tN original data packets as follows:
;
 Clear the its buffer and send a to the source;
else
 Store the coded data packet to its buffer;
 Send a to the source;
end  if
Algorithm 2: Decoding at the destination.