Help BulkSendApplication

1,284 views
Skip to first unread message

Leticia

unread,
Jun 23, 2012, 1:45:31 PM6/23/12
to ns-3-users
Hello,

I am doing a BulkSendApplication, how can I know when the application
has finished of sending packets if I didnt give a stop time in order
to send all bytes of MaxBytes?

Thank you in advance for your help.

Regards

Leticia

John Abraham

unread,
Jun 23, 2012, 2:24:29 PM6/23/12
to ns-3-...@googlegroups.com
I believe there is currently no direct way to do this.
you will have to implement a new callback similar to 
  TracedCallback<Ptr<const Packet> > m_txTrace;
in bulk-send-application.h
 TracedCallback<uint32_t> m_maxBytesSent;

and a call similar to       m_txTrace (packet); in  bulk-send-application.cc

    .AddTraceSource ("MaxBytesSent", "A new packet is created and is sent",
                     MakeTraceSourceAccessor (&BulkSendApplication:: m_maxBytesSent))

  // Check if time to close (all sent)
  if (m_totBytes == m_maxBytes && m_connected)
    {
      m_maxBytesSent (m_maxBytes);
      m_socket->Close ();
      m_connected = false;
    }




Leticia

--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.


Leticia

unread,
Jun 23, 2012, 3:48:44 PM6/23/12
to ns-3-users
Thank you for your response John!

I did what you said in bulk-send-application.h and bulk-send-
application.cc but then, how can I know in my script if the
application is finished? Must I change something in bulk-send-
helper.cc or bulk-send-helper.h?
My question is because I need the time when the bulk application has
finished to start another application after that!!

Thank you very much for your help!

Leticia


In my script I have a scenario of LTE and a server sending files to
the User Equipment.

John Abraham

unread,
Jun 23, 2012, 4:31:41 PM6/23/12
to ns-3-...@googlegroups.com
John-Abrahams-MacBook-Pro:ns-3-dev john$ hg diff
diff -r a55aa66b5132 examples/tcp/tcp-bulk-send.cc
--- a/examples/tcp/tcp-bulk-send.cc Mon Jun 18 06:35:32 2012 -0700
+++ b/examples/tcp/tcp-bulk-send.cc Sat Jun 23 13:29:27 2012 -0700
@@ -37,6 +37,12 @@
 
 NS_LOG_COMPONENT_DEFINE ("TcpBulkSendExample");
 
+
+void maxBytesSent (uint32_t maxBytes)
+{
+   NS_LOG_UNCOND (maxBytes << " Sent  , Time :" << Simulator::Now ().GetSeconds ()); 
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -111,7 +117,7 @@
   ApplicationContainer sinkApps = sink.Install (nodes.Get (1));
   sinkApps.Start (Seconds (0.0));
   sinkApps.Stop (Seconds (10.0));
-
+  sourceApps.Get (0)->TraceConnectWithoutContext ("MaxBytesSent", MakeCallback (maxBytesSent));
 //
 // Set up tracing if enabled
 //
diff -r a55aa66b5132 src/applications/model/bulk-send-application.cc
--- a/src/applications/model/bulk-send-application.cc Mon Jun 18 06:35:32 2012 -0700
+++ b/src/applications/model/bulk-send-application.cc Sat Jun 23 13:29:27 2012 -0700
@@ -65,6 +65,8 @@
                    MakeTypeIdChecker ())
     .AddTraceSource ("Tx", "A new packet is created and is sent",
                      MakeTraceSourceAccessor (&BulkSendApplication::m_txTrace))
+    .AddTraceSource ("MaxBytesSent", "MaxBytesSent sent",
+                     MakeTraceSourceAccessor (&BulkSendApplication::m_maxBytesSent))
   ;
   return tid;
 }
@@ -190,6 +192,7 @@
   // Check if time to close (all sent)
   if (m_totBytes == m_maxBytes && m_connected)
     {
+      m_maxBytesSent (m_maxBytes);
       m_socket->Close ();
       m_connected = false;
     }
diff -r a55aa66b5132 src/applications/model/bulk-send-application.h
--- a/src/applications/model/bulk-send-application.h Mon Jun 18 06:35:32 2012 -0700
+++ b/src/applications/model/bulk-send-application.h Sat Jun 23 13:29:27 2012 -0700
@@ -93,6 +93,7 @@
   uint32_t        m_totBytes;     // Total bytes sent so far
   TypeId          m_tid;
   TracedCallback<Ptr<const Packet> > m_txTrace;
+  TracedCallback<uint32_t> m_maxBytesSent;
 
 private:
   void ConnectionSucceeded (Ptr<Socket> socket);

