Skip to main content

PyTorch Code for Simple Neural Networks for MNIST Dataset

Creation of a New Agent in ns2 - NS2 Tutorial # 10

To create an new Agent in NS2 that describes the OTcl and C++ linkages

We know that the file is stored in the folder
~ns-2.35/pradeep/tspagent.cc

Open the file ns-2.35/Makefile.in and make an entry of your own file (in this case, it is tspagent.cc

Find a vairable inside the Makefile.in called

OBJ_CC=

and make an entry there as shown below pradeep/tspagent.o \

Save the file and open a terminal, go to the folder ~ns-2.35/ and execute the command one by one

$] ./configure
$] make

Correct any mistakes or errors in your .cc file and run the above commands.
Successful OTcl and C++ linkages....

Thank you and Stay tuned for more lectures

Next lecture will be on AODV protocol and its modification.

Refer my website nsnam.com for downloading the source code and refer my videos at

https://www.youtube.com/tspradeepkumar

Share and Subscribe.

Thank you......





Download the files here
https://drive.google.com/open?id=1kaIrYn91xl2NUNNK64cjHrEHyiSJCIiY



T S Pradeep Kumar

Comments

  1. Respected sir
    please solve this problem
    root@vikas:/usr/local/ns-allinone-2.35/ns-2.35/pardeep# make
    make: *** No targets specified and no makefile found. Stop.
    root@vikas:/usr/local/ns-allinone-2.35/ns-2.35/pardeep# cd ..
    root@vikas:/usr/local/ns-allinone-2.35/ns-2.35# make
    g++ -c -Wall -Wno-write-strings -DTCP_DELAY_BIND_ALL -DNO_TK -DTCLCL_CLASSINSTVAR -DNDEBUG -DLINUX_TCP_HEADER -DUSE_SHM -DHAVE_LIBTCLCL -DHAVE_TCLCL_H -DHAVE_LIBOTCL1_14 -DHAVE_OTCL_H -DHAVE_LIBTK8_5 -DHAVE_TK_H -DHAVE_LIBTCL8_5 -DHAVE_TCLINT_H -DHAVE_TCL_H -DHAVE_CONFIG_H -DNS_DIFFUSION -DSMAC_NO_SYNC -DCPP_NAMESPACE=std -DUSE_SINGLE_ADDRESS_SPACE -Drng_test -I. -I. -I/usr/local/ns-allinone-2.35/tclcl-1.20 -I/usr/local/ns-allinone-2.35/otcl-1.14 -I/usr/local/ns-allinone-2.35/include -I/usr/local/ns-allinone-2.35/include -I/usr/local/ns-allinone-2.35/include -I/usr/include/pcap -I./tcp -I./sctp -I./common -I./link -I./queue -I./adc -I./apps -I./mac -I./mobile -I./trace -I./routing -I./tools -I./classifier -I./mcast -I./diffusion3/lib/main -I./diffusion3/lib -I./diffusion3/lib/nr -I./diffusion3/ns -I./diffusion3/filter_core -I./asim/ -I./qs -I./diffserv -I./satellite -I./wpan -o mdart/mdart_adp.o mdart/mdart_adp.cc
    mdart/mdart_adp.cc: In member function ‘void ADP::sendDarq(nsaddr_t, int)’:
    mdart/mdart_adp.cc:108:21: error: reference to ‘hash’ is ambiguous
    nsaddr_t dstAdd_ = hash(reqId);
    ^~~~
    In file included from ./mdart/mdart.h:52:0,
    from ./mdart/mdart_adp.h:51,
    from mdart/mdart_adp.cc:47:
    ./mdart/mdart_function.h:230:17: note: candidates are: nsaddr_t hash(nsaddr_t)
    inline nsaddr_t hash(nsaddr_t id) {
    ^~~~
    In file included from /usr/include/c++/7/bits/basic_string.h:6587:0,
    from /usr/include/c++/7/string:52,
    from /usr/include/c++/7/bitset:47,
    from ./mdart/mdart_function.h:62,
    from ./mdart/mdart.h:52,
    from ./mdart/mdart_adp.h:51,
    from mdart/mdart_adp.cc:47:
    /usr/include/c++/7/bits/functional_hash.h:58:12: note: template struct std::hash
    struct hash;
    ^~~~
    mdart/mdart_adp.cc: In member function ‘void ADP::sendDaup()’:
    mdart/mdart_adp.cc:396:21: error: reference to ‘hash’ is ambiguous
    nsaddr_t dstAdd_ = hash(mdart_->id_);
    ^~~~
    In file included from ./mdart/mdart.h:52:0,
    from ./mdart/mdart_adp.h:51,
    from mdart/mdart_adp.cc:47:
    ./mdart/mdart_function.h:230:17: note: candidates are: nsaddr_t hash(nsaddr_t)
    inline nsaddr_t hash(nsaddr_t id) {
    ^~~~
    In file included from /usr/include/c++/7/bits/basic_string.h:6587:0,
    from /usr/include/c++/7/string:52,
    from /usr/include/c++/7/bitset:47,
    from ./mdart/mdart_function.h:62,
    from ./mdart/mdart.h:52,
    from ./mdart/mdart_adp.h:51,
    from mdart/mdart_adp.cc:47:
    /usr/include/c++/7/bits/functional_hash.h:58:12: note: template struct std::hash
    struct hash;
    ^~~~
    Makefile:93: recipe for target 'mdart/mdart_adp.o' failed
    make: *** [mdart/mdart_adp.o] Error 1

    ~/usr/local/ns-allinone-2.35/ns-2.35/pardeep# ls
    myown.tcl tspagent.cc tspagent.o
    ~/usr/local/ns-allinone-2.35/ns-2.35/pardeep# ns myown.tcl
    invalid command name "Agent/PRADEEP"
    while executing
    "Agent/PRADEEP create _o3 "
    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 Agent/PRADEEP"
    invoked from within
    "set xyz [new Agent/PRADEEP]"
    (file "myown.tcl" line 1)

    ReplyDelete
  2. Dear Sir, tell us how to create a UDP agent that can receive packets from the source then send the received packets to another node (the destination).
    Is there any Agent in ns2 that can do this?

    ReplyDelete
  3. Please tell me in details how can I create a new Agent that can forward to same received packet to another destination. I tried hard to do this since more than 1 year, please help me.

    ReplyDelete

Post a Comment

Popular posts from this blog

Installing ns3 in Ubuntu 22.04 | Complete Instructions

In this post, we are going to see how to install ns-3.36.1 in Ubuntu 22.04. You can follow the video for complete details Tools used in this simulation: NS3 version ns-3.36.1  OS Used: Ubuntu 22.04 LTS Installation of NS3 (ns-3.36.1) There are some changes in the ns3 installation procedure and the dependencies. So open a terminal and issue the following commands Step 1:  Prerequisites $ sudo apt update In the following packages, all the required dependencies are taken care and you can install all these packages for the complete use of ns3. $ sudo apt install g++ python3 python3-dev pkg-config sqlite3 cmake python3-setuptools git qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools gir1.2-goocanvas-2.0 python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython3 openmpi-bin openmpi-common openmpi-doc libopenmpi-dev autoconf cvs bzr unrar gsl-bin libgsl-dev libgslcblas0 wireshark tcpdump sqlite sqlite3 libsqlite3-dev  libxml2 libxml2-dev libc6-dev libc6-dev-i386 libclang-dev llvm-

Installation of NS2 (ns-2.35) in Ubuntu 20.04

Installation of NS2 (ns-2.35) in Ubuntu 20.04 LTS Step 1: Install the basic libraries like      $] sudo apt install build-essential autoconf automake libxmu-dev Step 2: install gcc-4.8 and g++-4.8 open the file using sudo mode $] sudo nano /etc/apt/sources.list Include the following line deb http://in.archive.ubuntu.com/ubuntu bionic main universe $] sudo apt update $] sudo apt install gcc-4.8 g++-4.8 Step 3:  Unzip the ns2 packages to home folder $] tar zxvf ns-allinone-2.35.tar.gz $] cd ns-allinone-2.35/ns-2.35 Modify the following make files. ~ns-2.35/Makefile.in Change @CC@ to gcc-4.8 change @CXX@ to g++-4.8 ~nam-1.15/Makefile.in ~xgraph-12.2/Makefile.in ~otcl-1.14/Makefile.in Change in all places  @CC@ to gcc-4.8 @CPP@ or @CXX@ to g++-4.8 open the file: ~ns-2.35/linkstate/ls.h Change at the Line no 137  void eraseAll() { erase(baseMap::begin(), baseMap::end()); } to This void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); } All changes made Step 4: Open a new termi

Installation of NS2 in Ubuntu 22.04 | NS2 Tutorial 2

NS-2.35 installation in Ubuntu 22.04 This post shows how to install ns-2.35 in Ubuntu 22.04 Operating System Since ns-2.35 is too old, it needs the following packages gcc-4.8 g++-4.8 gawk and some more libraries Follow the video for more instructions So, here are the steps to install this software: To download and extract the ns2 software Download the software from the following link http://sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.35/ns-allinone-2.35.tar.gz/download Extract it to home folder and in my case its /home/pradeepkumar (I recommend to install it under your home folder) $ tar zxvf ns-allinone-2.35.tar.gz or Right click over the file and click extract here and select the home folder. $ sudo apt update $ sudo apt install build-essential autoconf automake libxmu-dev gawk To install gcc-4.8 and g++-4.8 $ sudo gedit /etc/apt/sources.list make an entry in the above file deb http://in.archive.ubuntu.com/ubuntu/ bionic main universe $ sudo apt update Since, it&#