[ns] How to send a packet to previous node

howardgod howardgod howardgod at gmail.com
Tue Nov 11 09:02:32 PST 2008


Deer Teerawat
First, thanks for reply.

My timing for send a packet to previous node is when queue received a packet
I will computer some information in packet's header. And in some
circumstances I will send a packet back to previous hop. Let previous hop
knows the result I computer in current node.

Your method is to add some script in tcl file. But I want to add the method
in c++ file. So that anyone can just using my queue method ,says
Queue/MyQueue, then their topology will apply my queue mechanism.

And I'm facing a big problem. After I computer the packet's information, I
decide to send a packet to previous node. And I can't find any information
in packet's header about previous node's ID. Therefor, even I allocate a new
packet, I can't fill the packet's destination field in common header or ip
header. So the packet won't transmit to previous node.

any way , your method is great. Maybe in other program it will help!!

                                Howard

2008/11/12 Teerawat Issariyakul <teerawat at ece.ubc.ca>

>
> Dear Howard,
>
> Say you have a topology like (n1)-->(n2). Usually, packet will flow from
> (n1) to (n2). When you want to send a packet from (n2) back to (n1), you
> can do the following.
>
> 1. Define an instvar $conn (whose class Connector) of n2
> 2. Put the following in the Tcl simulation script
>
> [$n2 set conn] target $n1
>
> 3. I don't know when you want to send the packet back to n1, but when
> you want to do so, you can simply send the packet to $conn by using
> function recv(p,h)
>
> I hope this will help.
>
> Regards,
> Teerawat
>
>


More information about the Ns-users mailing list