-1

I am simulating Wireless Sensor Network using NS2.35 and I get an error saying

ns: 217: invalid command name "217" while executing "217"

I have no where used such command throughput my tcl file. Can any one help why I get this error?

shim_mang
  • 323
  • 4
  • 17

2 Answers2

0

invalid command name "217" :

"217" is an internal command in your 'ns' executable.

Please tell which changes you made to ns-2.35/, if any. (WSN ?)

And please upload your "wsn.tcl" file to e.g. 'Google Docs'.

Knud Larsen
  • 5,753
  • 2
  • 14
  • 19
0

You've probably used a variable containing a numeric value as a command name, perhaps by putting it at the start of a line or by placing [brackets] around it (because brackets do command substitution). The brackets can be even embedded in a string:

This example demonstrates what I mean:

set xyz 217
puts "This is [$xyz] in brackets"

If you want to print some literal brackets out around a variable, you have to add some backslashes:

set xyz 217
puts "This is \[$xyz\] in brackets"

The problem could also be if you've got a command that returns 217 and you've put brackets around it at the start of a line (or in other places where a command is expected):

proc xyz {} {
    return 217
}
[xyz]

You've not shown us your code so which exact possibility it is… we can't tell. But I bet it'll be one of these problems. Tcl cares about its syntax characters, and is very exacting about making sure they do what they say they do.

Donal Fellows
  • 133,037
  • 18
  • 149
  • 215