Flow Monitor Help

135 views
Skip to first unread message

Urvik Upadhyay

unread,
Mar 19, 2014, 7:06:50 PM3/19/14
to ns-3-...@googlegroups.com
Hello again!!
I'm trying to calculate throughput for my SUMO mobility.tcl scenario consisting 150 nodes. I've read some of the tutorials regarding flow monitors, read documentation and went through some examples available on this forum but still I'm not getting the desired result from my code. I want all 150 nodes to communicate with the nearby nodes randomly as that's what happens in VANET. Now what I don't know is how to create flows for this. I'm attaching my code here. Kindly look at the code and point out what I'm doing wrong as currently I'm getting only 1 flow in output, and if possible, solution to the problem. I'm still at the beginner level so pardon me if I've coded something stupid. Cheers!!
P.S. I've also attached flowmon file generated.
trial.cc
trial.flowmon

Tommaso Pecorella

unread,
Mar 19, 2014, 7:39:02 PM3/19/14
to ns-3-...@googlegroups.com
Hi,

FlowMonitor can NOT track broadcast or multicast packets. There was a bug allowing that, but it has been fixed (plus, the number reported were wrong).

About your question, you're seeing a single flow because there IS a single flow.
Source: 10.1.1.18 - you installed the source on one node only:
source = Socket::CreateSocket (c.Get (17), tid);

Destination: same, it's only one:
InetSocketAddress remote = InetSocketAddress (Ipv4Address("255.255.255.255"), 80);
Note, the broadcast address is translated into a local scope broadcast: 10.1.1.255

Source and Destination ports: always the same.

For FlowMonitor, it's one single flow.

And that's why the numbers are wrong and FlowMon can't track broadcast flows.
One source, and n receivers. Who's going to measure what ? What should be measured ? How ?
  • The time a packet has been received by the last receiver ?
  • How to define a packet "loss" ?
  • Etc.
Use unicast flows. Those are measured correctly.


T.

Urvik Upadhyay

unread,
Mar 20, 2014, 1:24:49 AM3/20/14
to ns-3-...@googlegroups.com


On Thursday, 20 March 2014 05:09:02 UTC+5:30, Tommaso Pecorella wrote:
Hi,

FlowMonitor can NOT track broadcast or multicast packets. There was a bug allowing that, but it has been fixed (plus, the number reported were wrong).

Source: 10.1.1.18 - you installed the source on one node only:
source = Socket::CreateSocket (c.Get (17), tid);

Destination: same, it's only one:
InetSocketAddress remote = InetSocketAddress (Ipv4Address("255.255.255.255"), 80);
Note, the broadcast address is translated into a local scope broadcast: 10.1.1.255
I tried to code InetSocketAddress as InetSocketAddress (Ipv4Address::GetAny(), 80); but it gave errors. 
Source and Destination ports: always the same.

For FlowMonitor, it's one single flow.

Use unicast flows. Those are measured correctly.
I've to use unicast flows only!! I have a doubt here. I've seen examples like wifi-simple-adhoc-grid.cc where we transmit data from node n1 to say n 24 using intermediate nodes. But in the coding, we have to specify each node and write a separate application code for each node. Can't we use loop and dynamically create app for all the nodes at once? 
I mean assume a VANET scenario with "n" nodes. Now all these nodes act as source as well as destination for their neighbors. Coding has to dynamic I assume.
Now how to code this scenario in ns3? And can I use Flow Monitor for such scenario?

Urvik Upadhyay

unread,
Mar 20, 2014, 1:26:28 AM3/20/14
to ns-3-...@googlegroups.com
*has to be

Tommaso Pecorella

unread,
Mar 20, 2014, 3:33:06 AM3/20/14
to ns-3-...@googlegroups.com


Get 2 random numbers, srcRandom and dstRandom, with range [0... nuberOfNodes-1]
then do:
  for(int y=0;y<150;y++)
 
{
    source
= Socket::CreateSocket (c.Get (srcRandom), tid);
   
InetSocketAddress remote = InetSocketAddress (Address(i.GetAddress (dstRandom));, 80);
    source
->SetAllowBroadcast (true);
    source
->Connect (remote);
 
}

Don't ask how to grab two random numbers...

However, the error is way more deeply inside you. You're asking something before reading the tutorial. Or the manual. Or thinking to the problem, even.

You're trying to use a socket to send packets. Seems logical. It is NOT.
You should install an application in the node, and tell THAT application where to send data.
Otherwise, you'll have to maintain the list of sockets in the main application. Which is highly questionable.
You have one socket only in your program, it's normal it can send data to one receiver only (or to a broadcast). You have to change its receiver address if you want it to send packets to other destinations. Or have multiple sockets.

I feel that you should read this:
because your issue isn't (only) bad programming, it's lack of design.


T.
Reply all
Reply to author
Forward
0 new messages