John-Abrahams-MacBook-Pro:ns-3-dev john$ ./waf --run "tcp-bulk-send --maxBytes=100000"
Waf: Entering directory `/Users/john/ns-3/ns-3-allinone/ns-3-dev/build'
Waf: Leaving directory `/Users/john/ns-3/ns-3-allinone/ns-3-dev/build'
'build' finished successfully (4.348s)
100000 Sent  , Time :0.011344
Total Bytes Received: 100000
John-Abrahams-MacBook-Pro:ns-3-dev john$ 

Leticia

unread,
Jun 26, 2012, 4:56:10 PM6/26/12
to ns-3-...@googlegroups.com
Sorry John but I dont understand.

I want to simulate web traffic so first of all I will send bytes for the "main object" through a bulk send application, when the application finishes of sending all the bytes, I must immediately start another bulk application with a different amount of bytes, so I must indicate the start time for the second application and it must be equal to the finish time of the previous application,  this is what I want to do.

THank you very much for your help!

Best regards

Leticia

John Abraham

unread,
Jun 26, 2012, 5:05:04 PM6/26/12
to ns-3-...@googlegroups.com
Can't you schedule the second application when 
void maxBytesSent (uint32_t maxBytes)
+{
+   NS_LOG_UNCOND (maxBytes << " Sent  , Time :" << Simulator::Now ().GetSeconds ()); 
     ScheduleNextApp
+}

is called? It is called only once , after the first application completes sending maxBytes.

--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/ns-3-users/-/nHJs47EhGPUJ.

Leticia

unread,
Jun 26, 2012, 5:58:06 PM6/26/12
to ns-3-...@googlegroups.com
Thank you for your time John.

Im still not familiar with NS3, so I dont know what is NS_LOG_UNCOND for example. I will try to study about it and I will let you know if I have  more questions.

Thank you once again for your kind response.

Regards

Leticia
To unsubscribe from this group, send email to ns-3-users+unsubscribe@googlegroups.com.

ekim6...@gmail.com

unread,
Feb 11, 2015, 5:54:16 AM2/11/15
to ns-3-...@googlegroups.com


Hi,
Can we use BulkSendApplication with IPv6?
Below program uses BulkSendApplication in IPv6 scenario. But it's not showing any transfer.
Could anyone help to find the problem in below program?

Thanks.
fragmentation-ipv6-two-MTU.cc

Konstantinos

unread,
Feb 11, 2015, 6:01:52 AM2/11/15
to ns-3-...@googlegroups.com
Hi,

BulkSend application CAN work with IPv6, since it is not bound to any IP version.
BTW, the scenario you attached does not use BulkSend application.

ekim6...@gmail.com

unread,
Feb 12, 2015, 2:31:08 AM2/12/15
to ns-3-...@googlegroups.com
Hi Konstantinos,

Thanks for the reply.
Sorry, I attached the original file by mistake.
Here is the modified one.
Still unable to resolve.

Thanks.


fragmentation-ipv6-two-MTU.cc

Konstantinos

unread,
Feb 12, 2015, 4:34:19 AM2/12/15
to ns-3-...@googlegroups.com
And what makes you think that it is not working?
Have you looked at the generated trace files (ASCII traces and PCAP)?
Because I see both Tx and Rx packets.

If you are waiting to see them in the terminal, you need to enable the corresponding LogComponent for BulkSend and PacketSink applications instead of Ping.

ekim6...@gmail.com

unread,
Feb 15, 2015, 11:25:43 PM2/15/15
to ns-3-...@googlegroups.com
Hi Konstantinos,

Attached are the traced files generated.
In case of ping6 application, fragmentation is done as it is required.
But while using BulkSendApplication there is no fragmentation and data transfer.
Why?


Thanks.
fragmentation-ipv6-two-mtu-0-1.png
ipv6-bulksendapplication-0-1.png

Tommaso Pecorella

unread,
Feb 16, 2015, 4:10:07 AM2/16/15
to ns-3-...@googlegroups.com
From the screenshot you attached it seems that you didn't start the application, or that you messed up the subnets.
Attach the script you're trying to run. If it's a stupid error, be ready for a "honest" reply.

T.

ekim6...@gmail.com

unread,
Feb 17, 2015, 12:12:28 AM2/17/15
to ns-3-...@googlegroups.com

Hi,
It may be stupid error but I am unable to trace.
Attached is the script I am trying to run.

Thanks.
ipv6-bulksendapplication.cc

Tommaso Pecorella

unread,
Feb 17, 2015, 2:19:26 AM2/17/15
to ns-3-...@googlegroups.com
The source node is sending stuff it ITSELF.
 
  BulkSendHelper source ("ns3::TcpSocketFactory", Inet6SocketAddress (i1.GetAddress (0,1), port));


should be
   BulkSendHelper source ("ns3::TcpSocketFactory", Inet6SocketAddress (i2.GetAddress (1,1), port));


T.
Reply all
Reply to author
Forward
0 new messages