-   Linux - Newbie (
-   -   new simulator problem (

Nanda27 05-19-2009 05:03 AM

new simulator problem
Hi all i hav problem in NS2. whenever creating an new simulator it shows an error for invalid command name "new". how to solve this problem plz help me

Thanks in advance


knudfl 05-20-2009 08:16 AM

Welcome to LQ.

A command in ns2 would be

'ns file.tcl'

Or what have you got, and which command are you doing ? ?

Nanda27 05-21-2009 05:16 AM

New simulator problem
set ns [new Simulator] - in this line throws an error for invalid command "new"

set n0 [$ns node]

set n1 [$ns node]

$ns duplex-link $n0 $n1 1Mb 2ms DropTail

set udp0 [new Agent/UDP]

$ns attach-agent $n0 $udp0

set cbr0 [new Application/Traffic/CBR]

$cbr0 attach-agent $udp0

set null0 [new Agent/Null]

$ns attach-agent $n1 $null0

$ns connect $udp0 $null0

$ns at 1.0 “$cbr0 start”
$ns run

why this happening and what software i need to install for this plz help me


knudfl 05-21-2009 08:43 AM

2 Attachment(s)
Example ( Template )

The 'file.tcl' :

set ns [new Simulator]

set nf [open out.nam w]
$ns namtrace-all $nf

proc finish {} {
        global ns nf
        $ns flush-trace
        close $nf
        exec nam out.nam &
        exit 0

$ns at 5.0 "finish"

$ns run

And 'ns file.tcl' shows .... see attached file ...

Please try out some of the examples in ns-2.33/tcl/ex/
and also see how they are written.

EDIT : Your code works ? ? .. see attached 'tcl files'
Rename to suffix .tcl before use.

knudfl 05-21-2009 09:24 AM

1 Attachment(s)
The file '3file3.tcl : Please push the play button ... and wait .....

Nanda27 05-22-2009 05:47 AM

Ns pblm
I hav installed active tcl only, i hav ns2.33 but i dont no how to install that give me an procedure to install ns2.33



Nanda27 05-22-2009 06:55 AM

i hav executed ur coding its not working throws an same error. I think i hav problem in my software, can u guide me how to install d ns 2.33.
Codings r correct but problem in only s/w i didnt installed ns and nam

knudfl 05-22-2009 07:49 AM

The commnand 'ns' will work only, when ns-2.33 +
nam-1.13 are compiled with no errors.

Suggest :
Install from source to /usr/local/ , in this order :
otcl-1.13, tclcl-1.19, ns-2.33, nam-1.13 .
cd /home/"user"/tmp
tar xvf <application>
cd <application>
./configure .......
make .. 'su' (or sudo) make install.

The source code for the tcl8.4 + tk8.4 installed on
your OS must be unpacked to the folder with otcl and
tclcl. Please configure otcl with :
'./configure --with-tcl=../tcl8.4(.xx)'
And tclcl :
'./configure --with-tcl=../tcl8.4(.xx) --with-tk=../tk8.4(.xx)'

The build requirements : It is a little different from Fedora's
to various Ubuntu's. Please tell which Linux, name, version,
to be used.
Ubuntu, Debian : (sudo) apt-get install libx11-dev libxmu-dev \
libxmu-headers libxt-dev tcl8.4-dev tk8.4-dev

Nanda27 05-23-2009 09:08 AM

Nam pblm
Hi i hav installed ns 2.29.2 with cygwin environment all my commands r working but if i execute $ ns example1b.tcl it throws an following error:

Sathya@server /usr/local/ns-allinone-2.29.2/ns-allinone-2.29/bin
$ ns example1b.tcl

Sathya@server /usr/local/ns-allinone-2.29.2/ns-allinone-2.29/bin
$ nam:
[code omitted because of length]
: no event type or button # or keysym
while executing
"bind Listbox <MouseWheel> {
%W yview scroll [expr {- (%D / 120) * 4}] units
invoked from within
"if {[string equal [tk windowingsystem] "classic"]
|| [string equal [tk windowingsystem] "aqua"]} {
bind Listbox <MouseWheel> {
%W yview scroll [expr {..."

Sathya@server /usr/local/ns-allinone-2.29.2/ns-allinone-2.29/bin

knudfl 05-23-2009 10:35 AM

'example1b.tcl' : Where did you find it ?

Please provide location, a link to the code,
or please show the code, attached or in code tags.

Nanda27 05-25-2009 12:55 AM

1 Attachment(s)
I got the code from here : coding has correct but problem in nam only it showing an error for nam could not open msg.
Plz help me..

Thanks and Regards..!


knudfl 05-25-2009 03:33 PM

1 Attachment(s)
Can 'nam' itself be run ?
Please try the command ./nam or nam , depending on
the PATH you have set ... and location, cd nam-1/ ?

'nam' will display the attached image ....

Nanda27 05-26-2009 01:49 AM

Hi i hav installed ns2 with cygwin environment nam also working fine now thanks for ur kind reply. i need one more help how to transfer file between one computer to another using ns2. if u hav any coding plz attach

Thanks and Regards..!


Nanda27 05-27-2009 07:14 AM

1 Attachment(s)
Hi while running my program it shows an following error:

$ ns tcp.tcl
invalid command name "Application/TCPCNT"
while executing
"Application/TCPCNT create _o65 "
invoked from within
"catch "$className create $o $args" msg"
invoked from within
"if [catch "$className create $o $args" msg] {
if [string match "__FAILED_SHADOW_OBJECT_" $msg] {
delete $o
return ""
global errorInfo
error "class $..."
(procedure "new" line 3)
invoked from within
"new Application/TCPCNT"
("for" body line 17)
invoked from within
"for {set i 0} {$i < $streams} {incr i} {
# 3. Create objects for the TCP sender and receiver and specify maximum
# window sizes
set tcpz($i) [new ..."
(file "tcp.tcl" line 37)
I want to send the file to another computer if u hav any coding plz attach me..!

Thanks and Regards


knudfl 05-27-2009 12:06 PM

1 Attachment(s)
# 14 : Code bug ?
Have a look at this 'tcp.tcl' ( Attached ) :


'ns 2tcp.tcl.txt' will create the file 'out.nam' in the
current directory. 'out.nam' can be used with nam :

'nam' > > File > "Open..." :
will display the simulation, please push "Play", and wait for a minute ...

All times are GMT -5. The time now is 09:45 AM.