[ns] how to forward packets based on probability

Mubashir Rehmani mshrehmani at gmail.com
Tue Feb 17 23:49:16 PST 2009


Hi Phenix,

To forward a packet with certain probability, you need to include an if
condition in the sendPkt() function. It should be something like this:

If(probability > 0.5)
{
 Scheduler::instance().schedule(target_, p, delay);
}

in the SendPkt() function.

Hope it helps

Regards
Mubashir
www-rp.lip6.fr/~rehmani

2009/2/18 Phenix <phenix_yw at hhu.edu.cn>

>
>
> Hi guys,
>
>  How to implement probabilistic-based flooding in NS-2 ? Say, upon
> receiving a packet, a mobile node will decide whether to forward it with a
> certain probability.
>
>  I only know we can use the function below to send a packet in NS-2:
>            Scheduler::instance().schedule(target_, p, delay);
>  But how to deal with the probability?
>
>
> Regards,
> Phenix
>
>


-- 
Mubashir Husain Rehmani


More information about the Ns-users mailing list