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

Re: [ns] Allocate and send a packet in C++ level



Does your agent know the dest agent's address. I mean are you doing
something at the Tcl layer that is creating a problem ?

Debo

On Wed, 28 Feb 2001, Foundanas, Leonidas wrote:

> Hi ns users,
> I would like to get a packet from an agent in the C++ level.
> 
> I tried to implement the send function but I still have problems.
> Particularly, my problem first is how I can create a new packet.
> I tried to do that by using the following:
> 
> Packet *new_pkt = Agent::allocpkt()
> send(new_pkt,0)
> 
> I used Agent::    because I do that in the Queue class and not in the Agent
> class. Also, I changed the "allocpkt()" in the agent.h to public from
> protected and I included the "agent.h in the C++ function in which I give
> the command.
> The result after the compiling process (make file) is an error that 
> " I cannot call the member fcn allocpkt() without an object".
> 
> Then I tried to give the address of the agent that I want to invoke in order
> this agent to send one packet as follows:
> 
> saddr() = 1   %In TCL I give $source1 set addr_ 1  for the agent
> Packet *new_pkt = Agent::allocpkt()
> send(new_pkt,0)
> 
> but, then I had problem with the saddr() =....
> 
> I don't understand if the problem is that I cannot call the 
> Packet *p = allocpkt()
> from a class not derived from the class Agent,
> or there is something else. 
> 
> Any help will be greatly appreciated.
> Thanks,
> Leonidas
> 
>