[ns] FW: 2 SCTP agents in the same node to a sink node through a
middle node
ELSHEIKH, Mr Amr HIT/ISM
elshikha at emro.who.int
Tue Nov 30 03:41:39 PST 2004
_____
From: ELSHEIKH, Mr Amr HIT/ISM
Sent: Tuesday, November 30, 2004 1:40 PM
To: 'ns-users at isi.edu'
Subject: 2 SCTP agents in the same node to a sink node through a middle
node
Dear All:
* I'm making a simulation of 3 nodes
SCTP2 SINK
| |
N1----------N2---------------N3
|
SCTP1
* Source of data linked to agents is a trace file
* In the trace file always the first agents gives right results
while the second gives trash
Any one knows the reason?
I've attached dump for tracing SCTP
Script
Source data
SCTP2 data
time
size
40
1033
80
289
120
829
160
409
200
111
240
1115
SCTP 1 data
time
size
0
1200
480
2551
960
2913
1440
3275
1920
3193
2400
3184
Received_SCTP
op
time
frm
to
type
size
flag
Field8
src
dest
Field11
tsn
r
0.102298
1
2
sctp
1248
-------
1
0
2
-1
11
r
0.142701
1
2
sctp
1500
-------
2
0.1
2
-1
13
r
0.143901
1
2
sctp
1500
-------
2
0.1
2
-1
14
As you see 1248=1200 + 48 (header)
While 1500 should be = 1036 + 48=1084?????????????????
SCRIPT
set ns [new Simulator]
$ns color 1 Blue
$ns color 2 Red
set nf [open die_hard_small_sctp.nam w]
$ns namtrace-all $nf
# added by amr to genrate readable trace file
set allchan [open die_hard_small_trace_sctp.txt w]
$ns trace-all $allchan
# define the trace format:
#Agent/SCTP set nam_tracevar_ true
#Agent/SCTP set tracevar_ true
# generate the sending node:
set send_node [$ns node]
# generate the router:
set router [$ns node]
$router shape "box"
# generate the receiving node:
set recv_node [$ns node]
# define the links between the nodes:
$ns duplex-link $send_node $router 10Mb 10ms DropTail
$ns duplex-link $router $recv_node 10Mb 10ms DropTail
# define the source and the source model:
set sctp_I [new Agent/SCTP]
$sctp_I set fid_ 1
$sctp_I set numUnrelStreams_ 1
$sctp_I set unordered_ 1
$ns attach-agent $send_node $sctp_I
set sctp_BP [new Agent/SCTP]
$sctp_BP set fid_ 2
$sctp_BP set numUnrelStreams_ 1
$sctp_BP set unordered_ 1
$ns attach-agent $send_node $sctp_BP
# define the destination:
set snk [new Agent/SCTP]
$ns attach-agent $recv_node $snk
$ns connect $sctp_I $snk
$ns connect $sctp_BP $snk
# define the destination:
#set snk_I [new Agent/SCTP]
#$ns attach-agent $recv_node $snk_I
#set snk_BP [new Agent/SCTP]
#$ns attach-agent $recv_node $snk_BP
#$ns connect $sctp_I $snk_I
#$ns connect $sctp_BP $snk_BP
# generate the video trace file ("Verbose_Jurassic_64.dat" is only an
example):
set original_file_name_I die_hard_small_I.txt
set trace_file_name_I video_I.dat
set original_file_id_I [open $original_file_name_I r]
set trace_file_id_I [open $trace_file_name_I w]
set last_time_I 0
while {[eof $original_file_id_I] == 0} {
gets $original_file_id_I current_line
if {[string length $current_line] == 0 ||
[string compare [string index $current_line 0] "#"] == 0} {
continue
}
scan $current_line "%d%s%d" next_time type length
set time [expr ($next_time-$last_time_I)*1000]
set last_time_I $next_time
puts -nonewline $trace_file_id_I [binary format "II" $time $length]
}
close $original_file_id_I
close $trace_file_id_I
set original_file_name_BP die_hard_small_BP.txt
set trace_file_name_BP video_BP.dat
set original_file_id_BP [open $original_file_name_BP r]
set trace_file_id_BP [open $trace_file_name_BP w]
set last_time_BP 0
while {[eof $original_file_id_BP] == 0} {
gets $original_file_id_BP current_line
if {[string length $current_line] == 0 ||
[string compare [string index $current_line 0] "#"] == 0} {
continue
}
scan $current_line "%d%s%d" next_time type length
set time [expr ($next_time-$last_time_BP)*1000]
set last_time_BP $next_time
puts -nonewline $trace_file_id_BP [binary format "II" $time $length]
}
close $original_file_id_BP
close $trace_file_id_BP
# set the simulation end time:
set end_sim_time [expr 1.0*$last_time_BP/1000+0.100]
if { $last_time_I > $last_time_BP} {
set end_sim_time [expr 1.0*$last_time_I/1000+0.100]
}
# read the video trace file:
set trace_file_I [new Tracefile]
$trace_file_I filename $trace_file_name_I
set video_I [new Application/Traffic/Trace]
$video_I attach-agent $sctp_I
$video_I attach-tracefile $trace_file_I
set trace_file_BP [new Tracefile]
$trace_file_BP filename $trace_file_name_BP
set video_BP [new Application/Traffic/Trace]
$video_BP attach-agent $sctp_BP
$video_BP attach-tracefile $trace_file_BP
# add error model by amr
#set err [new ErrorModel]
#$err set rate_ 0.01
#$err unit pkt
#$err ranvar [new RandomVariable/Uniform]
#$err drop-target [new Agent/Null]
#$ns link-lossmodel $err $router $recv_node
# start the simulation:
$ns at 0.0 {
$send_node label "VIDEO-SERVER"
$router label "IP-ROUTER"
$recv_node label "VIDEO-CLIENT"
$video_I start
$video_BP start
}
# stop the simulation:
$ns at $end_sim_time {
finish
}
proc finish {} {
global ns nf allchan
$ns flush-trace
close $nf
close $allchan
exec nam die_hard_small_sctp.nam &
exit 0
}
$ns run
Anyone can help???
Thanks.
More information about the Ns-users
mailing list