Search code examples
c++tclns2

NS [Network Simulator] TCL and C++


i have written a protocol in c++ and would like to use NS to simulate and see the results.

i learned that TCL is the language used for it. I also found that C++ can be linked with TCL.

One of the method at link require to recompile the whole ns-package with the new cc files and doing some changes in some of the ns source files.

Is it required ? Would it take considerable time ? [more than 5 mins :( ]

Is there any better way ?


Solution

  • i learned that TCL is the language used for it. I also found that C++ can be linked with TCL.

    Both Tcl and C++ are used. Tcl is for writing the simulation script, i.e. a file that sets us a specific simulation scenario, and C++ is used for writing the protocols that will be implemented.

    One of the method at link require to recompile the whole ns-package with the new cc files and doing some changes in some of the ns source files.

    Is it required ? Would it take considerable time ? [more than 5 mins :( ]

    You can only avoid recompiling the whole package if you are using existing protocols, in which case you write a Tcl script to run your simulation. Since you want to implement a new protocol, you will definitely need to recompile the whole package.

    In order to do this you will have to install Linux, if you don't already have it, or a Linux emulator like cygwin.

    Then you should download and install the source code. I recommend the ns2 allinone package.

    After the ns2 installation is working, you can start porting your protocol to ns2. A Good introductory tutorial for ns2 is this. Section VII covers creating new protocols for ns2.

    So to answer your question

    • Yes you will need to recompile from source
    • Yes it will definitely take more that 5 minutes (Probably a few hours, depending on your experience).