[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using multiple agents in applications:how?
> I am trying to write an application for ns that needs more than one agent.
What functionality do you want in this application, and what functionality
of the existing Application do you want to reuse? The existing application
is only designed for a single agent, so if you want an application to
individually control N agents, seems to me that it's probably better to
derive a class from Process, in parallel to Application (see app.h).
> I am thinking of doing this by having a dummy agent that attaches the
> application to the node it is to reside at.
> Then defining all the different agents I actually need and attaching them
> to the same node(in Tcl). I then need some way of letting my application
> obtain the references of these agents so I can let my application use the
> agents when needed. I though of using the dummy agent to obtain a pointer
> to the node(try to get hold of the agents_ list, but I can not quite
> figure out how to get hold of this variable for the node the application
> is attached to.
See the handling of attach-agent in app.cc to see how to pass a reference
of an agent into application.
> If I get hold of this list(agents_) I would get hold of the agent names ,
> so I could attach them with the application, or?
If so, why do you need that dummy agent anyway? See
HttpApp in webcache/http.{h,cc} for an example of how to create your own
"application" which handles multiple transport agents. Also see the
application chapter in ns doc.
- Haobo