Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 12-23-2011, 09:08 AM   #1
LQ Newbie
Registered: Dec 2011
Posts: 5

Rep: Reputation: Disabled
Working with ns2-34

Hello again,
I have created tcl script for simple packet transsmision: FTP over TCP and CBR over UDP:
set ns [new Simulator]
set nf [open out.nam w]
$ns namtrace-all $nf

$ns color 1 Blue
$ns color 2 Red

proc finish {} {
global ns nf
$ns flush-trace
close $nf
exec nam out.nam &
exit 0

set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]
set n5 [$ns node]

$ns duplex-link $n0 $n2 1Mb 10ms DropTail
$ns duplex-link $n1 $n2 1Mb 10ms DropTail
$ns duplex-link $n2 $n3 1Mb 10ms DropTail
$ns duplex-link $n3 $n4 1Mb 10ms DropTail
$ns duplex-link $n3 $n5 1Mb 10ms DropTail

$ns duplex-link-op $n0 $n2 orient right-down
$ns duplex-link-op $n1 $n2 orient right-up
$ns duplex-link-op $n2 $n3 orient right
$ns duplex-link-op $n3 $n4 orient right-up
$ns duplex-link-op $n3 $n5 orient right-down

set tcp0 [new Agent/TCP]
set sink0 [new Agent/TCPSink]
$ns attach-agent $n0 $tcp0
$ns attach-agent $n4 $sink0

set ftp0 [new Application/FTP]
$ftp0 set type_ FTP

$ftp0 attach-agent $tcp0

$ns connect $tcp0 $sink0

set udp0 [new Agent/UDP]
set null1 [new Agent/Null]
$ns attach-agent $n1 $udp0
$ns attach-agent $n5 $null1

set cbr0 [new Application/Traffic/CBR]
$cbr0 set packetSize_ 500
$cbr0 set interval_ 0.005

$cbr0 attach-agent $udp0

$ns connect $udp0 $null1

$tcp0 set class_ 1
$udp0 set class_ 2

$ns at 1 "$ftp0 start"
$ns at 4.5 "$ftp0 stop"
$ns at 1.5 "$cbr0 start"
$ns at 4 "$cbr0 stop"

$ns at 5.0 "finish"
$ns run
The things I need to do now are following: change size of congestion window to 10 and record traffic with xgraph. Hope someone can help me...


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
patch for working leach protocol in ns2.34 fedora rajcek Linux - Wireless Networking 4 02-04-2013 06:59 AM
publish command is not working in rmstsource + diffusion + ns2 AnasAmer Linux - Software 0 08-27-2011 07:10 PM
[SOLVED] ns2 nam not working in fedora 14 mujtiba Linux - Newbie 7 05-24-2011 07:30 AM
problem in installing working NS2 and ATM patch kshitiz Linux - Software 2 03-02-2011 11:30 AM
working with ns2 in Ubuntu 8.1 neeraj.dwivedi Linux - Newbie 5 11-16-2009 09:19 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:11 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration