[ns] to pass message class application to agent

Teerawat Issariyakul teerawat at ece.ubc.ca
Wed Apr 29 23:11:00 PDT 2009


Dear Gisane,

NS2 defines applications in class Application (see ~ns/apps/app.h,cc).
The derive classes of application are for example TrafficGenerator
(e.g., CBR) or FTP. The application models user demand. Therefore it
need to send message to an agent saying that a use needs to send data.
Here is how.

Class Application have a pointer to an Agent object, agent_. In order to
send a message with size nbyte bytes to an associated agent. It executes

agent->sendmsg(nbytes);

where the function sendmsg(...) belongs to class Agent. There are several
more ways that an Agent object can received a message. Those ways are
defined in function of class Agent (see ~ns/common/agent.cc).

(This message is posted in my blog at

http://t-issariyakul.blogspot.com/2009/04/how-application-sends-message-to-agent.html)

For more information about Agents and Applications, see Chapters 9-11 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

Best Regards,
Teerawat

On 4/28/2009, "Gisane Michelon" <gisanema at gmail.com> wrote:

>
>Somebody has a example how to pass a message of class application to
>agent Ping? How I do this?
>thanks
>Ane
>



More information about the Ns-users mailing list