[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ns] Questions about Application Data
You were using a UDP agent, right? By default the UDP agent does not know
how to handle application data (it should, but it wasn't there). You can
either derive a simple UDP agent that implements a send(int, AppData*) and
a recv() that handles AppData. E.g., something like this:
void HttpInvalAgent::recv(Packet *pkt, Handler*)
{
if (app_ == 0)
return;
app_->process_data(pkt->datalen(), pkt->userdata());
Packet::free(pkt);
}
void HttpInvalAgent::send(int realsize, AppData* data)
{
Packet *pkt = allocpkt(data->size());
pkt->setdata(data);
Agent::send(pkt, 0);
}
It should be included in the udp agent. I'll add it there sometime later,
perhaps this week. Thanks for the Q that reminds me.
- Haobo
On Fri, 16 Feb 2001, Ken Sedgwick wrote:
> Greetings,
>
> I'm trying to construct a simulation of a system of interconnected
> application-level programs. I need to pass application data between
> the simulated entities in this model.
>
> So far I have created a subclass of Application, and have provided
> a send method which attempts to create and send some application
> data:
> PacketData * pdatap = new PacketData(nbytes);
> memcpy(pdatap->data(), datap, nbytes);
> agent_->send(nbytes, pdatap);
>
> When I run the simulator, I get the following error:
> "Agent::sendmsg(int, AppData*, const char*) not implemented"
>
> I discovered the following comment in agent.cc where the
> indicated routine is defined:
> /*
> * Place holders for sending application data
> */
>
> What is my best plan of attack here? Should I implement the needed
> routines in agent.cc? Is this hard for some reason?
>
> I noticed other simulations with application level data seem to
> avoid passing the data in the "payload" of the packets. Is an
> "out-of-band" mechanism for communicating the application data
> a better way to go?
>
> Many, many thanks in advance.
>
> Ken
>
> Ken Sedgwick
> Zodiac Networks
> ken@zodiacnetworks.com
>
>