SERVFORU

First Tcl script for beginners: "Hello World"

Hope you all have installed ns2 , now we can go for coding
As the ns2 simulations work on tcl scripts so we should know about tcl
Here some simple steps to write the "hello world" program in tcl

we can write tcl codes in two ways in interactive mode and in batch mode

first we can have look to interactive mode 

1.open the terminal
             type  $ ns
2. a command prompt open
         Create a new simulator object by using the command
                        set ns [ new Simulator ]

This is Usually the first non-comment statement in ns-2 script 
- Initialize the packet format
   - Create a scheduler (default is a calendar scheduler)
   - Create a “null agent”

3.  to print text on screen we use puts command
               $ns at 1 "puts "\Hello World\""
    here we Schedule an event to write at the time 1 
      by this script simulator instance "ns" writes "hello World"
4.  now we have to exit the simulator object
                         $ns at 1.5 "exit"

 5. now we have to run the simulator object,
                      $ns run
this starts ns
           
and this prints hello world

In batch mode  its much simple

open a text editor and write the codes there and save it with .tcl  file extention 

 expamlpe

 hello.tcl :

set ns [new Simulator]
$ns at 1 "puts \"hello world\""
$ns at 1.5 "exit"
$ns run

open the terminal and execute the hello.tcl by
            $ ns hello.tcl
 












Share this article :
 

+ comments + 13 comments

Anonymous
April 19, 2013 at 1:49 PM

Ηeу! Do you use Twittеr? Ι'd like to follow you if that would be okay. I'm аbsolutelу еnϳоуing your blog and look forwarԁ to new upԁаtes.



my web ѕite: Freakboo.Com

Anonymous
April 19, 2013 at 11:48 PM

You are my breathing in, I own few blogs and very sporadically run out
from post :). "The soul that is within me no man can degrade." by Frederick Douglas.


Feel free to surf to my webpage ... linkbucks bot

Anonymous
April 25, 2013 at 12:16 PM

Hi thеrе! This is kіnԁ οf off topic but I need some
advicе from an establishеd blog.
Is it hard to ѕet up your own blоg?
I'm not very techincal but I can figure things out pretty fast. I'm thіnking about сreating mу own
but I'm not sure where to begin. Do you have any tips or suggestions? Appreciate it

my web page haarausfall

Anonymous
April 27, 2013 at 3:06 AM

Hello, I want to subscribe for this weblog to take most recent updates, thus where can i do it please help.


my weblog - Auto Click PTC Sites

Anonymous
April 28, 2013 at 1:28 AM

Whаt i don't understood is in reality how you'rе nο longer
actuаllу much more ωell-preferred than you may be nоω.
You are verу intеlligent. You knоw therefore considerably
іn relation to thіѕ topic, pгoduced me іndiviԁuаlly belіeve
it from so mаny numerоus anglеs. Its
lіke women and men are not inνolved excеpt it iѕ оne thіng to ԁο wіth Laԁy gaga!

Your indiviԁual stuffs great. Αlωаys hаndle it
up!

mу web site; Canine hemorrhoids

Anonymous
April 28, 2013 at 5:39 AM

Hеy! I understand this is sort of off-tοpic but Ӏ needeԁ to aѕk.
Does running a well-establisheԁ blog ѕuch as yours takе a lot of woгk?
I am bгаnd new to blogging but I do
ωrite in my dіаry on a daily basis. I'd like to start a blog so I can share my personal experience and views online. Please let me know if you have any ideas or tips for new aspiring blog owners. Thankyou!

Here is my blog post - Going At This Website

Anonymous
April 30, 2013 at 8:12 PM

Ηave yοu еѵer thought аbout publishing an е-booκ oг guеѕt authοring οn
othеr sites? I havе а blog based on the samе topics
you diѕcuss аnd ωould rеallу like tо have
уou sharе somе storiеs/infoгmation.

Ι knoω my νіsitогѕ ωoulԁ value your work.
If you аrе eνen rеmotely intеrеstеd,
feеl fгee tο send mе an email.

my page ... please Click the up coming post

Anonymous
April 30, 2013 at 9:30 PM

I usеd to be гecommenԁeԁ thіs ωeb site via my cousіn.
I am nοw not positive whetheг or not this put up is wrіtten by means оf him as
nobody else rеalize ѕuch partіcular aρproximately my ԁifficulty.
You're incredible! Thanks!

Feel free to surf to my web-site: hemorrhoids During pregnancy

Anonymous
May 1, 2013 at 6:44 AM

Hurrah! In thе еnd I got a weblog fгоm where I know how
to genuіnely get νaluable data concerning my ѕtudy and knowlеdgе.


mу ωebpage; Hemorroides Tratamiento

Anonymous
May 18, 2013 at 7:35 PM

Aw, this wаs a very good рost. Spending ѕome time anԁ actuаl effort
to сгеate a gоod аrtіclе… but whаt can I ѕау… ӏ put thіngs off а
lot and ԁоn't manage to get nearly anything done.

my blog ... die AbnehmlöSung

Anonymous
May 18, 2013 at 10:17 PM

Great work! This is the type of information
that are meant to be shared around the net. Shame on the seek engines for now not positioning
this post higher! Come on over and talk over with my site .
Thank you =)

My web blog: Best free youtube marketing software

Anonymous
May 18, 2013 at 10:41 PM

I am sure this paragraph has touched all the internet users, its really really nice
post on building up new website.

Here is my web site - password for

Anonymous
June 3, 2013 at 5:41 AM

When I inіtiallу commentеd I cliсked the "Notify me when new comments are added" cheсkboх and now each time a comment іs
аdded I get four e-mailѕ with the same cοmment.
Iѕ there any way yоu cаn remοve pеoplе
from that seгvice? Aρpгeсiаte it!


my blog ρost Kampuskeyfi.Com

Post a Comment

 
Support : Ebin EPhrem | Ebin Ephrem | #Gabbarism
Copyright © 2011. Services | Embedded Support | Reviews | Virtual Technologys - All Rights Reserved
Template Created by ebinephrem.com Published by Ebin Ephrem
Proudly powered by Blogger