NS2 PROJECT - need for check of the code

Status
Not open for further replies.

cbecer2003

Newbie level 6
Joined
Feb 28, 2006
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,364
NS2 PROJECT

hi,everyone
i have a homework about ns2.I've done something but i am not sure if it is true or not.Could you check for me?

Project

1. There are two nodes; one is server and the other is user
2. The capacity of the link is 1Mbit/s.
3. The propagation delay of the link is 10 ms.
4. Other properties of the link can be adjusted but should be declared well.
5. Experiment duration is 1 minute

My Code

set ns [new Simulator]

#Open the NAM trace file
set nf [open out.nam w]
$ns namtrace-all $nf

#Define a 'finish' procedure
proc finish {} {
global ns nf
$ns flush-trace
#Close the NAM trace file
close $nf
#Execute NAM on the trace file
exec nam out.nam &
exit 0
}

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

#Create links between the nodes
$ns duplex-link $n0 $n1 1Mb 10ms DropTail

#Give node position (for NAM)
$ns duplex-link-op $n0 $n1 orient right-down

#Setup a TCP connection
set tcp [new Agent/TCP]
$tcp set class_ 2
$ns attach-agent $n0 $tcp
set sink [new Agent/TCPSink]
$ns attach-agent $n1 $sink
$ns connect $tcp $sink
$tcp set fid_ 1

#Setup a FTP over TCP connection
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ftp set type_ FTP

$ns at 0.0 "$ftp start"
$ns at 60.0 "$ftp stop"

$ns at 125.0 "finish"

$ns run
 

hi

have you successfully able to communicate between layers?can you help me ?

I am also doing crosslayer in ns2.

please help[ me to proceed.

nans
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…