Ns3 tcp-bulk-send.cc

333 views
Skip to first unread message

taha zohaib

unread,
Jun 18, 2021, 8:48:04 AM6/18/21
to ns-3-users
I am running the https://www.nsnam.org/doxygen/tcp-bulk-send_8cc_source.html file and it gives the output of total bytes received. I want to add the total bytes sent from node 0 as well how can I do that? 

Akshit Patel

unread,
Jun 18, 2021, 1:23:37 PM6/18/21
to ns-3-users
Hi,
The example you mentioned has only two nodes, where one node(Node 0) behaves as a bulkSendApplication and the other node(Node 1) behaves as a packetSink. The example outputs the total bytes received on a particular sink( i.e. Node 1 in this case). In this example, as there are only two nodes, all the packets received by node 1 (sink) will have been sent by node 0 (BulkSendApplication). In other words, the total bytes received at node 1 will be the same as the total bytes sent from node 0. If you wish to verify this, you can set the tracing variable to True, and observe the generated .pcap file in Wireshark(or any other packet analyzer). 
On a side note, BulkSendApplication allows you to set the maximum number of packets a node can send. In this case, this variable is set to 0; meaning the bulkSendApplication (node 0) is allowed to send as many packets as it can (or in other words as many packets as the link between the nodes can handle) within the simulation duration.

Best,
Akshit Patel

taha zohaib

unread,
Jun 18, 2021, 1:29:20 PM6/18/21
to ns-3-...@googlegroups.com
I have to find the PDR which is the ratio of Bytes Sent to Bytes Received is there any easier way to do that?

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/f1MiFem2bkc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/6bbc4c40-85f1-4c16-b08e-bc56f4497ae8n%40googlegroups.com.

Akshit Patel

unread,
Jun 18, 2021, 2:08:30 PM6/18/21
to ns-3-users
Hi,
Total bytes received at a particular sink can be calculated quite easily in the same way as done in the example that you mentioned. For calculating the total bytes sent, as far I understand, you might have to use ns-3's tracing[1] and use bulkSendApplication::Tx as your trace source. You can use this example[2] as a base as this contains several tracers. By doing this, you will have a function that will be triggered every time a new packet is sent by bulkSendApplication. I am not completely sure this is the best approach, but it should work. 


Best, 
Akshit Patel

Muhammad Haris

unread,
Jun 19, 2021, 3:05:18 AM6/19/21
to ns-3-...@googlegroups.com
Thanks, Talha Zohaib, and Akshit Patel,

I have a question, how can we send data of greater size from node zero to node one, Assume 5MB data, or dummy data? . If packet size is set as 1000 and the number of the packet is set as 1 it is understandable but for the case of 5MB we don't know how many packets will be created (MTU). then what should be the packet size and number of packets?.

Secondly, when node 1 receives the 5MB data how it would be divide into sub data, Assume we want to divide in 3 part and send to 3 other nodes (n2,n3,n4)?





Mailtrack Sender notified by
Mailtrack 06/19/21, 11:57:50 AM

You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/05f5690d-0c9c-4d8d-8609-94804519840bn%40googlegroups.com.

Akshit Patel

unread,
Jun 20, 2021, 7:30:48 AM6/20/21
to ns-3-...@googlegroups.com
Hi,

You can manually set the size of the TCP payload by modifying the 'SendSize' attribute of BulkSendApplication. You can do this by using this command: 'bulkSendHelper.SetAttribute ("SendSize", UintegerValue (customSize))'.
You can also change the MTU of a link by setting the 'Mtu' attribute. For example, if you are using a point-to-point net Device, you can use the command 'point-to-point-helper.SetDeviceAttribute("Mtu", UintegerValue(customMtuSize));'. 

If you wish to do processing on a packet on a sink Node, I will again suggest using tracers and make packetSink::Rx as the trace source. If you only wish to get the number of bytes received you can use packetSink::GetTotalRx() directly. 

Best,
Akshit Patel




Reply all
Reply to author
Forward
0 new messages