1: Mobile device connect to access point that Connected with Cloud.

2: While

3: Measure RSSnew; and BRnew of discovered access point

4: if (RSSnew -RSScurrent > RSSThreshold) and( BRnew > BRcurrent) then

5: Tcurrent = N * ( D / BRcurrent + Tprop + ETm + ETcloud)

6: Tnew = N * ( D / BRnew + Tprop + ETm + ETcloud

7: if (Tnew < Tcurrent ) then

8: handoff occur ( RSSnew = RSScurrent , BRnew = BRcurrent)

9: take new decision for offloading

10: end if

11: end while