-1

Can anyone tell me how should I fix this problem? I have a problem in attaching more than one applications to one agent. (I am running ns2.35 on Ubuntu12.10)

There are two nodes(Source and Destination) in my environment and here are some features:

  1. I attached a loss-monitor agent on Destination node.

  2. I attached an udp agent on Source node.

  3. I attached 9 applications on the udp agent by following declaration:

    set nExpGen 9
    for {set i 1} {$i <= $nExpGen} {incr i} {
        set eee($i) [new Application/Traffic/Exponential]
        $eee($i) attach-agent $udp
        $ns connect $eee($i) $lmt
    #nExpGen= number of exponential generators
    #eee = exponential application
    #lmt = loss-monitor agent
    
  4. I got errors "cant read agent address: no such variable.." when running my tcl file ( see [error message])

  5. Did I use the wrong way to attach these applications to the agent? How can I fix that?

Thank you all in advance.

[error messages]

can't read "agent_addr_": no such variable
    while executing
"subst $[subst $var]"
    (procedure "_o40" line 5)
    (Object next line 5)
    invoked from within
"_o40 next agent_addr_"
    ("eval" body line 1)
    invoked from within
"eval $self next $args"
    (procedure "_o40" line 11)
    (Application/Traffic set line 11)
    invoked from within
"$dst set agent_addr_"
    (procedure "_o3" line 2)
    (Simulator simplex-connect line 2)
    invoked from within
"$self simplex-connect $dst $src"
    (procedure "_o3" line 10)
    (Simulator connect line 10)
    invoked from within
"$ns connect $eee($i) $lmt"
    ("for" body line 4)
    invoked from within
"for {set i 1} {$i <= $nExpGen} {incr i} {
        set eee($i) [new Application/Traffic/Exponential]
        $eee($i) attach-agent $udp
        $ns con..."
    (file "myTest3.tcl" line 47)
Donal Fellows
  • 133,037
  • 18
  • 149
  • 215
DartKouth
  • 65
  • 3
  • 11

1 Answers1

0

I got the solution: The following statement build connections between two "Agents" (here $A and $B).

$ns connect $A $B

So, for this question, I shall connect my UDP agent and LossMonitor agent (outside my for loop).

$ns connect $udp $lmt

Connecting an "application" to an "agent" causes compiling error.

DartKouth
  • 65
  • 3
  • 11