-1

谁能告诉我应该如何解决这个问题?我在将多个应用程序附加到一个代理时遇到问题。(我在 Ubuntu12.10 上运行 ns2.35)

我的环境中有两个节点(源和目标),这里有一些功能:

  1. 我在目标节点上附加了一个丢失监控代理。

  2. 我在源节点上附加了一个 udp 代理。

  3. 我通过以下声明在 udp 代理上附加了 9 个应用程序:

    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. 运行我的 tcl 文件时出现错误“无法读取代理地址:没有这样的变量..”(请参阅​​ [错误消息])

  5. 我是否使用错误的方式将这些应用程序附加到代理?我该如何解决?

谢谢大家。

[错误信息]

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)
4

1 回答 1

0

我得到了解决方案:以下语句在两个“代理”(此处为 $A 和 $B)之间建立连接。

$ns connect $A $B

所以,对于这个问题,我将连接我的 UDP 代理和 LossMonitor 代理(在我的 for 循环之外)。

$ns connect $udp $lmt

将“应用程序”连接到“代理”会导致编译错误。

于 2013-05-21T03:21:48.913 回答