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

Re: [ns] sending a new packet type (fwd)



Hi all,

I want to attach a new type of agent to nodes when I start my simulation,
and then only connect agents on the fly later in the simulation.  {ie. if
my new packet type needs to be sent from a node to its neighbor, then I'll
connect the agents (for the new packet type) and send the packet.}  

I get this to work if I create 2 new agents on the fly and connect them
(ie. the new packet is both sent and received correctly).  However, it
isn't working if I try to make only one new agent at each node, at the
beginning of the simulation, like I want to.  I get an error message when
I try to access the new agent in order to make the connection.

I'd appreciate some advice from someone who understands the agents and
connections better than I do!

Thanks,
-Lori

ps. And many thanks to Srinivasan, who figured out where the last problem
was (see below)...


---------- Forwarded message ----------
woo-hoo! That did it.

Thanks!!!
-Lori

On Tue, 14 Mar 2000, Srinivasan Jagannathan wrote:

> i think the problem is in using hdrip->dst(), if you set this within the
> C++, you will have set the target_ field also. this is the object which
> does the packet handling. in fact if you lookup agent.h, you will find :
>         
>    void send(Packet* p, Handler* h) { target_->recv(p, h); }
> 
> so my suggestion is, once you connect the agents, do not set the dst_
> variable. and of course, remember to attach the agents to the node.
> (i was searching for a bug in my code for 2 full days and then realised,
> i had forgotten to attach the agent to the node :)
> 
> -Srinivasan