Giter Site home page Giter Site logo

basic doubt about ns3-focal HOT 2 CLOSED

rochadiego avatar rochadiego commented on July 29, 2024
basic doubt

from ns3-focal.

Comments (2)

rochadiego avatar rochadiego commented on July 29, 2024 1

hey man, it works! 😃

thank you so much.

greetings from brazil. 🇧🇷

from ns3-focal.

Luxxii avatar Luxxii commented on July 29, 2024

Here a small tutorial on how to add own scripts.

You can easily navigate most of the images by executing docker run -it luxii/ns3-focal /bin/bash.

Your command line would then show something like:

[<My Computer>]$ docker run -it luxii/ns3-focal /bin/bash
root@1c3d1b88e5ed:/ns3/ns-allinone-3.31/ns-3.31# 

You can then run ll ls la, pwd and all the other command you may need, to know what is going on inside this image :)


Now on to building. I followed this tutorial to test it out.

First, we need a soruce file, which i have added on my local computer in: home/user/project/mycode/first.cc (this can also be more complex than a single file). The tutorial mentions that those files need to be added into the scratch-folder. So lets add it, see if it exists, build it and lastly execute first.ccs code:

[<My Computer>]$ docker run -it -v /home/user/project/mycode/:/ns3/ns-allinone-3.31/ns-3.31/scratch  luxii/ns3-focal /bin/bash

root@d66f2cb97220:/ns3/ns-allinone-3.31/ns-3.31# ls scratch/
first.cc

root@d66f2cb97220:/ns3/ns-allinone-3.31/ns-3.31# ./waf
Waf: Entering directory `/ns3/ns-allinone-3.31/ns-3.31/build'
[2810/2881] Compiling scratch/first.cc
[2841/2881] Linking build/scratch/first
Waf: Leaving directory `/ns3/ns-allinone-3.31/ns-3.31/build'
Build commands will be stored in build/compile_commands.json
'build' finished successfully (10.011s)

root@d66f2cb97220:/ns3/ns-allinone-3.31/ns-3.31# ./waf --run scratch/first
Waf: Entering directory `/ns3/ns-allinone-3.31/ns-3.31/build'
Waf: Leaving directory `/ns3/ns-allinone-3.31/ns-3.31/build'
Build commands will be stored in build/compile_commands.json
'build' finished successfully (1.698s)
At time 2s client sent 1024 bytes to 10.1.1.2 port 9
At time 2.00369s server received 1024 bytes from 10.1.1.1 port 49153
At time 2.00369s server sent 1024 bytes to 10.1.1.1 port 49153
At time 2.00737s client received 1024 bytes from 10.1.1.2 port 9

So far, this image can build and execute a custom script. Luckily waf can build the sources automatically, so that only one command (./waf --run scratch/first) needs to be executed. You can test this yourself.

For a one liner, not going into this image (via/bin/bash), you can run the following:

docker run -v /home/user/project/mycode/:/ns3/ns-allinone-3.31/ns-3.31/scratch luxii/ns3-focal "./waf --run scratch/first"

Giving you the following output:

Waf: Entering directory `/ns3/ns-allinone-3.31/ns-3.31/build'
[2810/2881] Compiling scratch/first.cc
[2841/2881] Linking build/scratch/first
Waf: Leaving directory `/ns3/ns-allinone-3.31/ns-3.31/build'
Build commands will be stored in build/compile_commands.json
'build' finished successfully (8.527s)
At time 2s client sent 1024 bytes to 10.1.1.2 port 9
At time 2.00369s server received 1024 bytes from 10.1.1.1 port 49153
At time 2.00369s server sent 1024 bytes to 10.1.1.1 port 49153
At time 2.00737s client received 1024 bytes from 10.1.1.2 port 9

from ns3-focal.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.