Hi!

Wouldn't it be kind of dangerous to drop the packet using the first method 
described? The packet would jsut disappear and the logs would not be 
consistent. I would recommend using the latter method

drop(p)

instead. This makes the logging consistent and almost all objects I've come 
across where I would like to drop packets have been Connector objects.

Best regards,
Mats Folke

Teerawat Issariyakul wrote:
> Hi,
> 
> Suppose you have a pointer "p". You can drop the packet by executing
> 
> 
>     Packet::free(p)
> 
> Also the packet "*p" can be dropped from within the Connector object
> by invoking function drop as follows:
> 
>     drop(p);
> 
> 
> Note that "drop(p)" is a function of class Connector, and therefore
> must be invoked from within the scope of class Connector.
> 
> I posted how to drop a a packet in the following blog:
> 
> http://t-issariyakul.blogspot.com/2009/03/ns2-dropping-packet.html
> 
> For more information about Connector and Packet, see Chapters 5 and 8,
> respectively, in the following book from Springer:
> 
> T. Issaraiyakul and E. Hossain, "Introduction to Network Simulator
> NS2", Springer 2008.
> http://www.springer.com/engineering/signals/book/978-0-387-71759-3
> 
> You may also find the following website useful:
> http://www.ece.ubc.ca/~teerawat/NS2.htm
> 
> On 3/13/2009, "muralikrishna g" <muralikrishn...@gmail.com> wrote:
> 
>> 
>> Hi to all..
>> 
>> i am using ns-2.33, here in my work i have to drop packets from a
>> particular sender, i am planing to drop packets depending on the
>> sender node_id 
>> 
>> please help me regarding this..
>> 
>> by
>> 
>> Muralikrishna Gaddam (muralikrishn...@gmail.com)



-- 
Mats Folke, M.Sc., Lic.Eng.
Research Engineer

Ericsson AB                     Office: +46 10 7171385
Ericsson Research               Fax: +46 920 99621
P.O. Box 920                    Mobile: +46 76 1271385
SE-971 28 LuleƄ
Sweden

Reply via email to