LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 04-23-2014, 11:18 PM   #1
ramshank
LQ Newbie
 
Registered: Apr 2014
Posts: 3

Rep: Reputation: Disabled
Segmentation fault (Core dumped)


I tried a simple program with 11 nodes and 3 routers. Here is the code...
set ns [new Simulator]
#Definedifferent colors for data flows (for NAM)
$ns color 1 Blue
$ns color 2 Red
#Open theTrace file
set file1 [open out.tr w]
$ns namtrace-all $file1
#Open theNAMtrace file
set file2 [open out.nam w]
$ns namtrace-all $file2
#Definea 'finish' procedure
proc finish {} {
global ns file1 file2
$ns flush-trace
close $file1
close $file2
exec nam out.nam &
exit 0
}
#Node creation
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]
set n5 [$ns node]
set n6 [$ns node]
set n7 [$ns node]
set n8 [$ns node]
set n9 [$ns node]
set n10 [$ns node]
set r1 [$ns node]
set r2 [$ns node]
set r3 [$ns node]
set n11 [$ns node]
#Connection
$ns duplex-link $n1 $r1 1Mb 10ms DropTail
$ns duplex-link $n2 $r1 1Mb 10ms DropTail
$ns duplex-link $n3 $r1 1Mb 10ms DropTail
$ns duplex-link $n4 $r1 1Mb 10ms DropTail
$ns duplex-link $n5 $r1 1Mb 10ms DropTail
$ns duplex-link $n6 $r2 1Mb 10ms DropTail
$ns duplex-link $n7 $r2 1Mb 10ms DropTail
$ns duplex-link $n8 $r2 1Mb 10ms DropTail
$ns duplex-link $n9 $r2 1Mb 10ms DropTail
$ns duplex-link $n10 $r2 1Mb 10ms DropTail
$ns duplex-link $r1 $r3 1Mb 10ms DropTail
$ns duplex-link $r2 $r3 1Mb 10ms DropTail
$ns duplex-link $r3 $n11 1Mb 10ms DropTail
#Creating UDP
set udp1 [new Agent/UDP]
$udp1 set class_ 1
$ns attach-agent $n1 $udp1
#node2
set udp2 [new Agent/UDP]
$udp2 set class_ 2
$ns attach-agent $n2 $udp2
#node3
set udp3 [new Agent/UDP]
$udp3 set class_ 3
$ns attach-agent $n3 $udp3
#node4
set udp4 [new Agent/UDP]
$udp4 set class_ 4
$ns attach-agent $n4 $udp4
#node5
set udp5 [new Agent/UDP]
$udp5 set class_ 5
$ns attach-agent $n5 $udp5
#node6
set udp6 [new Agent/UDP]
$udp6 set class_ 6
$ns attach-agent $n6 $udp6
#node7
set udp7 [new Agent/UDP]
$udp7 set class_ 7
$ns attach-agent $n7 $udp7
#node8
set udp8 [new Agent/UDP]
$udp8 set class_ 8
$ns attach-agent $n8 $udp8
#node9
set udp9 [new Agent/UDP]
$udp9 set class_ 9
$ns attach-agent $n9 $udp9
#node10
set udp10 [new Agent/UDP]
$udp10 set class_ 10
$ns attach-agent $n10 $udp10
set udp1 [new Agent/UDP]
# Create a CBR traffic source and attach it to udp
set cbr1 [new Application/Traffic/CBR]
$cbr1 set packetSize_ 500
$cbr1 set interval_ 0.005
$cbr1 attach-agent $udp1
#udp2
set cbr2 [new Application/Traffic/CBR]
$cbr2 set packetSize_ 500
$cbr2 set interval_ 0.005
$cbr2 attach-agent $udp2
#udp3
set cbr3 [new Application/Traffic/CBR]
$cbr3 set packetSize_ 500
$cbr3 set interval_ 0.005
$cbr3 attach-agent $udp3
#udp4
set cbr4 [new Application/Traffic/CBR]
$cbr4 set packetSize_ 500
$cbr4 set interval_ 0.005
$cbr4 attach-agent $udp4
#udp5
set cbr5 [new Application/Traffic/CBR]
$cbr5 set packetSize_ 500
$cbr5 set interval_ 0.005
$cbr5 attach-agent $udp5
#udp6
set cbr6 [new Application/Traffic/CBR]
$cbr6 set packetSize_ 500
$cbr6 set interval_ 0.005
$cbr6 attach-agent $udp6
#udp7
set cbr7 [new Application/Traffic/CBR]
$cbr7 set packetSize_ 500
$cbr7 set interval_ 0.005
$cbr7 attach-agent $udp7
#udp8
set cbr8 [new Application/Traffic/CBR]
$cbr8 set packetSize_ 500
$cbr8 set interval_ 0.005
$cbr8 attach-agent $udp8
#udp9
set cbr9 [new Application/Traffic/CBR]
$cbr9 set packetSize_ 500
$cbr9 set interval_ 0.005
$cbr9 attach-agent $udp9
#udp10
set cbr10 [new Application/Traffic/CBR]
$cbr10 set packetSize_ 500
$cbr10 set interval_ 0.005
$cbr10 attach-agent $udp10
#null
set null0 [new Agent/Null]
$ns attach-agent $n11 $null0
#connecting traffic sources to null
$ns connect $udp1 $null0
$ns connect $udp2 $null0
$ns connect $udp3 $null0
$ns connect $udp4 $null0
$ns connect $udp5 $null0
$ns connect $udp6 $null0
$ns connect $udp7 $null0
$ns connect $udp8 $null0
$ns connect $udp9 $null0
$ns connect $udp10 $null0
#scheduling
$ns at 0.5 "$cbr1 start"
$ns at 0.6 "$cbr2 start"
$ns at 0.7 "$cbr3 start"
$ns at 0.8 "$cbr4 start"
$ns at 0.9 "$cbr5 start"
$ns at 1.0 "$cbr6 start"
$ns at 1.1 "$cbr7 start"
$ns at 1.2 "$cbr8 start"
$ns at 1.3 "$cbr9 start"
$ns at 1.4 "$cbr10 start"
$ns at 8.5 "$cbr10 stop"
$ns at 8.6 "$cbr9 stop"
$ns at 8.7 "$cbr8 stop"
$ns at 8.8 "$cbr7 stop"
$ns at 8.9 "$cbr6 stop"
$ns at 8.0 "$cbr5 stop"
$ns at 8.1 "$cbr4 stop"
$ns at 8.2 "$cbr3 stop"
$ns at 8.3 "$cbr2 stop"
$ns at 8.4 "$cbr1 stop"
#Stopping
$ns at 10.0 "finish"
#run
$ns run

