Skip to main content
. 2019 Sep 20;19(19):4072. doi: 10.3390/s19194072
Algorithm 2 Pseudocode for the receiver-based transport competition process at neighbor node j
  • 1:

    Input: pi ← received packet from the intermediate node i

  • 2:

  • 3:

    pj ← the packet to transmit at node j

  • 4:

    h ← the number of overhearing (default = 0)

  • 5:

  • 6:

    n = GetNumberofPaths(pi)        ▹ extract the number of paths n from the packet pi

  • 7:

    StartTimer(T)        ▹ timer for waiting according to distance from j to destination

  • 8:

    while TRUE do

  • 9:

        if T.expired() == TRUE then            ▹ waiting timer expiration

  • 10:

            n = bifurcation_decision_process(Preq, kj) ▹ calculate the number of path n (Algorithm 1)

  • 11:

            pj.SetNumberofPaths(n)        ▹ set the number of paths n to satisfy the Rreq

  • 12:

            Send(pj)                        ▹ send a packet pj

  • 13:

            Exit()                      ▹ quit the competition process

  • 14:

        end if

  • 15:

        if Receive(pj) == TRUE then      ▹ when receive the packet pj from other competitor

  • 16:

            h = h + 1

  • 17:

            if hn then           ▹ already enough number of paths are constructed

  • 18:

               T.Stop()                ▹ stop timer to transmit the packet

  • 19:

               Drop(pj)                    ▹ drop the packet pj

  • 20:

               Exit()                  ▹ quit the competition process

  • 21:

            end if

  • 22:

        end if

  • 23:

    end while