Packetsink Rx trace fired twice for first packet. Why?

95 views
Skip to first unread message

Pradnya Kiri Taksande

unread,
Jan 31, 2018, 12:57:25 AM1/31/18
to ns-3-users
Hello,

I am using Ns3.26 to simulate my scenario.
Attached is my simulation script. 
Whenever a packet is received at Packet sink, Rx trace is fired and the function ReceivePacket
is called. Only for the first packet, this function is called twice, otherwise it works fine.
I could not understand why is it being called twice, when the packet is received only once at the receiver.
This is a subtle problem, which can be ignored, but I would really like to find out the reason behind this behaviour.

Thank you,
Pradnya
try_PacketsinkRx.cc

Tommaso Pecorella

unread,
Jan 31, 2018, 3:13:41 PM1/31/18
to ns-3-users
Hi,

I don't see any double call in 3.27
.
However, I see that you call 
Config::ConnectWithoutContext("/NodeList/2/ApplicationList/*/$ns3::PacketSink/Rx", MakeCallback (&ReceivePacket));
twice in two different code pieces.

Mind that it needs to be called only once (before any packet is received and after the apps have been created). Perhaps this is the issue.

T.

Pradnya Kiri Taksande

unread,
Feb 2, 2018, 8:32:25 AM2/2/18
to ns-3-users
Have you changed any source code of NS3.27 ?
Coz for me in Ns3.27 also, I am getting the same result; that is,
for the first packet, Packetsink Rx trace is called twice.

Thanks,
Pradnya

Pradnya Kiri Taksande

unread,
Feb 2, 2018, 8:57:30 AM2/2/18
to ns-3-users
Also, If I remove one of the the call statements :

Config::ConnectWithoutContext("/NodeList/2/ApplicationList/*/$ns3::PacketSink/Rx", MakeCallback (&ReceivePacket));
Then, Packetsink Rx Trace is not called for some of the packets. This is because the two calls are called in different functions,
with different Tx and Rx apps.

Thanks,
Pradnya

Tommaso Pecorella

unread,
Feb 4, 2018, 12:33:57 AM2/4/18
to ns-3-users
Hi,

please read the manual about tracing functions.
You do NOT need to connect it on a per-function basis. Once it is connected it stays connected.

Moreover, on my ns-3 I can't reproduce your problem. If I can't reproduce it, I can't help either.

Please cleanup your code and make sure to connect your functions to the respective trace like shown in the examples.


T.
Reply all
Reply to author
Forward
0 new messages