[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ns] Error with PING part 2
Hi all,
sorry left out the relevant code:
......
Agent/Ping instproc recv {from stime rtt} {
global sampling_interval f_rtt
$self instvar node_
set ns [Simulator instance]
set now [$ns now]
puts $f_rtt "$from $stime $rtt"
}
# Create ping agents and attach them to each route
for {set i 0} {$i <= $N} {incr i} {
set send_ping($i) [new Agent/Ping]
# make sure forward ping packets are the same sizes as normal packets
$send_ping($i) set packetSize_ $packet_size
$ns attach-agent $srcn($i) $send_ping($i)
set recv_ping($i) [new Agent/Ping]
# backward ping packets should be the same sizes as acks
$ns attach-agent $dstn($i) $recv_ping($i)
# Connect the two agents
$ns connect $send_ping($i) $recv_ping($i)
puts $f_rtt "% ping route $i = [$dstn($i) set id_]"
# schedule the ping's
set ping_time $str_start_t
while {$ping_time < $T} {
$ns at [expr $ping_time + $i*$sampling_interval/($N+1)] "$send_ping($i)
send"
set ping_time [expr $ping_time + $sampling_interval]
}
}
.....
....
Thanks all
Vijay