[ns] ftp stop

david cogan at rock.com
Mon May 3 02:15:18 PDT 2004


Hi! 

I'm trying to stop a ftp transfer at given time, but the source just 
goes on sending. I figure I must be doing something wrong but I can't 
understand what. For instance I tried the following: I copied the 
example on the webpage http://www-mash.cs.berkeley.edu/ns/ns-man.html 
and added a few lines for nam and a line that should stop one of 
the ftp transfers. If somebody could tell me why this don't work and 
what I should do to make it work I'll be very great 

______________What the script looks like now _______________________________ 

set ns [new Simulator] 

# 
# Create two nodes 
# 
set n0 [$ns node] 
set n1 [$ns node] 

# 
# Create a trace and arrange for all the trace events of the # links subsequently created to be dumped to "out.tr" # 
set f [open out.tr w] 
$ns trace-all $f 

#Open a file to write the nam-trace to. ;# 
set namfile [open out.nam w] ;# I added these lines 
$ns namtrace-all $namfile ;# 

# 
# Connect the two nodes with a 1.5Mb link with a transmission # delay of 10ms using FIFO drop-tail queuing # 
$ns duplex-link $n0 $n1 1.5Mb 10ms DropTail 

$ns duplex-link-op $n0 $n1 orient right ;# I added this line 

# 
# Set up BSD Tahoe TCP connections in opposite directions. # 
set tcp_src1 [new Agent/TCP] 
set tcp_snk1 [new Agent/TCPSink] 
set tcp_src2 [new Agent/TCP] 
set tcp_snk2 [new Agent/TCPSink] 
$ns attach-agent $n0 $tcp_src1 
$ns attach-agent $n1 $tcp_snk1 
$ns attach-agent $n1 $tcp_src2 
$ns attach-agent $n0 $tcp_snk2 
$ns connect $tcp_src1 $tcp_snk1 
$ns connect $tcp_src2 $tcp_snk2 

# 
# Create ftp sources at the each node # 
set ftp1 [$tcp_src1 attach-source FTP] 
set ftp2 [$tcp_src2 attach-source FTP] 

# 
# Start up the first ftp at the time 0 and # the second ftp staggered 1 second later # 

$ns at 0.0 "$ftp1 start" 
$ns at 1.0 "$ftp2 start" 
$ns at 2.0 "$ftp1 stop" ;# I added this line 

# 
# run the simulation for 10 simulated seconds # 
$ns at 10.0 "exit 0" 
$ns run 




__________________________________________________
You Rock! Your E-mail should, too. Visit Rock.com!




More information about the Ns-users mailing list