LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-06-2015, 05:03 PM   #1
Niggly91
LQ Newbie
 
Registered: Oct 2015
Posts: 1

Rep: Reputation: Disabled
Problem with Simple NS2 Simulation


Hello,

I have to do an assignment of my university. I have to simulate a very simple network consisting of only 2 nodes.

When I run my tcl-file in the terminal only errors follow and I don't know why.

Here is my simple code:

set ns [new Simulator]

set tracefile [open out.tr w]
$ns trace-all $tracefile

set cwndfile [open outcwnd.tr w]

set node1 [$ns node]
set node2 [$ns node]

$ns duplex-link $node1 $node2 1Mb 4ms DropTail

set queue 18
$ns queue-limit $node1 $node2 $queue

set tcp1 [new Agent/TCP]
$ns attach-agent $node1 $tcp1

set ftp [new Application/FTP]
$ftp attach-agent $tcp1

set tcpsink [new Agent/TCPSink]
$ns attach-agent $node2 $tcpsink

$ns connect $tcp1 $tcpsink

proc record {} {
global ns tcp1 cwndfile
set now [$ns now]
puts $cwndfile $now [$tcp1 set cwnd_]
$ns at [expr $now+0.01] record
}

proc finish {} {
global ns tracefile cwndfile

$ns flush-trace
close $tracefile
close $cwndfile

puts Simulation Complete!
$ns halt
}

$ns at 0.0 record
$ns at 0.0 $ftp start
$ns at 10 finish
puts Simulation Running
$ns run





When I run this, than I got this message:

(_o5 cmd line 1)
invoked from within
"_o5 cmd at 0.0 _o38 start"
invoked from within
"catch "$self cmd $args" ret"
invoked from within
"if [catch "$self cmd $args" ret] {
set cls [$self info class]
global errorInfo
set savedInfo $errorInfo
error "error when calling class $cls: $args" $..."
(procedure "_o5" line 2)
(SplitObject unknown line 2)
invoked from within
"_o5 at 0.0 _o38 start"
("eval" body line 1)
invoked from within
"eval $scheduler_ at $args"
(procedure "_o3" line 3)
(Simulator at line 3)
invoked from within
"$ns at 0.0 $ftp start"
(file "tcpTahoe.tcl" line 46)


I would be so glad, if you could help me. By the way, the script is from my teacher.

Thanks a lot!

Last edited by Niggly91; 10-06-2015 at 05:12 PM.
 
Old 10-07-2015, 10:44 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,518

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Welcome to LQ.

You have missing quotes in line 46, $ns at 0.0 $ftp start
and line 48, puts Simulation Running
... Must be
$ns at 0.0 "$ftp start"
$ns at 10 finish
puts "Simulation Running"

And there might also be quotes to add in line 45, $ns at 0.0 record
... To
$ns at 0.0 "record"

Solutions can be found by comparing with the 2,000 other simulation examples.
All examples : all_tcl-examples-2.tar.gz (41.8MB)
https://drive.google.com/file/d/0B7S...ew?usp=sharing

** There are still some issues in your file : With the "record" entries.
Example search command, All-examples/ : $ grep -n record *
>>> Example file with "record" : wireless-tcp.tcl


-
 
  


Reply

Tags
ns2


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
Simulation NS2 imen Linux - Newbie 2 08-24-2015 02:20 AM
simulation problem in ns2 shwetaam Linux - Newbie 3 04-10-2014 12:26 PM
NS2: Require eap-sim authentication code for simulation in ns2.24 noamankhatib Linux - Software 0 04-29-2013 12:03 PM
Simulation in NS2 shilpy Linux - Software 2 09-04-2012 07:57 AM
NS2 network simulation problem:Change queue parameters dynamically during simulation raeisy Linux - Networking 1 11-21-2010 11:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:30 AM.

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