| View previous topic :: View next topic |
| Author |
Message |
jnc_xavier Voice
Joined: 20 Aug 2011 Posts: 4 Location: India
|
Posted: Sat Aug 20, 2011 8:57 am Post subject: Proc Finish? |
|
|
when i execute this file i get the error as said below. plz help
| Code: |
#Create a ns simulator
set ns [new Simulator]
#Open the NS trace file
set tracefile [open out1.tr w]
$ns trace-all $tracefile
#Open the NAM trace file
set namfile [open out1.nam w]
$ns namtrace-all $namfile
#===================================
# Nodes Definition
#===================================
#Create 3 nodes
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
#===================================
# Links Definition
#===================================
#Createlinks between nodes
$ns duplex-link $n0 $n1 100.0Mb 10ms DropTail
$ns queue-limit $n0 $n1 50
$ns duplex-link $n0 $n2 100.0Mb 10ms DropTail
$ns queue-limit $n0 $n2 50
#Give node position (for NAM)
$ns duplex-link-op $n0 $n1 orient right-down
$ns duplex-link-op $n0 $n2 orient right-down
#===================================
# Agents Definition
#===================================
#===================================
# Applications Definition
#===================================
#===================================
# Termination
#===================================
#Define a 'finish' procedure
proc finish {}
{
global ns tracefile namfile
$ns flush-trace
close $tracefile
close $namfile
exec nam -a out1.nam &
exit 0
}
$ns at 10.0 "finish"
$ns run
|
ERROR THAT SHOWS UP:
| Quote: |
wrong #args: should be "proc name args body"
while executing
"proc finish {}"
(file wired2node.tcl line 71)
|
_________________ Jan Xavier |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sat Aug 20, 2011 9:07 am Post subject: |
|
|
In tcl, all arguments must be on the same line (though each argument may contain newlines)
Thus, this is incorrect:
| Code: | proc finish {}
{
... |
The proper code would look like this:
| Code: | proc finish {} {
... |
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
jnc_xavier Voice
Joined: 20 Aug 2011 Posts: 4 Location: India
|
Posted: Sat Aug 20, 2011 9:27 am Post subject: |
|
|
but that too aint working. could u plz help _________________ Jan Xavier |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sat Aug 20, 2011 9:32 am Post subject: |
|
|
Changing the definition of "finish" into this:
| Code: | proc finish {} {
global ns tracefile namfile
$ns flush-trace
close $tracefile
close $namfile
exec nam -a out1.nam &
exit 0
} |
Should sort the posted error message. Please post any new error messages you get. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
sh.minaee Voice
Joined: 02 Mar 2014 Posts: 1
|
Posted: Sun Mar 02, 2014 2:17 am Post subject: |
|
|
I've did that, but this time i have this error :
ns: finish: wrong # args: should be "close channelId"
while executing
"close $tracefile # close tracefile"
(procedure "finish" line 5)
invoked from within
"finish" |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun Mar 02, 2014 11:16 am Post subject: |
|
|
Remove the comment (# close tracefile) from your code...
Or prefix the # with a ;
Such as this:
| Code: | ...
close $tracefile ;# close tracefile
|
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
|