[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: destination



On Tue, 28 Sep 1999 13:24:20 +0900, "Yoann NEC, Japan" wrote: 
>Hello,
>
>I am programming a new agent for NS (coded in c++)
>I have a topology and to each node is attached an agent called "wc".
>My agent deceide himself about the next node to take but I don't know how to
>send the packet to this specified node.  (I tried to use "target" but it
>doesn't seem to be what I want)
>
>So my question is :
>
>### How do you send a packet to a specific neighbor node ? ###
>
>for example in c++ :
>// Create a new packet
>Packet* pkt = allocpkt();
>// Choose the next node
>int next_node_id = 1;      /* 1 is a neighbor */
>// set the destination node :
>???
>???
>// send the packet
>send(pkt, 0);
>
>what should be instead of "???"  ?
>
>Answer me please. I am a beginner in NS but I nedd this to improve.

Ns uses routing to send packets, so you can't (usually) directly
control how the packets go somewhere.

You can study the routing code to see how how ns sets up routing.
ns notes and docs will help (see classifiers, for example).

You could also get the objects representing the endpoints of your
links and send the packets directly to them.  (This is sort of what
routing does.)

Both appraoches will require a reasonable amount of work and care, but
what you want is not impossible.

   -John Heidemann