Problem with LANs
Verena Rose
rose@telematik.informatik.uni-karlsruhe.de
Mon, 28 Sep 1998 14:49:57 +0200
This is a multi-part message in MIME format.
--------------F152C21C14F2E97D359AF75B
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi,
I'm quite new to ns and I have a problem with LAN elements in my code.
I'm using the ns all-in-one 2.1b3 package.
I've tried to make up a small LAN with two nodes and an FTP application
over simple tcp agents, but only one tcp packet and one ack were
received and then the simulation stopped.
I give the code and the output file below. Maybe someone could help and
tell me if my code's wrong or if there's a problem with this ns version.
Thanks in advance,
Verena (rose@telematik.informatik.uni-karlsruhe.de)
--------------F152C21C14F2E97D359AF75B
Content-Type: application/x-tcl; name="lantest.tcl"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="lantest.tcl"
set opt(tr) out
set opt(namtr) "lantest.nam"
set opt(ll) LL
set opt(ifq) Queue/DropTail
set opt(mac) Mac/Csma/Cd
set opt(chan) Channel
set opt(tcp) TCP/Reno
set opt(sink) TCPSink
set opt(app) FTP
#Create a simulator object
set ns [new Simulator]
#Open the nam trace file
set nf [open $opt(namtr) w]
$ns namtrace-all $nf
#open trace file
set tracefile [open $opt(tr) w]
$ns trace-all $tracefile
#Define a 'finish' procedure
proc finish {} {
global ns nf tracefile opt
$ns flush-trace
#Close the trace file
close $nf
close $tracefile
#Execute nam on the trace file
exec nam $opt(namtr) &
exit 0
}
for {set i 0} {$i < 2} {incr i} {
set node($i) [$ns node]
lappend nodelist $node($i)
}
#$ns newLan $nodelist $opt(bw) $opt(delay) $opt(ll) $opt(ifq) $opt(mac) $opt(chan)
$ns make-lan "$node(0) $node(1)" 2Mb 10ms
set tcp0 [new Agent/TCP]
$ns attach-agent $node(0) $tcp0
set sink [new Agent/TCPSink]
$ns attach-agent $node(1) $sink
$ns connect $tcp0 $sink
#set tcp0 [$ns create-connection TCP/Reno $node(0) TCPSink $node(1) 0]
set ftp0 [new Source/FTP]
$ftp0 attach $tcp0
#set ftp0 [$tcp0 attach-app FTP]
$ns at 0.0 "$ftp0 start"
$ns at 5.0 "finish"
$ns run
--------------F152C21C14F2E97D359AF75B
Content-Type: text/plain; charset=us-ascii; name="out"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="out"
+ 0 0 1 tcp 1000 ------- 0 0.0 1.0 0 0
- 0 0 1 tcp 1000 ------- 0 0.0 1.0 0 0
r 0.014004 0 1 tcp 1000 ------- 0 0.0 1.0 0 0
+ 0.014004 1 0 ack 40 ------- 0 1.0 0.0 0 1
- 0.014004 1 0 ack 40 ------- 0 1.0 0.0 0 1
r 0.024168 1 0 ack 40 ------- 0 1.0 0.0 0 1
--------------F152C21C14F2E97D359AF75B--