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

Re:[ns]: Can't get the correct node id



Hello
 
My network topology is as follows :
 
sender node 0 o------------------------------o receiver node 1
                 
I attach the loss monitor agent to the receiver node.
 
Then I use the following script to configure node 1
 
set agent [$self create-agent $node Agent/UDP $fid]
set cbr [new Application/Traffic/CBR]
$cbr attach-agent $agent
 
set loss_mon [new Agent/LossMonitor]
$loss_mon connect $agent
I follow Marc Greis's approach to modifiy the code of "loss-monitor.cc"
so that node 1 will return a packet to node 0
 
Modification of loss-monitor.cc
-------------------------------------
        char out[200];
        sprintf(out, "%s recv %d %d %8.1f", name(),
                  hdrip->src_.addr_ >> Address::instance().NodeShift_[1], 
                  bwp->bw);
        Tcl& tcl = Tcl::instance();    
        tcl.eval(out);
 
TCL script
------------
 Agent/LossMonitor instproc recv {from bw} {
                     
            puts "node [$node_ id] received from $from with bandwidth $bw bps."
}
 
However the output is always
 
node 1 received from 1 with bandwidth 1000bps.
 
I have tried many ways without success. Could anyone please tell me why can't
I get the correct node id ?
 
Thank you very much.
Bye.