Creation of broadcast nodes

137 views
Skip to first unread message

tuenkam steve

unread,
Feb 23, 2016, 10:22:56 PM2/23/16
to ns-3-users
Hi every body, i am new user of NS3. I want to know how i can  create two nodes which communicate by broadcasting. I don't well understand the manual

Tommaso Pecorella

unread,
Feb 24, 2016, 4:05:25 AM2/24/16
to ns-3-users
Hi,

I'd suggest to re-read the tutorial, not the manual first.
If you don't understand how two nodes can broadcast packets... well, perhaps you should ask for a clarification on a specific thing, not on the whole problem.

T.

tuenkam steve

unread,
Feb 25, 2016, 9:28:50 PM2/25/16
to ns-3-users
i want to create new wireless model based on NS3 wireles model for opportunistic routing. I can't use AP for that implementation.

Tommaso Pecorella

unread,
Feb 26, 2016, 3:08:50 AM2/26/16
to ns-3-users
Sorry but I don't see the question in this statement.
What you want to do is not really important (for me). if you have a specific issue about the code or you didn't understand a page in the manual, feel free to ask. However, you can not expect that we explain here how ns-3 (or networking) works.

T.

tuenkam steve

unread,
Feb 28, 2016, 7:18:41 PM2/28/16
to ns-3-users
Hi, i am  a master student and for an assignment, i want to know if it is possible to create a sensor for WSN. if yes, how ? if no, why ?

Tommaso Pecorella

unread,
Feb 28, 2016, 8:26:12 PM2/28/16
to ns-3-users
Hi,

short answer:
I'm sorry but I have little or no time to waste on repeating the stuff that is clearly explained in the tutorial.
Please read the tutorial and understand it. As soon as you have reached the necessary basic knowledge, feel free to ask what you need.

Long answer:
Yes, it is possible, but since you don't explain what a "sensor" is for you and what a "WSN" is for you, the answer is no.
Yes: because you can simulate any wireless or wired technology (with enough time and skills).
No: because you keep failing at the basic task of explaining what is your scenario, goal and problem.

Again: 1) read the tutorial, 2) describe your scenario (the wireless technology you want to use, traffic type, etc.), 3) check if all the parts are in ns-3 or you need to develop some, 4) develop the missing parts.

T.

Steve Tuenkam

unread,
Mar 3, 2016, 10:12:42 AM3/3/16
to ns-3-users

I would like to define a set of 5 nodes on the same line. Every node has a battery and the values of the batteries  change after any transmission. Nodes communicate unsing broadcast. Node 0 being the source and node 4 being destination. The source broadcast a packet to nodes 1,2 and 3. the first of those node 1,2 and 3 should sends the packet to node 4 and others should discard it.
 Please how can i do that ? After reading a tutorial i have made some tests but i cannot be sure that every node broadcasts the incoming paquet. and i don't know how to add a battery to every node.

Thanks in advance !!!
wifi1.cc

Tommaso Pecorella

unread,
Mar 4, 2016, 6:23:27 PM3/4/16
to ns-3-users
Hi,

about the batteries, you must study the energy model, it's in the manual. If I'm right it's not the first time I have to point you at the documentation. 

About the re-broadcasting of packets directed to a broadcast address, that's called flooding. It is a routing protocol and it's not implemented in ns-3. All the other multi-hop routing protocols do NOT forward broadcast packets because flooding is, in general, an extremely bad idea.
Why ? Simple, because "the first of those node 1,2 and 3 should sends the packet to node 4 and others should discard it".
How the "other" nodes will know that the packet has been already forwarded ? It seems easy, but it isn't easy at all. In order to do it properly you have to add guard intervals, duplicate detection, indexes, and so on. Any naive implementation will only lead to a congestion in the network.

Shortly put: flooding is not a good idea. You can use any of the ad-hoc routing protocols instead.... and they are described in the manual !

T.

Steve Tuenkam

unread,
Mar 15, 2016, 7:58:53 AM3/15/16
to ns-3-users
Thank's sir for your explanation. Now i want to see the packet content. after some reading, i have see this code below but it doesn't work. please how can i achieve this goal.

here is the transmitter code
 stringstream msgx;
                msgx << " Hello World !" ;
                uint16_t packetSize = 800;
        Ptr<Packet> packet = Create<Packet>((uint8_t*) msgx.str().c_str(), packetSize);
       TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");
       Ptr<Socket> source = Socket::CreateSocket (c.Get (0), tid);
      socket->Send (packet);

here the receiver code

  uint8_t *buffer = new uint8_t[packet->GetSize()]; 
        packet->CopyData (buffer, packet->GetSize());
                        string data = string((char*)buffer);
Reply all
Reply to author
Forward
0 new messages