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

[ns] FTP Frustration



Hmmm... should it take over 40 seconds to send 4 packets of default size
over 3.0 ms of link delay?
 
My networking knowledge is a little rusty, but if I tell FTP to send 40
packets, shouldn't TCP send out the whole window? This is clearly not the
case in my results. TCP sends out a packet, waits an geometrically
increasing amount of time, and then sends out another. 

Any explanation for this behavior? Is LossMonitor not sending ACKs? 

My xgraph of [$source set ack_] stays at -1 during the course of my
simulation.

Here is my *VERY SIMPLE* sample code. Any ideas?

-------------------------------------------------------
#Create a simulator object
set ns [new Simulator]
set nf [open out.nam w]
$ns namtrace-all $nf

global source

#Open the output files
set f0 [open out0.tr w]
set f1 [open out1.tr w]
set f2 [open out2.tr w]

#Create 3 nodes
set n0 [$ns node]
set n3 [$ns node]
set n4 [$ns node]

#Connect the nodes
$ns duplex-link $n0 $n3 100Mb 1.5ms DropTail
$ns duplex-link $n3 $n4 100Mb 1.5ms DropTail

#Define a 'finish' procedure
proc finish {} {
	global f0 f1 f2 ns nf
	#Close the output files
	close $f0
	close $f1
	close $f2
	#Call xgraph to display the results
	exec xgraph out0.tr -geometry 800x400 &
        exec xgraph out1.tr -geometry 800x400 &
        exec xgraph out2.tr -geometry 800x400 &
        $ns flush-trace
	#Close the trace file
        close $nf
	#Execute nam on the trace file
        exec nam out.nam &
        exit 0
}

proc attach-traffic { node sink} {
    global source
	#Get an instance of the simulator
	set ns [Simulator instance]

	#Create a TCP agent and attach it to the node
	set source [new Agent/TCP]
	$ns attach-agent $node $source

	#Create FTP
	set traffic [new Application/FTP]
	$traffic set type_ FTP
        
        # Attach traffic source to the traffic generator
        $traffic attach-agent $source
	#Connect the source and the sink
	$ns connect $source $sink
	return $traffic
}

proc record {} {
        global sink0 f0 f1 f2 source
	#Get an instance of the simulator
	set ns [Simulator instance]
	#Set the time after which the procedure should be called again
        set time 0.01
	#How many packets have been received by the traffic sinks?
        set packs [$sink0 set npkts_]
	#Get the current time
        set now [$ns now]
	#show packets received
        puts $f0 "$now $packs"
        #show sequence number of sender
        puts $f1 "$now [$source set t_seqno_]"
        #show highest ack_ received
        puts $f2 "$now [$source set ack_]"
	#Re-schedule the procedure
        $ns at [expr $now+$time] "record"
}


set sink0 [new Agent/LossMonitor]
$ns attach-agent $n4 $sink0

set ftpapp [attach-traffic $n0 $sink0]

#Start logging the received bandwidth
$ns at 0.0 "record"
#Start the traffic sources
$ns at 0.2 "$ftpapp produce 40"

#Call the finish procedure after 60 seconds simulation time
$ns at 60 "finish"

#Run the simulation
$ns run

-----------------------------------------------------

Gracias,
-Stan