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

Re: [ns] Way to access "node" object through an attached agent?



Here's a snippet that I believe does what you want:

    # Create agents and traffic sources
    set u($i) [new Agent/UDP]
    $ns attach-agent $s($i) $u($i)
    set n($i) [new Agent/Null]
    $ns attach-agent $t($i) $n($i)
    $ns connect $u($i) $n($i)
puts "Agent node is [$u($i) set node_]"
puts "Agent node id is [[$u($i) set node_] id]"
puts "Agent port is [$u($i) set agent_addr_]"

George

On Wed, 9 Jan 2002, Stanley M Bielski wrote:

> Hello once again,
>
> I am attempting to access a node object via its attached agent object. I
> know that the class application has the [$self agent] method to retrieve a
> pointer to its agent. However, looking at the agent.cc code, there doesn't
> seem to be a similar method supported for accessing the node.
>
> On the other hand, I can obtain the agent's source address through a
> method in agent.cc. Is there a way I can access the node pointer via this
> address w/o altering the ns source?
>
> Many thanks, wise ones!
> -Stan
>
>
>

-- 
                        -Dr. George F. Riley ([email protected])
                        -Assistant Professor, Georgia Tech ECE