It shows segmentation fault (Core dumped) when executed.
(I'm working in windows)
Please help me, I'm new to this tcl and ns2.
 
Old 04-24-2014, 01:52 AM   #2
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 16,825

Rep: Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408
Quote:
(I'm working in windows)
you might want to post to a MICROSOFT forum

and tell tham what os you are using
Windows 2000
Windows ME
windows XP
Vista
7
8
8.1
8.1 update1
 
1 members found this post helpful.
Old 04-24-2014, 03:11 AM   #3
ramshank
LQ Newbie
 
Registered: Apr 2014
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thanks for the attention...!!!
And I corrected the error myself, its a fairly simple one, a beginner's mistake.
 
Old 04-24-2014, 03:31 AM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2016, Slack14.1 Deb Jessie, + 50+ other Linux OS, for test only.
Posts: 16,276

Rep: Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154
Welcome to LQ.

Code is supposed to be presented in Code Tags :
Type [/code] at code end, and [code] at code start.
. http://www.linuxquestions.org/questi....php?do=bbcode
. http://www.linuxquestions.org/questi...gs-4175464257/
.... Or use the ` # ´ button in the 'Advanced Editor'.
* Please edit post #1, to Code Tags : The 'Edit' button.

Your »tcl code« : Not easy to read.
Suggest : Split up the text, into sections.
* The sequence may be wrong :
As it is now it can output 'Segmentation fault' only.

Here is a nice example that works : ZHIBIN-WU.tcl ( 1 2 3 )
http://www.winlab.rutgers.edu/~zhibi.../NS_examp.html

-
 
1 members found this post helpful.
Old 04-24-2014, 03:35 AM   #5
ramshank
LQ Newbie
 
Registered: Apr 2014
Posts: 3

Original Poster
Rep: Reputation: Disabled
As I said I'm new to this programing, but I figured it out and got the required output.
Thanks again
 
  


Reply


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
Segmentation fault (core dumped) mayankladoia Programming 4 07-17-2010 03:11 AM
Segmentation fault (core dumped) nasim751 Programming 2 01-28-2008 03:56 PM
Segmentation fault (core dumped) nasim751 Programming 1 01-27-2008 10:18 PM
Segmentation fault (core dumped) eytan *BSD 3 04-27-2005 09:38 PM
Segmentation fault (core dumped) hasanaydin Linux - General 0 03-27-2002 08:47 AM


All times are GMT -5. The time now is 11:15 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration