delay_jitter.RecordRx(packet);

123 views
Skip to first unread message

ES SALHI Afaf

unread,
Jun 5, 2016, 9:26:40 AM6/5/16
to ns-3-users
Hi every body,

I want to use delay-jitter class to monitor my flow.

So i called PrepareRx( packet) just before sending a packet (in my OnOffApplication and just before SendPacket function).
Now I want to call RecordRx(packet) just after receiving a packet but  I don't know in which file I can do this.
The function that checks received packets is Socket::Recv but I don't know how to locate it.

Can you help me please?

Thank you very much :)

Tommaso Pecorella

unread,
Jun 5, 2016, 5:17:23 PM6/5/16
to ns-3-users
Usually you do it in the receiving application. I guess you know what application you're using to receive packets, isn't it ?

T.

ES SALHI Afaf

unread,
Jun 6, 2016, 7:21:53 AM6/6/16
to ns-3-users
Hi Tommaso Pecorella,

I am using PacketSink but I don't see which function is responsible for receiving packets.

Tommaso Pecorella

unread,
Jun 6, 2016, 5:30:24 PM6/6/16
to ns-3-users
Don't ask the same question twice. It's in the posting guidelines.

Now, a simple question. A function named "PacketSink::HandleRead" that prints stuff like "At time "  and "packet sink received" is too hard to find and/or guess what it does ?
The documentation says that that function "Handle a packet received by the application". It's not that obscure, isn't it ?

Seriously, the point isn't to not help you. The point is that if you can't find THIS, then you're in big troubles.

T.

ES SALHI Afaf

unread,
Jun 7, 2016, 5:38:56 AM6/7/16
to ns-3-users
Hi Tommaso,

Thank you for you reply.
It's okey I found It. PacketSink is an application. It's in the same folder with OnOffApplication.
I had have a deedline and was so stressed.
Now I can print GetLastJitter and GetLastDelay without any problem.

Have a good day.

ES SALHI Afaf

unread,
Jun 7, 2016, 6:47:22 AM6/7/16
to ns-3-users
Hi,

Finally what is printed is not what I want :(
I attached two captures: the first one shows my HandleRead function and the second presents what I obtain when I execute my prog after this command : NS_LOG=PacketSink:HandleRead.

What I want is to print GetLastJitter and GetLastDelay.

Is there another command to use NS_LOG_INFO?

I will be so glad to have your advise or explanation.
Screenshot from 2016-06-03 18_10_19.png
Screenshot from 2016-06-03 18_10_49.png

Tommaso Pecorella

unread,
Jun 7, 2016, 10:00:53 AM6/7/16
to ns-3-users
How to use the logs is explained in the tutorial.

T.

Tommaso Pecorella

unread,
Jun 7, 2016, 10:02:07 AM6/7/16
to ns-3-users
As a side note: it seems that your sink is not receiving any packet. I'd triple check your script.

T.

ES SALHI Afaf

unread,
Jun 10, 2016, 7:13:41 AM6/10/16
to ns-3-users
Hi Tommaso,

I used Wireshark and I see that nodes receive packets. Would you tell me plz if there is an other way to verify that I really receive ma packets?

Thank you.
Have a good day.
Vlan.png

ES SALHI Afaf

unread,
Jun 10, 2016, 8:00:23 AM6/10/16
to ns-3-users
I try to debug. For example in the HandleRead method I added some lines to print a message:

void PacketSink::HandleRead (Ptr<Socket> socket)
{
  NS_LOG_FUNCTION (this << socket);
  Ptr<Packet> packet;
  Address from;
  DelayJitterEstimation GooseDelayJitter;
 
 
  //Im using this lines to debug
  std::string message = "Hello"; // création de la chaîne "Hello"
  message += " World !";         // concaténation de " Word !"
  std::cout << message << '\n';  // affichage de "Hello World !"
 
 
  while ((packet = socket->RecvFrom (from)))
    {
      //capture the Rx_timepstamp
      GooseDelayJitter.RecordRx(packet);

      if (packet->GetSize () == 0)
        { //EOF
          break;
        }
      m_totalRx += packet->GetSize ();

      ////nothing is printed yet :(
      std::cout << GooseDelayJitter.GetLastDelay().GetSeconds() << std::endl;
      std::cout << GooseDelayJitter.GetLastJitter() << std::endl;

      if (InetSocketAddress::IsMatchingType (from))
        {...

The message is not printed! I think that HandleRead is not called. I found also that PacketSink application "Receive sand consumes traffic generated to an IP address and port. " (https://www.nsnam.org/doxygen/classns3_1_1_packet_sink.html#details). Im not unsing PacketSocket and my packets are mapped directtly to layer 2. I havve not IP address so I think that this is the reason why My PacketSink doesn't work.

I need to know what do you think?

Thks :)

ES SALHI Afaf

unread,
Jun 10, 2016, 9:22:16 AM6/10/16
to ns-3-users
Please find attached my script ^^


I think that my analysis are not good because there is a NS3 example called csma-packet-socket where PacketSink is used with PacketSocket. I run it It in a traced file, SinkRx returns the size of received packets.

Do you think that it doesn't work because of the bridge that I added to the topology?
mycsma-bridge.cc

Tommaso Pecorella

unread,
Jun 10, 2016, 4:34:14 PM6/10/16
to ns-3-users
Please read the examples.
If you need to use PacketSockets, this is mandatory: src/network/examples/packet-socket-apps.cc

T.

ES SALHI Afaf

unread,
Jun 10, 2016, 7:24:17 PM6/10/16
to ns-3-users
Thank you Tommaso,

So finally I found that the problem is because of Layer2. When I choose Dix or Llc that are implemented in NS3, my script wokrs very well and delay and jitter are printed but when I choose Vlan as a type of encapsulation my script is executed very well without any errors and I use Wireshark and I see that I receive packets but no delay and no jitter is printed.

What do you think? ^^

Tommaso Pecorella

unread,
Jun 10, 2016, 7:38:29 PM6/10/16
to ns-3-users
This makes me think that you're using an outdated ns-3 version.

Please update your ns-3 to 3.25. Then you'll see an error, basically telling you that it's definitely a bad idea to use a not-implemented thing.
... unless, of course, in the case that you did implement it. But in that case how could you expect that we can help on something that you (and you alone) have ?

Last line is: don't ask me what do I think. It's not a wise idea.

T.
Reply all
Reply to author
Forward
0 new messages