[ns] segmentation fault extending ns2 because of more output channels: how to fix it???

Adriano Galati azg at Cs.Nott.AC.UK
Thu Dec 6 11:59:27 PST 2007


Hi everybody,

I am extending ns2 and below is my script tcl.
I have realized that my tcl script works only with one output stream. 
For example, If at the script below I take off the "open a file" part 
and the "puts" function in the finish{} then the tcl script works.
Any idea?
Thanks
Adriano

# Create a simulator object
set ns [new Simulator]

#Open a file
set f [open out.tr w]
$ns trace-all $f

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

# Define a 'finish' procedure
proc finish {} {
       global ns f nf
       $ns flush-trace
   close $f
   close $nf

      puts "Starting nam..."
       exec nam out.nam &
       exit 0
}


#Create nodes
set node1 [$ns node]
set node2 [$ns node]

#Create the agent for the first node
set dtn1 [new Agent/DTNAgent]

#Create another Agent for the second node
set dtn2 [new Agent/DTNAgent]

#attach the agents to the nodes
$ns attach-agent $node1 $dtn1
$ns attach-agent $node2 $dtn2

#Set local region
$dtn1 region "REGION1"
$dtn2 region "REGION2"

#Setup routing table
#$dtn1 add "REGION2" $dtn2 1 1 1500
#$dtn2 add "REGION1" $dtn1 1 1 1500

# Set endtime
$ns at 100.0 "finish"

# Run the simulation
$ns run

This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.



More information about the Ns-users mailing list